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 (#387)
Browse files Browse the repository at this point in the history
Former-commit-id: 2efd071a254ffd1d9eb33ad42e9b7d3b2b2c40ee
  • Loading branch information
HoleFish authored Feb 3, 2024
1 parent 05dfa4e commit 83af553
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 83af553

Please sign in to comment.