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

Commit

Permalink
Calculate multiplier in a new way
Browse files Browse the repository at this point in the history
Former-commit-id: 248075afe831a1e100aa53933275284094f21d03
  • Loading branch information
HoleFish committed Jan 23, 2024
1 parent 06f9319 commit 279f422
Showing 1 changed file with 11 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
import gregtech.api.recipe.check.CheckRecipeResultRegistry;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_ParallelHelper;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;

Expand Down Expand Up @@ -258,26 +259,20 @@ protected CheckRecipeResult validateRecipe(@NotNull GT_Recipe recipe) {

@NotNull
@Override
public CheckRecipeResult process() {
CheckRecipeResult result = super.process();
if (!result.wasSuccessful()) {
return result;
}
// We already made sure the recipe runs. Now the vat looks for as many "parallels" as it can do
GT_TileEntity_BioVat.this.mExpectedMultiplier = GT_TileEntity_BioVat.this
.getExpectedMultiplier(this.lastRecipe.getFluidOutput(0), true);
GT_TileEntity_BioVat.this.mTimes = 1;
for (int i = 1; i < GT_TileEntity_BioVat.this.mExpectedMultiplier; i++) {
if (GT_TileEntity_BioVat.this.depleteInput(this.lastRecipe.mFluidInputs[0])) {
GT_TileEntity_BioVat.this.mTimes++;
}
}
this.outputFluids[0].amount *= GT_TileEntity_BioVat.this.mTimes;
return result;
protected GT_ParallelHelper createParallelHelper(@NotNull GT_Recipe recipe) {
return super.createParallelHelper(recipeWithMultiplier(recipe));
}
};
}

protected GT_Recipe recipeWithMultiplier(GT_Recipe recipe) {
GT_Recipe tRecipe = recipe.copy();
int multiplier = getExpectedMultiplier(recipe.getFluidOutput(0), true);
tRecipe.mFluidInputs[0].amount *= multiplier;
tRecipe.mFluidOutputs[0].amount *= multiplier;
return tRecipe;
}

@Override
protected void setupProcessingLogic(ProcessingLogic logic) {
super.setupProcessingLogic(logic);
Expand Down

0 comments on commit 279f422

Please sign in to comment.