diff --git a/src/main/java/mekanism/client/gui/GuiChemicalInfuser.java b/src/main/java/mekanism/client/gui/GuiChemicalInfuser.java index bd43bfac6..4da2b9417 100644 --- a/src/main/java/mekanism/client/gui/GuiChemicalInfuser.java +++ b/src/main/java/mekanism/client/gui/GuiChemicalInfuser.java @@ -51,7 +51,7 @@ public class GuiChemicalInfuser extends GuiMekanism if(tileEntity.getRecipe() != null) { - usage = tileEntity.getUpgradedUsage(tileEntity.getRecipe())*MekanismUtils.getPureEnergyPerTick(tileEntity, tileEntity.BASE_ENERGY_USAGE); + usage = tileEntity.getUpgradedUsage(tileEntity.getRecipe())*tileEntity.energyPerTick; } String multiplier = MekanismUtils.getEnergyDisplay(usage); diff --git a/src/main/java/mekanism/client/gui/GuiChemicalWasher.java b/src/main/java/mekanism/client/gui/GuiChemicalWasher.java index 045ad2514..88e4fa2ca 100644 --- a/src/main/java/mekanism/client/gui/GuiChemicalWasher.java +++ b/src/main/java/mekanism/client/gui/GuiChemicalWasher.java @@ -53,7 +53,7 @@ public class GuiChemicalWasher extends GuiMekanism @Override public List getInfo() { - String multiplier = MekanismUtils.getEnergyDisplay(MekanismUtils.getPureEnergyPerTick(tileEntity, tileEntity.BASE_ENERGY_USAGE)*tileEntity.getUpgradedUsage()); + String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyPerTick*tileEntity.getUpgradedUsage()); return ListUtils.asList("Using: " + multiplier + "/t", "Needed: " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy())); } }, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalWasher.png"))); diff --git a/src/main/java/mekanism/client/gui/GuiElectrolyticSeparator.java b/src/main/java/mekanism/client/gui/GuiElectrolyticSeparator.java index fae952a4e..f98ccc6a5 100755 --- a/src/main/java/mekanism/client/gui/GuiElectrolyticSeparator.java +++ b/src/main/java/mekanism/client/gui/GuiElectrolyticSeparator.java @@ -57,7 +57,7 @@ public class GuiElectrolyticSeparator extends GuiMekanism if(tileEntity.getRecipe() != null) { - usage = tileEntity.getUpgradedUsage(tileEntity.getRecipe())*MekanismUtils.getPureEnergyPerTick(tileEntity, tileEntity.getRecipe().extraEnergy); + usage = tileEntity.getUpgradedUsage(tileEntity.getRecipe())*tileEntity.energyPerTick; } String multiplier = MekanismUtils.getEnergyDisplay(usage); diff --git a/src/main/java/mekanism/client/gui/GuiRotaryCondensentrator.java b/src/main/java/mekanism/client/gui/GuiRotaryCondensentrator.java index f80d5c47a..87de2342f 100644 --- a/src/main/java/mekanism/client/gui/GuiRotaryCondensentrator.java +++ b/src/main/java/mekanism/client/gui/GuiRotaryCondensentrator.java @@ -59,7 +59,7 @@ public class GuiRotaryCondensentrator extends GuiMekanism @Override public List getInfo() { - String multiplier = MekanismUtils.getEnergyDisplay(MekanismUtils.getPureEnergyPerTick(tileEntity, tileEntity.BASE_ENERGY_USAGE)*tileEntity.getUpgradedUsage()); + String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyPerTick*tileEntity.getUpgradedUsage()); return ListUtils.asList("Using: " + multiplier + "/t", "Needed: " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy())); } }, this, MekanismUtils.getResource(ResourceType.GUI, "GuiRotaryCondensentrator.png"))); diff --git a/src/main/java/mekanism/common/recipe/machines/SeparatorRecipe.java b/src/main/java/mekanism/common/recipe/machines/SeparatorRecipe.java index ac93e4477..aaf737f5b 100644 --- a/src/main/java/mekanism/common/recipe/machines/SeparatorRecipe.java +++ b/src/main/java/mekanism/common/recipe/machines/SeparatorRecipe.java @@ -10,12 +10,12 @@ import net.minecraftforge.fluids.FluidTank; public class SeparatorRecipe extends MachineRecipe { - public double extraEnergy; + public double energyUsage; public SeparatorRecipe(FluidInput input, double energy, ChemicalPairOutput output) { super(input, output); - extraEnergy = energy; + energyUsage = energy; } public SeparatorRecipe(FluidStack input, double energy, GasStack left, GasStack right) @@ -26,7 +26,7 @@ public class SeparatorRecipe extends MachineRecipe= MekanismUtils.getPureEnergyPerTick(this, BASE_ENERGY_USAGE) && MekanismUtils.canFunction(this)) + if(canOperate(recipe) && getEnergy() >= energyPerTick && MekanismUtils.canFunction(this)) { setActive(true); - setEnergy(getEnergy() - MekanismUtils.getPureEnergyPerTick(this, BASE_ENERGY_USAGE)); + setEnergy(getEnergy() - energyPerTick); operate(recipe); } @@ -167,7 +169,7 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl } possibleProcess = Math.min(centerTank.getNeeded()/recipe.recipeOutput.output.amount, possibleProcess); - possibleProcess = Math.min((int)(getEnergy()/MekanismUtils.getPureEnergyPerTick(this, BASE_ENERGY_USAGE)), possibleProcess); + possibleProcess = Math.min((int)(getEnergy()/energyPerTick), possibleProcess); return possibleProcess; } @@ -535,6 +537,7 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl { case ENERGY: maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY); + energyPerTick = MekanismUtils.getBaseEnergyPerTick(this, BASE_ENERGY_USAGE); default: break; } diff --git a/src/main/java/mekanism/common/tile/TileEntityChemicalWasher.java b/src/main/java/mekanism/common/tile/TileEntityChemicalWasher.java index ec0fe767c..3c4e9a5cf 100644 --- a/src/main/java/mekanism/common/tile/TileEntityChemicalWasher.java +++ b/src/main/java/mekanism/common/tile/TileEntityChemicalWasher.java @@ -71,6 +71,8 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple public double prevEnergy; public final double BASE_ENERGY_USAGE = usage.chemicalWasherUsage; + + public double energyPerTick = BASE_ENERGY_USAGE; public WasherRecipe cachedRecipe; @@ -123,13 +125,13 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple WasherRecipe recipe = getRecipe(); - if(canOperate(recipe) && getEnergy() >= MekanismUtils.getPureEnergyPerTick(this, BASE_ENERGY_USAGE) && MekanismUtils.canFunction(this)) + if(canOperate(recipe) && getEnergy() >= energyPerTick && MekanismUtils.canFunction(this)) { setActive(true); int operations = operate(recipe); - setEnergy(getEnergy() - MekanismUtils.getPureEnergyPerTick(this, BASE_ENERGY_USAGE)*operations); + setEnergy(getEnergy() - energyPerTick*operations); } else { if(prevEnergy >= getEnergy()) @@ -264,7 +266,7 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple { int possibleProcess = (int)Math.pow(2, upgradeComponent.getUpgrades(Upgrade.SPEED)); possibleProcess = Math.min(Math.min(inputTank.getStored(), outputTank.getNeeded()), possibleProcess); - possibleProcess = Math.min((int)(getEnergy()/MekanismUtils.getPureEnergyPerTick(this, BASE_ENERGY_USAGE)), possibleProcess); + possibleProcess = Math.min((int)(getEnergy()/energyPerTick), possibleProcess); return Math.min(fluidTank.getFluidAmount()/WATER_USAGE, possibleProcess); } @@ -636,6 +638,7 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple { case ENERGY: maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY); + energyPerTick = MekanismUtils.getBaseEnergyPerTick(this, BASE_ENERGY_USAGE); default: break; } diff --git a/src/main/java/mekanism/common/tile/TileEntityElectrolyticSeparator.java b/src/main/java/mekanism/common/tile/TileEntityElectrolyticSeparator.java index 2f45e7005..445fe2cbb 100644 --- a/src/main/java/mekanism/common/tile/TileEntityElectrolyticSeparator.java +++ b/src/main/java/mekanism/common/tile/TileEntityElectrolyticSeparator.java @@ -76,6 +76,10 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp /** Type type of gas this block is dumping. */ public GasMode dumpRight = GasMode.IDLE; + + public double BASE_ENERGY_USAGE; + + public double energyPerTick; public boolean isActive = false; @@ -144,13 +148,22 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp SeparatorRecipe recipe = getRecipe(); - if(canOperate(recipe) && getEnergy() >= MekanismUtils.getPureEnergyPerTick(this, recipe.extraEnergy)) + if(canOperate(recipe) && getEnergy() >= energyPerTick) { + boolean update = BASE_ENERGY_USAGE != recipe.energyUsage; + + BASE_ENERGY_USAGE = recipe.energyUsage; + + if(update) + { + recalculateUpgradables(Upgrade.ENERGY); + } + setActive(true); int operations = operate(recipe); - setEnergy(getEnergy() - MekanismUtils.getPureEnergyPerTick(this, recipe.extraEnergy)*operations); + setEnergy(getEnergy() - energyPerTick*operations); } else { setActive(false); @@ -250,7 +263,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp } possibleProcess = Math.min((int)Math.pow(2, upgradeComponent.getUpgrades(Upgrade.SPEED)), possibleProcess); - possibleProcess = Math.min((int)(getEnergy()/MekanismUtils.getPureEnergyPerTick(this, recipe.extraEnergy)), possibleProcess); + possibleProcess = Math.min((int)(getEnergy()/energyPerTick), possibleProcess); return Math.min(fluidTank.getFluidAmount()/recipe.recipeInput.ingredient.amount, possibleProcess); } @@ -734,6 +747,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp { case ENERGY: maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY); + energyPerTick = MekanismUtils.getBaseEnergyPerTick(this, BASE_ENERGY_USAGE); default: break; } diff --git a/src/main/java/mekanism/common/tile/TileEntityRotaryCondensentrator.java b/src/main/java/mekanism/common/tile/TileEntityRotaryCondensentrator.java index 23c8d1d50..ecc67dfff 100644 --- a/src/main/java/mekanism/common/tile/TileEntityRotaryCondensentrator.java +++ b/src/main/java/mekanism/common/tile/TileEntityRotaryCondensentrator.java @@ -67,6 +67,8 @@ public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock imp public final double BASE_ENERGY_USAGE = usage.rotaryCondensentratorUsage; + public double energyPerTick = BASE_ENERGY_USAGE; + public TileComponentUpgrade upgradeComponent = new TileComponentUpgrade(this, 5); /** This machine's current RedstoneControl type. */ @@ -171,14 +173,14 @@ public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock imp } } - if(getEnergy() >= BASE_ENERGY_USAGE && MekanismUtils.canFunction(this) && isValidGas(gasTank.getGas()) && (fluidTank.getFluid() == null || (fluidTank.getFluid().amount < MAX_FLUID && gasEquals(gasTank.getGas(), fluidTank.getFluid())))) + if(getEnergy() >= energyPerTick && MekanismUtils.canFunction(this) && isValidGas(gasTank.getGas()) && (fluidTank.getFluid() == null || (fluidTank.getFluid().amount < MAX_FLUID && gasEquals(gasTank.getGas(), fluidTank.getFluid())))) { int usage = getUpgradedUsage(); setActive(true); fluidTank.fill(new FluidStack(gasTank.getGas().getGas().getFluid(), usage), true); gasTank.draw(usage, true); - setEnergy(getEnergy() - BASE_ENERGY_USAGE*usage); + setEnergy(getEnergy() - energyPerTick*usage); } else { if(prevEnergy >= getEnergy()) @@ -278,14 +280,14 @@ public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock imp } } - if(getEnergy() >= MekanismUtils.getPureEnergyPerTick(this, BASE_ENERGY_USAGE) && MekanismUtils.canFunction(this) && isValidFluid(fluidTank.getFluid()) && (gasTank.getGas() == null || (gasTank.getStored() < MAX_FLUID && gasEquals(gasTank.getGas(), fluidTank.getFluid())))) + if(getEnergy() >= energyPerTick && MekanismUtils.canFunction(this) && isValidFluid(fluidTank.getFluid()) && (gasTank.getGas() == null || (gasTank.getStored() < MAX_FLUID && gasEquals(gasTank.getGas(), fluidTank.getFluid())))) { int operations = getUpgradedUsage(); setActive(true); gasTank.receive(new GasStack(GasRegistry.getGas(fluidTank.getFluid().getFluid()), operations), true); fluidTank.drain(operations, true); - setEnergy(getEnergy() - MekanismUtils.getPureEnergyPerTick(this, BASE_ENERGY_USAGE)*operations); + setEnergy(getEnergy() - energyPerTick*operations); } else { if(prevEnergy >= getEnergy()) @@ -311,7 +313,7 @@ public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock imp possibleProcess = Math.min(Math.min(fluidTank.getFluidAmount(), gasTank.getNeeded()), possibleProcess); } - possibleProcess = Math.min((int)(getEnergy()/MekanismUtils.getPureEnergyPerTick(this, BASE_ENERGY_USAGE)), possibleProcess); + possibleProcess = Math.min((int)(getEnergy()/energyPerTick), possibleProcess); return possibleProcess; } @@ -646,6 +648,7 @@ public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock imp { case ENERGY: maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY); + energyPerTick = MekanismUtils.getBaseEnergyPerTick(this, BASE_ENERGY_USAGE); default: break; } diff --git a/src/main/java/mekanism/common/util/MekanismUtils.java b/src/main/java/mekanism/common/util/MekanismUtils.java index 828bc641d..e075e3371 100644 --- a/src/main/java/mekanism/common/util/MekanismUtils.java +++ b/src/main/java/mekanism/common/util/MekanismUtils.java @@ -599,7 +599,7 @@ public final class MekanismUtils return def * Math.pow(general.maxUpgradeMultiplier, (2*mgmt.getComponent().getUpgrades(Upgrade.SPEED)-(float)mgmt.getComponent().getUpgrades(Upgrade.ENERGY))/(float)Upgrade.ENERGY.getMax()); } - public static double getPureEnergyPerTick(IUpgradeTile mgmt, double def) + public static double getBaseEnergyPerTick(IUpgradeTile mgmt, double def) { return def * Math.pow(general.maxUpgradeMultiplier, -(float)mgmt.getComponent().getUpgrades(Upgrade.ENERGY)/(float)Upgrade.ENERGY.getMax()); }