aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt
index c38e20dee..d7956c5c0 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt
@@ -17,16 +17,9 @@ object InventoryUtils {
var latestItemInHand: ItemStack? = null
fun getItemsInOpenChest() = buildList<Slot> {
val guiChest = Minecraft.getMinecraft().currentScreen as? GuiChest ?: return emptyList<Slot>()
- val inventorySlots = guiChest.inventorySlots.inventorySlots
- val skipAt = inventorySlots.size - 9 * 4
- var i = 0
- for (slot in inventorySlots) {
- val stack = slot.stack
- if (stack != null) {
- add(slot)
- }
- i++
- if (i == skipAt) break
+ for (slot in guiChest.inventorySlots.inventorySlots) {
+ if (slot.inventory is InventoryPlayer) break
+ if (slot.stack != null) add(slot)
}
}