aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorWalker Selby <git@walkerselby.com>2023-12-09 12:22:27 -0800
committerGitHub <noreply@github.com>2023-12-09 21:22:27 +0100
commit25a8b8d33061c1dbf4bdd881e8ae436ead67d045 (patch)
treecad6da42cddbbf8332394e823ac992c99a14e7b2 /src/main
parent79e838d5f425fd161fd23f8a8e31938fa5b2bbb7 (diff)
downloadskyhanni-25a8b8d33061c1dbf4bdd881e8ae436ead67d045.tar.gz
skyhanni-25a8b8d33061c1dbf4bdd881e8ae436ead67d045.tar.bz2
skyhanni-25a8b8d33061c1dbf4bdd881e8ae436ead67d045.zip
Cleanup getItemsInOpenChest (#781)
Cleanup getItemsInOpenChest. #781
Diffstat (limited to 'src/main')
-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)
}
}