diff --git a/common/mekanism/client/MekanismRenderer.java b/common/mekanism/client/MekanismRenderer.java index 8c5be58a4..359745d62 100644 --- a/common/mekanism/client/MekanismRenderer.java +++ b/common/mekanism/client/MekanismRenderer.java @@ -83,6 +83,11 @@ public class MekanismRenderer public static void renderObject(Model3D object) { + if(object == null) + { + return; + } + renderBlocks.renderMaxX = object.maxX; renderBlocks.renderMinX = object.minX; renderBlocks.renderMaxY = object.maxY; diff --git a/common/mekanism/client/RenderMechanicalPipe.java b/common/mekanism/client/RenderMechanicalPipe.java index f126d3431..2a85cd999 100644 --- a/common/mekanism/client/RenderMechanicalPipe.java +++ b/common/mekanism/client/RenderMechanicalPipe.java @@ -44,14 +44,11 @@ public class RenderMechanicalPipe extends TileEntitySpecialRenderer boolean[] connectable = PipeUtils.getConnections(tileEntity); - if(tileEntity.canTransferLiquids()) + for(int i = 0; i < 6; i++) { - for(int i = 0; i < 6; i++) + if(connectable[i]) { - if(connectable[i]) - { - model.renderSide(ForgeDirection.getOrientation(i)); - } + model.renderSide(ForgeDirection.getOrientation(i)); } } @@ -70,15 +67,12 @@ public class RenderMechanicalPipe extends TileEntitySpecialRenderer bindTextureByName(tileEntity.refLiquid.getTextureSheet()); GL11.glTranslatef((float)x, (float)y, (float)z); - if(tileEntity.canTransferLiquids()) + for(int i = 0; i < 6; i++) { - for(int i = 0; i < 6; i++) + if(connectable[i]) { - if(connectable[i]) - { - int[] displayList = getListAndRender(ForgeDirection.getOrientation(i), tileEntity.refLiquid, tileEntity.worldObj); - GL11.glCallList(displayList[Math.max(3, (int)((float)tileEntity.liquidScale*(stages-1)))]); - } + int[] displayList = getListAndRender(ForgeDirection.getOrientation(i), tileEntity.refLiquid, tileEntity.worldObj); + GL11.glCallList(displayList[Math.max(3, (int)((float)tileEntity.liquidScale*(stages-1)))]); } } diff --git a/common/mekanism/client/RenderUniversalCable.java b/common/mekanism/client/RenderUniversalCable.java index fb486e61f..d33570239 100644 --- a/common/mekanism/client/RenderUniversalCable.java +++ b/common/mekanism/client/RenderUniversalCable.java @@ -40,14 +40,11 @@ public class RenderUniversalCable extends TileEntitySpecialRenderer boolean[] connectable = CableUtils.getConnections(tileEntity); - if(tileEntity.canTransferEnergy()) + for(int i = 0; i < 6; i++) { - for(int i = 0; i < 6; i++) + if(connectable[i]) { - if(connectable[i]) - { - model.renderSide(ForgeDirection.getOrientation(i)); - } + model.renderSide(ForgeDirection.getOrientation(i)); } } @@ -63,14 +60,11 @@ public class RenderUniversalCable extends TileEntitySpecialRenderer bindTextureByName("/mods/mekanism/textures/items/LiquidEnergy.png"); GL11.glTranslatef((float)x, (float)y, (float)z); - if(tileEntity.canTransferEnergy()) + for(int i = 0; i < 6; i++) { - for(int i = 0; i < 6; i++) + if(connectable[i]) { - if(connectable[i]) - { - renderEnergy(ForgeDirection.getOrientation(i)); - } + renderEnergy(ForgeDirection.getOrientation(i)); } } diff --git a/common/mekanism/common/CableUtils.java b/common/mekanism/common/CableUtils.java index a533f91c9..843740840 100644 --- a/common/mekanism/common/CableUtils.java +++ b/common/mekanism/common/CableUtils.java @@ -28,17 +28,14 @@ public final class CableUtils { TileEntity[] acceptors = new TileEntity[] {null, null, null, null, null, null}; - if(!(tileEntity instanceof IUniversalCable) || ((IUniversalCable)tileEntity).canTransferEnergy()) + for(ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS) { - for(ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS) - { - TileEntity acceptor = Object3D.get(tileEntity).getFromSide(orientation).getTileEntity(tileEntity.worldObj); - - if(acceptor instanceof IStrictEnergyAcceptor || acceptor instanceof IEnergySink || (acceptor instanceof IPowerReceptor && !(acceptor instanceof IUniversalCable) && Mekanism.hooks.BuildCraftLoaded)) - { - acceptors[orientation.ordinal()] = acceptor; - } - } + TileEntity acceptor = Object3D.get(tileEntity).getFromSide(orientation).getTileEntity(tileEntity.worldObj); + + if(acceptor instanceof IStrictEnergyAcceptor || acceptor instanceof IEnergySink || (acceptor instanceof IPowerReceptor && !(acceptor instanceof IUniversalCable) && Mekanism.hooks.BuildCraftLoaded)) + { + acceptors[orientation.ordinal()] = acceptor; + } } return acceptors; @@ -53,17 +50,14 @@ public final class CableUtils { TileEntity[] cables = new TileEntity[] {null, null, null, null, null, null}; - if(!(tileEntity instanceof IUniversalCable) || ((IUniversalCable)tileEntity).canTransferEnergy()) + for(ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS) { - for(ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS) - { - TileEntity cable = Object3D.get(tileEntity).getFromSide(orientation).getTileEntity(tileEntity.worldObj); - - if(cable instanceof IUniversalCable && ((IUniversalCable)cable).canTransferEnergy()) - { - cables[orientation.ordinal()] = cable; - } - } + TileEntity cable = Object3D.get(tileEntity).getFromSide(orientation).getTileEntity(tileEntity.worldObj); + + if(cable instanceof IUniversalCable) + { + cables[orientation.ordinal()] = cable; + } } return cables; @@ -124,17 +118,14 @@ public final class CableUtils { TileEntity[] outputters = new TileEntity[] {null, null, null, null, null, null}; - if(!(tileEntity instanceof IUniversalCable) || ((IUniversalCable)tileEntity).canTransferEnergy()) + for(ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS) { - for(ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS) - { - TileEntity outputter = Object3D.get(tileEntity).getFromSide(orientation).getTileEntity(tileEntity.worldObj); - - if(outputter instanceof ICableOutputter && ((ICableOutputter)outputter).canOutputTo(orientation.getOpposite()) || outputter instanceof IEnergySource && ((IEnergySource)outputter).emitsEnergyTo(tileEntity, MekanismUtils.toIC2Direction(orientation.getOpposite()))) - { - outputters[orientation.ordinal()] = outputter; - } - } + TileEntity outputter = Object3D.get(tileEntity).getFromSide(orientation).getTileEntity(tileEntity.worldObj); + + if(outputter instanceof ICableOutputter && ((ICableOutputter)outputter).canOutputTo(orientation.getOpposite()) || outputter instanceof IEnergySource && ((IEnergySource)outputter).emitsEnergyTo(tileEntity, MekanismUtils.toIC2Direction(orientation.getOpposite()))) + { + outputters[orientation.ordinal()] = outputter; + } } return outputters; diff --git a/common/mekanism/common/EnergyNetwork.java b/common/mekanism/common/EnergyNetwork.java index d077dc701..2ddbda708 100644 --- a/common/mekanism/common/EnergyNetwork.java +++ b/common/mekanism/common/EnergyNetwork.java @@ -288,7 +288,7 @@ public class EnergyNetwork public void loopThrough(Object3D location) { - if(location.getTileEntity(worldObj) instanceof IUniversalCable && ((IUniversalCable)location.getTileEntity(worldObj)).canTransferEnergy()) + if(location.getTileEntity(worldObj) instanceof IUniversalCable) { iterated.add(location); } @@ -306,7 +306,7 @@ public class EnergyNetwork { TileEntity tileEntity = obj.getTileEntity(worldObj); - if(tileEntity instanceof IUniversalCable && ((IUniversalCable)tileEntity).canTransferEnergy()) + if(tileEntity instanceof IUniversalCable) { loopThrough(obj); } diff --git a/common/mekanism/common/IMechanicalPipe.java b/common/mekanism/common/IMechanicalPipe.java index 830bbdbd0..e0bfed3c2 100644 --- a/common/mekanism/common/IMechanicalPipe.java +++ b/common/mekanism/common/IMechanicalPipe.java @@ -9,12 +9,6 @@ import net.minecraftforge.liquids.LiquidStack; */ public interface IMechanicalPipe { - /** - * Whether or not this pipe can transfer liquids. - * @return if the pipe can transfer liquids - */ - public boolean canTransferLiquids(); - /** * Called when liquid is transferred through this pipe. * @param liquidStack - the liquid transferred diff --git a/common/mekanism/common/IUniversalCable.java b/common/mekanism/common/IUniversalCable.java index 12bc95b3f..42e1f7985 100644 --- a/common/mekanism/common/IUniversalCable.java +++ b/common/mekanism/common/IUniversalCable.java @@ -7,12 +7,6 @@ package mekanism.common; */ public interface IUniversalCable { - /** - * Whether or not this cable can transfer energy. - * @return if the cable can transfer energy - */ - public boolean canTransferEnergy(); - /** * Gets the EnergyNetwork currently in use by this cable segment. * @return EnergyNetwork this cable is using diff --git a/common/mekanism/common/LiquidNetwork.java b/common/mekanism/common/LiquidNetwork.java index 3def835d0..f5a6b15b3 100644 --- a/common/mekanism/common/LiquidNetwork.java +++ b/common/mekanism/common/LiquidNetwork.java @@ -250,7 +250,7 @@ public class LiquidNetwork { TileEntity tileEntity = obj.getTileEntity(worldObj); - if(tileEntity instanceof IMechanicalPipe && ((IMechanicalPipe)tileEntity).canTransferLiquids()) + if(tileEntity instanceof IMechanicalPipe) { loopThrough(obj); } diff --git a/common/mekanism/common/PipeUtils.java b/common/mekanism/common/PipeUtils.java index e93127b3d..a5880d394 100644 --- a/common/mekanism/common/PipeUtils.java +++ b/common/mekanism/common/PipeUtils.java @@ -19,17 +19,14 @@ public final class PipeUtils { TileEntity[] pipes = new TileEntity[] {null, null, null, null, null, null}; - if(!(tileEntity instanceof IMechanicalPipe) || ((IMechanicalPipe)tileEntity).canTransferLiquids()) + for(ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS) { - for(ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS) - { - TileEntity pipe = Object3D.get(tileEntity).getFromSide(orientation).getTileEntity(tileEntity.worldObj); - - if(pipe instanceof IMechanicalPipe && ((IMechanicalPipe)pipe).canTransferLiquids()) - { - pipes[orientation.ordinal()] = pipe; - } - } + TileEntity pipe = Object3D.get(tileEntity).getFromSide(orientation).getTileEntity(tileEntity.worldObj); + + if(pipe instanceof IMechanicalPipe) + { + pipes[orientation.ordinal()] = pipe; + } } return pipes; @@ -86,17 +83,14 @@ public final class PipeUtils { ITankContainer[] acceptors = new ITankContainer[] {null, null, null, null, null, null}; - if(!(tileEntity instanceof IMechanicalPipe) || ((IMechanicalPipe)tileEntity).canTransferLiquids()) + for(ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS) { - for(ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS) - { - TileEntity acceptor = Object3D.get(tileEntity).getFromSide(orientation).getTileEntity(tileEntity.worldObj); - - if(acceptor instanceof ITankContainer && !(acceptor instanceof IMechanicalPipe)) - { - acceptors[orientation.ordinal()] = (ITankContainer)acceptor; - } - } + TileEntity acceptor = Object3D.get(tileEntity).getFromSide(orientation).getTileEntity(tileEntity.worldObj); + + if(acceptor instanceof ITankContainer && !(acceptor instanceof IMechanicalPipe)) + { + acceptors[orientation.ordinal()] = (ITankContainer)acceptor; + } } return acceptors; diff --git a/common/mekanism/common/TileEntityMechanicalPipe.java b/common/mekanism/common/TileEntityMechanicalPipe.java index fbfb29ed3..6f3386c74 100644 --- a/common/mekanism/common/TileEntityMechanicalPipe.java +++ b/common/mekanism/common/TileEntityMechanicalPipe.java @@ -38,12 +38,6 @@ public class TileEntityMechanicalPipe extends TileEntity implements IMechanicalP /** The scale (0F -> 1F) of this pipe's liquid level. */ public float liquidScale; - @Override - public boolean canTransferLiquids() - { - return worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) == 0; - } - @Override public void onTransfer(LiquidStack liquidStack) { @@ -91,23 +85,17 @@ public class TileEntityMechanicalPipe extends TileEntity implements IMechanicalP { if(!worldObj.isRemote) { - if(canTransferLiquids()) + for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { - for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) - { - TileEntity tileEntity = Object3D.get(this).getFromSide(side).getTileEntity(worldObj); - - if(tileEntity instanceof IMechanicalPipe && ((IMechanicalPipe)tileEntity).canTransferLiquids()) - { - getNetwork().merge(((IMechanicalPipe)tileEntity).getNetwork()); - } - } + TileEntity tileEntity = Object3D.get(this).getFromSide(side).getTileEntity(worldObj); - getNetwork().refresh(); - } - else { - getNetwork().split(this); + if(tileEntity instanceof IMechanicalPipe) + { + getNetwork().merge(((IMechanicalPipe)tileEntity).getNetwork()); + } } + + getNetwork().refresh(); } } diff --git a/common/mekanism/common/TileEntityUniversalCable.java b/common/mekanism/common/TileEntityUniversalCable.java index 320227698..70c03cbe0 100644 --- a/common/mekanism/common/TileEntityUniversalCable.java +++ b/common/mekanism/common/TileEntityUniversalCable.java @@ -65,31 +65,19 @@ public class TileEntityUniversalCable extends TileEntity implements IUniversalCa { if(!worldObj.isRemote) { - if(canTransferEnergy()) + for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { - for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) - { - TileEntity tileEntity = Object3D.get(this).getFromSide(side).getTileEntity(worldObj); - - if(tileEntity instanceof IUniversalCable && ((IUniversalCable)tileEntity).canTransferEnergy()) - { - getNetwork().merge(((IUniversalCable)tileEntity).getNetwork()); - } - } + TileEntity tileEntity = Object3D.get(this).getFromSide(side).getTileEntity(worldObj); - getNetwork().refresh(); - } - else { - getNetwork().split(this); + if(tileEntity instanceof IUniversalCable) + { + getNetwork().merge(((IUniversalCable)tileEntity).getNetwork()); + } } + + getNetwork().refresh(); } } - - @Override - public boolean canTransferEnergy() - { - return worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) == 0; - } @Override public void setPowerProvider(IPowerProvider provider) {} @@ -108,7 +96,7 @@ public class TileEntityUniversalCable extends TileEntity implements IUniversalCa { ArrayList ignored = new ArrayList(); ignored.add(Object3D.get(this).getFromSide(from).getTileEntity(worldObj)); - return canTransferEnergy() ? (int)Math.min(100, getNetwork().getEnergyNeeded(ignored)*Mekanism.TO_BC) : 0; + return (int)Math.min(100, getNetwork().getEnergyNeeded(ignored)*Mekanism.TO_BC); } @Override diff --git a/common/mekanism/common/Version.java b/common/mekanism/common/Version.java index a19024d88..bd8e217fe 100644 --- a/common/mekanism/common/Version.java +++ b/common/mekanism/common/Version.java @@ -92,7 +92,6 @@ public class Version if(split.length != 3) { - System.out.println(split.length); return null; }