From e2a766aa79626280d3a166f7ebb4c7e43bdb6c76 Mon Sep 17 00:00:00 2001 From: Nick Date: Sun, 17 Jan 2016 00:58:12 -0800 Subject: [PATCH] Block bounds for the nodes + cleanup AFAICT, the `shouldConnect` method works just fine like this. --- .../bloodmagic/block/BlockRoutingNode.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockRoutingNode.java b/src/main/java/WayofTime/bloodmagic/block/BlockRoutingNode.java index 8b40e51f..20448cd3 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockRoutingNode.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockRoutingNode.java @@ -2,13 +2,10 @@ package WayofTime.bloodmagic.block; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; -import net.minecraft.block.BlockFenceGate; import net.minecraft.block.material.Material; -import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; -import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; import net.minecraft.world.IBlockAccess; import WayofTime.bloodmagic.BloodMagic; @@ -31,7 +28,9 @@ public abstract class BlockRoutingNode extends BlockContainer setResistance(5.0F); setHarvestLevel("pickaxe", 2); - this.setDefaultState(this.blockState.getBaseState().withProperty(DOWN, Boolean.valueOf(false)).withProperty(UP, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false))); + setBlockBounds(0.378F, 0.378F, 0.378F, 0.625F, 0.625F, 0.625F); + + this.setDefaultState(this.blockState.getBaseState().withProperty(DOWN, false).withProperty(UP, false).withProperty(NORTH, false).withProperty(EAST, false).withProperty(SOUTH, false).withProperty(WEST, false)); } @Override @@ -70,23 +69,19 @@ public abstract class BlockRoutingNode extends BlockContainer @Override public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { - return state.withProperty(UP, Boolean.valueOf(this.shouldConnect(worldIn, pos.up()))).withProperty(DOWN, Boolean.valueOf(this.shouldConnect(worldIn, pos.down()))).withProperty(NORTH, Boolean.valueOf(this.shouldConnect(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.shouldConnect(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.shouldConnect(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.shouldConnect(worldIn, pos.west()))); + return state.withProperty(UP, this.shouldConnect(worldIn, pos.up())).withProperty(DOWN, this.shouldConnect(worldIn, pos.down())).withProperty(NORTH, this.shouldConnect(worldIn, pos.north())).withProperty(EAST, this.shouldConnect(worldIn, pos.east())).withProperty(SOUTH, this.shouldConnect(worldIn, pos.south())).withProperty(WEST, this.shouldConnect(worldIn, pos.west())); } @Override protected BlockState createBlockState() { - return new BlockState(this, new IProperty[] { UP, DOWN, NORTH, EAST, WEST, SOUTH }); + return new BlockState(this, UP, DOWN, NORTH, EAST, WEST, SOUTH); } public boolean shouldConnect(IBlockAccess world, BlockPos pos) { Block block = world.getBlockState(pos).getBlock(); - if (block instanceof BlockRoutingNode) - { - return false; - } - return block == Blocks.barrier ? false : (block != this && !(block instanceof BlockFenceGate) ? (block.getMaterial().isOpaque() && block.isFullCube() ? block.getMaterial() != Material.gourd : false) : true); + return block.isFullBlock() && block.isFullCube(); } @Override