From b5c956c38335e6fbb3519b88a894975acf0bf419 Mon Sep 17 00:00:00 2001 From: Steelux <70096037+Steelux8@users.noreply.github.com> Date: Mon, 7 Feb 2022 17:48:26 +0000 Subject: Large Boiler Whitelist and NEI Large Boiler Tab Update (#910) * Whitelist for Advanced Boilers - Added a whitelist system to check allowed fuels for the Titanium and Tungstensteel Boilers (thanks glow for the code); - Removed fuel value checks for the advanced boilers, none are needed because the whitelist check does it all; - Changed the boiler tooltip to clarify that the advanced boilers won't work if there is a fuel in the input bus that is not allowed to be burned. * NEI Large Boiler Tab Updated - Changed the burn times to reflect the speed at which the boilers now consume fuels; - Changed the TItanium and Tungstensteel Boiler info to display "Not Allowed" on the fuels that aren't accepted by them. * Re-added Previous Constructor as a Default Case - Implemented the previous addRecipe constructor without the boolean, applying to all non-solid fuels, with a default value; - Changed the boiler code to make the advanced Boilers ignore the fluid recipes (they're only supposed to burn the allowed solid fuels); - Small NEI clarifications. * Unnecessary Burn Time Calculation - Removed the burn time calculation on the NEI handler for the fuels that can't run in the advanced boilers. * Shortened Tungstensteel Boiler Line - Made text shorter to not overflow past the NEI display. * Properly implement solid fuel whitelist for Large Titanium/Tungsten Boilers Co-authored-by: glowredman --- .../multi/GT_MetaTileEntity_LargeBoiler.java | 78 +++++++++++----------- .../GT_MetaTileEntity_LargeBoiler_Titanium.java | 14 ++++ ...T_MetaTileEntity_LargeBoiler_TungstenSteel.java | 14 ++++ 3 files changed, 67 insertions(+), 39 deletions(-) (limited to 'src/main/java/gregtech/common') 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 466ffea8e5..d0636e038a 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 @@ -94,8 +94,8 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_En if (isSuperheated()) { tt.addInfo("Produces " + (getEUt() * 40) * ((runtimeBoost(20) / (20f)) / superToNormalSteam) + "L of Superheated Steam with 1 Coal at " + (getEUt() * 40) / superToNormalSteam + "L/s")//? .addInfo("A programmed circuit in the main block throttles the boiler (-1000L/s per config)") - .addInfo("Solid Fuels with a burn value that is too high or too low will not work") - .addInfo("Coal/Charcoal/Coal Coke and their compressed forms will not work here!"); + .addInfo("Only some solid fuels are allowed (check the NEI Large Boiler tab for details)") + .addInfo("If there are any disallowed fuels in the input bus, the boiler won't run!"); } else { tt.addInfo("Produces " + (getEUt() * 40) * (runtimeBoost(20) / 20f) + "L of Steam with 1 Coal at " + getEUt() * 40 + "L/s")//? @@ -196,53 +196,53 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_En } 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 = adjustBurnTimeForConfig(runtimeBoost(tRecipe.mSpecialValue / 2)); - this.mEUt = adjustEUtForConfig(getEUt()); - this.mEfficiencyIncrease = this.mMaxProgresstime * getEfficiencyIncrease() * 4; - return true; + if (!isSuperheated()) { + 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 = adjustBurnTimeForConfig(runtimeBoost(tRecipe.mSpecialValue / 2)); + this.mEUt = adjustEUtForConfig(getEUt()); + this.mEfficiencyIncrease = this.mMaxProgresstime * getEfficiencyIncrease() * 4; + return true; + } } } - } - for (GT_Recipe tRecipe : GT_Recipe.GT_Recipe_Map.sDenseLiquidFuels.mRecipeList) { - FluidStack tFluid = GT_Utility.getFluidForFilledItem(tRecipe.getRepresentativeInput(0), true); - if (tFluid != null) { - tFluid.amount = 1000; - if (depleteInput(tFluid)) { - this.mMaxProgresstime = adjustBurnTimeForConfig(Math.max(1, runtimeBoost(tRecipe.mSpecialValue * 2))); - this.mEUt = adjustEUtForConfig(getEUt()); - this.mEfficiencyIncrease = this.mMaxProgresstime * getEfficiencyIncrease(); - return true; + for (GT_Recipe tRecipe : GT_Recipe.GT_Recipe_Map.sDenseLiquidFuels.mRecipeList) { + FluidStack tFluid = GT_Utility.getFluidForFilledItem(tRecipe.getRepresentativeInput(0), true); + if (tFluid != null) { + tFluid.amount = 1000; + if (depleteInput(tFluid)) { + this.mMaxProgresstime = adjustBurnTimeForConfig(Math.max(1, runtimeBoost(tRecipe.mSpecialValue * 2))); + this.mEUt = adjustEUtForConfig(getEUt()); + this.mEfficiencyIncrease = this.mMaxProgresstime * getEfficiencyIncrease(); + return true; + } } } } + ArrayList tInputList = getStoredInputs(); if (!tInputList.isEmpty()) { if (isSuperheated()) { for (ItemStack tInput : tInputList) { - // Checking for Solid Super Fuel and Magic Solid Super Fuel with their burn values. This needs to be replaced with a whitelist configurable in the config file. - if (GT_ModHandler.getFuelValue(tInput) == 100000 || GT_ModHandler.getFuelValue(tInput) == 150000) { - if (tInput != GT_OreDictUnificator.get(OrePrefixes.bucket, Materials.Lava, 1)){ - if (GT_Utility.getFluidForFilledItem(tInput, true) == null && (this.mMaxProgresstime = GT_ModHandler.getFuelValue(tInput) / 80) > 0) { - this.excessFuel += GT_ModHandler.getFuelValue(tInput) % 80; - this.mMaxProgresstime += this.excessFuel / 80; - this.excessFuel %= 80; - this.mMaxProgresstime = adjustBurnTimeForConfig(runtimeBoost(this.mMaxProgresstime)); - this.mEUt = adjustEUtForConfig(getEUt()); - this.mEfficiencyIncrease = this.mMaxProgresstime * getEfficiencyIncrease(); - this.mOutputItems = new ItemStack[]{GT_Utility.getContainerItem(tInput, true)}; - tInput.stackSize -= 1; - updateSlots(); - if (this.mEfficiencyIncrease > 5000) { - this.mEfficiencyIncrease = 0; - this.mSuperEfficencyIncrease = 20; - } - return true; + if (tInput != GT_OreDictUnificator.get(OrePrefixes.bucket, Materials.Lava, 1)){ + if (GT_Utility.getFluidForFilledItem(tInput, true) == null && (this.mMaxProgresstime = GT_ModHandler.getFuelValue(tInput) / 80) > 0) { + this.excessFuel += GT_ModHandler.getFuelValue(tInput) % 80; + this.mMaxProgresstime += this.excessFuel / 80; + this.excessFuel %= 80; + this.mMaxProgresstime = adjustBurnTimeForConfig(runtimeBoost(this.mMaxProgresstime)); + this.mEUt = adjustEUtForConfig(getEUt()); + this.mEfficiencyIncrease = this.mMaxProgresstime * getEfficiencyIncrease(); + this.mOutputItems = new ItemStack[]{GT_Utility.getContainerItem(tInput, true)}; + tInput.stackSize -= 1; + updateSlots(); + if (this.mEfficiencyIncrease > 5000) { + this.mEfficiencyIncrease = 0; + this.mSuperEfficencyIncrease = 20; } + return true; } } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Titanium.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Titanium.java index 78b20782d5..b81dab847b 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Titanium.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Titanium.java @@ -4,6 +4,7 @@ import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map_LargeBoilerFakeFuels; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; @@ -90,4 +91,17 @@ public class GT_MetaTileEntity_LargeBoiler_Titanium extends GT_MetaTileEntity_La @Override boolean isSuperheated() { return true; } + + @Override + public boolean checkRecipe(ItemStack aStack) { + for(ItemStack input : getStoredInputs()) { + if(!GT_Recipe_Map_LargeBoilerFakeFuels.isAllowedSolidFuel(input)) { + //if any item is not in ALLOWED_SOLID_FUELS, operation cannot be allowed because it might still be consumed + this.mMaxProgresstime = 0; + this.mEUt = 0; + return false; + } + } + return super.checkRecipe(aStack); + } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_TungstenSteel.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_TungstenSteel.java index 9e53026ff6..75a080c49f 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_TungstenSteel.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_TungstenSteel.java @@ -4,6 +4,7 @@ import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map_LargeBoilerFakeFuels; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; @@ -88,4 +89,17 @@ public class GT_MetaTileEntity_LargeBoiler_TungstenSteel extends GT_MetaTileEnti @Override boolean isSuperheated() { return true; } + + @Override + public boolean checkRecipe(ItemStack aStack) { + for(ItemStack input : getStoredInputs()) { + if(!GT_Recipe_Map_LargeBoilerFakeFuels.isAllowedSolidFuel(input)) { + //if any item is not in ALLOWED_SOLID_FUELS, operation cannot be allowed because it might still be consumed + this.mMaxProgresstime = 0; + this.mEUt = 0; + return false; + } + } + return super.checkRecipe(aStack); + } } -- cgit