From 8f7945ff4eff59d0de5f1eaab668bfb999d2e538 Mon Sep 17 00:00:00 2001 From: Snownee Date: Tue, 26 Jan 2021 16:48:03 +0800 Subject: [PATCH] Fix rope pulley breaking bedrock --- .../structureMovement/pulley/PulleyTileEntity.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyTileEntity.java index a416edadc..e2d4b7c0d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyTileEntity.java @@ -48,6 +48,17 @@ public class PulleyTileEntity extends LinearActuatorTileEntity { return; if (speed == 0) return; + int maxLength = AllConfigs.SERVER.kinetics.maxRopeLength.get(); + int i = 1; + while (i <= maxLength) { + BlockPos ropePos = pos.down(i); + BlockState ropeState = world.getBlockState(ropePos); + if (!AllBlocks.ROPE.has(ropeState) && !AllBlocks.PULLEY_MAGNET.has(ropeState)) { + break; + } + ++i; + } + offset = i - 1; if (offset >= getExtensionRange() && getSpeed() > 0) return; if (offset <= 0 && getSpeed() < 0) @@ -70,7 +81,7 @@ public class PulleyTileEntity extends LinearActuatorTileEntity { if (!canAssembleStructure && getSpeed() > 0) return; - for (int i = ((int) offset); i > 0; i--) { + for (i = ((int) offset); i > 0; i--) { BlockPos offset = pos.down(i); BlockState oldState = world.getBlockState(offset); if (oldState.getBlock() instanceof IWaterLoggable && oldState.has(BlockStateProperties.WATERLOGGED)