aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/ItemClickEvent.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt11
4 files changed, 19 insertions, 22 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt
index 3d154666f..3ffc44719 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt
@@ -10,7 +10,6 @@ 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
@@ -20,17 +19,18 @@ class ItemClickData {
@SubscribeEvent
fun onItemClickSend(event: PacketEvent.SendEvent) {
val packet = event.packet
- if (packet is C08PacketPlayerBlockPlacement && packet.placedBlockDirection != 255) {
- val position = packet.position.toLorenzVec()
- BlockClickEvent(ClickType.RIGHT_CLICK, position, packet.stack).postAndCatch()
+ if (packet is C08PacketPlayerBlockPlacement) {
+ if (packet.placedBlockDirection != 255) {
+ val position = packet.position.toLorenzVec()
+ BlockClickEvent(ClickType.RIGHT_CLICK, position, packet.stack).postAndCatch()
+ } else {
+ ItemClickEvent(InventoryUtils.getItemInHand(), ClickType.RIGHT_CLICK).postAndCatch()
+ }
}
if (packet is C07PacketPlayerDigging && packet.status == C07PacketPlayerDigging.Action.START_DESTROY_BLOCK) {
val position = packet.position.toLorenzVec()
BlockClickEvent(ClickType.LEFT_CLICK, position, InventoryUtils.getItemInHand()).postAndCatch()
}
- if (packet is C0APacketAnimation) {
- ItemClickEvent(InventoryUtils.getItemInHand()).postAndCatch()
- }
}
@SubscribeEvent
diff --git a/src/main/java/at/hannibal2/skyhanni/events/ItemClickEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ItemClickEvent.kt
index c0c4f4e83..5bf89558a 100644
--- a/src/main/java/at/hannibal2/skyhanni/events/ItemClickEvent.kt
+++ b/src/main/java/at/hannibal2/skyhanni/events/ItemClickEvent.kt
@@ -1,5 +1,6 @@
package at.hannibal2.skyhanni.events
+import at.hannibal2.skyhanni.data.ClickType
import net.minecraft.item.ItemStack
-class ItemClickEvent(val itemInHand: ItemStack?) : LorenzEvent() \ No newline at end of file
+class ItemClickEvent(val itemInHand: ItemStack?, val clickType: ClickType) : LorenzEvent()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt
index 9154df2e5..2bbf80502 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt
@@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.config.features.itemability.FireVeilWandConfig.DisplayEntry
import at.hannibal2.skyhanni.data.ClickType
-import at.hannibal2.skyhanni.events.BlockClickEvent
+import at.hannibal2.skyhanni.events.ItemClickEvent
import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.events.ReceiveParticleEvent
import at.hannibal2.skyhanni.utils.ConfigUtils
@@ -35,15 +35,14 @@ class FireVeilWandParticles {
}
@SubscribeEvent
- fun onBlockClick(event: BlockClickEvent) {
+ fun onItemClick(event: ItemClickEvent) {
if (!LorenzUtils.inSkyBlock) return
+ if (event.clickType != ClickType.RIGHT_CLICK) return
- if (event.clickType == ClickType.RIGHT_CLICK) {
- val internalName = event.itemInHand?.getInternalName() ?: return
+ val internalName = event.itemInHand?.getInternalName() ?: return
- if (internalName == item) {
- lastClick = System.currentTimeMillis()
- }
+ if (internalName == item) {
+ lastClick = System.currentTimeMillis()
}
}
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 237fca803..08e2b9820 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
@@ -1,8 +1,8 @@
package at.hannibal2.skyhanni.features.itemabilities.abilitycooldown
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.ClickType
import at.hannibal2.skyhanni.data.ItemRenderBackground.Companion.background
-import at.hannibal2.skyhanni.events.BlockClickEvent
import at.hannibal2.skyhanni.events.ItemClickEvent
import at.hannibal2.skyhanni.events.LorenzActionBarEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
@@ -159,13 +159,10 @@ class ItemAbilityCooldown {
}
@SubscribeEvent
- fun onBlockClickSend(event: BlockClickEvent) {
- handleItemClick(event.itemInHand)
- }
-
- @SubscribeEvent
fun onItemClick(event: ItemClickEvent) {
- handleItemClick(event.itemInHand)
+ if (event.clickType == ClickType.RIGHT_CLICK) {
+ handleItemClick(event.itemInHand)
+ }
}
private fun handleItemClick(itemInHand: ItemStack?) {