Inventory Util
dev.anvilcraft.lib.v2.util.InventoryUtil provides inventory operations.
getFirstItem(Inventory, ItemLike)– finds the first matching itemgetFirstItem(Inventory, Supplier<ItemLike>)– same as above, using a lazy suppliergetFirstItem(Inventory, Predicate<ItemStack>)– finds by conditiongetItems(Inventory, Predicate<ItemStack>)– filters the inventorygetItems(Inventory)– gets a copy of all itemshasItem(Inventory, Item)– checks whether the inventory contains the itemhasItem(Inventory, Supplier<ItemLike>)– same as abovegetItemInCompat(LivingEntity, Predicate<ItemStack>)– retrieves an item via compat consumersgetCompatItems(LivingEntity)– gets a list of compat items (custom consumers can be registered)hasItemInCompat(LivingEntity, Predicate<ItemStack>)– compat item detectioninsertItem(Inventory, ItemStack)– inserts an item into a suitable slot (with network sync)
Note: compatConsumer defaults to a no-op. Set this BiConsumer to support item containers from other mods.