diff --git a/src/minecraft/dark/assembly/common/machine/NetworkAssembly.java b/src/minecraft/dark/assembly/common/machine/NetworkAssembly.java index 399ba1185..8b065c2db 100644 --- a/src/minecraft/dark/assembly/common/machine/NetworkAssembly.java +++ b/src/minecraft/dark/assembly/common/machine/NetworkAssembly.java @@ -12,6 +12,7 @@ import universalelectricity.core.block.IElectricalStorage; import universalelectricity.core.vector.Vector3; import dark.api.parts.INetworkEnergyPart; import dark.api.parts.INetworkPart; +import dark.core.prefab.tilenetwork.NetworkHandler; import dark.core.prefab.tilenetwork.NetworkSharedPower; public class NetworkAssembly extends NetworkSharedPower @@ -38,18 +39,16 @@ public class NetworkAssembly extends NetworkSharedPower public float maxDemand = 0; /** lowest demand the network has seen */ public float minDemand = 0; + static + { + NetworkHandler.registerNetworkClass("AssemblyNet", NetworkAssembly.class); + } public NetworkAssembly(INetworkPart... parts) { super(parts); } - @Override - public NetworkAssembly newInstance() - { - return new NetworkAssembly(); - } - /** Gets the demand of all parts of the network including network parts */ public float getNetworkDemand() { @@ -104,7 +103,7 @@ public class NetworkAssembly extends NetworkSharedPower lastTime = time; } - for (INetworkPart part : this.getNetworkMemebers()) + for (INetworkPart part : this.getMembers()) { if (part instanceof TileEntityAssembly) { @@ -184,17 +183,10 @@ public class NetworkAssembly extends NetworkSharedPower return higher; } - @Override - public boolean isPartOfNetwork(TileEntity ent) - { - //TODO check how this is used since it might only want network parts and not connections - return this.networkMember.contains(ent); - } - @Override public boolean removeTile(TileEntity ent) { - return this.networkMember.remove(ent) || this.powerLoads.remove(ent) || this.powerSources.remove(ent); + return super.removeTile(ent) || this.powerLoads.remove(ent) || this.powerSources.remove(ent); } @Override @@ -266,10 +258,4 @@ public class NetworkAssembly extends NetworkSharedPower return super.isValidMember(part) && part instanceof TileEntityAssembly; } - @Override - public String toString() - { - return "AssemblyNetwork[" + this.hashCode() + "][parts:" + this.networkMember.size() + "]"; - } - } diff --git a/src/minecraft/dark/assembly/common/machine/TileEntityAssembly.java b/src/minecraft/dark/assembly/common/machine/TileEntityAssembly.java index 1cd1be4f3..55c1c60ee 100644 --- a/src/minecraft/dark/assembly/common/machine/TileEntityAssembly.java +++ b/src/minecraft/dark/assembly/common/machine/TileEntityAssembly.java @@ -10,6 +10,7 @@ import net.minecraftforge.common.ForgeDirection; import universalelectricity.core.electricity.ElectricityPack; import universalelectricity.core.vector.Vector3; import dark.api.parts.INetworkEnergyPart; +import dark.api.parts.ITileNetwork; import dark.assembly.common.AssemblyLine; import dark.core.prefab.machine.TileEntityEnergyMachine; import dark.core.prefab.tilenetwork.NetworkSharedPower; @@ -17,7 +18,7 @@ import dark.core.prefab.tilenetwork.NetworkTileEntities; /** A class to be inherited by all machines on the assembly line. This class acts as a single peace * in a network of similar tiles allowing all to share power from one or more sources - * + * * @author DarkGuardsman */ public abstract class TileEntityAssembly extends TileEntityEnergyMachine implements INetworkEnergyPart { @@ -50,7 +51,7 @@ public abstract class TileEntityAssembly extends TileEntityEnergyMachine impleme NetworkTileEntities.invalidate(this); if (this.getTileNetwork() != null) { - this.getTileNetwork().splitNetwork(this.worldObj, this); + this.getTileNetwork().splitNetwork(this); } super.invalidate(); } @@ -95,7 +96,7 @@ public abstract class TileEntityAssembly extends TileEntityEnergyMachine impleme TileEntity tileEntity = new Vector3(this).modifyPositionFromSide(dir).getTileEntity(this.worldObj); if (tileEntity instanceof TileEntityAssembly && ((TileEntityAssembly) tileEntity).canTileConnect(Connection.NETWORK, dir.getOpposite())) { - this.getTileNetwork().merge(((TileEntityAssembly) tileEntity).getTileNetwork(), this); + this.getTileNetwork().mergeNetwork(((TileEntityAssembly) tileEntity).getTileNetwork(), this); connectedTiles.add(tileEntity); } } @@ -119,7 +120,7 @@ public abstract class TileEntityAssembly extends TileEntityEnergyMachine impleme } @Override - public void setTileNetwork(NetworkTileEntities network) + public void setTileNetwork(ITileNetwork network) { if (network instanceof NetworkAssembly) { @@ -186,13 +187,6 @@ public abstract class TileEntityAssembly extends TileEntityEnergyMachine impleme this.energyStored = energy; } - @Override - public boolean mergeDamage(String effect) - { - this.onDisable(20); - return true; - } - @Override public AxisAlignedBB getRenderBoundingBox() { diff --git a/src/minecraft/dark/assembly/common/machine/belt/TileEntityConveyorBelt.java b/src/minecraft/dark/assembly/common/machine/belt/TileEntityConveyorBelt.java index ced211497..1c6a78aef 100644 --- a/src/minecraft/dark/assembly/common/machine/belt/TileEntityConveyorBelt.java +++ b/src/minecraft/dark/assembly/common/machine/belt/TileEntityConveyorBelt.java @@ -23,7 +23,7 @@ import dark.core.common.DarkMain; import dark.core.network.PacketHandler; /** Conveyer belt TileEntity that allows entities of all kinds to be moved - * + * * @author DarkGuardsman */ public class TileEntityConveyorBelt extends TileEntityAssembly implements IBelt, IRotatable { @@ -278,12 +278,12 @@ public class TileEntityConveyorBelt extends TileEntityAssembly implements IBelt, rear = back.getTileEntity(this.worldObj); if (front instanceof TileEntityAssembly) { - this.getTileNetwork().merge(((TileEntityAssembly) front).getTileNetwork(), this); + this.getTileNetwork().mergeNetwork(((TileEntityAssembly) front).getTileNetwork(), this); this.connectedTiles.add(front); } if (rear instanceof TileEntityAssembly) { - this.getTileNetwork().merge(((TileEntityAssembly) rear).getTileNetwork(), this); + this.getTileNetwork().mergeNetwork(((TileEntityAssembly) rear).getTileNetwork(), this); this.connectedTiles.add(rear); }