Skip to main content

Inventory (Entity Condition Type)

Counts the items in the entity's inventory, an inventory power's container or both that pass an item condition, and compares the count with a number.

Type ID: apoli:inventory

note

Including "power" in inventory_types counts items in the apoli:inventory power named by the power field. That container is read on the server only, because its contents aren't synced to clients. Address its slots with the container.N form of Item Slot instead of named slots.

Fields

FieldTypeDefaultDescription
inventory_typesArray of Inventory Type["inventory"]Whether to count items in the entity's inventory, in the inventories of its powers, or both.
process_modeProcess Mode"items"Whether individual items or whole stacks are counted.
item_conditionItem Condition TypeoptionalOnly items that pass this condition are counted.
slotsArray of Item SlotoptionalOnly the items in these slots are checked.
slotItem SlotoptionalOnly the item in this slot is checked.
powerIdentifieroptionalWhen inventory_types includes "power", the inventory power whose items are checked.
comparisonComparison">"How the count is compared with compare_to.
compare_toInteger0The number the count is compared with.

Examples

"condition": {
    "type": "apoli:inventory",
    "process_mode": "stacks",
    "comparison": ">=",
    "compare_to": 10
}

This checks whether 10 or more slots of the entity's inventory hold any item.

"condition": {
    "type": "apoli:inventory",
    "process_mode": "items",
    "item_condition": {
        "type": "apoli:ingredient",
        "ingredient": {
            "tag": "minecraft:flowers"
        }
    },
    "comparison": "<",
    "compare_to": 16
}

This checks whether the entity has 15 or fewer items from the #minecraft:flowers item tag (data/minecraft/tags/items/flowers.json) in its inventory.