aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2024-02-10 21:59:37 +0100
committerGitHub <noreply@github.com>2024-02-10 21:59:37 +0100
commit7336d09d4f7da51f3b781b19b881a9cda7182783 (patch)
treee6b1d77142179ecbb81fd0245a21f2c682f4339a /src/main
parent8b3e7017b810b68145e9364a7b10cecd3f386f49 (diff)
downloadskyhanni-7336d09d4f7da51f3b781b19b881a9cda7182783.tar.gz
skyhanni-7336d09d4f7da51f3b781b19b881a9cda7182783.tar.bz2
skyhanni-7336d09d4f7da51f3b781b19b881a9cda7182783.zip
Fixed shift click npc sell not working for menus with different sizes. #990
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickNPCSell.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt3
2 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickNPCSell.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickNPCSell.kt
index 5e6c8bf6b..fbdd047db 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickNPCSell.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickNPCSell.kt
@@ -15,7 +15,7 @@ object ShiftClickNPCSell {
private val config get() = SkyHanniMod.feature.inventory.shiftClickNPCSell
- private val sellSlot = 49
+ private val sellSlot = -4
private val lastLoreLineOfSellPattern by RepoPattern.pattern(
"inventory.npc.sell.lore",
"§7them to this Shop!|§eClick to buyback!"
@@ -29,7 +29,9 @@ object ShiftClickNPCSell {
@SubscribeEvent
fun onOpen(event: InventoryFullyOpenedEvent) {
if (!LorenzUtils.inSkyBlock) return
- inInventory = lastLoreLineOfSellPattern.matches(event.inventoryItems[sellSlot]?.getLore()?.lastOrNull())
+ val item = event.inventoryItems[event.inventoryItems.keys.last() + sellSlot]
+
+ inInventory = lastLoreLineOfSellPattern.matches(item?.getLore()?.lastOrNull())
}
@SubscribeEvent
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
index 33731505f..d33fead7f 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -275,7 +275,8 @@ object LorenzUtils {
slot?.slotNumber?.let { slotNumber ->
Minecraft.getMinecraft().playerController.windowClick(
container.windowId, slotNumber, 0, 1, Minecraft.getMinecraft().thePlayer
- )?.also { isCanceled = true }
+ )
+ isCanceled = true
}
private val recalculateDerpy =