diff options
author | BlueWeabo <ilia.iliev2005@gmail.com> | 2023-07-18 21:15:10 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-18 21:15:10 +0300 |
commit | 33f0642c3a6961741709381726caff067b22b9da (patch) | |
tree | 9e05dd020e6b3d450f34abbdb46af86ee64c47cc /src/main | |
parent | ca2ebd4bd1887d32dab8c9c23b419c617a1b4f58 (diff) | |
download | GT5-Unofficial-33f0642c3a6961741709381726caff067b22b9da.tar.gz GT5-Unofficial-33f0642c3a6961741709381726caff067b22b9da.tar.bz2 GT5-Unofficial-33f0642c3a6961741709381726caff067b22b9da.zip |
Fix GT_ParallelHelper always doing batch mode parallels instead of focusing on normal parallels (#2147)
* fix
* make sure normal parallels are ran before batch mode
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/gregtech/api/util/GT_ParallelHelper.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/gregtech/api/util/GT_ParallelHelper.java b/src/main/java/gregtech/api/util/GT_ParallelHelper.java index 4c9f53745b..46a646356d 100644 --- a/src/main/java/gregtech/api/util/GT_ParallelHelper.java +++ b/src/main/java/gregtech/api/util/GT_ParallelHelper.java @@ -320,6 +320,7 @@ public class GT_ParallelHelper { } } + int maxParallelBeforeBatchMode = mMaxParallel; if (mBatchMode) { mMaxParallel *= mBatchModifier; } @@ -353,16 +354,17 @@ public class GT_ParallelHelper { mMaxParallel = Math.min(voidProtectionHelper.getMaxParallel(), mMaxParallel); } + maxParallelBeforeBatchMode = Math.min(mMaxParallel, maxParallelBeforeBatchMode); + final int tRecipeEUt = (int) Math.ceil(mRecipe.mEUt * mEUtModifier); - final int batchCorrectedMaxParallel = mMaxParallel / mBatchModifier; // Consume inputs to determine normal parallel if (recipeCheck != null) { - int actualMaxParallel = (int) Math.min(batchCorrectedMaxParallel, mAvailableEUt / tRecipeEUt); + int actualMaxParallel = (int) Math.min(maxParallelBeforeBatchMode, mAvailableEUt / tRecipeEUt); mCurrentParallel = recipeCheck.checkRecipeInputs(true, actualMaxParallel, tItemInputs, tFluidInputs); } else { long tCurrentUsage = 0; boolean builtRecipeCheck = false; - for (; mCurrentParallel < batchCorrectedMaxParallel + for (; mCurrentParallel < maxParallelBeforeBatchMode && tCurrentUsage < (mAvailableEUt - tRecipeEUt); mCurrentParallel++) { if (!mRecipe.isRecipeInputEqual(true, false, tFluidInputs, tItemInputs)) { break; @@ -382,7 +384,8 @@ public class GT_ParallelHelper { // If Batch Mode is enabled determine how many extra parallels we can get if (mBatchMode && mCurrentParallel > 0) { int tExtraParallels = 0; - final int maxExtraParallels = mCurrentParallel * (mBatchModifier - 1); + final int maxExtraParallels = Math + .min(mCurrentParallel * (mBatchModifier - 1), mMaxParallel - mCurrentParallel); if (recipeCheck != null) { tExtraParallels = recipeCheck.checkRecipeInputs(true, maxExtraParallels, tItemInputs, tFluidInputs); } else { |