Formatting
This commit is contained in:
parent
57d0d6d3f0
commit
5d93843a1e
1 changed files with 41 additions and 40 deletions
|
@ -86,7 +86,8 @@ public class BlockCable extends BlockWithEntity {
|
|||
public BlockCable(TRContent.Cables type) {
|
||||
super(Block.Settings.of(Material.STONE).strength(1f, 8f));
|
||||
this.type = type;
|
||||
setDefaultState(this.stateFactory.getDefaultState().with(EAST, false).with(WEST, false).with(NORTH, false).with(SOUTH, false).with(UP, false).with(DOWN, false));
|
||||
setDefaultState(this.stateFactory.getDefaultState().with(EAST, false).with(WEST, false).with(NORTH, false)
|
||||
.with(SOUTH, false).with(UP, false).with(DOWN, false));
|
||||
BlockWrenchEventHandler.wrenableBlocks.add(this);
|
||||
}
|
||||
|
||||
|
@ -110,18 +111,18 @@ public class BlockCable extends BlockWithEntity {
|
|||
}
|
||||
|
||||
private BlockState makeConnections(World world, BlockPos pos) {
|
||||
Boolean down = checkEnergyCapability(world, pos.down(), Direction.UP);
|
||||
Boolean up = checkEnergyCapability(world, pos.up(), Direction.DOWN);
|
||||
Boolean north = checkEnergyCapability(world, pos.north(), Direction.SOUTH);
|
||||
Boolean east = checkEnergyCapability(world, pos.east(), Direction.WEST);
|
||||
Boolean south = checkEnergyCapability(world, pos.south(), Direction.NORTH);
|
||||
Boolean west = checkEnergyCapability(world, pos.west(), Direction.WEST);
|
||||
Boolean down = canConnectTo(world, pos.down(), Direction.UP);
|
||||
Boolean up = canConnectTo(world, pos.up(), Direction.DOWN);
|
||||
Boolean north = canConnectTo(world, pos.north(), Direction.SOUTH);
|
||||
Boolean east = canConnectTo(world, pos.east(), Direction.WEST);
|
||||
Boolean south = canConnectTo(world, pos.south(), Direction.NORTH);
|
||||
Boolean west = canConnectTo(world, pos.west(), Direction.WEST);
|
||||
|
||||
return this.getDefaultState().with(DOWN, down).with(UP, up).with(NORTH, north).with(EAST, east)
|
||||
.with(SOUTH, south).with(WEST, west);
|
||||
}
|
||||
|
||||
private Boolean checkEnergyCapability(IWorld world, BlockPos pos, Direction facing) {
|
||||
private Boolean canConnectTo(IWorld world, BlockPos pos, Direction facing) {
|
||||
BlockEntity tileEntity = world.getBlockEntity(pos);
|
||||
if (tileEntity != null && (tileEntity instanceof IEnergyInterfaceTile)) {
|
||||
return Boolean.TRUE;
|
||||
|
@ -171,8 +172,9 @@ public class BlockCable extends BlockWithEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockState getStateForNeighborUpdate(BlockState ourState, Direction ourFacing, BlockState otherState, IWorld worldIn, BlockPos ourPos, BlockPos otherPos) {
|
||||
Boolean value = checkEnergyCapability(worldIn, otherPos, ourFacing.getOpposite());
|
||||
public BlockState getStateForNeighborUpdate(BlockState ourState, Direction ourFacing, BlockState otherState,
|
||||
IWorld worldIn, BlockPos ourPos, BlockPos otherPos) {
|
||||
Boolean value = canConnectTo(worldIn, otherPos, ourFacing.getOpposite());
|
||||
return ourState.with(getProperty(ourFacing), value);
|
||||
}
|
||||
|
||||
|
@ -185,7 +187,8 @@ public class BlockCable extends BlockWithEntity {
|
|||
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, EntityContext entityContext) {
|
||||
if (type != null) {
|
||||
double culling = type.cableThickness / 2;
|
||||
return Block.createCuboidShape(culling , culling, culling, 16.0D - culling, 16.0D - culling, 16.0D - culling);
|
||||
return Block.createCuboidShape(culling, culling, culling, 16.0D - culling, 16.0D - culling,
|
||||
16.0D - culling);
|
||||
}
|
||||
return Block.createCuboidShape(6, 6, 6, 10, 10, 10);
|
||||
}
|
||||
|
@ -220,13 +223,11 @@ public class BlockCable extends BlockWithEntity {
|
|||
entityIn.damage(new ElectrialShockSource(), 1F);
|
||||
}
|
||||
if (uninsulatedElectrocutionSound) {
|
||||
worldIn.playSound(null, entityIn.x, entityIn.y, entityIn.z, ModSounds.CABLE_SHOCK,
|
||||
SoundCategory.BLOCKS, 0.6F, 1F);
|
||||
worldIn.playSound(null, entityIn.x, entityIn.y, entityIn.z, ModSounds.CABLE_SHOCK, SoundCategory.BLOCKS,
|
||||
0.6F, 1F);
|
||||
}
|
||||
if (uninsulatedElectrocutionParticles) {
|
||||
worldIn.addParticle(ParticleTypes.CRIT, entityIn.x, entityIn.y, entityIn.z, 0, 0, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue