|
7 | 7 | import net.minecraft.block.BlockState;
|
8 | 8 | import net.minecraft.entity.FallingBlockEntity;
|
9 | 9 | import net.minecraft.util.math.BlockPos;
|
| 10 | +import net.minecraft.world.World; |
10 | 11 | import org.spongepowered.asm.mixin.Mixin;
|
11 | 12 | import org.spongepowered.asm.mixin.Shadow;
|
12 | 13 | import org.spongepowered.asm.mixin.injection.At;
|
13 | 14 | import org.spongepowered.asm.mixin.injection.Inject;
|
| 15 | +import org.spongepowered.asm.mixin.injection.ModifyArgs; |
14 | 16 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
15 | 17 | import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
| 18 | +import org.spongepowered.asm.mixin.injection.invoke.arg.Args; |
16 | 19 |
|
17 | 20 | @Mixin(FallingBlockEntity.class)
|
18 | 21 | public abstract class FallingBlockEntityMixin {
|
19 | 22 | @Shadow
|
20 | 23 | private BlockState block;
|
21 | 24 |
|
22 |
| - @Inject( |
| 25 | + @ModifyArgs( |
23 | 26 | method = "tick",
|
24 | 27 | at = @At(
|
25 | 28 | value = "INVOKE",
|
26 |
| - target = "Lnet/minecraft/world/World;removeBlock(Lnet/minecraft/util/math/BlockPos;Z)Z" |
27 |
| - ), |
28 |
| - locals = LocalCapture.CAPTURE_FAILEXCEPTION |
29 |
| - ) |
30 |
| - private void ledgerBlockFallInvoker(CallbackInfo ci, Block block, BlockPos blockPos) { |
| 29 | + target = "Lnet/minecraft/world/World;removeBlock(Lnet/minecraft/util/math/BlockPos;Z)Z")) |
| 30 | + private void ledgerBlockFallInvoker(Args args) { |
31 | 31 | FallingBlockEntity entity = (FallingBlockEntity) (Object) this;
|
32 |
| - |
33 |
| - BlockBreakCallback.EVENT.invoker().breakBlock(entity.world, blockPos, this.block, this.block.hasBlockEntity() ? entity.world.getBlockEntity(blockPos) : null, Sources.GRAVITY); |
| 32 | + BlockPos pos = args.get(0); |
| 33 | + BlockBreakCallback.EVENT.invoker().breakBlock(entity.world, pos, this.block, this.block.hasBlockEntity() ? entity.world.getBlockEntity(pos) : null, Sources.GRAVITY); |
34 | 34 | }
|
35 | 35 |
|
36 |
| - @Inject( |
| 36 | + @ModifyArgs( |
37 | 37 | method = "tick",
|
38 | 38 | at = @At(
|
39 |
| - value = "INVOKE_ASSIGN", |
40 |
| - target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z" |
41 |
| - ), |
42 |
| - locals = LocalCapture.CAPTURE_FAILEXCEPTION |
43 |
| - ) |
44 |
| - private void ledgerBlockLandInvoker(CallbackInfo ci, Block block, BlockPos blockPos) { |
| 39 | + value = "INVOKE", |
| 40 | + target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z")) |
| 41 | + private void ledgerBlockLandInvoker(Args args) { |
45 | 42 | FallingBlockEntity entity = (FallingBlockEntity) (Object) this;
|
46 |
| - |
47 |
| - BlockPlaceCallback.EVENT.invoker().place(entity.world, blockPos, this.block, null, Sources.GRAVITY); |
| 43 | + BlockPos pos = args.get(0); |
| 44 | + BlockPlaceCallback.EVENT.invoker().place(entity.world, pos, this.block, null, Sources.GRAVITY); |
48 | 45 | }
|
49 | 46 | }
|
0 commit comments