From e61549ae102e3fe568cc1574f62aaab6461b9e71 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 11 Mar 2020 00:17:42 -0300 Subject: [PATCH] be more considerate to other modders --- .../carpet/mixins/RedstoneWireBlockMixin.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/carpet/mixins/RedstoneWireBlockMixin.java b/src/main/java/carpet/mixins/RedstoneWireBlockMixin.java index 7fd650ea..096a0e31 100644 --- a/src/main/java/carpet/mixins/RedstoneWireBlockMixin.java +++ b/src/main/java/carpet/mixins/RedstoneWireBlockMixin.java @@ -18,6 +18,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import java.util.Iterator; import java.util.Set; @@ -41,13 +42,6 @@ public abstract class RedstoneWireBlockMixin implements RedstoneWireBlockInterfa @Shadow private BlockState update(World world_1, BlockPos blockPos_1, BlockState blockState_1) { return null; } - // = - - @Override - public BlockState updateLogicPublic(World world_1, BlockPos blockPos_1, BlockState blockState_1) { - return updateLogic(world_1, blockPos_1, blockState_1); - } - @Override @Accessor("wiresGivePower") public abstract void setWiresGivePower(boolean wiresGivePower); @@ -79,8 +73,15 @@ public abstract class RedstoneWireBlockMixin implements RedstoneWireBlockInterfa /** * @author theosib, soykaf, gnembon */ - @Overwrite - private BlockState updateLogic(World world_1, BlockPos blockPos_1, BlockState blockState_1) { + @Inject(method = "updateLogic", at = @At("HEAD"), cancellable = true) + private void updateLogicAlternative(World world, BlockPos pos, BlockState state, CallbackInfoReturnable cir) + { + if (CarpetSettings.fastRedstoneDust) + cir.setReturnValue(updateLogicPublic(world, pos, state)); + } + + @Override + public BlockState updateLogicPublic(World world_1, BlockPos blockPos_1, BlockState blockState_1) { BlockState blockState_2 = blockState_1; int int_1 = (Integer)blockState_1.get(POWER); // i this.wiresGivePower = false;