Skip to content

Commit

Permalink
Fix #4582
Browse files Browse the repository at this point in the history
  • Loading branch information
Vazkii committed Apr 5, 2024
1 parent 33fbfb7 commit 980193d
Showing 1 changed file with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public static int getActualEnchantmentLevel(Enchantment enchant, ItemStack stack
public static void addEnchantmentsIfMissing(ItemStack stack, Map<Enchantment, Integer> 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);
Expand All @@ -153,20 +153,21 @@ public static boolean shouldShowEnchantments(ItemStack stack) {
}

public static void fakeEnchantmentTooltip(ItemStack stack, List<Component> components) {
for(Map.Entry<Enchantment, Integer> 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<Enchantment, Integer> 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) {
Expand Down

0 comments on commit 980193d

Please sign in to comment.