From 86611ed73600a77cfd01cc497ec04311bfe503a5 Mon Sep 17 00:00:00 2001 From: Julia Dijkstra <julia.dijkstra@technolution.nl> Date: Mon, 6 Jan 2025 23:47:22 +0100 Subject: [PATCH 1/5] Apply correct EU modifier for calculating parallels in the Volcanus. --- .../multi/processing/advanced/MTEAdvEBF.java | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvEBF.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvEBF.java index 71f84c4ea29..cbd7b1113e9 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvEBF.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvEBF.java @@ -46,10 +46,7 @@ import gregtech.api.recipe.RecipeMaps; import gregtech.api.recipe.check.CheckRecipeResult; import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.util.GTRecipe; -import gregtech.api.util.GTUtility; -import gregtech.api.util.MultiblockTooltipBuilder; -import gregtech.api.util.OverclockCalculator; +import gregtech.api.util.*; import gregtech.api.util.shutdown.ShutDownReasonRegistry; import gregtech.common.pollution.PollutionConfig; import gtPlusPlus.core.block.ModBlocks; @@ -254,6 +251,25 @@ protected OverclockCalculator createOverclockCalculator(@NotNull GTRecipe recipe .setRecipeHeat(recipe.mSpecialValue) .setMachineHeat((int) getCoilLevel().getHeat()); } + + @NotNull + @Override + protected ParallelHelper createParallelHelper(@NotNull GTRecipe recipe) { + return new ParallelHelper().setRecipe(recipe) + .setItemInputs(inputItems) + .setFluidInputs(inputFluids) + .setAvailableEUt(availableVoltage * availableAmperage) + .setMachine(machine, protectItems, protectFluids) + .setRecipeLocked(recipeLockableMachine, isRecipeLocked) + .setMaxParallel(maxParallel) + .setEUtModifier( + euModifier + * Math.pow(0.95F, Math.floor((getCoilLevel().getHeat() - recipe.mSpecialValue) / 900F))) + .enableBatchMode(batchSize) + .setConsumption(true) + .setOutputCalculation(true); + } + }.setSpeedBonus(1F / 2.2F) .setEuModifier(0.9F) .setMaxParallelSupplier(this::getMaxParallelRecipes); From 21aa12033578e3b538132afd03eeb69726503c90 Mon Sep 17 00:00:00 2001 From: Julia Dijkstra <julia.dijkstra@technolution.nl> Date: Tue, 7 Jan 2025 00:15:54 +0100 Subject: [PATCH 2/5] Remove star imports. --- .../machines/multi/processing/advanced/MTEAdvEBF.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvEBF.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvEBF.java index cbd7b1113e9..d1281139928 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvEBF.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvEBF.java @@ -46,7 +46,11 @@ import gregtech.api.recipe.RecipeMaps; import gregtech.api.recipe.check.CheckRecipeResult; import gregtech.api.recipe.check.CheckRecipeResultRegistry; -import gregtech.api.util.*; +import gregtech.api.util.GTRecipe; +import gregtech.api.util.GTUtility; +import gregtech.api.util.MultiblockTooltipBuilder; +import gregtech.api.util.OverclockCalculator; +import gregtech.api.util.ParallelHelper; import gregtech.api.util.shutdown.ShutDownReasonRegistry; import gregtech.common.pollution.PollutionConfig; import gtPlusPlus.core.block.ModBlocks; From 671a1312584f071063dde21219bda5928ea03bf6 Mon Sep 17 00:00:00 2001 From: Julia Dijkstra <julia.dijkstra@technolution.nl> Date: Wed, 29 Jan 2025 08:28:27 +0100 Subject: [PATCH 3/5] Start rework of `ProcessingLogic` --- .../gregtech/test/GTParallelHelperTest.java | 25 +- .../common/tileentities/multis/MTEBioVat.java | 6 +- .../multis/mega/MTEMegaBlastFurnace.java | 16 +- .../multis/mega/MTEMegaVacuumFreezer.java | 28 +- .../base/MTELargeFusionComputer.java | 6 +- .../api/logic/AbstractProcessingLogic.java | 34 +- .../api/logic/MuTEProcessingLogic.java | 13 +- .../gregtech/api/logic/ProcessingLogic.java | 47 +-- .../implementations/MTEMultiBlockBase.java | 8 +- ...allelHelper.java => ProcessingHelper.java} | 292 +++++++++--------- .../gregtech/api/util/ProcessingResult.java | 30 ++ .../machines/multi/MTEAssemblyLine.java | 4 +- .../multi/MTEElectricBlastFurnace.java | 15 +- .../machines/multi/MTEFusionComputer.java | 6 +- .../machines/multi/MTEPCBFactory.java | 6 +- .../machines/multi/MTEPlasmaForge.java | 11 +- .../processing/MTEIndustrialAlloySmelter.java | 14 +- .../processing/MTEIndustrialDehydrator.java | 16 +- .../multi/processing/MTESpargeTower.java | 6 +- .../multi/processing/advanced/MTEAdvEBF.java | 34 +- .../production/MTEIndustrialFishingPond.java | 10 +- .../MTEQuantumForceTransformer.java | 12 +- .../multi/production/MTEThermalBoiler.java | 6 +- .../metaTileEntity/multi/MTEEyeOfHarmony.java | 2 +- .../multi/godforge/MTEMoltenModule.java | 6 +- .../multi/godforge/MTESmeltingModule.java | 8 +- 26 files changed, 326 insertions(+), 335 deletions(-) rename src/main/java/gregtech/api/util/{ParallelHelper.java => ProcessingHelper.java} (72%) create mode 100644 src/main/java/gregtech/api/util/ProcessingResult.java diff --git a/src/functionalTest/java/gregtech/test/GTParallelHelperTest.java b/src/functionalTest/java/gregtech/test/GTParallelHelperTest.java index a0242627f9d..f2821de6177 100644 --- a/src/functionalTest/java/gregtech/test/GTParallelHelperTest.java +++ b/src/functionalTest/java/gregtech/test/GTParallelHelperTest.java @@ -13,7 +13,7 @@ import gregtech.api.enums.TierEU; import gregtech.api.util.GTRecipe; import gregtech.api.util.GTUtility; -import gregtech.api.util.ParallelHelper; +import gregtech.api.util.ProcessingHelper; import gregtech.test.mock.MockIVoidableMachine; public class GTParallelHelperTest { @@ -46,10 +46,10 @@ static void setup() { @Test void OutputsIntegerOverflow() { - ParallelHelper helper = new ParallelHelper().setRecipe(rubberRecipe) + ProcessingHelper helper = new ProcessingHelper().setRecipe(rubberRecipe) .setMachine(machine, false, false) .setItemInputs(inputItems) - .setMaxParallel(4_000_000) + .setMaxParallels(4_000_000) .setAvailableEUt(4_000_000) .setOutputCalculation(true) .setConsumption(false); @@ -64,22 +64,23 @@ void OutputsIntegerOverflow() { @Test void parallelIntegerOverflow() { // Without batch mode - ParallelHelper helperWithoutBatchMode = new ParallelHelper().setRecipe(rubberRecipe) + ProcessingHelper helperWithoutBatchMode = new ProcessingHelper().setRecipe(rubberRecipe) .setMachine(machine, false, false) .setItemInputs(inputItems) - .setMaxParallel(Integer.MAX_VALUE) + .setMaxParallels(Integer.MAX_VALUE) .setAvailableEUt(TierEU.MAX * 16) .setConsumption(false) .build(); assertEquals(Integer.MAX_VALUE, helperWithoutBatchMode.getCurrentParallel()); // With batch mode - ParallelHelper helperWithBatchMode = new ParallelHelper().setRecipe(rubberRecipe) + ProcessingHelper helperWithBatchMode = new ProcessingHelper().setRecipe(rubberRecipe) .setMachine(machine, false, false) .setItemInputs(inputItems) - .setMaxParallel(Integer.MAX_VALUE / 50) + .setMaxParallels(Integer.MAX_VALUE / 50) .setAvailableEUt(TierEU.MAX * 16) - .enableBatchMode(128) + .setBatchMode(true) + .setBatchModifier(128) .setConsumption(false) .build(); assertEquals(Integer.MAX_VALUE, helperWithBatchMode.getCurrentParallel()); @@ -87,10 +88,10 @@ void parallelIntegerOverflow() { @Test void chanceMultiplier() { - ParallelHelper helper = new ParallelHelper().setRecipe(rubberRecipe) + ProcessingHelper helper = new ProcessingHelper().setRecipe(rubberRecipe) .setMachine(machine, false, false) .setItemInputs(inputItems) - .setMaxParallel(10) + .setMaxParallels(10) .setAvailableEUt(10) .setConsumption(false) .setOutputCalculation(true) @@ -106,10 +107,10 @@ void chanceMultiplier() { @Test void outputMultiplier() { - ParallelHelper helper = new ParallelHelper().setRecipe(rubberRecipe) + ProcessingHelper helper = new ProcessingHelper().setRecipe(rubberRecipe) .setMachine(machine, false, false) .setItemInputs(inputItems) - .setMaxParallel(1) + .setMaxParallels(1) .setAvailableEUt(1) .setConsumption(false) .setOutputCalculation(true) diff --git a/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java b/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java index f65b9d61bfc..58f242bc0e5 100644 --- a/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java +++ b/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java @@ -83,7 +83,7 @@ import gregtech.api.util.GTRecipe; import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; -import gregtech.api.util.ParallelHelper; +import gregtech.api.util.ProcessingHelper; public class MTEBioVat extends MTEEnhancedMultiBlockBase<MTEBioVat> implements ISurvivalConstructable { @@ -266,8 +266,8 @@ protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { @NotNull @Override - protected ParallelHelper createParallelHelper(@NotNull GTRecipe recipe) { - return super.createParallelHelper(recipeWithMultiplier(recipe, inputFluids)); + protected ProcessingHelper createProcessingHelper(@NotNull GTRecipe recipe) { + return super.createProcessingHelper(recipeWithMultiplier(recipe, inputFluids)); } }; } diff --git a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaBlastFurnace.java b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaBlastFurnace.java index 9cd6053a364..2ed6940d54c 100644 --- a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaBlastFurnace.java +++ b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaBlastFurnace.java @@ -67,7 +67,6 @@ import gregtech.api.util.GTRecipe; import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; -import gregtech.api.util.OverclockCalculator; import gregtech.common.pollution.PollutionConfig; public class MTEMegaBlastFurnace extends MegaMultiBlockBase<MTEMegaBlastFurnace> implements ISurvivalConstructable { @@ -299,22 +298,17 @@ protected String[] getExtendedInfoData() { protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic() { - @Nonnull - @Override - protected OverclockCalculator createOverclockCalculator(@Nonnull GTRecipe recipe) { - return super.createOverclockCalculator(recipe).setRecipeHeat(recipe.mSpecialValue) - .setMachineHeat(MTEMegaBlastFurnace.this.mHeatingCapacity) - .setHeatOC(true) - .setHeatDiscount(true); - } - @Override protected @Nonnull CheckRecipeResult validateRecipe(@Nonnull GTRecipe recipe) { return recipe.mSpecialValue <= MTEMegaBlastFurnace.this.mHeatingCapacity ? CheckRecipeResultRegistry.SUCCESSFUL : CheckRecipeResultRegistry.insufficientHeat(recipe.mSpecialValue); } - }.setMaxParallel(Configuration.Multiblocks.megaMachinesMax); + }.setHeatOC(true) + .setHeatDiscount(true) + .setHeatDiscountMultiplier(0.95) + .setMachineHeat(MTEMegaBlastFurnace.this.mHeatingCapacity) + .setMaxParallel(Configuration.Multiblocks.megaMachinesMax); } @Override diff --git a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaVacuumFreezer.java b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaVacuumFreezer.java index c9138789363..a4f8439c2bc 100644 --- a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaVacuumFreezer.java +++ b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaVacuumFreezer.java @@ -29,8 +29,6 @@ import java.util.Arrays; import java.util.Optional; -import javax.annotation.Nonnull; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; @@ -60,10 +58,8 @@ import gregtech.api.recipe.RecipeMap; import gregtech.api.recipe.RecipeMaps; import gregtech.api.render.TextureFactory; -import gregtech.api.util.GTRecipe; import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; -import gregtech.api.util.OverclockCalculator; import gregtech.api.util.shutdown.ShutDownReasonRegistry; import gregtech.common.blocks.BlockCasingsAbstract; @@ -409,24 +405,12 @@ public SubspaceCoolingFluid findSubspaceCoolingFluid() { @Override protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic() { - - @Nonnull - @Override - protected OverclockCalculator createOverclockCalculator(@Nonnull GTRecipe recipe) { - // Check if the freezer is T2 - if (mTier == 1) return super.createOverclockCalculator(recipe); - - // First try to detect the current fluid used for subspace cooling. - currentCoolingFluid = findSubspaceCoolingFluid(); - - return super.createOverclockCalculator(recipe) - .setMachineHeat(currentCoolingFluid == null ? 0 : currentCoolingFluid.perfectOverclocks * 1800) - .setRecipeHeat(0) - .setHeatOC(true) - .setHeatDiscount(false); - } - }.setMaxParallel(Configuration.Multiblocks.megaMachinesMax); + currentCoolingFluid = findSubspaceCoolingFluid(); + + return new ProcessingLogic().setHeatOC(true) + .setHeatDiscount(false) + .setMachineHeat(currentCoolingFluid == null ? 0 : currentCoolingFluid.perfectOverclocks * 1800) + .setMaxParallel(Configuration.Multiblocks.megaMachinesMax); } @Override diff --git a/src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeFusionComputer.java b/src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeFusionComputer.java index c6c54e448a8..3d52f406775 100644 --- a/src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeFusionComputer.java +++ b/src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeFusionComputer.java @@ -62,7 +62,7 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.HatchElementBuilder; import gregtech.api.util.OverclockCalculator; -import gregtech.api.util.ParallelHelper; +import gregtech.api.util.ProcessingHelper; import gregtech.api.util.shutdown.ShutDownReasonRegistry; import gregtech.common.tileentities.machines.IDualInputHatch; import gregtech.common.tileentities.machines.multi.drone.MTEHatchDroneDownLink; @@ -424,9 +424,9 @@ protected ProcessingLogic createProcessingLogic() { @NotNull @Override - protected ParallelHelper createParallelHelper(@NotNull GTRecipe recipe) { + protected ProcessingHelper createProcessingHelper(@NotNull GTRecipe recipe) { // When the fusion first loads and is still processing, it does the recipe check without consuming. - return super.createParallelHelper(recipe).setConsumption(!mRunningOnLoad); + return super.createProcessingHelper(recipe).setConsumption(!mRunningOnLoad); } @NotNull diff --git a/src/main/java/gregtech/api/logic/AbstractProcessingLogic.java b/src/main/java/gregtech/api/logic/AbstractProcessingLogic.java index 57fbf227006..c6d101a5b6d 100644 --- a/src/main/java/gregtech/api/logic/AbstractProcessingLogic.java +++ b/src/main/java/gregtech/api/logic/AbstractProcessingLogic.java @@ -13,7 +13,8 @@ import gregtech.api.recipe.check.CheckRecipeResultRegistry; import gregtech.api.util.GTRecipe; import gregtech.api.util.OverclockCalculator; -import gregtech.api.util.ParallelHelper; +import gregtech.api.util.ProcessingHelper; +import gregtech.api.util.ProcessingResult; /** * Logic class to calculate result of recipe check from inputs. @@ -44,6 +45,12 @@ public abstract class AbstractProcessingLogic<P extends AbstractProcessingLogic< protected boolean amperageOC = true; protected boolean isCleanroom; + // Heat related parameters + protected boolean heatOC; + protected boolean heatDiscount; + protected double heatDiscountMultiplier; + protected int machineHeat; + // #region Setters /** @@ -180,6 +187,26 @@ public P setAmperageOC(boolean amperageOC) { return getThis(); } + public P setHeatOC(boolean heatOC) { + this.heatOC = heatOC; + return getThis(); + } + + public P setHeatDiscount(boolean heatDiscount) { + this.heatDiscount = heatDiscount; + return getThis(); + } + + public P setHeatDiscountMultiplier(double heatDiscountMultiplier) { + this.heatDiscountMultiplier = heatDiscountMultiplier; + return getThis(); + } + + public P setMachineHeat(int machineHeat) { + this.machineHeat = machineHeat; + return getThis(); + } + /** * Clears calculated results (and provided machine inputs) to prepare for the next machine operation. */ @@ -229,8 +256,7 @@ protected RecipeMap<?> preProcess() { * At this point, inputs have been already consumed. */ @Nonnull - protected CheckRecipeResult applyRecipe(@Nonnull GTRecipe recipe, @Nonnull ParallelHelper helper, - @Nonnull OverclockCalculator calculator, @Nonnull CheckRecipeResult result) { + protected CheckRecipeResult applyRecipe(@Nonnull GTRecipe recipe, @Nonnull ProcessingResult result) { if (recipe.mCanBeBuffered) { lastRecipe = recipe; } else { @@ -267,7 +293,7 @@ protected CheckRecipeResult applyRecipe(@Nonnull GTRecipe recipe, @Nonnull Paral /** * Override to tweak final duration that will be set as a result of this logic class. */ - protected double calculateDuration(@Nonnull GTRecipe recipe, @Nonnull ParallelHelper helper, + protected double calculateDuration(@Nonnull GTRecipe recipe, @Nonnull ProcessingHelper helper, @Nonnull OverclockCalculator calculator) { return calculator.getDuration() * helper.getDurationMultiplierDouble(); } diff --git a/src/main/java/gregtech/api/logic/MuTEProcessingLogic.java b/src/main/java/gregtech/api/logic/MuTEProcessingLogic.java index 0d6bf4cac95..20edb832768 100644 --- a/src/main/java/gregtech/api/logic/MuTEProcessingLogic.java +++ b/src/main/java/gregtech/api/logic/MuTEProcessingLogic.java @@ -27,7 +27,7 @@ import gregtech.api.util.GTRecipe; import gregtech.api.util.GTUtility; import gregtech.api.util.OverclockCalculator; -import gregtech.api.util.ParallelHelper; +import gregtech.api.util.ProcessingHelper; /** * Processing logic class, dedicated for MultiTileEntities. @@ -86,7 +86,7 @@ protected CheckRecipeResult processRecipe(@Nonnull List<GTRecipe> recipes, @Nonn CheckRecipeResult result = CheckRecipeResultRegistry.INTERNAL_ERROR; for (GTRecipe recipe : recipes) { Objects.requireNonNull(recipe); - ParallelHelper helper = createParallelHelper(recipe, itemInput, fluidInput); + ProcessingHelper helper = createParallelHelper(recipe, itemInput, fluidInput); OverclockCalculator calculator = createOverclockCalculator(recipe); helper.setCalculator(calculator); helper.build(); @@ -112,15 +112,16 @@ protected Object findRecipe(@Nullable RecipeMap<?> map, @Nonnull ItemInventoryLo } @Nonnull - protected ParallelHelper createParallelHelper(@Nonnull GTRecipe recipe, @Nonnull ItemInventoryLogic itemInput, + protected ProcessingHelper createParallelHelper(@Nonnull GTRecipe recipe, @Nonnull ItemInventoryLogic itemInput, @Nonnull FluidInventoryLogic fluidInput) { - return new ParallelHelper().setRecipe(recipe) + return new ProcessingHelper().setRecipe(recipe) .setItemInputInventory(itemInput) .setFluidInputInventory(fluidInput) .setAvailableEUt(availableVoltage * availableAmperage) - .setMaxParallel(maxParallel) + .setMaxParallels(maxParallel) .setEUtModifier(euModifier) - .enableBatchMode(batchSize) + .setBatchMode(batchSize > 1) + .setBatchModifier(batchSize) .setConsumption(true) .setOutputCalculation(true) .setMuTEMode(true); diff --git a/src/main/java/gregtech/api/logic/ProcessingLogic.java b/src/main/java/gregtech/api/logic/ProcessingLogic.java index 63c8f6494e4..ffc787ac78d 100644 --- a/src/main/java/gregtech/api/logic/ProcessingLogic.java +++ b/src/main/java/gregtech/api/logic/ProcessingLogic.java @@ -15,8 +15,8 @@ import gregtech.api.recipe.check.CheckRecipeResultRegistry; import gregtech.api.recipe.check.SingleRecipeCheck; import gregtech.api.util.GTRecipe; -import gregtech.api.util.OverclockCalculator; -import gregtech.api.util.ParallelHelper; +import gregtech.api.util.ProcessingHelper; +import gregtech.api.util.ProcessingResult; /** * Logic class to calculate result of recipe check from inputs, based on recipemap. @@ -144,22 +144,18 @@ public CheckRecipeResult process() { */ @Nonnull private CalculationResult validateAndCalculateRecipe(@Nonnull GTRecipe recipe) { - CheckRecipeResult result = validateRecipe(recipe); - if (!result.wasSuccessful()) { - return CalculationResult.ofFailure(result); + CheckRecipeResult validationResult = validateRecipe(recipe); + if (!validationResult.wasSuccessful()) { + return CalculationResult.ofFailure(validationResult); } - ParallelHelper helper = createParallelHelper(recipe); - OverclockCalculator calculator = createOverclockCalculator(recipe); - helper.setCalculator(calculator); - helper.build(); + ProcessingResult processingResult = createProcessingHelper(recipe).process(); - if (!helper.getResult() - .wasSuccessful()) { - return CalculationResult.ofFailure(helper.getResult()); + if (!processingResult.wasSuccessful()) { + return CalculationResult.ofFailure(processingResult.getResult()); } - return CalculationResult.ofSuccess(applyRecipe(recipe, helper, calculator, result)); + return CalculationResult.ofSuccess(applyRecipe(recipe, processingResult)); } /** @@ -186,16 +182,21 @@ protected Stream<GTRecipe> findRecipeMatches(@Nullable RecipeMap<?> map) { * Override to tweak parallel logic if needed. */ @Nonnull - protected ParallelHelper createParallelHelper(@Nonnull GTRecipe recipe) { - return new ParallelHelper().setRecipe(recipe) - .setItemInputs(inputItems) - .setFluidInputs(inputFluids) - .setAvailableEUt(availableVoltage * availableAmperage) - .setMachine(machine, protectItems, protectFluids) - .setRecipeLocked(recipeLockableMachine, isRecipeLocked) - .setMaxParallel(maxParallel) - .setEUtModifier(euModifier) - .enableBatchMode(batchSize) + protected ProcessingHelper createProcessingHelper(@Nonnull GTRecipe recipe) { + return new ProcessingHelper().setRecipe(recipe) + .setItemInputs(this.inputItems) + .setFluidInputs(this.inputFluids) + .setAvailableEUt(this.availableVoltage * this.availableAmperage) + .setMachine(this.machine, this.protectItems, this.protectFluids) + .setRecipeLocked(this.recipeLockableMachine, this.isRecipeLocked) + .setMaxParallels(this.maxParallel) + .setEUtModifier(this.euModifier) + .setBatchMode(this.batchSize > 1) + .setBatchModifier(this.batchSize) + .setHeatOC(this.heatOC) + .setHeatDiscount(this.heatDiscount) + .setHeatDiscountMultiplier(this.heatDiscountMultiplier) + .setMachineHeat(this.machineHeat) .setConsumption(true) .setOutputCalculation(true); } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java index 611e4bd36aa..e06df7dd675 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java @@ -93,7 +93,7 @@ import gregtech.api.util.GTWaila; import gregtech.api.util.OutputHatchWrapper; import gregtech.api.util.OverclockCalculator; -import gregtech.api.util.ParallelHelper; +import gregtech.api.util.ProcessingHelper; import gregtech.api.util.VoidProtectionHelper; import gregtech.api.util.shutdown.ShutDownReason; import gregtech.api.util.shutdown.ShutDownReasonRegistry; @@ -1007,7 +1007,7 @@ protected int getMaxBatchSize() { /** * Gets the pollution this Device outputs to a Muffler per tick (10000 = one Pullution Block) - * + * * @param aStack what is in controller */ public int getPollutionPerTick(ItemStack aStack) { @@ -1019,7 +1019,7 @@ public int getPollutionPerTick(ItemStack aStack) { * the code of the multiblock. * * This returns the unmodified raw pollution value, not the one after muffler discounts. - * + * * @param aStack what is in controller */ public int getPollutionPerSecond(ItemStack aStack) { @@ -2173,7 +2173,7 @@ public boolean checkExoticAndNormalEnergyHatches() { * If void protection is enabled, it also checks for {@link #protectsExcessItem()} and * {@link #protectsExcessFluid()}, so you don't need to call them along with this method. * <p> - * If you're using {@link ParallelHelper}, it will handle void protection and return 0 parallel + * If you're using {@link ProcessingHelper}, it will handle void protection and return 0 parallel * if all the output cannot be dumped into buses / hatches. In that case you won't use this method. */ protected boolean canOutputAll(@Nonnull GTRecipe recipe) { diff --git a/src/main/java/gregtech/api/util/ParallelHelper.java b/src/main/java/gregtech/api/util/ProcessingHelper.java similarity index 72% rename from src/main/java/gregtech/api/util/ParallelHelper.java rename to src/main/java/gregtech/api/util/ProcessingHelper.java index de08a594721..29008b4d8ae 100644 --- a/src/main/java/gregtech/api/util/ParallelHelper.java +++ b/src/main/java/gregtech/api/util/ProcessingHelper.java @@ -22,7 +22,7 @@ import gregtech.api.recipe.check.SingleRecipeCheck; @SuppressWarnings({ "unused", "UnusedReturnValue" }) -public class ParallelHelper { +public class ProcessingHelper { private static final double MAX_BATCH_MODE_TICK_TIME = 128; /** @@ -52,7 +52,7 @@ public class ParallelHelper { /** * The maximum possible parallel possible for the multiblock */ - private int maxParallel = 1; + private int maxParallels = 1; /** * The Batch Modifier applied when batch mode is enabled. 1 does nothing. 2 doubles max possible * parallel, but also duration @@ -130,6 +130,22 @@ public class ParallelHelper { * Multiplier by which the output will be multiplied */ private int outputMultiplier = 1; + /** + * Are perfect heat overclocks enabled? + */ + private boolean heatOC; + /** + * Are heat discounts enabled? + */ + private boolean heatDiscount; + /** + * Energy discount if heatDiscount is used. Applied for every 900 degrees above the recipe requirement. + */ + private double heatDiscountMultiplier; + /** + * Heat of the machine used for processing. + */ + private int machineHeat; /** * Method for calculating max parallel from given inputs. */ @@ -139,10 +155,6 @@ public class ParallelHelper { */ private InputConsumer inputConsumer = GTRecipe::consumeInput; - /** - * Calculator to use for overclocking - */ - private OverclockCalculator calculator; @Nonnull private CheckRecipeResult result = CheckRecipeResultRegistry.NONE; @@ -150,19 +162,13 @@ public class ParallelHelper { private Function<Integer, FluidStack[]> customFluidOutputCalculation; - /** - * MuTE Mode this is a mode for changing how the GT_ParallelHelper works as Mutes don't use ItemStack and FluidStack - * arrays for inputs - */ - private boolean muteMode = false; - - public ParallelHelper() {} + public ProcessingHelper() {} /** * Sets machine, with current configuration for void protection mode. */ @Nonnull - public ParallelHelper setMachine(IVoidable machine) { + public ProcessingHelper setMachine(IVoidable machine) { return setMachine(machine, machine.protectsExcessItem(), machine.protectsExcessFluid()); } @@ -170,7 +176,7 @@ public ParallelHelper setMachine(IVoidable machine) { * Sets machine, with void protection mode forcibly. */ @Nonnull - public ParallelHelper setMachine(IVoidable machine, boolean protectExcessItem, boolean protectExcessFluid) { + public ProcessingHelper setMachine(IVoidable machine, boolean protectExcessItem, boolean protectExcessFluid) { this.protectExcessItem = protectExcessItem; this.protectExcessFluid = protectExcessFluid; this.machine = machine; @@ -181,13 +187,13 @@ public ParallelHelper setMachine(IVoidable machine, boolean protectExcessItem, b * Sets the recipe, which will be used for the parallel calculation */ @Nonnull - public ParallelHelper setRecipe(@Nonnull GTRecipe aRecipe) { + public ProcessingHelper setRecipe(@Nonnull GTRecipe aRecipe) { recipe = Objects.requireNonNull(aRecipe); return this; } @Nonnull - public ParallelHelper setRecipeLocked(IRecipeLockable singleRecipeMachine, boolean isRecipeLocked) { + public ProcessingHelper setRecipeLocked(IRecipeLockable singleRecipeMachine, boolean isRecipeLocked) { this.singleRecipeMachine = singleRecipeMachine; this.isRecipeLocked = isRecipeLocked; return this; @@ -197,7 +203,7 @@ public ParallelHelper setRecipeLocked(IRecipeLockable singleRecipeMachine, boole * Sets the items available for the recipe check */ @Nonnull - public ParallelHelper setItemInputs(ItemStack... aItemInputs) { + public ProcessingHelper setItemInputs(ItemStack... aItemInputs) { this.itemInputs = aItemInputs; return this; } @@ -206,7 +212,7 @@ public ParallelHelper setItemInputs(ItemStack... aItemInputs) { * Sets the fluid inputs available for the recipe check */ @Nonnull - public ParallelHelper setFluidInputs(FluidStack... aFluidInputs) { + public ProcessingHelper setFluidInputs(FluidStack... aFluidInputs) { this.fluidInputs = aFluidInputs; return this; } @@ -215,7 +221,7 @@ public ParallelHelper setFluidInputs(FluidStack... aFluidInputs) { * Sets the available eut when trying for more parallels */ @Nonnull - public ParallelHelper setAvailableEUt(long aAvailableEUt) { + public ProcessingHelper setAvailableEUt(long aAvailableEUt) { this.availableEUt = aAvailableEUt; return this; } @@ -224,7 +230,7 @@ public ParallelHelper setAvailableEUt(long aAvailableEUt) { * Sets the modifier for recipe eut. 1 does nothing 0.9 is 10% less. 1.1 is 10% more */ @Nonnull - public ParallelHelper setEUtModifier(double aEUtModifier) { + public ProcessingHelper setEUtModifier(double aEUtModifier) { this.eutModifier = aEUtModifier; return this; } @@ -234,7 +240,7 @@ public ParallelHelper setEUtModifier(double aEUtModifier) { * Only useful for item outputs for sure. */ @Nonnull - public ParallelHelper setChanceMultiplier(double chanceMultiplier) { + public ProcessingHelper setChanceMultiplier(double chanceMultiplier) { this.chanceMultiplier = chanceMultiplier; return this; } @@ -243,24 +249,18 @@ public ParallelHelper setChanceMultiplier(double chanceMultiplier) { * Sets the item/fluid output multiplier. 1 does nothing. 2 doubles the item and fluid outputs. */ @Nonnull - public ParallelHelper setOutputMultiplier(int outputMultiplier) { + public ProcessingHelper setOutputMultiplier(int outputMultiplier) { this.outputMultiplier = outputMultiplier; return this; } - @Nonnull - public ParallelHelper setCalculator(OverclockCalculator calculator) { - this.calculator = calculator; - return this; - } - /** * Set if we should consume inputs or not when trying for parallels * * @param consume Should we consume inputs */ @Nonnull - public ParallelHelper setConsumption(boolean consume) { + public ProcessingHelper setConsumption(boolean consume) { this.consume = consume; return this; } @@ -269,18 +269,27 @@ public ParallelHelper setConsumption(boolean consume) { * Sets the MaxParallel a multi can handle */ @Nonnull - public ParallelHelper setMaxParallel(int maxParallel) { - this.maxParallel = maxParallel; + public ProcessingHelper setMaxParallels(int maxParallels) { + this.maxParallels = maxParallels; return this; } /** - * Enables Batch mode. Can do up to an additional processed recipes of mCurrentParallel * mBatchModifier A batch - * modifier of 1 does nothing + * Enables Batch mode, allowing additional recipes to be processed in parallel + * with proportionally increased processing time. Processes up to mCurrentParallel * BatchModifier recipes. */ @Nonnull - public ParallelHelper enableBatchMode(int batchModifier) { - this.batchMode = batchModifier > 1; + public ProcessingHelper setBatchMode(boolean batchMode) { + this.batchMode = batchMode; + return this; + } + + /** + * Sets the batch modifier, which determines how many additional recipes + * can be processed in parallel when Batch Mode is enabled. + **/ + @Nonnull + public ProcessingHelper setBatchModifier(int batchModifier) { this.batchModifier = batchModifier; return this; } @@ -291,7 +300,7 @@ public ParallelHelper enableBatchMode(int batchModifier) { * @param calculateOutputs Should we calculate outputs with the helper or not */ @Nonnull - public ParallelHelper setOutputCalculation(boolean calculateOutputs) { + public ProcessingHelper setOutputCalculation(boolean calculateOutputs) { this.calculateOutputs = calculateOutputs; return this; } @@ -301,7 +310,7 @@ public ParallelHelper setOutputCalculation(boolean calculateOutputs) { * array */ @Nonnull - public ParallelHelper setCustomItemOutputCalculation(Function<Integer, ItemStack[]> custom) { + public ProcessingHelper setCustomItemOutputCalculation(Function<Integer, ItemStack[]> custom) { customItemOutputCalculation = custom; return this; } @@ -311,25 +320,19 @@ public ParallelHelper setCustomItemOutputCalculation(Function<Integer, ItemStack * array */ @Nonnull - public ParallelHelper setCustomFluidOutputCalculation(Function<Integer, FluidStack[]> custom) { + public ProcessingHelper setCustomFluidOutputCalculation(Function<Integer, FluidStack[]> custom) { customFluidOutputCalculation = custom; return this; } @Nonnull - public ParallelHelper setMuTEMode(boolean muteMode) { - this.muteMode = muteMode; - return this; - } - - @Nonnull - public ParallelHelper setItemInputInventory(ItemInventoryLogic itemInputInventory) { + public ProcessingHelper setItemInputInventory(ItemInventoryLogic itemInputInventory) { this.itemInputInventory = itemInputInventory; return this; } @Nonnull - public ParallelHelper setFluidInputInventory(FluidInventoryLogic fluidInputInventory) { + public ProcessingHelper setFluidInputInventory(FluidInventoryLogic fluidInputInventory) { this.fluidInputInventory = fluidInputInventory; return this; } @@ -337,7 +340,7 @@ public ParallelHelper setFluidInputInventory(FluidInventoryLogic fluidInputInven /** * Sets method for calculating max parallel from given inputs. */ - public ParallelHelper setMaxParallelCalculator(MaxParallelCalculator maxParallelCalculator) { + public ProcessingHelper setMaxParallelCalculator(MaxParallelCalculator maxParallelCalculator) { this.maxParallelCalculator = maxParallelCalculator; return this; } @@ -345,36 +348,44 @@ public ParallelHelper setMaxParallelCalculator(MaxParallelCalculator maxParallel /** * Sets method for consuming inputs after determining how many parallels it can execute. */ - public ParallelHelper setInputConsumer(InputConsumer inputConsumer) { + public ProcessingHelper setInputConsumer(InputConsumer inputConsumer) { this.inputConsumer = inputConsumer; return this; } @Nonnull - public ParallelHelper setItemOutputInventory(ItemInventoryLogic itemOutputInventory) { + public ProcessingHelper setItemOutputInventory(ItemInventoryLogic itemOutputInventory) { this.itemOutputInventory = itemOutputInventory; return this; } @Nonnull - public ParallelHelper setFluidOutputInventory(FluidInventoryLogic fluidOutputInventory) { + public ProcessingHelper setFluidOutputInventory(FluidInventoryLogic fluidOutputInventory) { this.fluidOutputInventory = fluidOutputInventory; return this; } - /** - * Finishes the GT_ParallelHelper. Anything changed after this will not effect anything - */ @Nonnull - public ParallelHelper build() { - if (built) { - throw new IllegalStateException("Tried to build twice"); - } - if (recipe == null) { - throw new IllegalStateException("Recipe is not set"); - } - built = true; - determineParallel(); + public ProcessingHelper setHeatOC(boolean heatOC) { + this.heatOC = heatOC; + return this; + } + + @Nonnull + public ProcessingHelper setHeatDiscount(boolean heatDiscount) { + this.heatDiscount = heatDiscount; + return this; + } + + @Nonnull + public ProcessingHelper setHeatDiscountMultiplier(double heatDiscountMultiplier) { + this.heatDiscountMultiplier = heatDiscountMultiplier; + return this; + } + + @Nonnull + public ProcessingHelper setMachineHeat(int machineHeat) { + this.machineHeat = machineHeat; return this; } @@ -439,72 +450,75 @@ public CheckRecipeResult getResult() { /** * Called by build(). Determines the parallels and everything else that needs to be done at build time */ - protected void determineParallel() { - if (maxParallel <= 0) { - return; - } - if (itemInputs == null) { - itemInputs = new ItemStack[0]; - } - if (fluidInputs == null) { - fluidInputs = new FluidStack[0]; - } - - if (!consume) { - copyInputs(); - } - - if (calculator == null) { - calculator = new OverclockCalculator().setEUt(availableEUt) - .setRecipeEUt(recipe.mEUt) - .setDuration(recipe.mDuration) - .setEUtDiscount(eutModifier); - } - - final int tRecipeEUt = (int) Math.ceil(recipe.mEUt * eutModifier); - if (availableEUt < tRecipeEUt) { - result = CheckRecipeResultRegistry.insufficientPower(tRecipeEUt); - return; + public ProcessingResult process() { + // Sanitize inputs + this.itemInputs = this.itemInputs == null ? new ItemStack[0] : this.itemInputs; + this.fluidInputs = this.fluidInputs == null ? new FluidStack[0] : this.fluidInputs; + + // If not consuming, perform deep copy + if (!this.consume) { + this.itemInputs = Arrays.stream(this.itemInputs) + .map(ItemStack::copy) + .toArray(ItemStack[]::new); + this.fluidInputs = Arrays.stream(this.fluidInputs) + .map(FluidStack::copy) + .toArray(FluidStack[]::new); } - // Save the original max parallel before calculating our overclocking under 1 tick - int originalMaxParallel = maxParallel; - calculator.setParallel(originalMaxParallel); - double tickTimeAfterOC = calculator.calculateDurationUnderOneTick(); - if (tickTimeAfterOC < 1) { - maxParallel = GTUtility.safeInt((long) (maxParallel / tickTimeAfterOC), 0); + // Truncate and sanitize the outputs + final ItemStack[] truncatedItemOutputs = this.recipe.mOutputs == null ? new ItemStack[0] + : Arrays.copyOfRange( + this.recipe.mOutputs, + 0, + Math.min(this.machine.getItemOutputLimit(), this.recipe.mOutputs.length)); + final FluidStack[] truncatedFluidOutputs = this.recipe.mFluidOutputs == null ? new FluidStack[0] + : Arrays.copyOfRange( + this.recipe.mFluidOutputs, + 0, + Math.min(this.machine.getFluidOutputLimit(), this.recipe.mFluidOutputs.length)); + + // Calculate heat discount + final double heatDiscount = this.heatDiscount + ? Math.pow(this.heatDiscountMultiplier, Math.max(0, (this.recipe.mSpecialValue - this.machineHeat) / 900)) + : 1; + + // Check whether there is sufficient energy + final int EUt = (int) Math.ceil(this.recipe.mEUt * this.eutModifier * heatDiscount); + if (this.availableEUt < EUt) { + return ProcessingResult.failure(CheckRecipeResultRegistry.insufficientPower(EUt)); } - int maxParallelBeforeBatchMode = maxParallel; - if (batchMode) { - maxParallel = GTUtility.safeInt((long) maxParallel * batchModifier, 0); - } - - final ItemStack[] truncatedItemOutputs = recipe.mOutputs != null - ? Arrays.copyOfRange(recipe.mOutputs, 0, Math.min(machine.getItemOutputLimit(), recipe.mOutputs.length)) - : new ItemStack[0]; - final FluidStack[] truncatedFluidOutputs = recipe.mFluidOutputs != null ? Arrays - .copyOfRange(recipe.mFluidOutputs, 0, Math.min(machine.getFluidOutputLimit(), recipe.mFluidOutputs.length)) - : new FluidStack[0]; - - SingleRecipeCheck recipeCheck = null; - SingleRecipeCheck.Builder tSingleRecipeCheckBuilder = null; - if (isRecipeLocked && singleRecipeMachine != null) { - recipeCheck = singleRecipeMachine.getSingleRecipeCheck(); - if (recipeCheck == null) { - // Machine is configured to lock to a single recipe, but haven't built the recipe checker yet. - // Build the checker on next successful recipe. - RecipeMap<?> recipeMap = singleRecipeMachine.getRecipeMap(); - if (recipeMap != null) { - tSingleRecipeCheckBuilder = SingleRecipeCheck.builder(recipeMap) - .setBefore(itemInputs, fluidInputs); - } - } - } + // TODO + // double overclockedDuration; + // int subTickParallels; + // if (overclockedDuration < 1) { + // subTickParallels = GTUtility.safeInt((long) (maxParallels / overclockedDuration), 0); + // } + + // int batchParallels; + // if (batchMode) { + // batchParallels = GTUtility.safeInt((long) maxParallels * batchModifier, 0); + // } + + // todo +// SingleRecipeCheck recipeCheck = null; +// SingleRecipeCheck.Builder tSingleRecipeCheckBuilder = null; +// if (isRecipeLocked && singleRecipeMachine != null) { +// recipeCheck = singleRecipeMachine.getSingleRecipeCheck(); +// if (recipeCheck == null) { +// // Machine is configured to lock to a single recipe, but haven't built the recipe checker yet. +// // Build the checker on next successful recipe. +// RecipeMap<?> recipeMap = singleRecipeMachine.getRecipeMap(); +// if (recipeMap != null) { +// tSingleRecipeCheckBuilder = SingleRecipeCheck.builder(recipeMap) +// .setBefore(itemInputs, fluidInputs); +// } +// } +// } // Let's look at how many parallels we can get with void protection - if (protectExcessItem || protectExcessFluid) { - if (machine == null && !muteMode) { + if (this.protectExcessItem || this.protectExcessFluid) { + if (this.machine == null && !this.muteMode) { throw new IllegalStateException("Tried to calculate void protection, but machine is not set"); } VoidProtectionHelper voidProtectionHelper = new VoidProtectionHelper(); @@ -514,26 +528,23 @@ protected void determineParallel() { .setChangeGetter(recipe::getOutputChance) .setOutputMultiplier(outputMultiplier) .setChanceMultiplier(chanceMultiplier) - .setMaxParallel(maxParallel) + .setMaxParallel(maxParallels) .setItemOutputInventory(itemOutputInventory) .setFluidOutputInventory(fluidOutputInventory) - .setMuTEMode(muteMode) .build(); - maxParallel = Math.min(voidProtectionHelper.getMaxParallel(), maxParallel); + maxParallels = Math.min(voidProtectionHelper.getMaxParallel(), maxParallels); if (voidProtectionHelper.isItemFull()) { - result = CheckRecipeResultRegistry.ITEM_OUTPUT_FULL; - return; + return ProcessingResult.failure(CheckRecipeResultRegistry.ITEM_OUTPUT_FULL); } if (voidProtectionHelper.isFluidFull()) { - result = CheckRecipeResultRegistry.FLUID_OUTPUT_FULL; - return; + return ProcessingResult.failure(CheckRecipeResultRegistry.FLUID_OUTPUT_FULL); } } - maxParallelBeforeBatchMode = Math.min(maxParallel, maxParallelBeforeBatchMode); + maxParallelBeforeBatchMode = Math.min(maxParallels, maxParallelBeforeBatchMode); // determine normal parallel - int actualMaxParallel = tRecipeEUt > 0 ? (int) Math.min(maxParallelBeforeBatchMode, availableEUt / tRecipeEUt) + int actualMaxParallel = EUt > 0 ? (int) Math.min(maxParallelBeforeBatchMode, availableEUt / EUt) : maxParallelBeforeBatchMode; if (recipeCheck != null) { currentParallel = recipeCheck.checkRecipeInputs(true, actualMaxParallel, itemInputs, fluidInputs); @@ -568,7 +579,7 @@ protected void determineParallel() { final int maxExtraParallels = (int) Math.floor( Math.min( currentParallel * Math.min(batchMultiplierMax - 1, batchModifier - 1), - maxParallel - currentParallel)); + maxParallels - currentParallel)); if (recipeCheck != null) { tExtraParallels = recipeCheck.checkRecipeInputs(true, maxExtraParallels, itemInputs, fluidInputs); } else { @@ -588,21 +599,6 @@ protected void determineParallel() { result = CheckRecipeResultRegistry.SUCCESSFUL; } - protected void copyInputs() { - ItemStack[] itemInputsToUse; - FluidStack[] fluidInputsToUse; - itemInputsToUse = new ItemStack[itemInputs.length]; - for (int i = 0; i < itemInputs.length; i++) { - itemInputsToUse[i] = itemInputs[i].copy(); - } - fluidInputsToUse = new FluidStack[fluidInputs.length]; - for (int i = 0; i < fluidInputs.length; i++) { - fluidInputsToUse[i] = fluidInputs[i].copy(); - } - itemInputs = itemInputsToUse; - fluidInputs = fluidInputsToUse; - } - private void calculateItemOutputs(ItemStack[] truncatedItemOutputs) { if (customItemOutputCalculation != null) { itemOutputs = customItemOutputCalculation.apply(currentParallel); diff --git a/src/main/java/gregtech/api/util/ProcessingResult.java b/src/main/java/gregtech/api/util/ProcessingResult.java new file mode 100644 index 00000000000..4b979d75262 --- /dev/null +++ b/src/main/java/gregtech/api/util/ProcessingResult.java @@ -0,0 +1,30 @@ +package gregtech.api.util; + +import gregtech.api.recipe.check.CheckRecipeResult; + +public class ProcessingResult { + + private final boolean success; + private final CheckRecipeResult result; + + private ProcessingResult(boolean success, CheckRecipeResult result) { + this.success = success; + this.result = result; + } + + public static ProcessingResult success(CheckRecipeResult result) { + return new ProcessingResult(true, result); + } + + public static ProcessingResult failure(CheckRecipeResult result) { + return new ProcessingResult(false, result); + } + + public boolean wasSuccessful() { + return success; + } + + public CheckRecipeResult getResult() { + return result; + } +} diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEAssemblyLine.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEAssemblyLine.java index 99b63d40898..34fb1352aeb 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEAssemblyLine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEAssemblyLine.java @@ -61,7 +61,7 @@ import gregtech.api.util.IGTHatchAdder; import gregtech.api.util.MultiblockTooltipBuilder; import gregtech.api.util.OverclockCalculator; -import gregtech.api.util.ParallelHelper; +import gregtech.api.util.ProcessingHelper; import gregtech.api.util.VoidProtectionHelper; public class MTEAssemblyLine extends MTEExtendedPowerMultiBlockBase<MTEAssemblyLine> implements ISurvivalConstructable { @@ -360,7 +360,7 @@ public CheckRecipeResult checkProcessing() { } result = CheckRecipeResultRegistry.SUCCESSFUL; ArrayList<ItemStack> outputs = new ArrayList<>(); - ParallelHelper.addItemsLong(outputs, tRecipe.mOutput, (long) tRecipe.mOutput.stackSize * maxParallel); + ProcessingHelper.addItemsLong(outputs, tRecipe.mOutput, (long) tRecipe.mOutput.stackSize * maxParallel); mOutputItems = outputs.toArray(new ItemStack[0]); break; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEElectricBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEElectricBlastFurnace.java index ffe7efa0ba5..ad38b573935 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEElectricBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEElectricBlastFurnace.java @@ -62,7 +62,6 @@ import gregtech.api.util.GTRecipe; import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; -import gregtech.api.util.OverclockCalculator; public class MTEElectricBlastFurnace extends MTEAbstractMultiFurnace<MTEElectricBlastFurnace> implements ISurvivalConstructable { @@ -191,21 +190,15 @@ public IStructureDefinition<MTEElectricBlastFurnace> getStructureDefinition() { protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic() { - @Nonnull - @Override - protected OverclockCalculator createOverclockCalculator(@Nonnull GTRecipe recipe) { - return super.createOverclockCalculator(recipe).setRecipeHeat(recipe.mSpecialValue) - .setMachineHeat(mHeatingCapacity) - .setHeatOC(true) - .setHeatDiscount(true); - } - @Override protected @Nonnull CheckRecipeResult validateRecipe(@Nonnull GTRecipe recipe) { return recipe.mSpecialValue <= mHeatingCapacity ? CheckRecipeResultRegistry.SUCCESSFUL : CheckRecipeResultRegistry.insufficientHeat(recipe.mSpecialValue); } - }; + }.setHeatOC(true) + .setHeatDiscount(true) + .setHeatDiscountMultiplier(0.95) + .setMachineHeat(this.mHeatingCapacity); } public boolean addOutputHatchToTopList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEFusionComputer.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEFusionComputer.java index 17a55c45204..f2389c93653 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEFusionComputer.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEFusionComputer.java @@ -74,7 +74,7 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; import gregtech.api.util.OverclockCalculator; -import gregtech.api.util.ParallelHelper; +import gregtech.api.util.ProcessingHelper; import gregtech.api.util.shutdown.ShutDownReason; import gregtech.api.util.shutdown.ShutDownReasonRegistry; import gregtech.common.tileentities.machines.multi.drone.MTEHatchDroneDownLink; @@ -314,9 +314,9 @@ protected ProcessingLogic createProcessingLogic() { @NotNull @Override - protected ParallelHelper createParallelHelper(@NotNull GTRecipe recipe) { + protected ProcessingHelper createProcessingHelper(@NotNull GTRecipe recipe) { // When the fusion first loads and is still processing, it does the recipe check without consuming. - return super.createParallelHelper(recipe).setConsumption(!mRunningOnLoad); + return super.createProcessingHelper(recipe).setConsumption(!mRunningOnLoad); } @NotNull diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEPCBFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEPCBFactory.java index 189bdd4640f..1caa8791b95 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEPCBFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEPCBFactory.java @@ -89,7 +89,7 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; import gregtech.api.util.OverclockCalculator; -import gregtech.api.util.ParallelHelper; +import gregtech.api.util.ProcessingHelper; import gregtech.api.util.shutdown.ShutDownReasonRegistry; import gregtech.common.blocks.BlockCasings8; @@ -582,8 +582,8 @@ protected OverclockCalculator createOverclockCalculator(@Nonnull GTRecipe recipe @Nonnull @Override - protected ParallelHelper createParallelHelper(@Nonnull GTRecipe recipe) { - return super.createParallelHelper(recipe) + protected ProcessingHelper createProcessingHelper(@Nonnull GTRecipe recipe) { + return super.createProcessingHelper(recipe) .setEUtModifier((float) Math.sqrt(mUpgradesInstalled == 0 ? 1 : mUpgradesInstalled)) .setChanceMultiplier(mRoughnessMultiplier); } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEPlasmaForge.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEPlasmaForge.java index bba75222527..541dffe248e 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEPlasmaForge.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEPlasmaForge.java @@ -83,7 +83,7 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; import gregtech.api.util.OverclockCalculator; -import gregtech.api.util.ParallelHelper; +import gregtech.api.util.ProcessingHelper; import tectech.thing.gui.TecTechUITextures; public class MTEPlasmaForge extends MTEExtendedPowerMultiBlockBase<MTEPlasmaForge> implements ISurvivalConstructable { @@ -762,8 +762,7 @@ protected ProcessingLogic createProcessingLogic() { @Nonnull @Override protected OverclockCalculator createOverclockCalculator(@Nonnull GTRecipe recipe) { - overclockCalculator = super.createOverclockCalculator(recipe).setRecipeHeat(recipe.mSpecialValue) - .setMachineHeat(mHeatingCapacity); + overclockCalculator = super.createOverclockCalculator(recipe).setRecipeHeat(recipe.mSpecialValue); if (discount == maximum_discount && convergence) { if (doesRecipeHaveNativeCatInput || isEnoughCatalystPresent) { overclockCalculator = overclockCalculator.enablePerfectOC(); @@ -774,8 +773,8 @@ protected OverclockCalculator createOverclockCalculator(@Nonnull GTRecipe recipe @NotNull @Override - protected ParallelHelper createParallelHelper(@Nonnull GTRecipe recipe) { - return super.createParallelHelper(recipeAfterAdjustments(recipe)); + protected ProcessingHelper createProcessingHelper(@Nonnull GTRecipe recipe) { + return super.createProcessingHelper(recipeAfterAdjustments(recipe)); } @Override @@ -783,7 +782,7 @@ protected ParallelHelper createParallelHelper(@Nonnull GTRecipe recipe) { return recipe.mSpecialValue <= mHeatingCapacity ? CheckRecipeResultRegistry.SUCCESSFUL : CheckRecipeResultRegistry.insufficientHeat(recipe.mSpecialValue); } - }; + }.setMachineHeat(this.mHeatingCapacity); } @Nonnull diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialAlloySmelter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialAlloySmelter.java index 873fa99ecfe..b6536a7c71d 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialAlloySmelter.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialAlloySmelter.java @@ -204,14 +204,14 @@ protected ProcessingLogic createProcessingLogic() { @Override protected OverclockCalculator createOverclockCalculator(@NotNull GTRecipe recipe) { return super.createOverclockCalculator(recipe).setSpeedBoost(100.0 / (100 + 5 * mLevel)) - .setHeatOC(true) - .setRecipeHeat(0) - // Need to multiply by 2 because heat OC is done only once every 1800 and this one does it once - // every - // 900 - .setMachineHeat((int) (getCoilLevel().getHeat() * 2)); + .setRecipeHeat(0); } - }.setMaxParallelSupplier(this::getMaxParallelRecipes); + }.setHeatOC(true) + .setHeatDiscount(false) + // Requires doubling because heat OC is normally done every 1800 degrees, but this machine does it every + // 900. + .setMachineHeat((int) (getCoilLevel().getHeat() * 2)) + .setMaxParallelSupplier(this::getMaxParallelRecipes); } public HeatingCoilLevel getCoilLevel() { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialDehydrator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialDehydrator.java index 7d2eac943de..88d9b29debf 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialDehydrator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialDehydrator.java @@ -48,7 +48,6 @@ import gregtech.api.recipe.check.CheckRecipeResultRegistry; import gregtech.api.util.GTRecipe; import gregtech.api.util.MultiblockTooltipBuilder; -import gregtech.api.util.OverclockCalculator; import gregtech.common.pollution.PollutionConfig; import gtPlusPlus.api.recipe.GTPPRecipeMaps; import gtPlusPlus.core.block.ModBlocks; @@ -222,16 +221,11 @@ protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { return recipe.mSpecialValue <= getCoilLevel().getHeat() ? CheckRecipeResultRegistry.SUCCESSFUL : CheckRecipeResultRegistry.insufficientHeat(recipe.mSpecialValue); } - - @NotNull - @Override - protected OverclockCalculator createOverclockCalculator(@NotNull GTRecipe recipe) { - return super.createOverclockCalculator(recipe).setHeatOC(true) - .setHeatDiscount(true) - .setRecipeHeat(recipe.mSpecialValue) - .setMachineHeat((int) getCoilLevel().getHeat()); - } - }.setSpeedBonus(1F / 2.2F) + }.setHeatOC(true) + .setHeatDiscount(true) + .setHeatDiscountMultiplier(0.95) + .setMachineHeat((int) getCoilLevel().getHeat()) + .setSpeedBonus(1F / 2.2F) .setEuModifier(0.5F) .setMaxParallelSupplier(this::getMaxParallelRecipes); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTESpargeTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTESpargeTower.java index f9a4f39e87b..37543d4f04a 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTESpargeTower.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTESpargeTower.java @@ -41,7 +41,7 @@ import gregtech.api.recipe.RecipeMap; import gregtech.api.util.GTRecipe; import gregtech.api.util.MultiblockTooltipBuilder; -import gregtech.api.util.ParallelHelper; +import gregtech.api.util.ProcessingHelper; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.recipe.GTPPRecipeMaps; import gtPlusPlus.core.block.ModBlocks; @@ -194,8 +194,8 @@ protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic() { @Override - protected @NotNull ParallelHelper createParallelHelper(@NotNull GTRecipe recipe) { - return super.createParallelHelper(modifyRecipe(recipe)); + protected @NotNull ProcessingHelper createProcessingHelper(@NotNull GTRecipe recipe) { + return super.createProcessingHelper(modifyRecipe(recipe)); } private GTRecipe modifyRecipe(GTRecipe recipe) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvEBF.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvEBF.java index d1281139928..df81137713d 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvEBF.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvEBF.java @@ -49,8 +49,6 @@ import gregtech.api.util.GTRecipe; import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; -import gregtech.api.util.OverclockCalculator; -import gregtech.api.util.ParallelHelper; import gregtech.api.util.shutdown.ShutDownReasonRegistry; import gregtech.common.pollution.PollutionConfig; import gtPlusPlus.core.block.ModBlocks; @@ -246,35 +244,9 @@ protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { return recipe.mSpecialValue <= getCoilLevel().getHeat() ? CheckRecipeResultRegistry.SUCCESSFUL : CheckRecipeResultRegistry.insufficientHeat(recipe.mSpecialValue); } - - @NotNull - @Override - protected OverclockCalculator createOverclockCalculator(@NotNull GTRecipe recipe) { - return super.createOverclockCalculator(recipe).setHeatOC(true) - .setHeatDiscount(true) - .setRecipeHeat(recipe.mSpecialValue) - .setMachineHeat((int) getCoilLevel().getHeat()); - } - - @NotNull - @Override - protected ParallelHelper createParallelHelper(@NotNull GTRecipe recipe) { - return new ParallelHelper().setRecipe(recipe) - .setItemInputs(inputItems) - .setFluidInputs(inputFluids) - .setAvailableEUt(availableVoltage * availableAmperage) - .setMachine(machine, protectItems, protectFluids) - .setRecipeLocked(recipeLockableMachine, isRecipeLocked) - .setMaxParallel(maxParallel) - .setEUtModifier( - euModifier - * Math.pow(0.95F, Math.floor((getCoilLevel().getHeat() - recipe.mSpecialValue) / 900F))) - .enableBatchMode(batchSize) - .setConsumption(true) - .setOutputCalculation(true); - } - - }.setSpeedBonus(1F / 2.2F) + }.setHeatOC(true) + .setHeatDiscount(true) + .setSpeedBonus(1F / 2.2F) .setEuModifier(0.9F) .setMaxParallelSupplier(this::getMaxParallelRecipes); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEIndustrialFishingPond.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEIndustrialFishingPond.java index ee84fbcd0e9..88e0d67c874 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEIndustrialFishingPond.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEIndustrialFishingPond.java @@ -45,7 +45,7 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; import gregtech.api.util.OverclockCalculator; -import gregtech.api.util.ParallelHelper; +import gregtech.api.util.ProcessingHelper; import gregtech.api.util.ReflectionUtil; import gregtech.common.pollution.PollutionConfig; import gtPlusPlus.api.recipe.GTPPRecipeMaps; @@ -251,16 +251,16 @@ protected boolean filtersFluid() { OverclockCalculator calculator = new OverclockCalculator().setRecipeEUt(g.mEUt) .setEUt(tEnergy) .setDuration(g.mDuration); - ParallelHelper helper = new ParallelHelper().setRecipe(g) + ProcessingHelper helper = new ProcessingHelper().setRecipe(g) .setItemInputs(tItemInputs) .setFluidInputs(tFluidInputs) .setAvailableEUt(tEnergy) - .setMaxParallel(getMaxParallelRecipes()) + .setMaxParallels(getMaxParallelRecipes()) .setConsumption(true) .setOutputCalculation(true) .setMachine(this) - .enableBatchMode(batchMode ? 128 : 1) - .setCalculator(calculator); + .setBatchMode(batchMode) + .setBatchModifier(128); helper.build(); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEQuantumForceTransformer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEQuantumForceTransformer.java index d86395368f8..35d44791e3b 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEQuantumForceTransformer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEQuantumForceTransformer.java @@ -15,9 +15,9 @@ import static gregtech.api.util.GTRecipeBuilder.BUCKETS; import static gregtech.api.util.GTRecipeBuilder.INGOTS; import static gregtech.api.util.GTStructureUtility.buildHatchAdder; -import static gregtech.api.util.ParallelHelper.addFluidsLong; -import static gregtech.api.util.ParallelHelper.addItemsLong; -import static gregtech.api.util.ParallelHelper.calculateChancedOutputMultiplier; +import static gregtech.api.util.ProcessingHelper.addFluidsLong; +import static gregtech.api.util.ProcessingHelper.addItemsLong; +import static gregtech.api.util.ProcessingHelper.calculateChancedOutputMultiplier; import java.util.ArrayList; import java.util.Arrays; @@ -72,7 +72,7 @@ import gregtech.api.util.GTRecipe; import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; -import gregtech.api.util.ParallelHelper; +import gregtech.api.util.ProcessingHelper; import gregtech.api.util.shutdown.ShutDownReasonRegistry; import gtPlusPlus.api.recipe.GTPPRecipeMaps; import gtPlusPlus.core.block.ModBlocks; @@ -499,8 +499,8 @@ protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { @NotNull @Override - public ParallelHelper createParallelHelper(@Nonnull GTRecipe recipe) { - return super.createParallelHelper(recipe).setCustomItemOutputCalculation(parallel -> { + public ProcessingHelper createProcessingHelper(@Nonnull GTRecipe recipe) { + return super.createProcessingHelper(recipe).setCustomItemOutputCalculation(parallel -> { ArrayList<ItemStack> items = new ArrayList<>(); for (int i = 0; i < recipe.mOutputs.length; i++) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEThermalBoiler.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEThermalBoiler.java index 9c92bb24c76..ef12251e034 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEThermalBoiler.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEThermalBoiler.java @@ -42,7 +42,7 @@ import gregtech.api.util.GTLog; import gregtech.api.util.GTRecipe; import gregtech.api.util.MultiblockTooltipBuilder; -import gregtech.api.util.ParallelHelper; +import gregtech.api.util.ProcessingHelper; import gregtech.common.pollution.PollutionConfig; import gtPlusPlus.api.recipe.GTPPRecipeMaps; import gtPlusPlus.core.block.ModBlocks; @@ -134,7 +134,7 @@ protected Stream<GTRecipe> findRecipeMatches(@Nullable RecipeMap<?> map) { @NotNull @Override - protected ParallelHelper createParallelHelper(@Nonnull GTRecipe recipe) { + protected ProcessingHelper createProcessingHelper(@Nonnull GTRecipe recipe) { GTRecipe adjustedRecipe = recipe.copy(); // Hack the recipe logic to not consume water, so that we can explode. @@ -154,7 +154,7 @@ protected ParallelHelper createParallelHelper(@Nonnull GTRecipe recipe) { } } } - return super.createParallelHelper(adjustedRecipe); + return super.createProcessingHelper(adjustedRecipe); } }; } diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/MTEEyeOfHarmony.java b/src/main/java/tectech/thing/metaTileEntity/multi/MTEEyeOfHarmony.java index ea1f38a0d2a..eb41997bfa0 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/MTEEyeOfHarmony.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/MTEEyeOfHarmony.java @@ -10,7 +10,7 @@ import static gregtech.api.enums.HatchElement.OutputHatch; import static gregtech.api.util.GTStructureUtility.buildHatchAdder; import static gregtech.api.util.GTUtility.formatNumbers; -import static gregtech.api.util.ParallelHelper.calculateChancedOutputMultiplier; +import static gregtech.api.util.ProcessingHelper.calculateChancedOutputMultiplier; import static gregtech.common.misc.WirelessNetworkManager.addEUToGlobalEnergyMap; import static gregtech.common.misc.WirelessNetworkManager.strongCheckOrAddUser; import static java.lang.Math.exp; diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEMoltenModule.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEMoltenModule.java index eace01bb6a7..52f097c00af 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEMoltenModule.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEMoltenModule.java @@ -73,8 +73,6 @@ protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { protected OverclockCalculator createOverclockCalculator(@NotNull GTRecipe recipe) { return super.createOverclockCalculator(recipe).setEUt(getProcessingVoltage()) .setRecipeHeat(recipe.mSpecialValue) - .setHeatOC(true) - .setHeatDiscount(true) .setMachineHeat(Math.max(recipe.mSpecialValue, getHeatForOC())) .setHeatDiscountMultiplier(getHeatEnergyDiscount()) .setDurationDecreasePerOC(getOverclockTimeFactor()); @@ -96,7 +94,9 @@ protected CheckRecipeResult onRecipeStart(@NotNull GTRecipe recipe) { setCalculatedEut(0); return CheckRecipeResultRegistry.SUCCESSFUL; } - }; + }.setHeatOC(true) + .setHeatDiscount(true) + .setHeatDiscountMultiplier(0.95); } @Override diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTESmeltingModule.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTESmeltingModule.java index 1e499b3507a..74cd1fc0150 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTESmeltingModule.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTESmeltingModule.java @@ -127,13 +127,13 @@ protected CheckRecipeResult onRecipeStart(@NotNull GTRecipe recipe) { protected OverclockCalculator createOverclockCalculator(@NotNull GTRecipe recipe) { return super.createOverclockCalculator(recipe).setEUt(getProcessingVoltage()) .setRecipeHeat(recipe.mSpecialValue) - .setHeatOC(true) - .setHeatDiscount(true) - .setMachineHeat(Math.max(recipe.mSpecialValue, getHeatForOC())) + .setMachineHeat(Math.max(recipe.mSpecialValue, getHeatForOC())) // TODO .setHeatDiscountMultiplier(getHeatEnergyDiscount()) .setDurationDecreasePerOC(getOverclockTimeFactor()); } - }; + }.setHeatOC(true) + .setHeatDiscount(true) + .setHeatDiscountMultiplier(0.95); } @Override From 40cc1882bcaf8532d839ee40e80598a982c89028 Mon Sep 17 00:00:00 2001 From: Julia Dijkstra <julia.dijkstra@technolution.nl> Date: Wed, 29 Jan 2025 08:48:14 +0100 Subject: [PATCH 4/5] Small post-merge fixes --- .../gregtech/api/logic/ProcessingLogic.java | 45 +++++++++++-------- .../gregtech/api/util/ProcessingHelper.java | 33 +++++++------- .../MTEQuantumForceTransformer.java | 1 - 3 files changed, 42 insertions(+), 37 deletions(-) diff --git a/src/main/java/gregtech/api/logic/ProcessingLogic.java b/src/main/java/gregtech/api/logic/ProcessingLogic.java index b5ab244757f..fcc0a1c6fc5 100644 --- a/src/main/java/gregtech/api/logic/ProcessingLogic.java +++ b/src/main/java/gregtech/api/logic/ProcessingLogic.java @@ -54,6 +54,12 @@ public class ProcessingLogic { protected double overClockPowerIncrease = 4.0; protected boolean amperageOC = true; + // Heat related parameters + protected boolean heatOC; + protected boolean heatDiscount; + protected double heatDiscountMultiplier; + protected int machineHeat; + // Calculated results protected ItemStack[] outputItems; protected FluidStack[] outputFluids; @@ -214,6 +220,26 @@ public ProcessingLogic setOverclock(double timeReduction, double powerIncrease) return this; } + public ProcessingLogic setHeatOC(boolean heatOC) { + this.heatOC = heatOC; + return this; + } + + public ProcessingLogic setHeatDiscount(boolean heatDiscount) { + this.heatDiscount = heatDiscount; + return this; + } + + public ProcessingLogic setHeatDiscountMultiplier(double heatDiscountMultiplier) { + this.heatDiscountMultiplier = heatDiscountMultiplier; + return this; + } + + public ProcessingLogic setMachineHeat(int machineHeat) { + this.machineHeat = machineHeat; + return this; + } + /** * Sets overclock ratio to 4/4. */ @@ -394,8 +420,7 @@ private CalculationResult validateAndCalculateRecipe(@Nonnull GTRecipe recipe) { * At this point, inputs have been already consumed. */ @Nonnull - private CheckRecipeResult applyRecipe(@Nonnull GTRecipe recipe, @Nonnull ParallelHelper helper, - @Nonnull OverclockCalculator calculator, @Nonnull CheckRecipeResult result) { + private CheckRecipeResult applyRecipe(@Nonnull GTRecipe recipe, @Nonnull ProcessingResult result) { if (recipe.mCanBeBuffered) { lastRecipe = recipe; } else { @@ -488,22 +513,6 @@ protected ProcessingHelper createProcessingHelper(@Nonnull GTRecipe recipe) { .setOutputCalculation(true); } - /** - * Override to tweak overclock logic if needed. - */ - @Nonnull - protected OverclockCalculator createOverclockCalculator(@Nonnull GTRecipe recipe) { - return new OverclockCalculator().setRecipeEUt(recipe.mEUt) - .setAmperage(availableAmperage) - .setEUt(availableVoltage) - .setDuration(recipe.mDuration) - .setSpeedBoost(speedBoost) - .setEUtDiscount(euModifier) - .setAmperageOC(amperageOC) - .setDurationDecreasePerOC(overClockTimeReduction) - .setEUtIncreasePerOC(overClockPowerIncrease); - } - /** * Override to perform additional logic when recipe starts. * <p> diff --git a/src/main/java/gregtech/api/util/ProcessingHelper.java b/src/main/java/gregtech/api/util/ProcessingHelper.java index 01016871048..1833dcb51ee 100644 --- a/src/main/java/gregtech/api/util/ProcessingHelper.java +++ b/src/main/java/gregtech/api/util/ProcessingHelper.java @@ -14,7 +14,6 @@ import gregtech.api.interfaces.tileentity.IRecipeLockable; import gregtech.api.interfaces.tileentity.IVoidable; import gregtech.api.objects.XSTR; -import gregtech.api.recipe.RecipeMap; import gregtech.api.recipe.check.CheckRecipeResult; import gregtech.api.recipe.check.CheckRecipeResultRegistry; import gregtech.api.recipe.check.SingleRecipeCheck; @@ -459,24 +458,24 @@ public ProcessingResult process() { // } // todo -// SingleRecipeCheck recipeCheck = null; -// SingleRecipeCheck.Builder tSingleRecipeCheckBuilder = null; -// if (isRecipeLocked && singleRecipeMachine != null) { -// recipeCheck = singleRecipeMachine.getSingleRecipeCheck(); -// if (recipeCheck == null) { -// // Machine is configured to lock to a single recipe, but haven't built the recipe checker yet. -// // Build the checker on next successful recipe. -// RecipeMap<?> recipeMap = singleRecipeMachine.getRecipeMap(); -// if (recipeMap != null) { -// tSingleRecipeCheckBuilder = SingleRecipeCheck.builder(recipeMap) -// .setBefore(itemInputs, fluidInputs); -// } -// } -// } + // SingleRecipeCheck recipeCheck = null; + // SingleRecipeCheck.Builder tSingleRecipeCheckBuilder = null; + // if (isRecipeLocked && singleRecipeMachine != null) { + // recipeCheck = singleRecipeMachine.getSingleRecipeCheck(); + // if (recipeCheck == null) { + // // Machine is configured to lock to a single recipe, but haven't built the recipe checker yet. + // // Build the checker on next successful recipe. + // RecipeMap<?> recipeMap = singleRecipeMachine.getRecipeMap(); + // if (recipeMap != null) { + // tSingleRecipeCheckBuilder = SingleRecipeCheck.builder(recipeMap) + // .setBefore(itemInputs, fluidInputs); + // } + // } + // } // Let's look at how many parallels we can get with void protection if (this.protectExcessItem || this.protectExcessFluid) { - if (this.machine == null && !this.muteMode) { + if (this.machine == null) { throw new IllegalStateException("Tried to calculate void protection, but machine is not set"); } VoidProtectionHelper voidProtectionHelper = new VoidProtectionHelper(); @@ -487,8 +486,6 @@ public ProcessingResult process() { .setOutputMultiplier(outputMultiplier) .setChanceMultiplier(chanceMultiplier) .setMaxParallel(maxParallels) - .setItemOutputInventory(itemOutputInventory) - .setFluidOutputInventory(fluidOutputInventory) .build(); maxParallels = Math.min(voidProtectionHelper.getMaxParallel(), maxParallels); if (voidProtectionHelper.isItemFull()) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEQuantumForceTransformer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEQuantumForceTransformer.java index 9b41f1eb9d0..1a7d4f71ae5 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEQuantumForceTransformer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEQuantumForceTransformer.java @@ -76,7 +76,6 @@ import gregtech.api.util.IGTHatchAdder; import gregtech.api.util.MultiblockTooltipBuilder; import gregtech.api.util.ProcessingHelper; -import gregtech.api.util.shutdown.ShutDownReasonRegistry; import gtPlusPlus.api.recipe.GTPPRecipeMaps; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.material.MaterialsElements; From 0cc90dadc78fe852e922921f37b96c0b3e741ea8 Mon Sep 17 00:00:00 2001 From: Julia Dijkstra <julia.dijkstra@technolution.nl> Date: Thu, 30 Jan 2025 03:54:26 +0100 Subject: [PATCH 5/5] More work A lot of machines still require setters for their ProcessingLogic. --- .../common/tileentities/multis/MTEBioVat.java | 2 +- .../multis/MTECircuitAssemblyLine.java | 4 +- .../MTEElectricImplosionCompressor.java | 3 +- .../multis/mega/MTEMegaBlastFurnace.java | 3 +- .../multis/mega/MTEMegaChemicalReactor.java | 4 +- .../multis/mega/MTEMegaDistillTower.java | 4 +- .../multis/mega/MTEMegaOilCracker.java | 16 +- .../multis/mega/MTEMegaVacuumFreezer.java | 4 +- .../tileEntity/MTEFuelRefineFactory.java | 2 +- .../tileEntity/MTENeutronActivator.java | 14 +- .../gregtech/api/logic/ProcessingLogic.java | 82 ++++-- .../MTEExtendedPowerMultiBlockBase.java | 2 +- .../implementations/MTEMultiBlockBase.java | 4 +- .../gregtech/api/util/ProcessingHelper.java | 257 ++++++++++++------ .../machines/multi/MTEDistillationTower.java | 2 +- .../multi/MTEElectricBlastFurnace.java | 4 +- .../multi/MTEImplosionCompressor.java | 2 +- .../machines/multi/MTEIndustrialBrewery.java | 4 +- ...MTEIndustrialElectromagneticSeparator.java | 2 +- .../multi/MTEIndustrialExtractor.java | 2 +- .../multi/MTEIndustrialLaserEngraver.java | 2 +- .../multi/MTELargeChemicalReactor.java | 2 +- .../multi/MTELargeFluidExtractor.java | 2 +- .../machines/multi/MTEMultiAutoclave.java | 2 +- .../machines/multi/MTEMultiLathe.java | 2 +- .../machines/multi/MTEMultiSolidifier.java | 2 +- .../machines/multi/MTEOilCracker.java | 2 +- .../machines/multi/MTEPCBFactory.java | 10 +- .../compressor/MTEBlackHoleCompressor.java | 2 +- .../multi/compressor/MTEHIPCompressor.java | 4 +- .../compressor/MTEIndustrialCompressor.java | 2 +- .../multi/misc/MTEAmazonPackager.java | 2 +- .../processing/MTEIndustrialCentrifuge.java | 2 +- .../multi/processing/MTEIndustrialChisel.java | 2 +- .../processing/MTEIndustrialCokeOven.java | 2 +- .../MTEIndustrialCuttingMachine.java | 2 +- .../processing/MTEIndustrialDehydrator.java | 2 +- .../processing/MTEIndustrialFluidHeater.java | 2 +- .../processing/MTEIndustrialMultiMachine.java | 2 +- .../multi/processing/MTEIndustrialSifter.java | 2 +- .../MTEIndustrialThermalCentrifuge.java | 2 +- .../processing/MTEIndustrialWireMill.java | 2 +- .../machines/multi/processing/MTEIsaMill.java | 2 +- .../processing/MTEndustrialElectrolyzer.java | 2 +- .../advanced/MTEAdvDistillationTower.java | 2 +- .../multi/processing/advanced/MTEAdvEBF.java | 2 +- .../processing/advanced/MTEAdvFusionMk4.java | 2 +- .../processing/advanced/MTEAdvFusionMk5.java | 2 +- .../production/MTEElementalDuplicator.java | 2 +- .../production/MTEFrothFlotationCell.java | 2 +- .../production/MTEIndustrialRockBreaker.java | 2 +- .../multi/production/MTEMassFabricator.java | 4 +- .../multi/production/MTETreeFarm.java | 2 +- .../production/algae/MTEAlgaePondBase.java | 2 +- .../multi/godforge/MTEExoticModule.java | 4 +- .../multi/godforge/MTEMoltenModule.java | 10 +- .../multi/godforge/MTEPlasmaModule.java | 8 +- .../multi/godforge/MTESmeltingModule.java | 10 +- 58 files changed, 320 insertions(+), 209 deletions(-) diff --git a/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java b/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java index 72efbd2b550..878f5c12d21 100644 --- a/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java +++ b/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java @@ -267,7 +267,7 @@ protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { protected ProcessingHelper createProcessingHelper(@NotNull GTRecipe recipe) { return super.createProcessingHelper(recipeWithMultiplier(recipe, inputFluids)); } - }; + }.setOverclock(true); } protected GTRecipe recipeWithMultiplier(GTRecipe recipe, FluidStack[] fluidInputs) { diff --git a/src/main/java/bartworks/common/tileentities/multis/MTECircuitAssemblyLine.java b/src/main/java/bartworks/common/tileentities/multis/MTECircuitAssemblyLine.java index 744e0c0f68c..5c5323d8618 100644 --- a/src/main/java/bartworks/common/tileentities/multis/MTECircuitAssemblyLine.java +++ b/src/main/java/bartworks/common/tileentities/multis/MTECircuitAssemblyLine.java @@ -312,7 +312,6 @@ public Collection<RecipeMap<?>> getAvailableRecipeMaps() { @Override protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic() { - @Override @Nonnull protected CheckRecipeResult validateRecipe(@Nonnull GTRecipe recipe) { @@ -323,7 +322,8 @@ protected CheckRecipeResult validateRecipe(@Nonnull GTRecipe recipe) { } return CheckRecipeResultRegistry.SUCCESSFUL; } - }.enablePerfectOverclock(); + }.setOverclock(true) + .setPerfectOverclock(); } @NotNull diff --git a/src/main/java/bartworks/common/tileentities/multis/MTEElectricImplosionCompressor.java b/src/main/java/bartworks/common/tileentities/multis/MTEElectricImplosionCompressor.java index b8a5ace3cd7..807b5f5460b 100644 --- a/src/main/java/bartworks/common/tileentities/multis/MTEElectricImplosionCompressor.java +++ b/src/main/java/bartworks/common/tileentities/multis/MTEElectricImplosionCompressor.java @@ -331,7 +331,8 @@ protected OverclockCalculator createOverclockCalculator(@NotNull GTRecipe recipe .setEUt(MTEElectricImplosionCompressor.this.getMaxInputEu()) .setAmperage(1); } - }.setMaxParallelSupplier(() -> (int) Math.pow(4, Math.max(this.mBlockTier - 1, 0))); + }.setOverclock(true) + .setMaxParallelSupplier(() -> (int) Math.pow(4, Math.max(this.mBlockTier - 1, 0))); } private void updateChunkCoordinates() { diff --git a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaBlastFurnace.java b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaBlastFurnace.java index 722188d9e9d..f33333b9b3a 100644 --- a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaBlastFurnace.java +++ b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaBlastFurnace.java @@ -281,7 +281,8 @@ protected ProcessingLogic createProcessingLogic() { ? CheckRecipeResultRegistry.SUCCESSFUL : CheckRecipeResultRegistry.insufficientHeat(recipe.mSpecialValue); } - }.setHeatOC(true) + }.setOverclock(true) + .setHeatOC(true) .setHeatDiscount(true) .setHeatDiscountMultiplier(0.95) .setMachineHeat(MTEMegaBlastFurnace.this.mHeatingCapacity) diff --git a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaChemicalReactor.java b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaChemicalReactor.java index 9cc18de9b31..f68dc7e44cb 100644 --- a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaChemicalReactor.java +++ b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaChemicalReactor.java @@ -174,7 +174,9 @@ public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrench @Override protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().enablePerfectOverclock() + return new ProcessingLogic() + .setOverclock(true) + .setPerfectOverclock() .setMaxParallel(Configuration.Multiblocks.megaMachinesMax); } diff --git a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaDistillTower.java b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaDistillTower.java index 62697dcb8fd..c4a642eee82 100644 --- a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaDistillTower.java +++ b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaDistillTower.java @@ -385,7 +385,9 @@ public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrench @Override protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setMaxParallel(Configuration.Multiblocks.megaMachinesMax); + return new ProcessingLogic() + .setOverclock(true) + .setMaxParallel(Configuration.Multiblocks.megaMachinesMax); } @Override diff --git a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaOilCracker.java b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaOilCracker.java index 51d8d5ada3b..59fac3ed7f5 100644 --- a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaOilCracker.java +++ b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaOilCracker.java @@ -31,8 +31,6 @@ import java.util.List; import java.util.Map; -import javax.annotation.Nonnull; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -62,7 +60,6 @@ import gregtech.api.metatileentity.implementations.MTEHatchOutput; import gregtech.api.recipe.RecipeMap; import gregtech.api.recipe.RecipeMaps; -import gregtech.api.recipe.check.CheckRecipeResult; import gregtech.api.recipe.maps.OilCrackerBackend; import gregtech.api.render.TextureFactory; import gregtech.api.util.GTUtility; @@ -223,15 +220,10 @@ public RecipeMap<OilCrackerBackend> getRecipeMap() { @Override protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic() { - - @Override - @Nonnull - public CheckRecipeResult process() { - this.setEuModifier(1.0F - Math.min(0.1F * (MTEMegaOilCracker.this.heatLevel.getTier() + 1), 0.5F)); - return super.process(); - } - }.setMaxParallel(Configuration.Multiblocks.megaMachinesMax); + return new ProcessingLogic() + .setOverclock(true) + .setEUtModifier(1 - Math.min(0.1 * (this.heatLevel.getTier() + 1), 0.5)) + .setMaxParallel(Configuration.Multiblocks.megaMachinesMax); } public HeatingCoilLevel getCoilLevel() { diff --git a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaVacuumFreezer.java b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaVacuumFreezer.java index a4f8439c2bc..ab2c00d638e 100644 --- a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaVacuumFreezer.java +++ b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaVacuumFreezer.java @@ -407,7 +407,9 @@ public SubspaceCoolingFluid findSubspaceCoolingFluid() { protected ProcessingLogic createProcessingLogic() { currentCoolingFluid = findSubspaceCoolingFluid(); - return new ProcessingLogic().setHeatOC(true) + return new ProcessingLogic() + .setOverclock(true) + .setHeatOC(true) .setHeatDiscount(false) .setMachineHeat(currentCoolingFluid == null ? 0 : currentCoolingFluid.perfectOverclocks * 1800) .setMaxParallel(Configuration.Multiblocks.megaMachinesMax); diff --git a/src/main/java/goodgenerator/blocks/tileEntity/MTEFuelRefineFactory.java b/src/main/java/goodgenerator/blocks/tileEntity/MTEFuelRefineFactory.java index c7f4d9d9945..d0b55da319e 100644 --- a/src/main/java/goodgenerator/blocks/tileEntity/MTEFuelRefineFactory.java +++ b/src/main/java/goodgenerator/blocks/tileEntity/MTEFuelRefineFactory.java @@ -217,7 +217,7 @@ protected OverclockCalculator createOverclockCalculator(@NotNull GTRecipe recipe int overclockAmount = Tier - recipe.mSpecialValue; return super.createOverclockCalculator(recipe).limitOverclockCount(overclockAmount); } - }.enablePerfectOverclock(); + }.setPerfectOverclock(); } @Override diff --git a/src/main/java/goodgenerator/blocks/tileEntity/MTENeutronActivator.java b/src/main/java/goodgenerator/blocks/tileEntity/MTENeutronActivator.java index d03ad532ac3..39e97a44ee3 100644 --- a/src/main/java/goodgenerator/blocks/tileEntity/MTENeutronActivator.java +++ b/src/main/java/goodgenerator/blocks/tileEntity/MTENeutronActivator.java @@ -53,11 +53,9 @@ import gregtech.api.recipe.RecipeMap; import gregtech.api.recipe.check.CheckRecipeResult; import gregtech.api.render.TextureFactory; -import gregtech.api.util.GTRecipe; import gregtech.api.util.GTUtility; import gregtech.api.util.IGTHatchAdder; import gregtech.api.util.MultiblockTooltipBuilder; -import gregtech.api.util.OverclockCalculator; import tectech.thing.metaTileEntity.multi.base.INameFunction; import tectech.thing.metaTileEntity.multi.base.IStatusFunction; import tectech.thing.metaTileEntity.multi.base.LedStatus; @@ -111,14 +109,6 @@ public MTENeutronActivator(int id, String name, String nameRegional) { protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic() { - @NotNull - @Override - protected OverclockCalculator createOverclockCalculator(@NotNull GTRecipe recipe) { - return OverclockCalculator.ofNoOverclock(recipe) - .setDuration((int) Math.ceil(recipe.mDuration * Math.pow(0.9f, height - 4))) - .setDurationUnderOneTickSupplier(() -> recipe.mDuration * Math.pow(0.9f, height - 4)); - } - @NotNull @Override public CheckRecipeResult process() { @@ -132,10 +122,10 @@ public CheckRecipeResult process() { overwriteOutputItems(ItemRefer.Radioactive_Waste.get(4)); } // NA does not consume power, its hatches do. Set it to 0 to be sure - calculatedEut = 0; + calculatedEUt = 0; return result; } - }; + }.setDurationSupplier((recipe) -> recipe.mDuration * Math.pow(0.9f, this.height - 4)); } @Override diff --git a/src/main/java/gregtech/api/logic/ProcessingLogic.java b/src/main/java/gregtech/api/logic/ProcessingLogic.java index fcc0a1c6fc5..a68b4689f65 100644 --- a/src/main/java/gregtech/api/logic/ProcessingLogic.java +++ b/src/main/java/gregtech/api/logic/ProcessingLogic.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -31,7 +32,6 @@ */ @SuppressWarnings({ "unused", "UnusedReturnValue" }) public class ProcessingLogic { - // Traits protected IVoidable machine; protected IRecipeLockable recipeLockableMachine; @@ -44,16 +44,22 @@ public class ProcessingLogic { protected Supplier<Integer> maxParallelSupplier; protected int batchSize = 1; protected Supplier<RecipeMap<?>> recipeMapSupplier; - protected double euModifier = 1.0; - protected double speedBoost = 1.0; + protected double eutModifier = 1.0; protected long availableVoltage; protected long availableAmperage; protected boolean protectItems; protected boolean protectFluids; - protected double overClockTimeReduction = 2.0; - protected double overClockPowerIncrease = 4.0; protected boolean amperageOC = true; + // Speed related parameters + protected double speedBoost = 1.0; + protected Function<GTRecipe, Double> durationSupplier; + + // Overclock related parameters + protected boolean overclock; + protected Function<Integer, Double> ocEUtModifierSupplier; + protected Function<Integer, Double> ocDurationModifierSupplier; + // Heat related parameters protected boolean heatOC; protected boolean heatDiscount; @@ -63,7 +69,7 @@ public class ProcessingLogic { // Calculated results protected ItemStack[] outputItems; protected FluidStack[] outputFluids; - protected long calculatedEut; + protected long calculatedEUt; protected int duration; protected int calculatedParallels = 0; @@ -179,8 +185,8 @@ public ProcessingLogic setRecipeMapSupplier(Supplier<RecipeMap<?>> supplier) { return this; } - public ProcessingLogic setEuModifier(double modifier) { - this.euModifier = modifier; + public ProcessingLogic setEUtModifier(double eutModifier) { + this.eutModifier = eutModifier; return this; } @@ -189,6 +195,33 @@ public ProcessingLogic setSpeedBonus(double speedModifier) { return this; } + public ProcessingLogic setDurationSupplier(Function<GTRecipe, Double> durationSupplier) { + this.durationSupplier = durationSupplier; + return this; + } + + public ProcessingLogic setOverclock(boolean overclock) { + this.overclock = overclock; + return this; + } + + public ProcessingLogic setOCEUtModifierSupplier(Function<Integer, Double> ocEUtModifierSupplier) { + this.ocEUtModifierSupplier = ocEUtModifierSupplier; + return this; + } + + public ProcessingLogic setOCDurationModifierSupplier(Function<Integer, Double> ocDurationModifierSupplier) { + this.ocDurationModifierSupplier = ocDurationModifierSupplier; + return this; + } + + /** + * Sets overclock ratio to 4/4. + */ + public ProcessingLogic setPerfectOverclock() { + return this.setOCDurationModifierSupplier((overclocks) -> 4.0); + } + /** * Sets voltage of the machine. It doesn't need to be actual voltage (excluding amperage) of the machine; * For example, most of the multiblock machines set maximum possible input power (including amperage) as voltage @@ -214,11 +247,11 @@ public ProcessingLogic setVoidProtection(boolean protectItems, boolean protectFl return this; } - public ProcessingLogic setOverclock(double timeReduction, double powerIncrease) { - this.overClockTimeReduction = timeReduction; - this.overClockPowerIncrease = powerIncrease; - return this; - } + // public ProcessingLogic setOverclock(double timeReduction, double powerIncrease) { + // this.overClockTimeReduction = timeReduction; + // this.overClockPowerIncrease = powerIncrease; + // return this; + // } public ProcessingLogic setHeatOC(boolean heatOC) { this.heatOC = heatOC; @@ -240,13 +273,6 @@ public ProcessingLogic setMachineHeat(int machineHeat) { return this; } - /** - * Sets overclock ratio to 4/4. - */ - public ProcessingLogic enablePerfectOverclock() { - return this.setOverclock(4.0, 4.0); - } - /** * Sets whether the multi should use amperage to OC or not. */ @@ -279,7 +305,7 @@ public ProcessingLogic overwriteOutputFluids(FluidStack... fluidOutputs) { * Overwrites calculated EU/t. */ public ProcessingLogic overwriteCalculatedEut(long calculatedEut) { - this.calculatedEut = calculatedEut; + this.calculatedEUt = calculatedEut; return this; } @@ -302,7 +328,7 @@ public ProcessingLogic clear() { this.specialSlotItem = null; this.outputItems = null; this.outputFluids = null; - this.calculatedEut = 0; + this.calculatedEUt = 0; this.duration = 0; this.calculatedParallels = 0; this.craftingPattern = null; @@ -435,7 +461,7 @@ private CheckRecipeResult applyRecipe(@Nonnull GTRecipe recipe, @Nonnull Process return CheckRecipeResultRegistry.DURATION_OVERFLOW; } - calculatedEut = calculator.getConsumption(); + calculatedEUt = calculator.getConsumption(); double finalDuration = calculateDuration(recipe, helper, calculator); if (finalDuration >= Integer.MAX_VALUE) { @@ -502,7 +528,11 @@ protected ProcessingHelper createProcessingHelper(@Nonnull GTRecipe recipe) { .setMachine(this.machine, this.protectItems, this.protectFluids) .setRecipeLocked(this.recipeLockableMachine, this.isRecipeLocked) .setMaxParallels(this.maxParallel) - .setEUtModifier(this.euModifier) + .setEUtModifier(this.eutModifier) + .setDurationSupplier(this.durationSupplier) + .setOverclock(this.overclock) + .setOCEUtModifierSupplier(this.ocEUtModifierSupplier) + .setOCDurationModifierSupplier(this.ocDurationModifierSupplier) .setBatchMode(this.batchSize > 1) .setBatchModifier(this.batchSize) .setHeatOC(this.heatOC) @@ -542,8 +572,8 @@ public int getDuration() { return duration; } - public long getCalculatedEut() { - return calculatedEut; + public long getCalculatedEUt() { + return calculatedEUt; } public int getCurrentParallels() { diff --git a/src/main/java/gregtech/api/metatileentity/implementations/MTEExtendedPowerMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/MTEExtendedPowerMultiBlockBase.java index 9ff7f34fe3a..9e1243ec06b 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/MTEExtendedPowerMultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/MTEExtendedPowerMultiBlockBase.java @@ -129,7 +129,7 @@ protected CheckRecipeResult postCheckRecipe(@Nonnull CheckRecipeResult result, @Override protected void setEnergyUsage(ProcessingLogic processingLogic) { - lEUt = processingLogic.getCalculatedEut(); + lEUt = processingLogic.getCalculatedEUt(); if (lEUt > 0) { lEUt = (-lEUt); } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java index 34e91a6c33a..8ebdaa942eb 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java @@ -992,7 +992,7 @@ protected CheckRecipeResult checkRecipeForCustomHatches(CheckRecipeResult lastRe @Nonnull protected CheckRecipeResult postCheckRecipe(@Nonnull CheckRecipeResult result, @Nonnull ProcessingLogic processingLogic) { - if (result.wasSuccessful() && processingLogic.getCalculatedEut() > Integer.MAX_VALUE) { + if (result.wasSuccessful() && processingLogic.getCalculatedEUt() > Integer.MAX_VALUE) { return CheckRecipeResultRegistry.POWER_OVERFLOW; } return result; @@ -1004,7 +1004,7 @@ protected CheckRecipeResult postCheckRecipe(@Nonnull CheckRecipeResult result, */ protected void setEnergyUsage(ProcessingLogic processingLogic) { // getCalculatedEut() is guaranteed to not exceed int by postCheckRecipe() - mEUt = (int) processingLogic.getCalculatedEut(); + mEUt = (int) processingLogic.getCalculatedEUt(); if (mEUt > 0) { mEUt = (-mEUt); } diff --git a/src/main/java/gregtech/api/util/ProcessingHelper.java b/src/main/java/gregtech/api/util/ProcessingHelper.java index 1833dcb51ee..1fe0e3fca9b 100644 --- a/src/main/java/gregtech/api/util/ProcessingHelper.java +++ b/src/main/java/gregtech/api/util/ProcessingHelper.java @@ -20,8 +20,10 @@ @SuppressWarnings({ "unused", "UnusedReturnValue" }) public class ProcessingHelper { - private static final double MAX_BATCH_MODE_TICK_TIME = 128; + private static final int HEAT_DISCOUNT_THRESHOLD = 900; + private static final double OC_EUT_MODIFIER = 4; + protected static final double OC_DURATION_MODIFIER = 0.5; /** * Machine used for calculation */ @@ -103,6 +105,20 @@ public class ProcessingHelper { * Modifier which is applied on the recipe eut. Useful for GT++ machines */ private double eutModifier = 1; + /** + * Modifier which is applied the recipe duration. Useful for GT++ machines + */ + private double durationModifier = 1; + /** + * A supplier used for machines which have a custom way of calculating base duration, like Neutron Activator + */ + private Function<GTRecipe, Double> durationSupplier; + /** + * Does this machine perform overclocks? + */ + private boolean overclock; + protected Function<Integer, Double> ocEUtModifierSupplier; + protected Function<Integer, Double> ocDurationModifierSupplier; /** * Multiplier that is applied on the output chances */ @@ -216,6 +232,45 @@ public ProcessingHelper setEUtModifier(double aEUtModifier) { return this; } + /** + * Sets the modifier for recipe duration. 1 does nothing, 2 is twice as slow, 0.5 is twice as fast + */ + @Nonnull + public ProcessingHelper setDurationModifier(double durationModifier) { + this.durationModifier = durationModifier; + return this; + } + + /** + * Set the supplier used for machines which have a custom way of calculating base duration, like Neutron Activator + */ + @Nonnull + public ProcessingHelper setDurationSupplier(Function<GTRecipe, Double> durationSupplier) { + this.durationSupplier = durationSupplier; + return this; + } + + /** + * Sets whether the machine performs overclocks. + */ + @Nonnull + public ProcessingHelper setOverclock(boolean overclock) { + this.overclock = overclock; + return this; + } + + @Nonnull + public ProcessingHelper setOCEUtModifierSupplier(Function<Integer, Double> ocEUtModifierSupplier) { + this.ocEUtModifierSupplier = ocEUtModifierSupplier; + return this; + } + + @Nonnull + public ProcessingHelper setOCDurationModifierSupplier(Function<Integer, Double> ocDurationModifierSupplier) { + this.ocDurationModifierSupplier = ocDurationModifierSupplier; + return this; + } + /** * Sets the multiplier that is applied on output chances. 1 does nothing. 0.9 is 10% less. 1.1 is 10% more. * Only useful for item outputs for sure. @@ -435,9 +490,9 @@ public ProcessingResult process() { Math.min(this.machine.getFluidOutputLimit(), this.recipe.mFluidOutputs.length)); // Calculate heat discount - final double heatDiscount = this.heatDiscount - ? Math.pow(this.heatDiscountMultiplier, Math.max(0, (this.recipe.mSpecialValue - this.machineHeat) / 900)) - : 1; + final double heatDiscount = this.heatDiscount ? Math.pow( + this.heatDiscountMultiplier, + Math.max(0, (this.recipe.mSpecialValue - this.machineHeat) / HEAT_DISCOUNT_THRESHOLD)) : 1; // Check whether there is sufficient energy final int EUt = (int) Math.ceil(this.recipe.mEUt * this.eutModifier * heatDiscount); @@ -445,6 +500,47 @@ public ProcessingResult process() { return ProcessingResult.failure(CheckRecipeResultRegistry.insufficientPower(EUt)); } + // Determine parallels before sub-tick and batch + int parallels = EUt > 0 ? (int) Math.min(this.maxParallels, this.availableEUt / EUt) : this.maxParallels; + + // Determine duration using speed modifier or using custom supplier + double duration = this.durationSupplier == null ? this.recipe.mDuration * this.durationModifier + : this.durationSupplier.apply(this.recipe); + + if (this.overclock) { + double ocEUtModifier = ocEUtModifierSupplier == null ? OC_EUT_MODIFIER : ocEUtModifierSupplier.apply(0); + double ocDurationModifier = ocDurationModifierSupplier == null ? OC_DURATION_MODIFIER : ocDurationModifierSupplier.apply(0); + } + + // public double calculateDurationUnderOneTick() { + // if (noOverclock) return durationInDouble; + // double heatDiscountMultiplier = calculateHeatDiscountMultiplier(); + // if (hasAtLeastOneSupplierBeenSet) { + // int overclockCount = 0; + // double currentEutIncrease = eutIncreasePerOCSupplier.apply(overclockCount + 1); + // double currentDurationDecrease = durationDecreasePerOCSupplier.apply(overclockCount + 1); + // double machinePower = calculateMachinePower(); + // double recipePower = calculateRecipePower(heatDiscountMultiplier); + // while (machinePower > recipePower * currentEutIncrease + // && (!limitOverclocks || overclockCount < maxOverclocks)) { + // recipePower *= currentEutIncrease; + // durationInDouble /= currentDurationDecrease; + // overclockCount++; + // currentEutIncrease = eutIncreasePerOCSupplier.apply(overclockCount + 1); + // currentDurationDecrease = durationDecreasePerOCSupplier.apply(overclockCount + 1); + // } + // } else { + // int maxOverclockCount = calculateAmountOfOverclocks( + // calculateMachinePowerTier(), + // calculateRecipePowerTier(heatDiscountMultiplier)); + // if (limitOverclocks) maxOverclockCount = Math.min(maxOverclocks, maxOverclockCount); + // int heatOverclocks = Math.min(calculateMaxAmountOfHeatOverclocks(), maxOverclockCount); + // durationInDouble /= Math.pow(durationDecreasePerOC, maxOverclockCount - heatOverclocks) + // * Math.pow(durationDecreasePerHeatOC, heatOverclocks); + // } + // return durationInDouble; + // } + // TODO // double overclockedDuration; // int subTickParallels; @@ -474,84 +570,81 @@ public ProcessingResult process() { // } // Let's look at how many parallels we can get with void protection - if (this.protectExcessItem || this.protectExcessFluid) { - if (this.machine == null) { - throw new IllegalStateException("Tried to calculate void protection, but machine is not set"); - } - VoidProtectionHelper voidProtectionHelper = new VoidProtectionHelper(); - voidProtectionHelper.setMachine(machine) - .setItemOutputs(truncatedItemOutputs) - .setFluidOutputs(truncatedFluidOutputs) - .setChangeGetter(recipe::getOutputChance) - .setOutputMultiplier(outputMultiplier) - .setChanceMultiplier(chanceMultiplier) - .setMaxParallel(maxParallels) - .build(); - maxParallels = Math.min(voidProtectionHelper.getMaxParallel(), maxParallels); - if (voidProtectionHelper.isItemFull()) { - return ProcessingResult.failure(CheckRecipeResultRegistry.ITEM_OUTPUT_FULL); - } - if (voidProtectionHelper.isFluidFull()) { - return ProcessingResult.failure(CheckRecipeResultRegistry.FLUID_OUTPUT_FULL); - } - } - - maxParallelBeforeBatchMode = Math.min(maxParallels, maxParallelBeforeBatchMode); - - // determine normal parallel - int actualMaxParallel = EUt > 0 ? (int) Math.min(maxParallelBeforeBatchMode, availableEUt / EUt) - : maxParallelBeforeBatchMode; - if (recipeCheck != null) { - currentParallel = recipeCheck.checkRecipeInputs(true, actualMaxParallel, itemInputs, fluidInputs); - } else { - currentParallel = (int) maxParallelCalculator.calculate(recipe, actualMaxParallel, fluidInputs, itemInputs); - if (currentParallel > 0) { - if (tSingleRecipeCheckBuilder != null) { - // If recipe checker is not built yet, build and set it - inputConsumer.consume(recipe, 1, fluidInputs, itemInputs); - SingleRecipeCheck builtCheck = tSingleRecipeCheckBuilder.setAfter(itemInputs, fluidInputs) - .setRecipe(recipe) - .build(); - singleRecipeMachine.setSingleRecipeCheck(builtCheck); - inputConsumer.consume(recipe, currentParallel - 1, fluidInputs, itemInputs); - } else { - inputConsumer.consume(recipe, currentParallel, fluidInputs, itemInputs); - } - } - } - - if (currentParallel <= 0) { - result = CheckRecipeResultRegistry.INTERNAL_ERROR; - return; - } - - calculator.setCurrentParallel(currentParallel) - .calculate(); - // If Batch Mode is enabled determine how many extra parallels we can get - if (batchMode && currentParallel > 0 && calculator.getDuration() < MAX_BATCH_MODE_TICK_TIME) { - int tExtraParallels; - double batchMultiplierMax = MAX_BATCH_MODE_TICK_TIME / calculator.getDuration(); - final int maxExtraParallels = (int) Math.floor( - Math.min( - currentParallel * Math.min(batchMultiplierMax - 1, batchModifier - 1), - maxParallels - currentParallel)); - if (recipeCheck != null) { - tExtraParallels = recipeCheck.checkRecipeInputs(true, maxExtraParallels, itemInputs, fluidInputs); - } else { - tExtraParallels = (int) maxParallelCalculator - .calculate(recipe, maxExtraParallels, fluidInputs, itemInputs); - inputConsumer.consume(recipe, tExtraParallels, fluidInputs, itemInputs); - } - durationMultiplier = 1.0f + (float) tExtraParallels / currentParallel; - currentParallel += tExtraParallels; - } - - // If we want to calculate outputs we do it here - if (calculateOutputs && currentParallel > 0) { - calculateItemOutputs(truncatedItemOutputs); - calculateFluidOutputs(truncatedFluidOutputs); - } - result = CheckRecipeResultRegistry.SUCCESSFUL; + // if (this.protectExcessItem || this.protectExcessFluid) { + // if (this.machine == null) { + // throw new IllegalStateException("Tried to calculate void protection, but machine is not set"); + // } + // VoidProtectionHelper voidProtectionHelper = new VoidProtectionHelper(); + // voidProtectionHelper.setMachine(machine) + // .setItemOutputs(truncatedItemOutputs) + // .setFluidOutputs(truncatedFluidOutputs) + // .setChangeGetter(recipe::getOutputChance) + // .setOutputMultiplier(outputMultiplier) + // .setChanceMultiplier(chanceMultiplier) + // .setMaxParallel(maxParallels) + // .build(); + // maxParallels = Math.min(voidProtectionHelper.getMaxParallel(), maxParallels); + // if (voidProtectionHelper.isItemFull()) { + // return ProcessingResult.failure(CheckRecipeResultRegistry.ITEM_OUTPUT_FULL); + // } + // if (voidProtectionHelper.isFluidFull()) { + // return ProcessingResult.failure(CheckRecipeResultRegistry.FLUID_OUTPUT_FULL); + // } + // } + // + // maxParallelBeforeBatchMode = Math.min(maxParallels, maxParallelBeforeBatchMode); +// +// if (recipeCheck != null) { +// currentParallel = recipeCheck.checkRecipeInputs(true, actualMaxParallel, itemInputs, fluidInputs); +// } else { +// currentParallel = (int) maxParallelCalculator.calculate(recipe, actualMaxParallel, fluidInputs, itemInputs); +// if (currentParallel > 0) { +// if (tSingleRecipeCheckBuilder != null) { +// // If recipe checker is not built yet, build and set it +// inputConsumer.consume(recipe, 1, fluidInputs, itemInputs); +// SingleRecipeCheck builtCheck = tSingleRecipeCheckBuilder.setAfter(itemInputs, fluidInputs) +// .setRecipe(recipe) +// .build(); +// singleRecipeMachine.setSingleRecipeCheck(builtCheck); +// inputConsumer.consume(recipe, currentParallel - 1, fluidInputs, itemInputs); +// } else { +// inputConsumer.consume(recipe, currentParallel, fluidInputs, itemInputs); +// } +// } +// } +// +// if (currentParallel <= 0) { +// result = CheckRecipeResultRegistry.INTERNAL_ERROR; +// return; +// } +// +// calculator.setCurrentParallel(currentParallel) +// .calculate(); +// // If Batch Mode is enabled determine how many extra parallels we can get +// if (batchMode && currentParallel > 0 && calculator.getDuration() < MAX_BATCH_MODE_TICK_TIME) { +// int tExtraParallels; +// double batchMultiplierMax = MAX_BATCH_MODE_TICK_TIME / calculator.getDuration(); +// final int maxExtraParallels = (int) Math.floor( +// Math.min( +// currentParallel * Math.min(batchMultiplierMax - 1, batchModifier - 1), +// maxParallels - currentParallel)); +// if (recipeCheck != null) { +// tExtraParallels = recipeCheck.checkRecipeInputs(true, maxExtraParallels, itemInputs, fluidInputs); +// } else { +// tExtraParallels = (int) maxParallelCalculator +// .calculate(recipe, maxExtraParallels, fluidInputs, itemInputs); +// inputConsumer.consume(recipe, tExtraParallels, fluidInputs, itemInputs); +// } +// durationMultiplier = 1.0f + (float) tExtraParallels / currentParallel; +// currentParallel += tExtraParallels; +// } +// +// // If we want to calculate outputs we do it here +// if (calculateOutputs && currentParallel > 0) { +// calculateItemOutputs(truncatedItemOutputs); +// calculateFluidOutputs(truncatedFluidOutputs); +// } + return ProcessingResult.success(CheckRecipeResultRegistry.SUCCESSFUL); } private void calculateItemOutputs(ItemStack[] truncatedItemOutputs) { diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEDistillationTower.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEDistillationTower.java index e736415be48..06332aee352 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEDistillationTower.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEDistillationTower.java @@ -188,7 +188,7 @@ public boolean isCorrectMachinePart(ItemStack aStack) { @Override protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic(); + return new ProcessingLogic().setOverclock(true); } protected void onCasingFound() { diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEElectricBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEElectricBlastFurnace.java index 7999fdaf591..801b472a045 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEElectricBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEElectricBlastFurnace.java @@ -165,13 +165,13 @@ public IStructureDefinition<MTEElectricBlastFurnace> getStructureDefinition() { @Override protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic() { - @Override protected @Nonnull CheckRecipeResult validateRecipe(@Nonnull GTRecipe recipe) { return recipe.mSpecialValue <= mHeatingCapacity ? CheckRecipeResultRegistry.SUCCESSFUL : CheckRecipeResultRegistry.insufficientHeat(recipe.mSpecialValue); } - }.setHeatOC(true) + }.setOverclock(true) + .setHeatOC(true) .setHeatDiscount(true) .setHeatDiscountMultiplier(0.95) .setMachineHeat(this.mHeatingCapacity); diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEImplosionCompressor.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEImplosionCompressor.java index 5a0155b12fe..fa4ec5d89b8 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEImplosionCompressor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEImplosionCompressor.java @@ -117,7 +117,7 @@ public boolean isCorrectMachinePart(ItemStack aStack) { @Override protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic(); + return new ProcessingLogic().setOverclock(true); } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialBrewery.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialBrewery.java index 8f2c6d6c240..f125c4c5eb0 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialBrewery.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialBrewery.java @@ -195,7 +195,9 @@ protected void setProcessingLogicPower(ProcessingLogic logic) { @Override protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setSpeedBonus(1F / 1.5F) + return new ProcessingLogic() + .setOverclock(true) + .setSpeedBonus(1F / 1.5F) .setMaxParallelSupplier(this::getMaxParallelRecipes); } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialElectromagneticSeparator.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialElectromagneticSeparator.java index d4bcd9e2f2e..e4cea422178 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialElectromagneticSeparator.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialElectromagneticSeparator.java @@ -282,7 +282,7 @@ protected CheckRecipeResult validateRecipe(@Nonnull GTRecipe recipe) { if (magnetTier != null) { if (!mExoticEnergyHatches.isEmpty() && !magnetTier.supportsExotic) return SimpleCheckRecipeResult.ofFailure("electromagnet_insufficient"); - euModifier = magnetTier.euModifier; + eutModifier = magnetTier.euModifier; speedBoost = magnetTier.speedBoost; return CheckRecipeResultRegistry.SUCCESSFUL; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialExtractor.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialExtractor.java index 9cf147b4f48..33d9e737092 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialExtractor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialExtractor.java @@ -211,7 +211,7 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic().setSpeedBonus(1F / 3F) .setMaxParallelSupplier(this::getMaxParallelRecipes) - .setEuModifier(0.85F); + .setEUtModifier(0.85F); } public int getMaxParallelRecipes() { diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialLaserEngraver.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialLaserEngraver.java index 767d765e7f9..adb70b7b881 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialLaserEngraver.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialLaserEngraver.java @@ -368,7 +368,7 @@ public ProcessingLogic clear() { return super.clear(); } }.setSpeedBonus(1F / 3.5F) - .setEuModifier(0.8F) + .setEUtModifier(0.8F) .setMaxParallelSupplier(this::getMaxParallelRecipes); } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeChemicalReactor.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeChemicalReactor.java index 4eb9ad48409..0de33b07f9a 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeChemicalReactor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeChemicalReactor.java @@ -165,7 +165,7 @@ public RecipeMap<?> getRecipeMap() { @Override protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().enablePerfectOverclock(); + return new ProcessingLogic().setPerfectOverclock(); } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeFluidExtractor.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeFluidExtractor.java index d0f807c173f..a6b841b4f8d 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeFluidExtractor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeFluidExtractor.java @@ -207,7 +207,7 @@ protected void setProcessingLogicPower(ProcessingLogic logic) { logic.setAmperageOC(true); logic.setAvailableVoltage(GTUtility.roundUpVoltage(this.getMaxInputVoltage())); logic.setAvailableAmperage(1); - logic.setEuModifier(getEUMultiplier()); + logic.setEUtModifier(getEUMultiplier()); logic.setMaxParallel(getParallels()); logic.setSpeedBonus(1.0f / getSpeedBonus()); } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiAutoclave.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiAutoclave.java index 6cd585859d2..6be717f5544 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiAutoclave.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiAutoclave.java @@ -320,7 +320,7 @@ protected ProcessingLogic createProcessingLogic() { @Override @Nonnull public CheckRecipeResult process() { - euModifier = euModifier(fluidPipeTier); + eutModifier = euModifier(fluidPipeTier); speedBoost = speedBoost(getCoilTier()); return super.process(); } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiLathe.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiLathe.java index ea42aea04a0..3627cf0c4bf 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiLathe.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiLathe.java @@ -251,7 +251,7 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a @Override protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic().setSpeedBonus(1F / 4F) - .setEuModifier(0.8F) + .setEUtModifier(0.8F) .setMaxParallelSupplier(this::getMaxParallelRecipes); } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiSolidifier.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiSolidifier.java index ee5b8b52f2d..ff15f70e820 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiSolidifier.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiSolidifier.java @@ -340,7 +340,7 @@ protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { return super.validateRecipe(recipe); } }.setMaxParallelSupplier(this::getMaxParallelRecipes) - .setEuModifier(0.8F); + .setEUtModifier(0.8F); } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEOilCracker.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEOilCracker.java index 885d9e90fe0..4f08d05800e 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEOilCracker.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEOilCracker.java @@ -175,7 +175,7 @@ protected ProcessingLogic createProcessingLogic() { @Nonnull @Override public CheckRecipeResult process() { - setEuModifier(1.0F - Math.min(0.1F * (heatLevel.getTier() + 1), 0.5F)); + setEUtModifier(1.0F - Math.min(0.1F * (heatLevel.getTier() + 1), 0.5F)); return super.process(); } }; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEPCBFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEPCBFactory.java index db509b9fd1b..8d9ebe8c612 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEPCBFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEPCBFactory.java @@ -589,7 +589,7 @@ protected CheckRecipeResult validateRecipe(@Nonnull GTRecipe recipe) { @Nonnull @Override protected OverclockCalculator createOverclockCalculator(@Nonnull GTRecipe recipe) { - return super.createOverclockCalculator(recipe).setNoOverclock(isNoOC()) + return super.createOverclockCalculator(recipe) .setEUtDiscount(Math.sqrt(mUpgradesInstalled == 0 ? 1 : mUpgradesInstalled)) .setSpeedBoost(getDurationMultiplierFromRoughness()) .setDurationDecreasePerOC(mOCTier2 ? 4.0 : 2.0); @@ -602,11 +602,7 @@ protected ProcessingHelper createProcessingHelper(@Nonnull GTRecipe recipe) { .setEUtModifier((float) Math.sqrt(mUpgradesInstalled == 0 ? 1 : mUpgradesInstalled)) .setChanceMultiplier(mRoughnessMultiplier); } - }; - } - - private boolean isNoOC() { - return !mOCTier1 && !mOCTier2; + }.setOverclock(this.mOCTier1 || this.mOCTier2); } private double getDurationMultiplierFromRoughness() { @@ -622,7 +618,7 @@ public boolean onRunningTick(ItemStack aStack) { } if (ticker % 20 == 0) { - if (!isNoOC()) { + if (this.mOCTier1 || this.mOCTier2) { FluidStack tFluid = mOCTier1 ? GTModHandler.getDistilledWater(COOLANT_CONSUMED_PER_SEC) : Materials.SuperCoolant.getFluid(COOLANT_CONSUMED_PER_SEC); if (!drain(mCoolantInputHatch, tFluid, true)) { diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java b/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java index f595e0b16d8..a48ed06c850 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java @@ -599,7 +599,7 @@ protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { return super.validateRecipe(recipe); } }.setMaxParallelSupplier(this::getMaxParallelRecipes) - .setEuModifier(0.7F) + .setEUtModifier(0.7F) .setSpeedBonus(0.2F); } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEHIPCompressor.java b/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEHIPCompressor.java index 0c716e975a3..ba9b1235e7f 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEHIPCompressor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEHIPCompressor.java @@ -369,14 +369,14 @@ protected ProcessingLogic createProcessingLogic() { @Override protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { setSpeedBonus(1F / 3.5F); - setEuModifier(0.75F); + setEUtModifier(0.75F); int recipeReq = recipe.getMetadataOrDefault(CompressionTierKey.INSTANCE, 0); // Nerf when heated if (overheated) { setSpeedBonus(2.5F); - setEuModifier(1.1F); + setEUtModifier(1.1F); } // If HIP required, check for overheat and potentially crash diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEIndustrialCompressor.java b/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEIndustrialCompressor.java index bd8fc806cbc..d6dfb112785 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEIndustrialCompressor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEIndustrialCompressor.java @@ -202,7 +202,7 @@ protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { } }.setSpeedBonus(1F / 2F) .setMaxParallelSupplier(this::getMaxParallelRecipes) - .setEuModifier(0.9F); + .setEUtModifier(0.9F); } public int getMaxParallelRecipes() { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/MTEAmazonPackager.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/MTEAmazonPackager.java index c1e245350af..1007b71e39e 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/MTEAmazonPackager.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/MTEAmazonPackager.java @@ -159,7 +159,7 @@ public Collection<RecipeMap<?>> getAvailableRecipeMaps() { @Override protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic().setSpeedBonus(1F / 6F) - .setEuModifier(0.75F) + .setEUtModifier(0.75F) .setMaxParallelSupplier(this::getMaxParallelRecipes); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialCentrifuge.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialCentrifuge.java index 19895c83742..5e1b109cda1 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialCentrifuge.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialCentrifuge.java @@ -175,7 +175,7 @@ public RecipeMap<?> getRecipeMap() { @Override protected ProcessingLogic createProcessingLogic() { - return new ProcessingLogic().setEuModifier(0.9F) + return new ProcessingLogic().setEUtModifier(0.9F) .setSpeedBonus(1F / 2.25F) .setMaxParallelSupplier(this::getMaxParallelRecipes); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialChisel.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialChisel.java index bffce15245f..d0577a8a0a0 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialChisel.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialChisel.java @@ -294,7 +294,7 @@ protected Stream<GTRecipe> findRecipeMatches(@Nullable RecipeMap<?> map) { return GTStreamUtil.ofNullable(getRecipe()); } }.setSpeedBonus(1F / 3F) - .setEuModifier(0.75F) + .setEUtModifier(0.75F) .setMaxParallelSupplier(this::getMaxParallelRecipes); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialCokeOven.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialCokeOven.java index e7aab5d0f72..c8f71bb5fbe 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialCokeOven.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialCokeOven.java @@ -191,7 +191,7 @@ protected ProcessingLogic createProcessingLogic() { @Override protected void setupProcessingLogic(ProcessingLogic logic) { super.setupProcessingLogic(logic); - logic.setEuModifier((100F - (GTUtility.getTier(getMaxInputVoltage()) * 4)) / 100F); + logic.setEUtModifier((100F - (GTUtility.getTier(getMaxInputVoltage()) * 4)) / 100F); } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialCuttingMachine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialCuttingMachine.java index 907c895770e..e1e42b6d964 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialCuttingMachine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialCuttingMachine.java @@ -184,7 +184,7 @@ public int getRecipeCatalystPriority() { @Override protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic().setSpeedBonus(1F / 3F) - .setEuModifier(0.75F) + .setEUtModifier(0.75F) .setMaxParallelSupplier(this::getMaxParallelRecipes); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialDehydrator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialDehydrator.java index 88d9b29debf..39a17594a47 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialDehydrator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialDehydrator.java @@ -226,7 +226,7 @@ protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { .setHeatDiscountMultiplier(0.95) .setMachineHeat((int) getCoilLevel().getHeat()) .setSpeedBonus(1F / 2.2F) - .setEuModifier(0.5F) + .setEUtModifier(0.5F) .setMaxParallelSupplier(this::getMaxParallelRecipes); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialFluidHeater.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialFluidHeater.java index 5766a973142..58b1d4a04dd 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialFluidHeater.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialFluidHeater.java @@ -166,7 +166,7 @@ public RecipeMap<?> getRecipeMap() { @Override protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic().setSpeedBonus(1F / 2.2F) - .setEuModifier(0.9F) + .setEUtModifier(0.9F) .setMaxParallelSupplier(this::getMaxParallelRecipes); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialMultiMachine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialMultiMachine.java index f8117df4802..c6055ee0e65 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialMultiMachine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialMultiMachine.java @@ -346,7 +346,7 @@ protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { return super.validateRecipe(recipe); } }.setSpeedBonus(1F / 3.5F) - .setEuModifier(0.8F) + .setEUtModifier(0.8F) .setMaxParallelSupplier(this::getMaxParallelRecipes); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialSifter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialSifter.java index fca1e1d16f1..3c0c50b4c92 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialSifter.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialSifter.java @@ -188,7 +188,7 @@ public void onPreTick(final IGregTechTileEntity aBaseMetaTileEntity, final long @Override protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic().setSpeedBonus(1F / 5F) - .setEuModifier(0.75F) + .setEUtModifier(0.75F) .setMaxParallelSupplier(this::getMaxParallelRecipes); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialThermalCentrifuge.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialThermalCentrifuge.java index 5b69b59a50b..5f1914f7df1 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialThermalCentrifuge.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialThermalCentrifuge.java @@ -156,7 +156,7 @@ public RecipeMap<?> getRecipeMap() { @Override protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic().setSpeedBonus(1F / 2.5F) - .setEuModifier(0.8F) + .setEUtModifier(0.8F) .setMaxParallelSupplier(this::getMaxParallelRecipes); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialWireMill.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialWireMill.java index da6ace66776..e04d7eaf4d1 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialWireMill.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialWireMill.java @@ -161,7 +161,7 @@ public int getRecipeCatalystPriority() { @Override protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic().setSpeedBonus(1F / 3F) - .setEuModifier(0.75F) + .setEUtModifier(0.75F) .setMaxParallelSupplier(this::getMaxParallelRecipes); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIsaMill.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIsaMill.java index f09d57236ba..00a0782aedf 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIsaMill.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIsaMill.java @@ -519,6 +519,6 @@ public CheckRecipeResult process() { } return result; } - }.enablePerfectOverclock(); + }.setPerfectOverclock(); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEndustrialElectrolyzer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEndustrialElectrolyzer.java index 912cfb0cad3..a5e5e2f08dd 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEndustrialElectrolyzer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEndustrialElectrolyzer.java @@ -149,7 +149,7 @@ public RecipeMap<?> getRecipeMap() { @Override protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic().setSpeedBonus(1F / 2.8F) - .setEuModifier(0.9F) + .setEUtModifier(0.9F) .setMaxParallelSupplier(this::getMaxParallelRecipes); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvDistillationTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvDistillationTower.java index 3719d02bd17..a866e6c19bd 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvDistillationTower.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvDistillationTower.java @@ -391,7 +391,7 @@ protected ProcessingLogic createProcessingLogic() { @Override protected void setupProcessingLogic(ProcessingLogic logic) { super.setupProcessingLogic(logic); - logic.setEuModifier(mMode == Mode.Distillery ? 0.15F : 1F); + logic.setEUtModifier(mMode == Mode.Distillery ? 0.15F : 1F); logic.setSpeedBonus(mMode == Mode.Distillery ? 1F / 2F : 1F / 3.5F); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvEBF.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvEBF.java index df81137713d..e9238b380d1 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvEBF.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvEBF.java @@ -247,7 +247,7 @@ protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { }.setHeatOC(true) .setHeatDiscount(true) .setSpeedBonus(1F / 2.2F) - .setEuModifier(0.9F) + .setEUtModifier(0.9F) .setMaxParallelSupplier(this::getMaxParallelRecipes); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvFusionMk4.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvFusionMk4.java index aa6e66c9ca8..ba455bb4554 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvFusionMk4.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvFusionMk4.java @@ -106,7 +106,7 @@ public int getFusionCoilMeta() { @Override protected ProcessingLogic createProcessingLogic() { - return super.createProcessingLogic().enablePerfectOverclock(); + return super.createProcessingLogic().setPerfectOverclock(); } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvFusionMk5.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvFusionMk5.java index 90946f54401..c375fad3e76 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvFusionMk5.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvFusionMk5.java @@ -106,7 +106,7 @@ public int getFusionCoilMeta() { @Override protected ProcessingLogic createProcessingLogic() { - return super.createProcessingLogic().enablePerfectOverclock(); + return super.createProcessingLogic().setPerfectOverclock(); } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEElementalDuplicator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEElementalDuplicator.java index 5a6392785c5..b6dd4b31a84 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEElementalDuplicator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEElementalDuplicator.java @@ -297,7 +297,7 @@ public boolean isCorrectMachinePart(final ItemStack aStack) { @Override protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic().setSpeedBonus(1F / 2F) - .enablePerfectOverclock() + .setPerfectOverclock() .setMaxParallelSupplier(this::getMaxParallelRecipes); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEFrothFlotationCell.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEFrothFlotationCell.java index b7963b6cc94..5153ec16a44 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEFrothFlotationCell.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEFrothFlotationCell.java @@ -233,7 +233,7 @@ protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { } return CheckRecipeResultRegistry.SUCCESSFUL; } - }.enablePerfectOverclock(); + }.setPerfectOverclock(); } /* diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEIndustrialRockBreaker.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEIndustrialRockBreaker.java index 79c445e1978..8ffbca6d216 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEIndustrialRockBreaker.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEIndustrialRockBreaker.java @@ -213,7 +213,7 @@ protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { return CheckRecipeResultRegistry.SUCCESSFUL; } }.setSpeedBonus(1 / 3.0) - .setEuModifier(0.75) + .setEUtModifier(0.75) .setMaxParallelSupplier(this::getMaxParallelRecipes); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEMassFabricator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEMassFabricator.java index 9ac356b7078..f2e43a7e86f 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEMassFabricator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEMassFabricator.java @@ -305,14 +305,14 @@ protected Stream<GTRecipe> findRecipeMatches(@Nullable RecipeMap<?> map) { } return super.findRecipeMatches(map); } - }.setEuModifier(0.8F) + }.setEUtModifier(0.8F) .setMaxParallelSupplier(this::getMaxParallelRecipes); } @Override protected void setupProcessingLogic(ProcessingLogic logic) { super.setupProcessingLogic(logic); - logic.enablePerfectOverclock(); + logic.setPerfectOverclock(); } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTETreeFarm.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTETreeFarm.java index 85849832d4c..ef18d8b0a93 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTETreeFarm.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTETreeFarm.java @@ -375,7 +375,7 @@ public CheckRecipeResult process() { } duration = TICKS_PER_OPERATION; - calculatedEut = GTValues.VP[tier]; + calculatedEUt = GTValues.VP[tier]; for (Mode mode : MODE_VALUES) { if (outputPerMode.get(mode) != null) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/MTEAlgaePondBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/MTEAlgaePondBase.java index 3f22b85c59d..0f0d631e491 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/MTEAlgaePondBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/MTEAlgaePondBase.java @@ -358,7 +358,7 @@ protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { } return CheckRecipeResultRegistry.SUCCESSFUL; } - }.setEuModifier(0F) + }.setEUtModifier(0F) .setMaxParallelSupplier(this::getMaxParallelRecipes); } diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEExoticModule.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEExoticModule.java index 71e68ae91b7..b4be1da2db7 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEExoticModule.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEExoticModule.java @@ -171,7 +171,7 @@ protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { @NotNull @Override protected CheckRecipeResult onRecipeStart(@NotNull GTRecipe recipe) { - EUt = calculatedEut; + EUt = calculatedEUt; powerForRecipe = BigInteger.valueOf(EUt) .multiply(BigInteger.valueOf(duration * actualParallel)); @@ -203,7 +203,7 @@ protected void setProcessingLogicPower(ProcessingLogic logic) { logic.setAvailableAmperage(Integer.MAX_VALUE); logic.setAmperageOC(false); logic.setSpeedBonus(getSpeedBonus()); - logic.setEuModifier(getEnergyDiscount()); + logic.setEUtModifier(getEnergyDiscount()); } @Override diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEMoltenModule.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEMoltenModule.java index b978d22db80..393762725c7 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEMoltenModule.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEMoltenModule.java @@ -82,15 +82,15 @@ protected OverclockCalculator createOverclockCalculator(@NotNull GTRecipe recipe @NotNull @Override protected CheckRecipeResult onRecipeStart(@NotNull GTRecipe recipe) { - if (!addEUToGlobalEnergyMap(userUUID, -calculatedEut * duration)) { - return CheckRecipeResultRegistry.insufficientPower(calculatedEut * duration); + if (!addEUToGlobalEnergyMap(userUUID, -calculatedEUt * duration)) { + return CheckRecipeResultRegistry.insufficientPower(calculatedEUt * duration); } addToPowerTally( - BigInteger.valueOf(calculatedEut) + BigInteger.valueOf(calculatedEUt) .multiply(BigInteger.valueOf(duration))); addToRecipeTally(calculatedParallels); currentParallel = calculatedParallels; - EUt = calculatedEut; + EUt = calculatedEUt; overwriteCalculatedEut(0); return CheckRecipeResultRegistry.SUCCESSFUL; } @@ -106,7 +106,7 @@ protected void setProcessingLogicPower(ProcessingLogic logic) { logic.setAmperageOC(false); logic.setMaxParallel(getMaxParallel()); logic.setSpeedBonus(getSpeedBonus()); - logic.setEuModifier(getEnergyDiscount()); + logic.setEUtModifier(getEnergyDiscount()); } @Override diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEPlasmaModule.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEPlasmaModule.java index 48a4388048f..dddaec84a01 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEPlasmaModule.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEPlasmaModule.java @@ -91,15 +91,15 @@ protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { @Override protected CheckRecipeResult onRecipeStart(@NotNull GTRecipe recipe) { wirelessEUt = (long) recipe.mEUt * maxParallel; - if (!addEUToGlobalEnergyMap(userUUID, -calculatedEut * duration)) { + if (!addEUToGlobalEnergyMap(userUUID, -calculatedEUt * duration)) { return CheckRecipeResultRegistry.insufficientPower(wirelessEUt * recipe.mDuration); } addToPowerTally( - BigInteger.valueOf(calculatedEut) + BigInteger.valueOf(calculatedEUt) .multiply(BigInteger.valueOf(duration))); addToRecipeTally(calculatedParallels); currentParallel = calculatedParallels; - EUt = calculatedEut; + EUt = calculatedEUt; overwriteCalculatedEut(0); return CheckRecipeResultRegistry.SUCCESSFUL; } @@ -120,7 +120,7 @@ protected void setProcessingLogicPower(ProcessingLogic logic) { logic.setAmperageOC(false); logic.setMaxParallel(getMaxParallel()); logic.setSpeedBonus(getSpeedBonus()); - logic.setEuModifier(getEnergyDiscount()); + logic.setEUtModifier(getEnergyDiscount()); } @Override diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTESmeltingModule.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTESmeltingModule.java index 4e233695e76..c37e2e0dbef 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTESmeltingModule.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTESmeltingModule.java @@ -107,17 +107,17 @@ protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { @NotNull @Override protected CheckRecipeResult onRecipeStart(@NotNull GTRecipe recipe) { - if (!addEUToGlobalEnergyMap(userUUID, -calculatedEut * duration)) { - return CheckRecipeResultRegistry.insufficientPower(calculatedEut * duration); + if (!addEUToGlobalEnergyMap(userUUID, -calculatedEUt * duration)) { + return CheckRecipeResultRegistry.insufficientPower(calculatedEUt * duration); } addToPowerTally( - BigInteger.valueOf(calculatedEut) + BigInteger.valueOf(calculatedEUt) .multiply(BigInteger.valueOf(duration))); if (!furnaceMode) { addToRecipeTally(calculatedParallels); } currentParallel = calculatedParallels; - EUt = calculatedEut; + EUt = calculatedEUt; overwriteCalculatedEut(0); return CheckRecipeResultRegistry.SUCCESSFUL; } @@ -143,7 +143,7 @@ protected void setProcessingLogicPower(ProcessingLogic logic) { logic.setAmperageOC(false); logic.setMaxParallel(getMaxParallel()); logic.setSpeedBonus(getSpeedBonus()); - logic.setEuModifier(getEnergyDiscount()); + logic.setEUtModifier(getEnergyDiscount()); } @Override