diff options
Diffstat (limited to 'src/main/java/at')
-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 |