aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2023-11-24 03:01:01 +0100
committerGitHub <noreply@github.com>2023-11-24 03:01:01 +0100
commit43f0e576509d54bb7b12ab59be292c261a0b050d (patch)
treea61aa63d2393ac88e1ddbf577a67065a2753efaa /src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt
parentdd2a77f37504f81e09806e1c277451957ea455ac (diff)
downloadskyhanni-43f0e576509d54bb7b12ab59be292c261a0b050d.tar.gz
skyhanni-43f0e576509d54bb7b12ab59be292c261a0b050d.tar.bz2
skyhanni-43f0e576509d54bb7b12ab59be292c261a0b050d.zip
fishing v2 (#729)
Prevent wrong fishing item pickup #729
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt7
1 files changed, 5 insertions, 2 deletions
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()
}
}