|
7 | 7 | import com.mojang.brigadier.StringReader; |
8 | 8 | import io.github.misode.packtest.PackTestArgumentSource; |
9 | 9 | import net.minecraft.commands.arguments.blocks.BlockPredicateArgument; |
| 10 | +import net.minecraft.core.HolderLookup; |
| 11 | +import net.minecraft.world.level.block.Block; |
10 | 12 | import org.spongepowered.asm.mixin.Mixin; |
11 | 13 | import org.spongepowered.asm.mixin.injection.At; |
12 | 14 | import org.spongepowered.asm.mixin.injection.Inject; |
|
17 | 19 | */ |
18 | 20 | @Mixin(BlockPredicateArgument.class) |
19 | 21 | public class BlockPredicateArgumentMixin { |
20 | | - @Inject(method = "parse(Lcom/mojang/brigadier/StringReader;)Lnet/minecraft/commands/arguments/blocks/BlockPredicateArgument$Result;", at = @At("HEAD")) |
21 | | - private void getCursor(StringReader stringReader, CallbackInfoReturnable<BlockPredicateArgument.Result> cir, @Share("cursor") LocalIntRef cursorRef) { |
| 22 | + @Inject(method = "parse(Lnet/minecraft/core/HolderLookup;Lcom/mojang/brigadier/StringReader;)Lnet/minecraft/commands/arguments/blocks/BlockPredicateArgument$Result;", at = @At("HEAD")) |
| 23 | + private static void getCursor(HolderLookup<Block> holderLookup, StringReader stringReader, CallbackInfoReturnable<BlockPredicateArgument.Result> cir, @Share("cursor") LocalIntRef cursorRef) { |
22 | 24 | cursorRef.set(stringReader.getCursor()); |
23 | 25 | } |
24 | 26 |
|
25 | | - @ModifyReturnValue(method = "parse(Lcom/mojang/brigadier/StringReader;)Lnet/minecraft/commands/arguments/blocks/BlockPredicateArgument$Result;", at = @At("RETURN")) |
26 | | - private BlockPredicateArgument.Result returnSelector(BlockPredicateArgument.Result result, @Local StringReader reader, @Share("cursor") LocalIntRef cursorRef) { |
| 27 | + @ModifyReturnValue(method = "parse(Lnet/minecraft/core/HolderLookup;Lcom/mojang/brigadier/StringReader;)Lnet/minecraft/commands/arguments/blocks/BlockPredicateArgument$Result;", at = @At("RETURN")) |
| 28 | + private static BlockPredicateArgument.Result returnSelector(BlockPredicateArgument.Result result, @Local(argsOnly = true) StringReader reader, @Share("cursor") LocalIntRef cursorRef) { |
27 | 29 | ((PackTestArgumentSource)result).packtest$setSource(reader.getRead().substring(cursorRef.get())); |
28 | 30 | return result; |
29 | 31 | } |
|
0 commit comments