diff options
author | appable <enzospiacitelli@gmail.com> | 2023-03-28 09:07:37 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-28 18:07:37 +0200 |
commit | 8f8ffb3314d7822c3f4a4c9b7988526d25b3f393 (patch) | |
tree | 8587a9cbe6289beac9e1950cc118bf1ebd22bbf4 /src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt | |
parent | 7c618552f30fdb717219c348b9f24dcacc651442 (diff) | |
download | skyhanni-8f8ffb3314d7822c3f4a4c9b7988526d25b3f393.tar.gz skyhanni-8f8ffb3314d7822c3f4a4c9b7988526d25b3f393.tar.bz2 skyhanni-8f8ffb3314d7822c3f4a4c9b7988526d25b3f393.zip |
Item ability improvements (#24)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt index a2a22a865..fc68e1a52 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt @@ -2,12 +2,14 @@ package at.hannibal2.skyhanni.data 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.LorenzUtils import at.hannibal2.skyhanni.utils.toLorenzVec import net.minecraft.client.Minecraft import net.minecraft.network.play.client.C07PacketPlayerDigging import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement +import net.minecraft.network.play.client.C0APacketAnimation import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.InputEvent import org.lwjgl.input.Mouse @@ -21,11 +23,14 @@ class ItemClickData { val position = packet.position.toLorenzVec() BlockClickEvent(ClickType.RIGHT_CLICK, position, packet.stack).postAndCatch() } + val itemInHand = Minecraft.getMinecraft().thePlayer.heldItem if (packet is C07PacketPlayerDigging && packet.status == C07PacketPlayerDigging.Action.START_DESTROY_BLOCK) { val position = packet.position.toLorenzVec() - val itemInHand = Minecraft.getMinecraft().thePlayer.heldItem BlockClickEvent(ClickType.LEFT_CLICK, position, itemInHand).postAndCatch() } + if (packet is C0APacketAnimation) { + ItemClickEvent(itemInHand).postAndCatch() + } } @SubscribeEvent |