aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt
blob: 70ed2ead64fe561d84378dcc4e14820490f23de6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package at.hannibal2.skyhanni.data

import at.hannibal2.skyhanni.events.LorenzToolTipEvent
import net.minecraft.inventory.Slot
import net.minecraftforge.event.entity.player.ItemTooltipEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent

class ToolTipData {

    @SubscribeEvent(priority = EventPriority.LOWEST)
    fun onTooltip(event: ItemTooltipEvent) {
        val toolTip = event.toolTip ?: return
        val slot = lastSlot ?: return
        LorenzToolTipEvent(slot, event.itemStack, toolTip).postAndCatch()
    }

    companion object {
        var lastSlot: Slot? = null
    }
}