diff options
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickNPCSell.kt | 6 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt | 3 |
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 = |