mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Skip lore creation if hide tooltips exists
This commit is contained in:
parent
b78c7b2bd3
commit
14017c0499
2 changed files with 5 additions and 3 deletions
|
|
@ -123,7 +123,7 @@ public class Item {
|
|||
*/
|
||||
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()));
|
||||
|
|
|
|||
|
|
@ -137,8 +137,10 @@ public final class ItemTranslator {
|
|||
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);
|
||||
|
|
@ -148,13 +150,13 @@ public final class ItemTranslator {
|
|||
|
||||
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());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue