blob: ec75d1319e12b1dee962286a510311d27f33989b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
package miscutil.enderio.conduit.gas;
import mekanism.api.gas.GasStack;
import crazypants.enderio.conduit.AbstractConduitNetwork;
public class AbstractGasTankConduitNetwork<T extends AbstractGasTankConduit>
extends AbstractConduitNetwork<IGasConduit, T>
{
protected GasStack gasType;
protected AbstractGasTankConduitNetwork(Class<T> cl)
{
super(cl);
}
public GasStack getGasType()
{
return this.gasType;
}
public Class<IGasConduit> getBaseConduitType()
{
return IGasConduit.class;
}
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;
}
}
|