diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt index c28db9a9d..b9e2b45dc 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt @@ -1,6 +1,8 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.* +import at.hannibal2.skyhanni.utils.InventoryUtils +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzVec import net.minecraft.client.Minecraft @@ -64,4 +66,21 @@ class MinecraftData { tick++ LorenzTickEvent(tick).postAndCatch() } + + @SubscribeEvent + fun onTick(event: LorenzTickEvent) { + if (!LorenzUtils.inSkyBlock) return + val hand = InventoryUtils.getItemInHand() + val newItem = hand?.getInternalName() ?: "" + if (newItem != InventoryUtils.itemInHandId) { + ItemInHandChangeEvent(newItem, hand).postAndCatch() + InventoryUtils.itemInHandId = newItem + InventoryUtils.latestItemInHand = hand + } + } + + @SubscribeEvent + fun onWorldChange(event: LorenzWorldChangeEvent) { + InventoryUtils.itemInHandId = "" + } }
\ No newline at end of file |