From d008c38238ec9dc8f12d19d4b39a81e8540228e1 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 16 Oct 2019 16:21:35 -0300 Subject: [PATCH] fixes to piston movement --- .../carpet/mixins/PistonHandler_movableTEMixin.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/carpet/mixins/PistonHandler_movableTEMixin.java b/src/main/java/carpet/mixins/PistonHandler_movableTEMixin.java index 141b4b58..cae7ee6d 100644 --- a/src/main/java/carpet/mixins/PistonHandler_movableTEMixin.java +++ b/src/main/java/carpet/mixins/PistonHandler_movableTEMixin.java @@ -92,6 +92,11 @@ public abstract class PistonHandler_movableTEMixin @Shadow protected abstract boolean method_11538(BlockPos blockPos_1); + @Shadow protected static boolean method_23367(Block block_1) + { + return method_23367(block_1); + } + private BlockState blockState_1; @Redirect(method = "tryMove", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;getBlockState(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/block/BlockState;", ordinal = 0)) @@ -103,15 +108,16 @@ public abstract class PistonHandler_movableTEMixin private BlockState redirectGetBlockState_1_B(World world, BlockPos pos) { return blockState_1 = world.getBlockState(pos); } - @Inject(method = "method_23367", at = @At(value = "HEAD"), cancellable = true) + @Redirect(method = "tryMove", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/piston/PistonHandler;method_23367(Lnet/minecraft/block/Block;)Z")) //Thanks to Earthcomputer for showing how to redirect FIELD access like this /** * Makes backwards stickyness work with sticky non-slimeblocks as well. * @author 2No2Nameb */ - private void redirectSlimeBlock(Block block_1, CallbackInfoReturnable cir) { + private boolean redirectSlimeBlock(Block block_1) { if (CarpetSettings.movableBlockEntities && isStickyOnSide(blockState_1, this.direction.getOpposite())) - cir.setReturnValue(true); + return true; + return method_23367(block_1); }