diff --git a/archaic/src/main/java/resonantinduction/archaic/fluid/gutter/TileGutter.java b/archaic/src/main/java/resonantinduction/archaic/fluid/gutter/TileGutter.java index acb1a6e36..a092efd34 100644 --- a/archaic/src/main/java/resonantinduction/archaic/fluid/gutter/TileGutter.java +++ b/archaic/src/main/java/resonantinduction/archaic/fluid/gutter/TileGutter.java @@ -62,49 +62,46 @@ public class TileGutter extends TilePressureNode node = new FluidGravityNode(this) { @Override - public void recache() + public void doRecache() { - synchronized (connections) + connections.clear(); + byte previousConnections = renderSides; + renderSides = 0; + + for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { - connections.clear(); - byte previousConnections = renderSides; - renderSides = 0; + TileEntity tile = position().translate(dir).getTileEntity(world()); - for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) + if (tile instanceof IFluidHandler) { - TileEntity tile = position().translate(dir).getTileEntity(world()); - - if (tile instanceof IFluidHandler) + if (tile instanceof IPressureNodeProvider) { - if (tile instanceof IPressureNodeProvider) + FluidPressureNode check = ((IPressureNodeProvider) tile).getNode(FluidPressureNode.class, dir.getOpposite()); + + if (check != null && canConnect(dir, check) && check.canConnect(dir.getOpposite(), this)) { - FluidPressureNode check = ((IPressureNodeProvider) tile).getNode(FluidPressureNode.class, dir.getOpposite()); + connections.put(check, dir); - if (check != null && canConnect(dir, check) && check.canConnect(dir.getOpposite(), this)) - { - connections.put(check, dir); - - if (tile instanceof TileGutter) - renderSides = WorldUtility.setEnableSide(renderSides, dir, true); - - } - } - else - { - connections.put(tile, dir); - - if (tile instanceof TileGrate) + if (tile instanceof TileGutter) renderSides = WorldUtility.setEnableSide(renderSides, dir, true); + } } - } + else + { + connections.put(tile, dir); - /** Only send packet updates if visuallyConnected changed. */ - if (previousConnections != renderSides) - { - sendRenderUpdate(); + if (tile instanceof TileGrate) + renderSides = WorldUtility.setEnableSide(renderSides, dir, true); + } } } + + /** Only send packet updates if visuallyConnected changed. */ + if (previousConnections != renderSides) + { + sendRenderUpdate(); + } } }; } diff --git a/electrical/src/main/java/resonantinduction/electrical/generator/BlockMotor.java b/electrical/src/main/java/resonantinduction/electrical/generator/BlockMotor.java index 26c5bad5f..6d1a024bb 100644 --- a/electrical/src/main/java/resonantinduction/electrical/generator/BlockMotor.java +++ b/electrical/src/main/java/resonantinduction/electrical/generator/BlockMotor.java @@ -3,6 +3,7 @@ package resonantinduction.electrical.generator; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import net.minecraftforge.common.ForgeDirection; import resonantinduction.core.Reference; import universalelectricity.api.UniversalElectricity; import calclavia.lib.prefab.block.BlockRotatable; @@ -38,6 +39,12 @@ public class BlockMotor extends BlockRotatable return false; } + @Override + public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) + { + return doRotateBlock(world, x, y, z, ForgeDirection.getOrientation(side)); + } + @Override public boolean onSneakUseWrench(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) { diff --git a/mechanical/src/main/java/resonantinduction/mechanical/belt/TileConveyorBelt.java b/mechanical/src/main/java/resonantinduction/mechanical/belt/TileConveyorBelt.java index 8b122a17a..d6249abeb 100644 --- a/mechanical/src/main/java/resonantinduction/mechanical/belt/TileConveyorBelt.java +++ b/mechanical/src/main/java/resonantinduction/mechanical/belt/TileConveyorBelt.java @@ -42,68 +42,65 @@ public class TileConveyorBelt extends TileMechanical implements IBelt, IRotatabl mechanicalNode = new PacketMechanicalNode(this) { @Override - public void recache() + public void doRecache() { - synchronized (connections) + connections.clear(); + + boolean didRefresh = false; + + for (int i = 2; i < 6; i++) { - connections.clear(); + ForgeDirection dir = ForgeDirection.getOrientation(i); + Vector3 pos = new Vector3(TileConveyorBelt.this).translate(dir); + TileEntity tile = pos.getTileEntity(TileConveyorBelt.this.worldObj); - boolean didRefresh = false; - - for (int i = 2; i < 6; i++) + if (dir == TileConveyorBelt.this.getDirection() || dir == TileConveyorBelt.this.getDirection().getOpposite()) { - ForgeDirection dir = ForgeDirection.getOrientation(i); - Vector3 pos = new Vector3(TileConveyorBelt.this).translate(dir); - TileEntity tile = pos.getTileEntity(TileConveyorBelt.this.worldObj); - - if (dir == TileConveyorBelt.this.getDirection() || dir == TileConveyorBelt.this.getDirection().getOpposite()) + if (dir == TileConveyorBelt.this.getDirection()) { - if (dir == TileConveyorBelt.this.getDirection()) + if (TileConveyorBelt.this.slantType == SlantType.DOWN) { - if (TileConveyorBelt.this.slantType == SlantType.DOWN) - { - pos.translate(new Vector3(0, -1, 0)); - } - else if (TileConveyorBelt.this.slantType == SlantType.UP) - { - pos.translate(new Vector3(0, 1, 0)); - } + pos.translate(new Vector3(0, -1, 0)); } - else if (dir == TileConveyorBelt.this.getDirection().getOpposite()) + else if (TileConveyorBelt.this.slantType == SlantType.UP) { - if (TileConveyorBelt.this.slantType == SlantType.DOWN) - { - pos.translate(new Vector3(0, 1, 0)); - } - else if (TileConveyorBelt.this.slantType == SlantType.UP) - { - pos.translate(new Vector3(0, -1, 0)); - } - } - - tile = pos.getTileEntity(worldObj); - - if (tile instanceof TileConveyorBelt) - { - connections.put(((TileConveyorBelt) tile).getNode(MechanicalNode.class, dir.getOpposite()), dir); - didRefresh = true; + pos.translate(new Vector3(0, 1, 0)); } } - else if (tile instanceof INodeProvider) + else if (dir == TileConveyorBelt.this.getDirection().getOpposite()) { - MechanicalNode mechanical = ((INodeProvider) tile).getNode(MechanicalNode.class, dir.getOpposite()); - - if (mechanical != null) + if (TileConveyorBelt.this.slantType == SlantType.DOWN) { - connections.put(mechanical, dir); + pos.translate(new Vector3(0, 1, 0)); + } + else if (TileConveyorBelt.this.slantType == SlantType.UP) + { + pos.translate(new Vector3(0, -1, 0)); } } - } - if (!worldObj.isRemote) - { - markRefresh = true; + tile = pos.getTileEntity(worldObj); + + if (tile instanceof TileConveyorBelt) + { + connections.put(((TileConveyorBelt) tile).getNode(MechanicalNode.class, dir.getOpposite()), dir); + didRefresh = true; + } } + else if (tile instanceof INodeProvider) + { + MechanicalNode mechanical = ((INodeProvider) tile).getNode(MechanicalNode.class, dir.getOpposite()); + + if (mechanical != null) + { + connections.put(mechanical, dir); + } + } + } + + if (!worldObj.isRemote) + { + markRefresh = true; } } diff --git a/mechanical/src/main/java/resonantinduction/mechanical/energy/gear/PartGear.java b/mechanical/src/main/java/resonantinduction/mechanical/energy/gear/PartGear.java index dee80b7f2..c846e1654 100644 --- a/mechanical/src/main/java/resonantinduction/mechanical/energy/gear/PartGear.java +++ b/mechanical/src/main/java/resonantinduction/mechanical/energy/gear/PartGear.java @@ -104,88 +104,85 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure