Skip to content

Commit a344181

Browse files
authored
Fix Recipe Runner Error Reporting (#3296)
1 parent 8496266 commit a344181

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,9 @@ public void resetRecipeLogic() {
144144
duration = 0;
145145
isActive = false;
146146
lastFailedMatches = null;
147-
if (status != Status.SUSPEND)
148-
status = Status.IDLE;
147+
if (status != Status.SUSPEND) {
148+
setStatus(Status.IDLE);
149+
}
149150
updateTickSubscription();
150151
}
151152

@@ -435,14 +436,16 @@ public void onRecipeFinish() {
435436
}
436437
}
437438
// try it again
438-
if (!recipeDirty && !suspendAfterFinish && checkRecipe(lastRecipe).isSuccess()) {
439+
var recipeCheck = checkRecipe(lastRecipe);
440+
if (!recipeDirty && !suspendAfterFinish && recipeCheck.isSuccess()) {
439441
setupRecipe(lastRecipe);
440442
} else {
441443
if (suspendAfterFinish) {
442444
setStatus(Status.SUSPEND);
443445
suspendAfterFinish = false;
444446
} else {
445447
setStatus(Status.IDLE);
448+
waitingReason = recipeCheck.reason();
446449
}
447450
consecutiveRecipes = 0;
448451
progress = 0;
@@ -509,23 +512,23 @@ public void updateSound() {
509512

510513
@Override
511514
public IGuiTexture getFancyTooltipIcon() {
512-
if (isWaiting()) {
515+
if (waitingReason != null) {
513516
return GuiTextures.INSUFFICIENT_INPUT;
514517
}
515518
return IGuiTexture.EMPTY;
516519
}
517520

518521
@Override
519522
public List<Component> getFancyTooltip() {
520-
if (isWaiting() && waitingReason != null) {
523+
if (waitingReason != null) {
521524
return List.of(waitingReason);
522525
}
523526
return Collections.emptyList();
524527
}
525528

526529
@Override
527530
public boolean showFancyTooltip() {
528-
return isWaiting();
531+
return waitingReason != null;
529532
}
530533

531534
protected Map<RecipeCapability<?>, Object2IntMap<?>> makeChanceCaches() {

src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,7 @@ private void fillContentMatchList(Map<RecipeCapability<?>, List<Content>> entrie
109109
}
110110

111111
private RecipeHandlingResult handleContents() {
112-
var result = handleContentsInternal(io);
113-
if (result.isSuccess()) return result;
114-
return handleContentsInternal(IO.BOTH);
112+
return handleContentsInternal(io);
115113
}
116114

117115
private RecipeHandlingResult handleContentsInternal(IO capIO) {

0 commit comments

Comments
 (0)