Big L evator

- Fixed Elevator Contacts setting powered state when dialled manually
- Fixed Players not able to decent down a column of metal scaffolding
This commit is contained in:
simibubi 2023-03-27 22:08:34 +02:00
parent 187c4dcdf8
commit 7ad7340246
3 changed files with 23 additions and 5 deletions

View file

@ -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());

View file

@ -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;
}

View file

@ -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();
}