diff options
author | Techlone <techlone.mc@gmail.com> | 2017-02-11 19:23:57 +0500 |
---|---|---|
committer | Techlone <techlone.mc@gmail.com> | 2017-02-11 19:23:57 +0500 |
commit | 6aa902a946d6bc0fc67856b44fec2d2cc6b44d7b (patch) | |
tree | dc5c70255931cd7849479fd13bd0ae33b00a40d5 /src/main | |
parent | cb4111d405ecaaa0fb81f891cf7006e9f4fd828c (diff) | |
download | GT5-Unofficial-6aa902a946d6bc0fc67856b44fec2d2cc6b44d7b.tar.gz GT5-Unofficial-6aa902a946d6bc0fc67856b44fec2d2cc6b44d7b.tar.bz2 GT5-Unofficial-6aa902a946d6bc0fc67856b44fec2d2cc6b44d7b.zip |
Fix a possible situation when the oil cracking unit applies a both bonuses
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java index c9ccea1bba..4aef1285df 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java @@ -20,6 +20,9 @@ import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBase { + private final FluidStack fluidToDecreaseEu = GT_ModHandler.getSteam(128); + private final FluidStack fluidToIncreaseOutput = Materials.Hydrogen.getGas(64); + public GT_MetaTileEntity_OilCracker(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -66,20 +69,8 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sCrakingRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], new FluidStack[]{tInput}, new ItemStack[]{}); if (tRecipe != null) { if (tRecipe.isRecipeInputEqual(true, new FluidStack[]{tInput}, new ItemStack[]{})) { - boolean steam = false; - boolean hydrogen = false; - for (FluidStack tInput2 : tInputList) { - if (tInput2.getFluid() == GT_ModHandler.getSteam(1).getFluid()) { - steam = true; - tInput2.amount -= 128; - } - if (tInput2.getFluid() == Materials.Hydrogen.mGas) { - hydrogen = true; - steam = false; - tInput2.amount -= 64; - } - - } + boolean needDecreaseEu = depleteInput(fluidToDecreaseEu); + boolean needIncreaseOutput = !needDecreaseEu && depleteInput(fluidToIncreaseOutput); this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; @@ -94,13 +85,13 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa this.mMaxProgresstime /= 2; } } - if (steam) this.mEUt = this.mEUt / 2; + if (needDecreaseEu) this.mEUt = this.mEUt / 2; if (this.mEUt > 0) { this.mEUt = (-this.mEUt); } this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)}; - if (hydrogen) this.mOutputFluids[0].amount = this.mOutputFluids[0].amount * 130 / 100; + if (needIncreaseOutput) this.mOutputFluids[0].amount = this.mOutputFluids[0].amount * 130 / 100; return true; } } |