From 980193d370450c8564cf121d12ed30e1e881a703 Mon Sep 17 00:00:00 2001 From: Vasco Lavos Date: Fri, 5 Apr 2024 18:00:21 +0100 Subject: [PATCH] Fix #4582 --- .../module/GoldToolsHaveFortuneModule.java | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/module/GoldToolsHaveFortuneModule.java b/src/main/java/org/violetmoon/quark/content/tweaks/module/GoldToolsHaveFortuneModule.java index 26ce407a93..5d2d6cf624 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/module/GoldToolsHaveFortuneModule.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/module/GoldToolsHaveFortuneModule.java @@ -126,7 +126,7 @@ public static int getActualEnchantmentLevel(Enchantment enchant, ItemStack stack public static void addEnchantmentsIfMissing(ItemStack stack, Map map) { Item item = stack.getItem(); - if(staticEnabled && wellBakedEnchantments.containsKey(item) && displayBakedEnchantmentsInTooltip) { + if(staticEnabled && wellBakedEnchantments.containsKey(item)) { var pastry = wellBakedEnchantments.get(item); for(Enchantment enchantment : pastry.keySet()) { int level = map.getOrDefault(enchantment, 0); @@ -153,20 +153,21 @@ public static boolean shouldShowEnchantments(ItemStack stack) { } public static void fakeEnchantmentTooltip(ItemStack stack, List components) { - for(Map.Entry entry : Quark.ZETA.itemExtensions.get(stack).getAllEnchantmentsZeta(stack).entrySet()) { - int actualLevel = EnchantmentHelper.getTagEnchantmentLevel(entry.getKey(), stack); - if(actualLevel != entry.getValue()) { - Component comp = entry.getKey().getFullname(entry.getValue()); - if(italicTooltip) - comp = comp.copy().withStyle(ChatFormatting.ITALIC); - - if(actualLevel != 0) - comp = Component.translatable("quark.misc.enchantment_with_actual_level", comp, - Component.translatable("enchantment.level." + actualLevel)).withStyle(ChatFormatting.GRAY); - - components.add(comp); + if(staticEnabled && displayBakedEnchantmentsInTooltip) + for(Map.Entry entry : Quark.ZETA.itemExtensions.get(stack).getAllEnchantmentsZeta(stack).entrySet()) { + int actualLevel = EnchantmentHelper.getTagEnchantmentLevel(entry.getKey(), stack); + if(actualLevel != entry.getValue()) { + Component comp = entry.getKey().getFullname(entry.getValue()); + if(italicTooltip) + comp = comp.copy().withStyle(ChatFormatting.ITALIC); + + if(actualLevel != 0) + comp = Component.translatable("quark.misc.enchantment_with_actual_level", comp, + Component.translatable("enchantment.level." + actualLevel)).withStyle(ChatFormatting.GRAY); + + components.add(comp); + } } - } } public static ListTag hideSmallerEnchantments(ItemStack stack, ListTag tag) {