diff options
Diffstat (limited to 'src/main/java/at/hannibal2')
3 files changed, 11 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt index b9e2b45dc..db000fb25 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt @@ -74,6 +74,11 @@ class MinecraftData { val newItem = hand?.getInternalName() ?: "" if (newItem != InventoryUtils.itemInHandId) { ItemInHandChangeEvent(newItem, hand).postAndCatch() + + InventoryUtils.recentItemsInHand.keys.removeIf { it + 30_000 > System.currentTimeMillis() } + if (newItem != "") { + InventoryUtils.recentItemsInHand[System.currentTimeMillis()] = newItem + } InventoryUtils.itemInHandId = newItem InventoryUtils.latestItemInHand = hand } @@ -82,5 +87,6 @@ class MinecraftData { @SubscribeEvent fun onWorldChange(event: LorenzWorldChangeEvent) { InventoryUtils.itemInHandId = "" + InventoryUtils.recentItemsInHand.clear() } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt index afb1210aa..98bd41560 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt @@ -3,7 +3,6 @@ package at.hannibal2.skyhanni.features.itemabilities.abilitycooldown import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.ItemRenderBackground.Companion.background import at.hannibal2.skyhanni.events.* -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.ItemUtils.cleanName @@ -91,9 +90,11 @@ class ItemAbilityCooldown { } if (event.soundName == "mob.wolf.howl") { if (event.volume == 0.5f) { - if (!RiftAPI.inRift()) { + val recentItems = InventoryUtils.recentItemsInHand.values + if ("WEIRD_TUBA" in recentItems) { ItemAbility.WEIRD_TUBA.sound() - } else { + } + if ("WEIRDER_TUBA" in recentItems) { ItemAbility.WEIRDER_TUBA.sound() } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt index e9386430c..3f81df1a5 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt @@ -7,8 +7,8 @@ import net.minecraft.inventory.Slot import net.minecraft.item.ItemStack object InventoryUtils { - var itemInHandId = "" + var recentItemsInHand = mutableMapOf<Long, String>() var latestItemInHand: ItemStack? = null fun getItemsInOpenChest() = buildList<Slot> { |