aboutsummaryrefslogtreecommitdiff
path: root/src/Java/miscutil/enderio/conduit/gas/AbstractGasTankConduitNetwork.java
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2016-02-27 21:24:45 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2016-02-27 21:24:45 +1000
commit7711c80664fdfa703b5e60e62af437655da783ae (patch)
tree1a251a5919b7c6d4f32de7efca6a36d97cef0233 /src/Java/miscutil/enderio/conduit/gas/AbstractGasTankConduitNetwork.java
parent707621bc6afd36856feafb052c2e65c52fe79986 (diff)
downloadGT5-Unofficial-7711c80664fdfa703b5e60e62af437655da783ae.tar.gz
GT5-Unofficial-7711c80664fdfa703b5e60e62af437655da783ae.tar.bz2
GT5-Unofficial-7711c80664fdfa703b5e60e62af437655da783ae.zip
Added Custom GT Cables/Wire & also added a copy of EnderIO's Gas Conduit classes.
Time to combine the two, yeah? Also stripped out a heap of constants and refactored them together.
Diffstat (limited to 'src/Java/miscutil/enderio/conduit/gas/AbstractGasTankConduitNetwork.java')
-rw-r--r--src/Java/miscutil/enderio/conduit/gas/AbstractGasTankConduitNetwork.java68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/Java/miscutil/enderio/conduit/gas/AbstractGasTankConduitNetwork.java b/src/Java/miscutil/enderio/conduit/gas/AbstractGasTankConduitNetwork.java
new file mode 100644
index 0000000000..75a4a3c1ad
--- /dev/null
+++ b/src/Java/miscutil/enderio/conduit/gas/AbstractGasTankConduitNetwork.java
@@ -0,0 +1,68 @@
+package crazypants.enderio.conduit.gas;
+
+import crazypants.enderio.conduit.AbstractConduitNetwork;
+import mekanism.api.gas.GasStack;
+
+public class AbstractGasTankConduitNetwork<T extends AbstractGasTankConduit>
+ extends AbstractConduitNetwork<IGasConduit, T>
+{
+ protected GasStack gasType;
+
+ protected AbstractGasTankConduitNetwork(Class<T> cl)
+ {
+ super(cl, IGasConduit.class);
+ }
+
+ public GasStack getGasType()
+ {
+ return this.gasType;
+ }
+
+ public void addConduit(T con)
+ {
+ super.addConduit(con);
+ con.setGasType(this.gasType);
+ }
+
+ public boolean setGasType(GasStack newType)
+ {
+ if ((this.gasType != null) && (this.gasType.isGasEqual(newType))) {
+ return false;
+ }
+ if (newType != null)
+ {
+ this.gasType = newType.copy();
+ this.gasType.amount = 0;
+ }
+ else
+ {
+ this.gasType = null;
+ }
+ for (AbstractGasTankConduit conduit : this.conduits) {
+ conduit.setGasType(this.gasType);
+ }
+ return true;
+ }
+
+ public boolean canAcceptGas(GasStack acceptable)
+ {
+ return areGassCompatable(this.gasType, acceptable);
+ }
+
+ public static boolean areGassCompatable(GasStack a, GasStack b)
+ {
+ if ((a == null) || (b == null)) {
+ return true;
+ }
+ return a.isGasEqual(b);
+ }
+
+ public int getTotalVolume()
+ {
+ int totalVolume = 0;
+ for (T con : this.conduits) {
+ totalVolume += con.getTank().getStored();
+ }
+ return totalVolume;
+ }
+}