From eb68a59b4670d548fa4c0a493ad1d19029faeb5b Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 22 May 2023 20:06:36 +0200 Subject: Use getItemInHand() --- src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/data') diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt index eb6e20590..842cbcfcc 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.events.BlockClickEvent import at.hannibal2.skyhanni.events.EntityClickEvent import at.hannibal2.skyhanni.events.ItemClickEvent import at.hannibal2.skyhanni.events.PacketEvent +import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.toLorenzVec import net.minecraft.client.Minecraft @@ -24,13 +25,11 @@ class ItemClickData { BlockClickEvent(ClickType.RIGHT_CLICK, position, packet.stack).postAndCatch() } if (packet is C07PacketPlayerDigging && packet.status == C07PacketPlayerDigging.Action.START_DESTROY_BLOCK) { - val itemInHand = Minecraft.getMinecraft().thePlayer.heldItem val position = packet.position.toLorenzVec() - BlockClickEvent(ClickType.LEFT_CLICK, position, itemInHand).postAndCatch() + BlockClickEvent(ClickType.LEFT_CLICK, position, InventoryUtils.getItemInHand()).postAndCatch() } if (packet is C0APacketAnimation) { - val itemInHand = Minecraft.getMinecraft().thePlayer.heldItem - ItemClickEvent(itemInHand).postAndCatch() + ItemClickEvent(InventoryUtils.getItemInHand()).postAndCatch() } } -- cgit