Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow recipe properties to individually hide default tooltips #2094

Merged
merged 2 commits into from
Sep 24, 2023

Conversation

serenibyss
Copy link
Member

Removes the need for special case hacks in GTRecipeWrapper when a recipe property needs to hide Total EU, EU/t, or Duration default recipe tooltips. No API breaks, as the IRecipeProperty methods have the same defaults as previously

@serenibyss serenibyss requested a review from a team as a code owner September 24, 2023 23:34
@serenibyss serenibyss added the type: refactor Suggestion to refactor a section of code label Sep 24, 2023
} else yPosition -= LINE_HEIGHT * 2;
minecraft.fontRenderer.drawString(I18n.format("gregtech.recipe.duration", TextFormattingUtil.formatNumbers(recipe.getDuration() / 20d)), 0, yPosition += LINE_HEIGHT, 0x111111);
} else yPosition -= LINE_HEIGHT;
if (properties.isEmpty() || properties.stream().allMatch(RecipeProperty::showDuration)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should these be anyMatch instead of allMatch? Because if the properties have showDuration and showEUt, wouldn't allMatch return false for because it didn't match showEUt?

Copy link
Member Author

Choose a reason for hiding this comment

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

My thinking is that if a property has one of these set to false, do not show it even if other properties say to. Might be better to name them "hideEUt", "hideTotalEU", etc

@serenibyss serenibyss merged commit 3ba1453 into master Sep 24, 2023
@serenibyss serenibyss deleted the sb-recipe-property-tooltip-cleanup branch September 24, 2023 23:50
Oganesson897 added a commit to ChildCommunitCN/GregTech-ChildHappyEdition that referenced this pull request Sep 25, 2023
Allow recipe properties to individually hide default tooltips (GregTechCEu#2094)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: refactor Suggestion to refactor a section of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants