From 213d5bb9dfd67c1ce4d72a29b27fc9dda7837544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20G=C3=A4=C3=9Fler?= Date: Fri, 14 Apr 2017 20:03:29 +0200 Subject: [PATCH] Large Boiler fuel burn rate now configurable By placing an integrated circuit in the Large Boiler it is now possible to adjust fuel burn rate and steam output at no change in efficiency. The steam output of a boiler is reduced by 1000L per configuration. --- .../multi/GT_MetaTileEntity_LargeBoiler.java | 42 +++++++++++++++---- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java index 8573de7c..2a60093d 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java @@ -23,6 +23,7 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_MultiBlockBase { private boolean firstRun = true; private int mSuperEfficencyIncrease = 0; + private int integratedCircuitConfig = 0; //Steam output is reduced by 1000L per config public GT_MetaTileEntity_LargeBoiler(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -45,7 +46,7 @@ public abstract class GT_MetaTileEntity_LargeBoiler "1x Output Hatch (Any Casing)", "1x Maintenance Hatch (Any Firebox)", "1x Muffler Hatch (Any Firebox)", - "Refined liquid fuels have 1/4 efficiency"}; + "Diesel fuels have 1/4 efficiency"}; } public abstract Block getCasingBlock(); @@ -88,14 +89,26 @@ public abstract class GT_MetaTileEntity_LargeBoiler } public boolean checkRecipe(ItemStack aStack) { + //Do we have an integrated circuit with a valid configuration? + if (mInventory[1] != null && mInventory[1].getUnlocalizedName().startsWith("gt.integrated_circuit")) { + int circuit_config = mInventory[1].getItemDamage(); + if (circuit_config >= 1 && circuit_config <= 25) { + // If so, overwrite the current config + this.integratedCircuitConfig = circuit_config; + } else { + //If not, set the config to zero + this.integratedCircuitConfig = 0; + } + } + this.mSuperEfficencyIncrease=0; for (GT_Recipe tRecipe : GT_Recipe.GT_Recipe_Map.sDieselFuels.mRecipeList) { FluidStack tFluid = GT_Utility.getFluidForFilledItem(tRecipe.getRepresentativeInput(0), true); if ((tFluid != null) && (tRecipe.mSpecialValue > 1)) { tFluid.amount = 1000; if (depleteInput(tFluid)) { - this.mMaxProgresstime = (runtimeBoost(tRecipe.mSpecialValue / 2)); - this.mEUt = getEUt(); + this.mMaxProgresstime = adjustBurnTimeForConfig(runtimeBoost(tRecipe.mSpecialValue / 2)); + this.mEUt = adjustEUtForConfig(getEUt()); this.mEfficiencyIncrease = (this.mMaxProgresstime * getEfficiencyIncrease() * 4); return true; } @@ -106,8 +119,8 @@ public abstract class GT_MetaTileEntity_LargeBoiler if (tFluid != null) { tFluid.amount = 1000; if (depleteInput(tFluid)) { - this.mMaxProgresstime = Math.max(1, runtimeBoost(tRecipe.mSpecialValue * 2)); - this.mEUt = getEUt(); + this.mMaxProgresstime = adjustBurnTimeForConfig(Math.max(1, runtimeBoost(tRecipe.mSpecialValue * 2))); + this.mEUt = adjustEUtForConfig(getEUt()); this.mEfficiencyIncrease = (this.mMaxProgresstime * getEfficiencyIncrease()); return true; } @@ -117,7 +130,8 @@ public abstract class GT_MetaTileEntity_LargeBoiler if (!tInputList.isEmpty()) { for (ItemStack tInput : tInputList) { if ((GT_Utility.getFluidForFilledItem(tInput, true) == null) && ((this.mMaxProgresstime = runtimeBoost(GT_ModHandler.getFuelValue(tInput) / 80)) > 0)) { - this.mEUt = getEUt(); + this.mMaxProgresstime = adjustBurnTimeForConfig(this.mMaxProgresstime); + this.mEUt = adjustEUtForConfig(getEUt()); this.mEfficiencyIncrease = (this.mMaxProgresstime * getEfficiencyIncrease()); this.mOutputItems = new ItemStack[]{GT_Utility.getContainerItem(tInput, true)}; tInput.stackSize -= 1; @@ -155,12 +169,11 @@ public abstract class GT_MetaTileEntity_LargeBoiler public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (mProgresstime > 0 && firstRun) { firstRun = false; - GT_Mod.instance.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "extremepressure"); + GT_Mod.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "extremepressure"); } super.onPostTick(aBaseMetaTileEntity, aTick); } - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; @@ -236,4 +249,17 @@ public abstract class GT_MetaTileEntity_LargeBoiler public boolean explodesOnComponentBreak(ItemStack aStack) { return false; } + + private int adjustEUtForConfig(int rawEUt){ + int adjustedSteamOutput = rawEUt - 25 * integratedCircuitConfig; + return Math.max(adjustedSteamOutput, 25); + } + + private int adjustBurnTimeForConfig(int rawBurnTime){ + if(mEfficiency < 10000){ + return rawBurnTime; + } + int adjustedEUt = Math.max(25, getEUt() - 25 * integratedCircuitConfig); + return rawBurnTime * getEUt() / adjustedEUt; + } } \ No newline at end of file