aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-02-02 20:43:28 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-02-02 20:43:28 +0100
commit81575ce551cba580bc8843ed5f0048b8bd4dca7f (patch)
treec95e5ce19b7f21dd725877de260cec4906d11e6b /src/main/java/at/hannibal2/skyhanni/utils
parent29279564a61446ca1d2b684481dbf5b991485470 (diff)
downloadSkyHanni-81575ce551cba580bc8843ed5f0048b8bd4dca7f.tar.gz
SkyHanni-81575ce551cba580bc8843ed5f0048b8bd4dca7f.tar.bz2
SkyHanni-81575ce551cba580bc8843ed5f0048b8bd4dca7f.zip
Prepare for bingo stuff.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt
index feaaaa481..da152a2c3 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt
@@ -4,6 +4,7 @@ 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 {
@@ -48,4 +49,9 @@ object InventoryUtils {
fun ContainerChest.getInventoryName(): String {
return this.lowerChestInventory.displayName.unformattedText.trim()
}
+
+ fun countItemsInLowerInventory(predicate: (ItemStack) -> Boolean) =
+ Minecraft.getMinecraft().thePlayer.inventory.mainInventory
+ .filter { it != null && predicate(it) }
+ .sumOf { it.stackSize }
} \ No newline at end of file