Skip to content

Commit c6445aa

Browse files
authored
Force modifier re-apply when recipe starts after being suspended (#3971)
1 parent 54f39b7 commit c6445aa

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,18 @@ public void onRecipeFinish() {
472472
runDelay = 0;
473473
consecutiveRecipes++;
474474
handleRecipeIO(lastRecipe, IO.OUT);
475+
// Don't ready the next recipe after finish if suspend is set
476+
// so that the modifiers won't be applied until re-starting.
477+
if (suspendAfterFinish) {
478+
setStatus(Status.SUSPEND);
479+
consecutiveRecipes = 0;
480+
progress = 0;
481+
duration = 0;
482+
isActive = false;
483+
// Force a recipe recheck.
484+
lastRecipe = null;
485+
return;
486+
}
475487
if (machine.alwaysTryModifyRecipe()) {
476488
if (lastOriginRecipe != null) {
477489
var modified = machine.fullModifyRecipe(lastOriginRecipe.copy());
@@ -486,16 +498,12 @@ public void onRecipeFinish() {
486498
}
487499
// try it again
488500
var recipeCheck = checkRecipe(lastRecipe);
489-
if (!recipeDirty && !suspendAfterFinish && recipeCheck.isSuccess()) {
501+
if (!recipeDirty && recipeCheck.isSuccess()) {
490502
setupRecipe(lastRecipe);
491503
} else {
492-
if (suspendAfterFinish) {
493-
setStatus(Status.SUSPEND);
494-
} else {
495-
setStatus(Status.IDLE);
496-
if (recipeCheck.io() != IO.IN || recipeCheck.capability() == EURecipeCapability.CAP) {
497-
waitingReason = recipeCheck.reason();
498-
}
504+
setStatus(Status.IDLE);
505+
if (recipeCheck.io() != IO.IN || recipeCheck.capability() == EURecipeCapability.CAP) {
506+
waitingReason = recipeCheck.reason();
499507
}
500508
consecutiveRecipes = 0;
501509
progress = 0;

0 commit comments

Comments
 (0)