diff options
author | Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> | 2024-02-05 12:22:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-05 12:22:12 +0100 |
commit | 0f8ba9557a058909b071e1c817f3d94b4066f6f7 (patch) | |
tree | 7df226f287e3923435491242aed7fe91410af009 /src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt | |
parent | efc0fc65f2fede6204fa1cd9d3918a2f5d37dd92 (diff) | |
download | skyhanni-0f8ba9557a058909b071e1c817f3d94b4066f6f7.tar.gz skyhanni-0f8ba9557a058909b071e1c817f3d94b4066f6f7.tar.bz2 skyhanni-0f8ba9557a058909b071e1c817f3d94b4066f6f7.zip |
Fix: Click Keybinds (Minion Feature) (#971)
Fixed Minion XP calculation not working when having differnt mouse settings. #971
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt index f4621877a..4aa796b54 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt @@ -13,7 +13,6 @@ 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 class ItemClickData { @@ -39,20 +38,24 @@ class ItemClickData { } @SubscribeEvent - fun onEntityClick(event: InputEvent.MouseInputEvent) { + fun onEntityClick(event: InputEvent) { if (!LorenzUtils.inSkyBlock) return val minecraft = Minecraft.getMinecraft() - val clickedEntity = minecraft.pointedEntity - if (minecraft.thePlayer == null) return - if (clickedEntity == null) return - val clickType = when (Mouse.getEventButton()) { - 0 -> ClickType.LEFT_CLICK - 1 -> ClickType.RIGHT_CLICK + val attackKey = minecraft.gameSettings.keyBindAttack + val useKey = minecraft.gameSettings.keyBindUseItem + + val clickType = when { + attackKey.isKeyDown -> ClickType.LEFT_CLICK + useKey.isKeyDown -> ClickType.RIGHT_CLICK else -> return } + val clickedEntity = minecraft.pointedEntity + if (minecraft.thePlayer == null) return + if (clickedEntity == null) return + EntityClickEvent(clickType, clickedEntity).postAndCatch() } } |