From 83ed5f00e9943762d419e1b78f55942b15f9c99c Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Sat, 1 Jun 2024 19:27:51 +1000 Subject: Fix: Estimated item value not working in pv (#1955) --- .../java/at/hannibal2/skyhanni/data/ToolTipData.kt | 23 +++++++++------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/data') diff --git a/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt b/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt index 258cb244e..70cd9cd34 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt @@ -9,22 +9,13 @@ import at.hannibal2.skyhanni.utils.ItemUtils.name import net.minecraft.inventory.Slot import net.minecraft.item.ItemStack -// Please use LorenzToolTipEvent over ItemTooltipEvent if no special EventPriority is necessary +// Please use LorenzToolTipEvent over ItemHoverEvent, ItemHoverEvent is only used for special use cases (e.g. neu pv) object ToolTipData { @JvmStatic - fun getTooltip(stack: ItemStack, toolTip: MutableList): List { - onHover(stack, toolTip) - return onTooltip(toolTip) - } - - private fun onHover(stack: ItemStack, toolTip: MutableList) { - ItemHoverEvent(stack, toolTip).postAndCatch() - } - - fun onTooltip(toolTip: MutableList): List { - val slot = lastSlot ?: return toolTip - val itemStack = slot.stack ?: return toolTip + fun getTooltip(stack: ItemStack, toolTip: MutableList) { + val slot = lastSlot ?: return + val itemStack = slot.stack ?: return try { if (LorenzToolTipEvent(slot, itemStack, toolTip).postAndCatch()) { toolTip.clear() @@ -42,7 +33,11 @@ object ToolTipData { "lore" to itemStack.getLore(), ) } - return toolTip + } + + @JvmStatic + fun onHover(stack: ItemStack, toolTip: MutableList) { + ItemHoverEvent(stack, toolTip).postAndCatch() } var lastSlot: Slot? = null -- cgit