Skip to content

Fix Recipe failure reason and add score system#4942

Open
jurrejelle wants to merge 8 commits into
1.20.1from
jj/recipe-failure-reason
Open

Fix Recipe failure reason and add score system#4942
jurrejelle wants to merge 8 commits into
1.20.1from
jj/recipe-failure-reason

Conversation

@jurrejelle

Copy link
Copy Markdown
Contributor

What

  • Add recipe failure reasons
  • Keep track of score when checking failure and only report the most matched recipe

Implementation Details

UI is kinda ugly since we only have the resloc for a gtrecipe, no name. will need to be fixed when this gets merged into MUI

AI Usage

  • No AI driven tools were used for this pull request.
  • Yes AI driven tools were used for this pull request.

Agent Used

Claude Opus 4.8 High

Agent Usage Description

Used it to spitball the mechanics, write a decent bit of the code, write a decent bit of the tests. Everything was reviewed and checked by me, both in code and in game.

How Was This Tested

Tests and
java_y4vnQYPj7F
java_2QEspUE99a
java_7oCvF16Xa4

Potential Compatibility Issues

Since there should be no changes in parts that addons touch, I don't think this needs documentation?

@jurrejelle jurrejelle requested a review from a team as a code owner June 18, 2026 15:06
@jurrejelle jurrejelle added type: refactor Suggestion to refactor a section of code 1.20.1 Release: Major - 0.X.0 Releases focused on Content, changes to gameplay; While maintaining mostly API stability. labels Jun 18, 2026
@jurrejelle jurrejelle changed the title Add Recipe failure reasons and score Fix Recipe failure reason and add score system Jun 18, 2026
@screret

screret commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

IMO the raw recipe id should never be visible to end users, it's bad UX

@github-actions github-actions Bot added the Tests: Failed Game Tests have failed on this PR label Jun 18, 2026
@jurrejelle

Copy link
Copy Markdown
Contributor Author

IMO the raw recipe id should never be visible to end users, it's bad UX

I agree, but we don't have a better name in GTRecipe do we? I'm considering in the MUI branch to take the ID and making it Title Case and showing that but idk, will have to UX yappa on it

@screret screret left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the bestFailure* fields' names don't sit right with me. Could you think of something that better describes what they actually store?

for (var reason : reasons) {
var recipe = recipeLogic.getBestFailureRecipe();
if (recipe != null) {
textList.add(Component.literal(" - ").append(recipe).append(": ").append(reason));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Component.literal(" - ") could be made into a static final field to save some allocations. Same for Component.literal(": ")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dash can't since it's the first component in the list and we mutate it (unless you have a way where we can that saves allocations, but idts), will update with the colon though

Comment thread src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java
@screret

screret commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

I agree, but we don't have a better name in GTRecipe do we? I'm considering in the MUI branch to take the ID and making it Title Case and showing that but idk, will have to UX yappa on it

No ID should be shown at all, as there isn't a good way to make a human-readable name for recipes.

@github-actions github-actions Bot added Tests: Passed Game Tests have passed on this PR and removed Tests: Failed Game Tests have failed on this PR labels Jun 18, 2026
@jurrejelle

Copy link
Copy Markdown
Contributor Author

I agree, but we don't have a better name in GTRecipe do we? I'm considering in the MUI branch to take the ID and making it Title Case and showing that but idk, will have to UX yappa on it

No ID should be shown at all, as there isn't a good way to make a human-readable name for recipes.

I disagree because the value for a debugging end-user to see which recipe is being ran outweighs the ugliness imo but we'll have a discussion about it with ghosti for UX and they can decide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.20.1 Release: Major - 0.X.0 Releases focused on Content, changes to gameplay; While maintaining mostly API stability. Tests: Passed Game Tests have passed on this PR type: refactor Suggestion to refactor a section of code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants