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:
parent
187c4dcdf8
commit
7ad7340246
3 changed files with 23 additions and 5 deletions
|
@ -91,10 +91,11 @@ public class ElevatorContactBlock extends WrenchableDirectionalBlock
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ElevatorColumn elevatorColumn = ElevatorColumn.getOrCreate(pLevel, getColumnCoords(pLevel, pPos));
|
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);
|
pLevel.setBlock(pPos, pState.cycle(CALLING), 2);
|
||||||
|
|
||||||
for (BlockPos otherPos : elevatorColumn.getContacts()) {
|
for (BlockPos otherPos : elevatorColumn.getContacts()) {
|
||||||
|
@ -107,8 +108,9 @@ public class ElevatorContactBlock extends WrenchableDirectionalBlock
|
||||||
scheduleActivation(pLevel, otherPos);
|
scheduleActivation(pLevel, otherPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
pLevel.setBlock(pPos, pState.setValue(POWERED, true)
|
if (powered)
|
||||||
.setValue(CALLING, true), 2);
|
pState = pState.setValue(POWERED, true);
|
||||||
|
pLevel.setBlock(pPos, pState.setValue(CALLING, true), 2);
|
||||||
pLevel.updateNeighborsAt(pPos, this);
|
pLevel.updateNeighborsAt(pPos, this);
|
||||||
|
|
||||||
elevatorColumn.target(pPos.getY());
|
elevatorColumn.target(pPos.getY());
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class ElevatorTargetFloorPacket extends SimplePacketBase {
|
||||||
if (!(blockState.getBlock() instanceof ElevatorContactBlock ecb))
|
if (!(blockState.getBlock() instanceof ElevatorContactBlock ecb))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ecb.callToContactAndUpdate(elevatorColumn, blockState, level, pos);
|
ecb.callToContactAndUpdate(elevatorColumn, blockState, level, pos, false);
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.Direction.Axis;
|
import net.minecraft.core.Direction.Axis;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.level.BlockGetter;
|
import net.minecraft.world.level.BlockGetter;
|
||||||
import net.minecraft.world.level.LevelAccessor;
|
import net.minecraft.world.level.LevelAccessor;
|
||||||
import net.minecraft.world.level.LevelReader;
|
import net.minecraft.world.level.LevelReader;
|
||||||
|
@ -32,6 +33,20 @@ public class MetalScaffoldingBlock extends ScaffoldingBlock implements IWrenchab
|
||||||
return true;
|
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) {
|
public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) {
|
||||||
if (pState.getValue(BOTTOM))
|
if (pState.getValue(BOTTOM))
|
||||||
return AllShapes.SCAFFOLD_HALF;
|
return AllShapes.SCAFFOLD_HALF;
|
||||||
|
@ -41,6 +56,7 @@ public class MetalScaffoldingBlock extends ScaffoldingBlock implements IWrenchab
|
||||||
return Shapes.block();
|
return Shapes.block();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public VoxelShape getInteractionShape(BlockState pState, BlockGetter pLevel, BlockPos pPos) {
|
public VoxelShape getInteractionShape(BlockState pState, BlockGetter pLevel, BlockPos pPos) {
|
||||||
return Shapes.block();
|
return Shapes.block();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue