From a6e143df4997bdd76115f6da60a6f19ab320a436 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 3 Aug 2023 14:02:39 +0200 Subject: Fixed potential 1:10000 case --- src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt | 5 +++-- 1 file 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 { + val guiChest = Minecraft.getMinecraft().currentScreen as? GuiChest ?: return emptyList() val inventorySlots = guiChest.inventorySlots.inventorySlots val skipAt = inventorySlots.size - 9 * 4 var i = 0 -- cgit