From 0f8ba9557a058909b071e1c817f3d94b4066f6f7 Mon Sep 17 00:00:00 2001 From: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Date: Mon, 5 Feb 2024 12:22:12 +0100 Subject: Fix: Click Keybinds (Minion Feature) (#971) Fixed Minion XP calculation not working when having differnt mouse settings. #971 --- .../java/at/hannibal2/skyhanni/data/ItemClickData.kt | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt') 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() } } -- cgit