diff --git a/common/mekanism/api/DynamicNetwork.java b/common/mekanism/api/DynamicNetwork.java new file mode 100644 index 000000000..6fa9626c6 --- /dev/null +++ b/common/mekanism/api/DynamicNetwork.java @@ -0,0 +1,9 @@ +package mekanism.api; + +public class DynamicNetwork +{ + protected int ticksSinceCreate = 0; + protected int ticksSinceSecond = 0; + + protected boolean fixed = false; +} diff --git a/common/mekanism/api/GasNetwork.java b/common/mekanism/api/GasNetwork.java index 1dae4595a..cd4e1bf05 100644 --- a/common/mekanism/api/GasNetwork.java +++ b/common/mekanism/api/GasNetwork.java @@ -20,16 +20,13 @@ import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.world.ChunkEvent; import cpw.mods.fml.common.FMLCommonHandler; -public class GasNetwork implements ITransmitterNetwork +public class GasNetwork extends DynamicNetwork implements ITransmitterNetwork { public HashSet tubes = new HashSet(); public Set possibleAcceptors = new HashSet(); public Map acceptorDirections = new HashMap(); - private int ticksSinceCreate = 0; - private boolean fixed = false; - public GasNetwork(IPressurizedTube... varPipes) { tubes.addAll(Arrays.asList(varPipes)); @@ -370,7 +367,7 @@ public class GasNetwork implements ITransmitterNetwork @Override public String toString() { - return "[GasNetwork] " + tubes.size() + " pipes, " + possibleAcceptors.size() + " acceptors."; + return "[GasNetwork] " + tubes.size() + " tubes, " + possibleAcceptors.size() + " acceptors."; } public void tick() diff --git a/common/mekanism/api/TransmitterNetworkRegistry.java b/common/mekanism/api/TransmitterNetworkRegistry.java index d209137ff..f1a61b605 100644 --- a/common/mekanism/api/TransmitterNetworkRegistry.java +++ b/common/mekanism/api/TransmitterNetworkRegistry.java @@ -12,7 +12,6 @@ import cpw.mods.fml.relauncher.Side; public class TransmitterNetworkRegistry implements ITickHandler { private static TransmitterNetworkRegistry INSTANCE = new TransmitterNetworkRegistry(); - private HashSet networks = new HashSet(); public TransmitterNetworkRegistry() @@ -78,7 +77,7 @@ public class TransmitterNetworkRegistry implements ITickHandler @Override public String getLabel() { - return "Mekanism Transmitter Networks"; + return "MekanismNetworks"; } @Override diff --git a/common/mekanism/common/EnergyNetwork.java b/common/mekanism/common/EnergyNetwork.java index 650a9f7c4..183e056c0 100644 --- a/common/mekanism/common/EnergyNetwork.java +++ b/common/mekanism/common/EnergyNetwork.java @@ -13,8 +13,7 @@ import java.util.Map; import java.util.NoSuchElementException; import java.util.Set; -import cpw.mods.fml.common.FMLCommonHandler; - +import mekanism.api.DynamicNetwork; import mekanism.api.IStrictEnergyAcceptor; import mekanism.api.ITransmitterNetwork; import mekanism.api.Object3D; @@ -26,13 +25,14 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.Event; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.world.ChunkEvent; +import universalelectricity.core.block.IElectrical; +import universalelectricity.core.electricity.ElectricityPack; import buildcraft.api.power.IPowerReceptor; import buildcraft.api.power.PowerHandler.PowerReceiver; import buildcraft.api.power.PowerHandler.Type; -import universalelectricity.core.block.IElectrical; -import universalelectricity.core.electricity.ElectricityPack; +import cpw.mods.fml.common.FMLCommonHandler; -public class EnergyNetwork implements ITransmitterNetwork +public class EnergyNetwork extends DynamicNetwork implements ITransmitterNetwork { public HashSet cables = new HashSet(); @@ -42,9 +42,6 @@ public class EnergyNetwork implements ITransmitterNetwork private double lastPowerScale = 0; private double joulesTransmitted = 0; private double joulesLastTick = 0; - private int ticksSinceCreate = 0; - private int ticksSinceSecond = 0; - private boolean fixed = false; public EnergyNetwork(IUniversalCable... varCables) { diff --git a/common/mekanism/common/FluidNetwork.java b/common/mekanism/common/FluidNetwork.java index 57035ba5b..4988acdf4 100644 --- a/common/mekanism/common/FluidNetwork.java +++ b/common/mekanism/common/FluidNetwork.java @@ -11,6 +11,7 @@ import java.util.Map; import java.util.NoSuchElementException; import java.util.Set; +import mekanism.api.DynamicNetwork; import mekanism.api.ITransmitterNetwork; import mekanism.api.Object3D; import mekanism.api.TransmitterNetworkRegistry; @@ -25,17 +26,13 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; import cpw.mods.fml.common.FMLCommonHandler; -public class FluidNetwork implements ITransmitterNetwork +public class FluidNetwork extends DynamicNetwork implements ITransmitterNetwork { public HashSet pipes = new HashSet(); public Set possibleAcceptors = new HashSet(); public Map acceptorDirections = new HashMap(); - private int ticksSinceCreate = 0; - private int ticksSinceSecond = 0; - private boolean fixed = false; - public FluidNetwork(IMechanicalPipe... varPipes) { pipes.addAll(Arrays.asList(varPipes)); diff --git a/common/mekanism/common/InventoryNetwork.java b/common/mekanism/common/InventoryNetwork.java index 02c125044..b0ce12095 100644 --- a/common/mekanism/common/InventoryNetwork.java +++ b/common/mekanism/common/InventoryNetwork.java @@ -10,6 +10,7 @@ import java.util.Map; import java.util.NoSuchElementException; import java.util.Set; +import mekanism.api.DynamicNetwork; import mekanism.api.ITransmitterNetwork; import mekanism.api.Object3D; import mekanism.api.TransmitterNetworkRegistry; @@ -20,17 +21,13 @@ import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.world.ChunkEvent; -public class InventoryNetwork implements ITransmitterNetwork +public class InventoryNetwork extends DynamicNetwork implements ITransmitterNetwork { public HashSet transporters = new HashSet(); public Set possibleAcceptors = new HashSet(); public Map acceptorDirections = new HashMap(); - private int ticksSinceCreate = 0; - private int ticksSinceSecond = 0; - private boolean fixed = false; - public InventoryNetwork(ILogisticalTransporter... varTransporters) { transporters.addAll(Arrays.asList(varTransporters)); @@ -315,7 +312,7 @@ public class InventoryNetwork implements ITransmitterNetwork @Override public String toString() { - return "[InventoryNetwork] " + transporters.size() + " pipes, " + possibleAcceptors.size() + " acceptors."; + return "[InventoryNetwork] " + transporters.size() + " transporters, " + possibleAcceptors.size() + " acceptors."; } @Override