aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/data
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data')
-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