Skip to content

Commit 21ccafc

Browse files
committed
DataComponentType.ITEM_NAME should remove italics
1 parent a12d60d commit 21ccafc

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

core/src/main/java/org/geysermc/geyser/translator/item/ItemTranslator.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,13 +418,15 @@ public static String getCustomName(GeyserSession session, DataComponents compone
418418
if (components != null) {
419419
// ItemStack#getHoverName as of 1.20.5
420420
Component customName = components.get(DataComponentType.CUSTOM_NAME);
421-
if (customName == null) {
422-
customName = components.get(DataComponentType.ITEM_NAME);
423-
}
424421
if (customName != null) {
425-
// Get the translated name and prefix it with a reset char
426422
return MessageTranslator.convertMessage(customName, session.locale());
427423
}
424+
customName = components.get(DataComponentType.ITEM_NAME);
425+
if (customName != null) {
426+
// Get the translated name and prefix it with a reset char to prevent italics - matches Java Edition
427+
// behavior as of 1.21
428+
return ChatColor.RESET + ChatColor.ESCAPE + translationColor + MessageTranslator.convertMessage(customName, session.locale());
429+
}
428430
}
429431

430432
if (mapping.hasTranslation()) {

0 commit comments

Comments
 (0)