diff --git a/src/main/java/storagecraft/block/BlockCable.java b/src/main/java/storagecraft/block/BlockCable.java index b438eafd4..88a761458 100644 --- a/src/main/java/storagecraft/block/BlockCable.java +++ b/src/main/java/storagecraft/block/BlockCable.java @@ -44,12 +44,12 @@ public class BlockCable extends BlockBase public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) { return super.getActualState(state, world, pos) - .withProperty(NORTH, TileCable.isCable(world, pos.north())) - .withProperty(EAST, TileCable.isCable(world, pos.east())) - .withProperty(SOUTH, TileCable.isCable(world, pos.south())) - .withProperty(WEST, TileCable.isCable(world, pos.west())) - .withProperty(UP, TileCable.isCable(world, pos.up())) - .withProperty(DOWN, TileCable.isCable(world, pos.down())); + .withProperty(NORTH, TileCable.hasConnectionWith(world, pos.north())) + .withProperty(EAST, TileCable.hasConnectionWith(world, pos.east())) + .withProperty(SOUTH, TileCable.hasConnectionWith(world, pos.south())) + .withProperty(WEST, TileCable.hasConnectionWith(world, pos.west())) + .withProperty(UP, TileCable.hasConnectionWith(world, pos.up())) + .withProperty(DOWN, TileCable.hasConnectionWith(world, pos.down())); } @Override diff --git a/src/main/java/storagecraft/tile/TileCable.java b/src/main/java/storagecraft/tile/TileCable.java index 7b6396023..acce51387 100644 --- a/src/main/java/storagecraft/tile/TileCable.java +++ b/src/main/java/storagecraft/tile/TileCable.java @@ -5,35 +5,19 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; -import storagecraft.block.BlockCable; public class TileCable extends TileBase { - public static boolean isCable(IBlockAccess world, BlockPos pos) + public static boolean hasConnectionWith(IBlockAccess world, BlockPos pos) { - return world.getBlockState(pos).getBlock() instanceof BlockCable; - } + TileEntity tile = world.getTileEntity(pos); - public boolean hasConnection(EnumFacing dir) - { - if (!isEnabled()) - { - return false; - } - - if (isCable(worldObj, pos.offset(dir))) - { - return true; - } - - TileEntity tile = worldObj.getTileEntity(pos.offset(dir)); - - return tile instanceof TileMachine || tile instanceof TileController; + return tile instanceof TileCable || tile instanceof TileMachine || tile instanceof TileController; } public boolean isEnabled() { - return !worldObj.isBlockPowered(pos); + return true; // @TODO } public void addMachines(List visited, List machines, TileController controller) @@ -52,17 +36,17 @@ public class TileCable extends TileBase { BlockPos newPos = pos.offset(dir); - boolean found = false; + boolean alreadyVisited = false; for (BlockPos visitedBlock : visited) { if (visitedBlock.equals(newPos)) { - found = true; + alreadyVisited = true; } } - if (found) + if (alreadyVisited) { continue; }