From 454a20ad2f12396d3b9bf9d55e3c762fa2efe3cc Mon Sep 17 00:00:00 2001 From: Sakura Ryoko Date: Tue, 17 Dec 2024 21:49:54 -0500 Subject: [PATCH] Tooltip Seems to work now. --- .../dy/masa/malilib/render/InventoryOverlay.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/fi/dy/masa/malilib/render/InventoryOverlay.java b/src/main/java/fi/dy/masa/malilib/render/InventoryOverlay.java index 44dcb9391c..42e943f4ab 100644 --- a/src/main/java/fi/dy/masa/malilib/render/InventoryOverlay.java +++ b/src/main/java/fi/dy/masa/malilib/render/InventoryOverlay.java @@ -45,6 +45,7 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; +import fi.dy.masa.malilib.MaLiLibReference; import fi.dy.masa.malilib.gui.GuiBase; import fi.dy.masa.malilib.mixin.IMixinAbstractHorseEntity; import fi.dy.masa.malilib.mixin.IMixinPiglinEntity; @@ -1030,8 +1031,6 @@ public static void renderStackAt(ItemStack stack, float x, float y, float scale, RenderUtils.color(1f, 1f, 1f, 1f); matrixStack.pop(); - System.out.printf("renderStackAt(): [%s]\n", stack.toNbt(WorldUtils.getBestWorld(GameWrap.getClient()).getRegistryManager()).toString()); - if (mouseX >= x && mouseX < x + 16 * scale && mouseY >= y && mouseY < y + 16 * scale) { hoveredStack = stack.copy(); @@ -1114,7 +1113,10 @@ public static void renderStackToolTip(int x, int y, ItemStack stack, MinecraftCl List list = stack.getTooltip(Item.TooltipContext.create(mc.world), mc.player, mc.options.advancedItemTooltips ? TooltipType.ADVANCED : TooltipType.BASIC); List lines = new ArrayList<>(); - dumpStack(stack, list); + if (MaLiLibReference.DEBUG_MODE) + { + dumpStack(stack, list); + } for (int i = 0; i < list.size(); ++i) { if (i == 0) @@ -1143,8 +1145,14 @@ public static void renderStackToolTipStyled(int x, int y, ItemStack stack, Minec { if (stack.isEmpty() == false && mc.world != null && mc.player != null) { + // Not sure why getBestWorld() is required here, + // it's also required when connected to a server; + // or else not be able to see Enchantment tooltips. (>.>) List toolTips = stack.getTooltip(Item.TooltipContext.create(WorldUtils.getBestWorld(mc)), mc.player, mc.options.advancedItemTooltips ? TooltipType.ADVANCED : TooltipType.BASIC); - dumpStack(stack, toolTips); + if (MaLiLibReference.DEBUG_MODE) + { + dumpStack(stack, toolTips); + } drawContext.drawTooltip(mc.textRenderer, toolTips, stack.getTooltipData(), // Bundle/Optional Data