aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2024-06-01 19:27:51 +1000
committerGitHub <noreply@github.com>2024-06-01 11:27:51 +0200
commit83ed5f00e9943762d419e1b78f55942b15f9c99c (patch)
tree440786daf3917c59ca45d7dec80ab0d8ac660525 /src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt
parent7174c5eadbad4881c19f1ed5610285dc934741a1 (diff)
downloadskyhanni-83ed5f00e9943762d419e1b78f55942b15f9c99c.tar.gz
skyhanni-83ed5f00e9943762d419e1b78f55942b15f9c99c.tar.bz2
skyhanni-83ed5f00e9943762d419e1b78f55942b15f9c99c.zip
Fix: Estimated item value not working in pv (#1955)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt23
1 files changed, 9 insertions, 14 deletions
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<String>): List<String> {
- onHover(stack, toolTip)
- return onTooltip(toolTip)
- }
-
- private fun onHover(stack: ItemStack, toolTip: MutableList<String>) {
- ItemHoverEvent(stack, toolTip).postAndCatch()
- }
-
- fun onTooltip(toolTip: MutableList<String>): List<String> {
- val slot = lastSlot ?: return toolTip
- val itemStack = slot.stack ?: return toolTip
+ fun getTooltip(stack: ItemStack, toolTip: MutableList<String>) {
+ 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<String>) {
+ ItemHoverEvent(stack, toolTip).postAndCatch()
}
var lastSlot: Slot? = null