Skip to content

Commit

Permalink
Skip lore creation if hide tooltips exists
Browse files Browse the repository at this point in the history
  • Loading branch information
YHDiamond committed Jun 11, 2024
1 parent b78c7b2 commit 14017c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/org/geysermc/geyser/item/type/Item.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public ItemMapping toBedrockDefinition(DataComponents components, ItemMappings m
*/
public void translateComponentsToBedrock(@NonNull GeyserSession session, @NonNull DataComponents components, @NonNull BedrockItemBuilder builder) {
List<Component> loreComponents = components.get(DataComponentType.LORE);
if (loreComponents != null) {
if (loreComponents != null && components.get(DataComponentType.HIDE_TOOLTIP) == null) {
List<String> lore = builder.getOrCreateLore();
for (Component loreComponent : loreComponents) {
lore.add(MessageTranslator.convertMessage(loreComponent, session.locale()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,10 @@ public static ItemData translateToBedrock(GeyserSession session, ItemStack stack
private static ItemData.@NonNull Builder translateToBedrock(GeyserSession session, Item javaItem, ItemMapping bedrockItem, int count, @Nullable DataComponents components) {
BedrockItemBuilder nbtBuilder = new BedrockItemBuilder();

boolean hideTooltips = false;
if (components != null) {
javaItem.translateComponentsToBedrock(session, components, nbtBuilder);
if (components.get(DataComponentType.HIDE_TOOLTIP) != null) hideTooltips = true;
}

String customName = getCustomName(session, components, bedrockItem);
Expand All @@ -148,13 +150,13 @@ public static ItemData translateToBedrock(GeyserSession session, ItemStack stack

if (components != null) {
ItemAttributeModifiers attributeModifiers = components.get(DataComponentType.ATTRIBUTE_MODIFIERS);
if (attributeModifiers != null && attributeModifiers.isShowInTooltip()) {
if (attributeModifiers != null && attributeModifiers.isShowInTooltip() && !hideTooltips) {
// only add if attribute modifiers do not indicate to hide them
addAttributeLore(attributeModifiers, nbtBuilder, session.locale());
}
}

if (session.isAdvancedTooltips()) {
if (session.isAdvancedTooltips() && !hideTooltips) {
addAdvancedTooltips(components, nbtBuilder, javaItem, session.locale());
}

Expand Down

0 comments on commit 14017c0

Please sign in to comment.