From 5c55677074291927db1cf6ff2a9de208d86e2cac Mon Sep 17 00:00:00 2001 From: Maxim Date: Sat, 22 Jul 2023 14:42:04 +0200 Subject: Exposed recipe consumption via method (#2162) * Exposed recipe consumption via method --- src/main/java/gregtech/api/util/GT_ParallelHelper.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/api/util/GT_ParallelHelper.java b/src/main/java/gregtech/api/util/GT_ParallelHelper.java index 46a646356d..47b8ba17fb 100644 --- a/src/main/java/gregtech/api/util/GT_ParallelHelper.java +++ b/src/main/java/gregtech/api/util/GT_ParallelHelper.java @@ -288,6 +288,18 @@ public class GT_ParallelHelper { return mFluidOutputs; } + /** + * Try to consume the inputs of the recipe + * + * @param recipe Processed recipe + * @param fluids fluid inputs that will be consumed + * @param items item inputs that will be consumed + * @return True if recipe was satisfied, else false + */ + protected boolean tryConsumeRecipeInputs(GT_Recipe recipe, FluidStack[] fluids, ItemStack[] items) { + return recipe.isRecipeInputEqual(true, false, fluids, items); + } + /** * Called by build(). Determines the parallels and everything else that needs to be done at build time */ @@ -366,7 +378,7 @@ public class GT_ParallelHelper { boolean builtRecipeCheck = false; for (; mCurrentParallel < maxParallelBeforeBatchMode && tCurrentUsage < (mAvailableEUt - tRecipeEUt); mCurrentParallel++) { - if (!mRecipe.isRecipeInputEqual(true, false, tFluidInputs, tItemInputs)) { + if (!tryConsumeRecipeInputs(mRecipe, tFluidInputs, tItemInputs)) { break; } tCurrentUsage += tRecipeEUt; @@ -390,7 +402,7 @@ public class GT_ParallelHelper { tExtraParallels = recipeCheck.checkRecipeInputs(true, maxExtraParallels, tItemInputs, tFluidInputs); } else { while (tExtraParallels < maxExtraParallels - && mRecipe.isRecipeInputEqual(true, false, tFluidInputs, tItemInputs)) { + && tryConsumeRecipeInputs(mRecipe, tFluidInputs, tItemInputs)) { tExtraParallels++; } } -- cgit