diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-08-03 14:02:39 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-08-03 14:02:39 +0200 |
commit | a6e143df4997bdd76115f6da60a6f19ab320a436 (patch) | |
tree | 2a43e06855b47f70bf52e35f70938c5b213331e1 | |
parent | 0cfce2e3de75b9631cd75318477e3f71ec61a05a (diff) | |
download | skyhanni-a6e143df4997bdd76115f6da60a6f19ab320a436.tar.gz skyhanni-a6e143df4997bdd76115f6da60a6f19ab320a436.tar.bz2 skyhanni-a6e143df4997bdd76115f6da60a6f19ab320a436.zip |
Fixed potential 1:10000 case
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt index dd4a264ac..e9386430c 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.utils import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.inventory.ContainerChest +import net.minecraft.inventory.Slot import net.minecraft.item.ItemStack object InventoryUtils { @@ -10,8 +11,8 @@ object InventoryUtils { var itemInHandId = "" var latestItemInHand: ItemStack? = null - fun getItemsInOpenChest() = buildList { - val guiChest = Minecraft.getMinecraft().currentScreen as GuiChest + 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 |