Skip to content

Commit

Permalink
Replace mixin targets with class references
Browse files Browse the repository at this point in the history
  • Loading branch information
andantet committed Jun 1, 2024
1 parent 32b772c commit f27cd76
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package dev.andante.codex.mixin;

import com.mojang.serialization.DataResult;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import java.util.Optional;

@Mixin(targets = { "com.mojang.serialization.DataResult$Error" })
@Mixin(DataResult.Error.class)
public class DataResultErrorMixin<R> {
@Redirect(method = "error", at = @At(value = "INVOKE", target = "Ljava/util/Optional;of(Ljava/lang/Object;)Ljava/util/Optional;"), remap = false)
private Optional<R> onErrorOf(R value) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package dev.andante.codex.mixin;

import com.mojang.serialization.DataResult;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import java.util.Optional;

@Mixin(targets = { "com.mojang.serialization.DataResult$Success" })
@Mixin(DataResult.Success.class)
public class DataResultSuccessMixin<R> {
@Redirect(method = "result", at = @At(value = "INVOKE", target = "Ljava/util/Optional;of(Ljava/lang/Object;)Ljava/util/Optional;"), remap = false)
private Optional<R> onResultOf(R value) {
Expand Down

0 comments on commit f27cd76

Please sign in to comment.