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 --- .../skyhanni/features/minion/MinionFeatures.kt | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features') diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt index 7cd0d7c9e..3495a35f1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt @@ -3,8 +3,11 @@ package at.hannibal2.skyhanni.features.minion import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.Storage +import at.hannibal2.skyhanni.data.ClickType import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.ProfileStorageData +import at.hannibal2.skyhanni.events.BlockClickEvent +import at.hannibal2.skyhanni.events.EntityClickEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.InventoryUpdatedEvent @@ -50,11 +53,10 @@ import net.minecraftforge.client.event.RenderLivingEvent import net.minecraftforge.event.entity.player.PlayerInteractEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import net.minecraftforge.fml.common.gameevent.InputEvent -import org.lwjgl.input.Mouse import java.awt.Color class MinionFeatures { + private val config get() = SkyHanniMod.feature.minions private var lastClickedEntity: LorenzVec? = null private var newMinion: LorenzVec? = null @@ -86,21 +88,19 @@ class MinionFeatures { } @SubscribeEvent - fun onClick(event: InputEvent.MouseInputEvent) { + fun onEntityClick(event: EntityClickEvent) { if (!enableWithHub()) return + if (event.clickType != ClickType.RIGHT_CLICK) return - if (!Mouse.getEventButtonState()) return - if (Mouse.getEventButton() != 1) return + lastClickedEntity = event.clickedEntity?.getLorenzVec() ?: return + } - val minecraft = Minecraft.getMinecraft() - val entity = minecraft.pointedEntity - if (entity != null) { - lastClickedEntity = entity.getLorenzVec() - return - } - minecraft.thePlayer.rayTrace(16.0, 1.0f)?.let { - lastStorage = it.blockPos.toLorenzVec() - } + @SubscribeEvent + fun onBlockClick(event: BlockClickEvent) { + if (!enableWithHub()) return + if (event.clickType != ClickType.RIGHT_CLICK) return + + lastStorage = event.position } @SubscribeEvent -- cgit