aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-02-13 22:54:08 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-02-13 22:54:08 +0100
commit67ed7a34d52067dd83f93d8ab8e81401149b5659 (patch)
tree67de77857f661d7a5324dcc38a59a2df5e3e025e /src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt
parent848e9e6ca15b5e70dc0a282d7adb8c2f299be2c4 (diff)
downloadskyhanni-67ed7a34d52067dd83f93d8ab8e81401149b5659.tar.gz
skyhanni-67ed7a34d52067dd83f93d8ab8e81401149b5659.tar.bz2
skyhanni-67ed7a34d52067dd83f93d8ab8e81401149b5659.zip
Fixed fire veil particle hider bug.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt
index b7dccd76b..a2a22a865 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt
@@ -1,9 +1,13 @@
package at.hannibal2.skyhanni.data
+import at.hannibal2.skyhanni.events.BlockClickEvent
import at.hannibal2.skyhanni.events.EntityClickEvent
-import at.hannibal2.skyhanni.events.ItemClickInHandEvent
+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.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.InputEvent
import org.lwjgl.input.Mouse
@@ -11,17 +15,17 @@ import org.lwjgl.input.Mouse
class ItemClickData {
@SubscribeEvent
- fun onClick(event: InputEvent.MouseInputEvent) {
- if (!Mouse.getEventButtonState()) return
-
- val clickType = when (Mouse.getEventButton()) {
- 0 -> ClickType.LEFT_CLICK
- 1 -> ClickType.RIGHT_CLICK
- else -> return
+ fun onItemClickSend(event: PacketEvent.SendEvent) {
+ val packet = event.packet
+ if (packet is C08PacketPlayerBlockPlacement) {
+ val position = packet.position.toLorenzVec()
+ BlockClickEvent(ClickType.RIGHT_CLICK, position, packet.stack).postAndCatch()
+ }
+ 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()
}
-
- val itemStack = Minecraft.getMinecraft().thePlayer.heldItem
- ItemClickInHandEvent(clickType, itemStack).postAndCatch()
}
@SubscribeEvent