Skip to content

Conversation

@tier940
Copy link
Member

@tier940 tier940 commented Jan 10, 2026

No description provided.

@tier940 tier940 self-assigned this Jan 10, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request primarily focuses on improving code documentation by adding Javadoc comments to numerous mixin classes across the codebase. This is a valuable change for maintainability. The secondary focus, as indicated by the title, is fixing and enhancing the 'disable helmet auto-eat' feature. This includes updating a mixin to use mapped method names for better readability and adding logic to hide the corresponding tooltip when the feature is disabled. My review identifies a potential NullPointerException in the new tooltip-hiding logic and suggests a fix. Overall, the changes are positive, especially the widespread addition of documentation.

Comment on lines +44 to +50
private boolean gtexpert$hideAutoEatTooltip(List<String> list, Object element) {
if (GTEConfigHolder.ceuOverride.disableHelmetAutoEat &&
element.equals(I18n.format("metaarmor.tooltip.autoeat"))) {
return false;
}
return list.add((String) element);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This redirect method is susceptible to a NullPointerException if element is null, as element.equals(...) would be called. It's safer to invoke equals on the string literal, which is known to be non-null.

Additionally, the cast (String) element is unsafe and will throw a ClassCastException if a non-String object is ever added to the tooltip list. While this might be unlikely in the context of tooltips, it's a potential runtime error. The current logic would attempt the cast for any object that doesn't match the auto-eat tooltip.

The suggested change below fixes the potential NullPointerException.

Suggested change
private boolean gtexpert$hideAutoEatTooltip(List<String> list, Object element) {
if (GTEConfigHolder.ceuOverride.disableHelmetAutoEat &&
element.equals(I18n.format("metaarmor.tooltip.autoeat"))) {
return false;
}
return list.add((String) element);
}
private boolean gtexpert$hideAutoEatTooltip(List<String> list, Object element) {
if (GTEConfigHolder.ceuOverride.disableHelmetAutoEat &&
I18n.format("metaarmor.tooltip.autoeat").equals(element)) {
return false;
}
return list.add((String) element);
}

@tier940 tier940 merged commit f419975 into master Jan 10, 2026
2 checks passed
@tier940 tier940 deleted the tier-fix-helmet-auto-eat-mixin branch January 10, 2026 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants