From 7ad73402467bd2ba9945fb12e636bc6531052276 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Mon, 27 Mar 2023 22:08:34 +0200 Subject: [PATCH] Big L evator - Fixed Elevator Contacts setting powered state when dialled manually - Fixed Players not able to decent down a column of metal scaffolding --- .../elevator/ElevatorContactBlock.java | 10 ++++++---- .../elevator/ElevatorTargetFloorPacket.java | 2 +- .../curiosities/deco/MetalScaffoldingBlock.java | 16 ++++++++++++++++ 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/elevator/ElevatorContactBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/elevator/ElevatorContactBlock.java index 3b34d358e..4b9c62648 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/elevator/ElevatorContactBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/elevator/ElevatorContactBlock.java @@ -91,10 +91,11 @@ public class ElevatorContactBlock extends WrenchableDirectionalBlock return; ElevatorColumn elevatorColumn = ElevatorColumn.getOrCreate(pLevel, getColumnCoords(pLevel, pPos)); - callToContactAndUpdate(elevatorColumn, pState, pLevel, pPos); + callToContactAndUpdate(elevatorColumn, pState, pLevel, pPos, true); } - public void callToContactAndUpdate(ElevatorColumn elevatorColumn, BlockState pState, Level pLevel, BlockPos pPos) { + public void callToContactAndUpdate(ElevatorColumn elevatorColumn, BlockState pState, Level pLevel, BlockPos pPos, + boolean powered) { pLevel.setBlock(pPos, pState.cycle(CALLING), 2); for (BlockPos otherPos : elevatorColumn.getContacts()) { @@ -107,8 +108,9 @@ public class ElevatorContactBlock extends WrenchableDirectionalBlock scheduleActivation(pLevel, otherPos); } - pLevel.setBlock(pPos, pState.setValue(POWERED, true) - .setValue(CALLING, true), 2); + if (powered) + pState = pState.setValue(POWERED, true); + pLevel.setBlock(pPos, pState.setValue(CALLING, true), 2); pLevel.updateNeighborsAt(pPos, this); elevatorColumn.target(pPos.getY()); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/elevator/ElevatorTargetFloorPacket.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/elevator/ElevatorTargetFloorPacket.java index 001371986..caa116166 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/elevator/ElevatorTargetFloorPacket.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/elevator/ElevatorTargetFloorPacket.java @@ -57,7 +57,7 @@ public class ElevatorTargetFloorPacket extends SimplePacketBase { if (!(blockState.getBlock() instanceof ElevatorContactBlock ecb)) return; - ecb.callToContactAndUpdate(elevatorColumn, blockState, level, pos); + ecb.callToContactAndUpdate(elevatorColumn, blockState, level, pos, false); }); return true; } diff --git a/src/main/java/com/simibubi/create/content/curiosities/deco/MetalScaffoldingBlock.java b/src/main/java/com/simibubi/create/content/curiosities/deco/MetalScaffoldingBlock.java index 7141a2015..3f8653664 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/deco/MetalScaffoldingBlock.java +++ b/src/main/java/com/simibubi/create/content/curiosities/deco/MetalScaffoldingBlock.java @@ -9,6 +9,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Direction.Axis; import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; @@ -32,6 +33,20 @@ public class MetalScaffoldingBlock extends ScaffoldingBlock implements IWrenchab return true; } + @Override + public VoxelShape getCollisionShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, + CollisionContext pContext) { + if (pState.getValue(BOTTOM)) + return AllShapes.SCAFFOLD_HALF; + return super.getCollisionShape(pState, pLevel, pPos, pContext); + } + + @Override + public boolean isScaffolding(BlockState state, LevelReader level, BlockPos pos, LivingEntity entity) { + return true; + } + + @Override public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) { if (pState.getValue(BOTTOM)) return AllShapes.SCAFFOLD_HALF; @@ -41,6 +56,7 @@ public class MetalScaffoldingBlock extends ScaffoldingBlock implements IWrenchab return Shapes.block(); } + @Override public VoxelShape getInteractionShape(BlockState pState, BlockGetter pLevel, BlockPos pPos) { return Shapes.block(); }