Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Commit

Permalink
Fix Bio Vat internal error & scanner info (#394)
Browse files Browse the repository at this point in the history
* fix

* add comments

Former-commit-id: df5dbc939bfdb9bc26220a8a12f1d8e491970939
  • Loading branch information
HoleFish authored Feb 28, 2024
1 parent d8631ee commit 25d75e9
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,26 @@ 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;
// Calculate max multiplier limited by input fluids
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);
// In case multiplier is 0
multiplier = Math.max(multiplier, 1);
mTimes = multiplier;
tRecipe.mFluidInputs[0].amount *= multiplier;
tRecipe.mFluidOutputs[0].amount *= multiplier;
return tRecipe;
Expand Down

0 comments on commit 25d75e9

Please sign in to comment.