From 6400dfe3bb7fc95aaedab797ba10755d81b79f7b Mon Sep 17 00:00:00 2001 From: "spookydonut (Ash Wiren)" Date: Tue, 4 Feb 2014 13:29:27 +0800 Subject: [PATCH] Made Electrolytic Separators vent excess gas by default --- common/mekanism/api/gas/GasTank.java | 15 +++++++++++++++ .../tile/TileEntityElectrolyticSeparator.java | 8 ++++++++ 2 files changed, 23 insertions(+) diff --git a/common/mekanism/api/gas/GasTank.java b/common/mekanism/api/gas/GasTank.java index d4f2e27ec..10614ef69 100644 --- a/common/mekanism/api/gas/GasTank.java +++ b/common/mekanism/api/gas/GasTank.java @@ -115,6 +115,21 @@ public class GasTank return true; } + /** + * If this GasTank can receive the specified type of gas. Will return TRUE if this tank does not need anymore gas. + * @param gas - gas to check + * @return if this GasTank can accept the defined gas + */ + public boolean canReceiveType(Gas gas) + { + if(stored != null && (gas != null && gas != stored.getGas())) + { + return false; + } + + return true; + } + /** * If this GasTank can be drawn of the specified type of gas. Will return false if this tank does not contain any gas. * @param gas - gas to check diff --git a/common/mekanism/common/tile/TileEntityElectrolyticSeparator.java b/common/mekanism/common/tile/TileEntityElectrolyticSeparator.java index 600f122df..b79c39576 100644 --- a/common/mekanism/common/tile/TileEntityElectrolyticSeparator.java +++ b/common/mekanism/common/tile/TileEntityElectrolyticSeparator.java @@ -62,6 +62,9 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp /** Type type of gas this block is dumping. */ public boolean dumpRight = false; + + /** Whether to dump excess gas when a tank is full */ + public boolean dumpExcess = true; // default to true until gui elements added public TileEntityElectrolyticSeparator() { @@ -199,6 +202,11 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp public boolean canFill(ChemicalPair gases) { + if(dumpExcess) + { + return (leftTank.canReceiveType(gases.leftGas.getGas()) && rightTank.canReceiveType(gases.rightGas.getGas())) + } + return (leftTank.canReceive(gases.leftGas.getGas()) && leftTank.getNeeded() >= gases.leftGas.amount && rightTank.canReceive(gases.rightGas.getGas()) && rightTank.getNeeded() >= gases.rightGas.amount); }