From 43f0e576509d54bb7b12ab59be292c261a0b050d Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Fri, 24 Nov 2023 03:01:01 +0100 Subject: fishing v2 (#729) Prevent wrong fishing item pickup #729 --- src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt') diff --git a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt index bfcc8df5f..56d565299 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.events.PlaySoundEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent +import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzUtils @@ -71,6 +72,7 @@ object MinecraftData { Minecraft.getMinecraft().thePlayer ?: return totalTicks++ LorenzTickEvent(totalTicks).postAndCatch() + DelayedRun.checkRuns() } @SubscribeEvent @@ -78,8 +80,8 @@ object MinecraftData { if (!LorenzUtils.inSkyBlock) return val hand = InventoryUtils.getItemInHand() val newItem = hand?.getInternalName() ?: NEUInternalName.NONE - if (newItem != InventoryUtils.itemInHandId) { - ItemInHandChangeEvent(newItem, hand).postAndCatch() + val oldItem = InventoryUtils.itemInHandId + if (newItem != oldItem) { InventoryUtils.recentItemsInHand.keys.removeIf { it + 30_000 > System.currentTimeMillis() } if (newItem != NEUInternalName.NONE) { @@ -87,6 +89,7 @@ object MinecraftData { } InventoryUtils.itemInHandId = newItem InventoryUtils.latestItemInHand = hand + ItemInHandChangeEvent(newItem, oldItem).postAndCatch() } } -- cgit