From b6f7c5da89d80ee2b4a73951f1063217e02f215c Mon Sep 17 00:00:00 2001 From: Alex Bee Date: Sun, 3 Dec 2023 12:26:45 +0000 Subject: Plasma Mixer: only consume power when recipe starts. Fixes #14895. (#2375) --- src/main/java/gregtech/api/logic/ProcessingLogic.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/main/java/gregtech/api') diff --git a/src/main/java/gregtech/api/logic/ProcessingLogic.java b/src/main/java/gregtech/api/logic/ProcessingLogic.java index 4758af3254..803abafbe3 100644 --- a/src/main/java/gregtech/api/logic/ProcessingLogic.java +++ b/src/main/java/gregtech/api/logic/ProcessingLogic.java @@ -378,6 +378,11 @@ public class ProcessingLogic { } duration = (int) finalDuration; + CheckRecipeResult hookResult = onRecipeStart(recipe); + if (!hookResult.wasSuccessful()) { + return hookResult; + } + outputItems = helper.getItemOutputs(); outputFluids = helper.getFluidOutputs(); @@ -471,6 +476,19 @@ public class ProcessingLogic { .setEUtIncreasePerOC(overClockPowerIncrease); } + /** + * Override to perform additional logic when recipe starts. + * + * This is called when the recipe processing logic has finished all + * checks, consumed all inputs, but has not yet set the outputs to + * be produced. Returning a result other than SUCCESSFUL will void + * all inputs! + */ + @Nonnull + protected CheckRecipeResult onRecipeStart(@Nonnull GT_Recipe recipe) { + return CheckRecipeResultRegistry.SUCCESSFUL; + } + // endregion // region Getters -- cgit