minor refactoring
This commit is contained in:
parent
9fc1ea35e8
commit
8aa8895c52
|
@ -70,9 +70,9 @@ public class GlowstoneWireBlock extends Block{
|
|||
|
||||
private static boolean hasConnection(BlockState state) {
|
||||
return ((GlowWireConnection)state.get(WIRE_CONNECTION_NORTH)).isConnected() ||
|
||||
((GlowWireConnection)state.get(WIRE_CONNECTION_SOUTH)).isConnected() ||
|
||||
((GlowWireConnection)state.get(WIRE_CONNECTION_EAST)).isConnected() ||
|
||||
((GlowWireConnection)state.get(WIRE_CONNECTION_WEST)).isConnected();
|
||||
((GlowWireConnection)state.get(WIRE_CONNECTION_SOUTH)).isConnected() ||
|
||||
((GlowWireConnection)state.get(WIRE_CONNECTION_EAST)).isConnected() ||
|
||||
((GlowWireConnection)state.get(WIRE_CONNECTION_WEST)).isConnected();
|
||||
}
|
||||
|
||||
private BlockState determineState(WorldAccess world, BlockState state, BlockPos pos){
|
||||
|
@ -85,17 +85,18 @@ public class GlowstoneWireBlock extends Block{
|
|||
}
|
||||
|
||||
private GlowWireConnection determineConnection(WorldAccess world, BlockPos pos, Direction direction){
|
||||
if((world.getBlockState(pos.offset(direction).up()).isOf(this) && world.isAir(pos.up()))) // If offset+up is me && if up is air
|
||||
if(!world.getBlockState(pos.offset(direction).up()).get(DIRECTION_TO_WIRE_CONNECTION.get(direction.getOpposite())).isBroken()) //if offset+up is not broken
|
||||
if(world.getBlockState(pos.offset(direction)).hasSidedTransparency())
|
||||
BlockPos offsetPos = pos.offset(direction);
|
||||
if((world.getBlockState(offsetPos.up()).isOf(this) && world.isAir(pos.up()))) // If offset+up is me && if up is air
|
||||
if(!world.getBlockState(offsetPos.up()).get(DIRECTION_TO_WIRE_CONNECTION.get(direction.getOpposite())).isBroken()) //if offset+up is not broken
|
||||
if(world.getBlockState(offsetPos).hasSidedTransparency())
|
||||
return GlowWireConnection.SIDE;
|
||||
else
|
||||
return GlowWireConnection.UP;
|
||||
if(world.getBlockState(pos.offset(direction).down()).isOf(this) && world.isAir(pos.offset(direction))) // if offset+down is me && if offset is air
|
||||
if(!world.getBlockState(pos.offset(direction).down()).get(DIRECTION_TO_WIRE_CONNECTION.get(direction.getOpposite())).isBroken()) //if offset+down is not broken
|
||||
if(world.getBlockState(offsetPos.down()).isOf(this) && world.isAir(offsetPos)) // if offset+down is me && if offset is air
|
||||
if(!world.getBlockState(offsetPos.down()).get(DIRECTION_TO_WIRE_CONNECTION.get(direction.getOpposite())).isBroken()) //if offset+down is not broken
|
||||
return GlowWireConnection.SIDE;
|
||||
if(world.getBlockState(pos.offset(direction)).isOf(this)) // if offset is me
|
||||
if(!world.getBlockState(pos.offset(direction)).get(DIRECTION_TO_WIRE_CONNECTION.get(direction.getOpposite())).isBroken()) // if offset is not broken
|
||||
if(world.getBlockState(offsetPos).isOf(this)) // if offset is me
|
||||
if(!world.getBlockState(offsetPos).get(DIRECTION_TO_WIRE_CONNECTION.get(direction.getOpposite())).isBroken()) // if offset is not broken
|
||||
return GlowWireConnection.SIDE;
|
||||
return GlowWireConnection.NONE;
|
||||
}
|
||||
|
@ -108,9 +109,9 @@ public class GlowstoneWireBlock extends Block{
|
|||
public VoxelShape determineVoxelShape(BlockState state){
|
||||
VoxelShape voxelShape = DOT_VOXELSHAPE;
|
||||
|
||||
Iterator dirItr1 = Direction.Type.HORIZONTAL.iterator();
|
||||
while(dirItr1.hasNext()) {
|
||||
Direction direction = (Direction)dirItr1.next();
|
||||
Iterator dirItr = Direction.Type.HORIZONTAL.iterator();
|
||||
while(dirItr.hasNext()) {
|
||||
Direction direction = (Direction)dirItr.next();
|
||||
GlowWireConnection wireConnection = state.get(DIRECTION_TO_WIRE_CONNECTION.get(direction));
|
||||
if(state.equals(this.getDefaultState().with(DIRECTION_TO_WIRE_CONNECTION.get(direction), GlowWireConnection.SIDE))) {
|
||||
voxelShape = VoxelShapes.union(voxelShape, (VoxelShape)DIRECTION_HITBOX.get(direction));
|
||||
|
|
Loading…
Reference in New Issue