From 25a8b8d33061c1dbf4bdd881e8ae436ead67d045 Mon Sep 17 00:00:00 2001 From: Walker Selby Date: Sat, 9 Dec 2023 12:22:27 -0800 Subject: Cleanup getItemsInOpenChest (#781) Cleanup getItemsInOpenChest. #781 --- src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src') 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 { val guiChest = Minecraft.getMinecraft().currentScreen as? GuiChest ?: return emptyList() - 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) } } -- cgit