From 82f025ddc03e753426546dd5794bc37775d51689 Mon Sep 17 00:00:00 2001 From: HoleFish <1594248739@qq.com> Date: Mon, 26 Feb 2024 23:56:54 +0800 Subject: [PATCH 1/2] fix --- .../tileentities/multis/GT_TileEntity_BioVat.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java index 9778d5b63..93be4fb8c 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java @@ -260,14 +260,24 @@ protected CheckRecipeResult validateRecipe(@NotNull GT_Recipe recipe) { @NotNull @Override protected GT_ParallelHelper createParallelHelper(@NotNull GT_Recipe recipe) { - return super.createParallelHelper(recipeWithMultiplier(recipe)); + return super.createParallelHelper(recipeWithMultiplier(recipe, inputFluids)); } }; } - protected GT_Recipe recipeWithMultiplier(GT_Recipe recipe) { + protected GT_Recipe recipeWithMultiplier(GT_Recipe recipe, FluidStack[] fluidInputs) { GT_Recipe tRecipe = recipe.copy(); int multiplier = getExpectedMultiplier(recipe.getFluidOutput(0), true); + mExpectedMultiplier = multiplier; + long fluidAmount = 0; + for (FluidStack fluid : fluidInputs) { + if (recipe.mFluidInputs[0].isFluidEqual(fluid)) { + fluidAmount += fluid.amount; + } + } + multiplier = (int) Math.min(multiplier, fluidAmount / recipe.mFluidInputs[0].amount); + multiplier = Math.max(multiplier, 1); + mTimes = multiplier; tRecipe.mFluidInputs[0].amount *= multiplier; tRecipe.mFluidOutputs[0].amount *= multiplier; return tRecipe; From bf08cb2980bab40acbd08514536bc6e5faa49bbe Mon Sep 17 00:00:00 2001 From: HoleFish <1594248739@qq.com> Date: Tue, 27 Feb 2024 11:33:31 +0800 Subject: [PATCH 2/2] add comments --- .../common/tileentities/multis/GT_TileEntity_BioVat.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java index 93be4fb8c..fa2f7e959 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java @@ -269,6 +269,7 @@ protected GT_Recipe recipeWithMultiplier(GT_Recipe recipe, FluidStack[] fluidInp GT_Recipe tRecipe = recipe.copy(); int multiplier = getExpectedMultiplier(recipe.getFluidOutput(0), true); mExpectedMultiplier = multiplier; + // Calculate max multiplier limited by input fluids long fluidAmount = 0; for (FluidStack fluid : fluidInputs) { if (recipe.mFluidInputs[0].isFluidEqual(fluid)) { @@ -276,6 +277,7 @@ protected GT_Recipe recipeWithMultiplier(GT_Recipe recipe, FluidStack[] fluidInp } } multiplier = (int) Math.min(multiplier, fluidAmount / recipe.mFluidInputs[0].amount); + // In case multiplier is 0 multiplier = Math.max(multiplier, 1); mTimes = multiplier; tRecipe.mFluidInputs[0].amount *= multiplier;