Skip to content

fix crafting order chat notification showing item name in wrong locale - #1361

Closed
Eldrinn-Elantey wants to merge 3 commits into
masterfrom
fix/crafting-notification-item-name-localization
Closed

fix crafting order chat notification showing item name in wrong locale#1361
Eldrinn-Elantey wants to merge 3 commits into
masterfrom
fix/crafting-notification-item-name-localization

Conversation

@Eldrinn-Elantey

Copy link
Copy Markdown

item name in crafting completion chat message was resolved server-side via func_151000_E(), which always produces English text on a dedicated server. replaced with ChatComponentTranslation so the client translates it in their own locale, preserving [...] brackets and hover tooltip.

item name was resolved server-side via func_151000_E(), always producing English text. replaced with ChatComponentTranslation so the client translates it in their own locale, preserving brackets and hover tooltip.
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

#1362

@Eldrinn-Elantey
Eldrinn-Elantey requested a review from a team June 9, 2026 22:02

@Override
public IChatComponent getChatComponent() {
return this.getItemStack().func_151000_E();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

returns just stack.getDisplayName() with no brackets or hover event. There's also no mixin in GTNHLib that adds that rendering in GuiChat. Replacing with it would drop the [...] brackets and the item tooltip hover, which are part of vanilla func_151000_E() behavior that this fix preserves.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Still, couldn’t these two lines be replaced?

final String translationKey = itemStack.getItem().getUnlocalizedName(itemStack) + ".name";
final IChatComponent nameComponent = new ChatComponentTranslation(translationKey);

Also, for the hover event, it might be worth adding an option to ChatComponentItemName.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good points. We ended up moving the fix to Hodgepodge (GTNewHorizons/Hodgepodge#924) so it applies globally to all mods, not just AE2U.

On ChatComponentTranslation: it works for simple items but breaks for anything with a custom display name (renamed items, enchanted items, items with NBT-driven names) since getUnlocalizedName() won't reflect those. ChatComponentItemName with full ItemStack serialization handles all cases correctly.

On the hover event in ChatComponentItemName: agreed it would be cleaner to have it there rather than in a separate GuiChat mixin. Filed GTNewHorizons/GTNHLib#396 for the brackets change already. The hover tooltip is currently handled by a dedicated mixin in Hodgepodge to avoid the NBT toString crash from GTNH#21933/#21940 - if GTNHLib adds a safe binary-serialized hover event we can drop that mixin.

@Eldrinn-Elantey

Copy link
Copy Markdown
Author

The fix has been moved to Hodgepodge where it applies globally to all mods, not just AE2U. See GTNewHorizons/Hodgepodge#924. Closing this PR.

@Eldrinn-Elantey
Eldrinn-Elantey deleted the fix/crafting-notification-item-name-localization branch June 10, 2026 13:37
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.

3 participants