Skip to content

Commit

Permalink
Add some code comments
Browse files Browse the repository at this point in the history
  • Loading branch information
BUGTeas committed Dec 30, 2024
1 parent d4d202f commit 84865f5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public void translateComponentsToBedrock(@NonNull GeyserSession session, @NonNul
if (boxComponents != null) {
String customName = ItemTranslator.getCustomName(session, boxComponents, boxMapping, '7', false, true);
if (customName != null) {
// Fix count display (e.g., x16) with incorrect color due to some items with colored names
if (customName.contains("" + ChatColor.ESCAPE)) customName += ChatColor.RESET + ChatColor.GRAY;
boxItemNbt.putCompound("tag", NbtMap.builder()
.putCompound("display", NbtMap.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ public static String getPotionEffectInfo(PotionContents contents, String languag
.color((negativeEffectList.contains(effect)) ? NamedTextColor.RED : NamedTextColor.BLUE)
.append(appendTranslatable)
.build();
// Bedrock supports wrap lines with '\n' in a single string in custom name
finalText.append('\n').append(MessageTranslator.convertMessage(component, language));
}
return finalText.toString();
Expand Down Expand Up @@ -544,6 +545,7 @@ public static String getCustomName(GeyserSession session, DataComponents compone
if (potionName != null) return ChatColor.RESET + ChatColor.ESCAPE + translationColor + potionName;
}
if (includeAll) {
// Fix book title display in tooltips of shulker box
WrittenBookContent bookContent = components.get(DataComponentType.WRITTEN_BOOK_CONTENT);
if (bookContent != null) {
return ChatColor.RESET + ChatColor.ESCAPE + translationColor + bookContent.getTitle().getRaw();
Expand Down

0 comments on commit 84865f5

Please sign in to comment.