Inventory (Entity Condition Type)

Checks the entity's inventory (and/or an Inventory power's container) for items matching a condition, comparing the count against a value.

Checks the entity’s inventory (and/or an Inventory power’s container) for items matching a condition, comparing the count against a value.

Type ID: apoli:inventory

POWER INVENTORIES: including "power" in inventory_types counts items in the apoli:inventory named by the power field. This reads the power’s stored container server-side only (its contents aren’t synced to clients). Address its slots with the container.N Item Slot form rather than named slots.

Fields

FieldTypeDefaultDescription
inventory_typesArray of Inventory Types["inventory"]Determines whether to check for items in the entity’s inventory, inventories of powers present in the entity, or both.
process_modeProcess Mode"items"Determines how the item stacks in the specified inventory/inventories are evaluated.
item_conditionItem Condition TypeoptionalIf specified, only account for items from the specified inventory/inventories that fulfill this condition.
slotsArray of Item SlotsoptionalIf specified, only items from these specified item slots are evaluated.
slotItem SlotoptionalIf specified, only the item from this specified item slot is evaluated.
powerIdentifieroptionalIf specified and if inventory_type is "power", the items in the inventory of this power will be evaluated instead.
comparisonComparison">"Determines how the amount of items/stacks that were evaluated should be compared to the specified value.
compare_toInteger0The value at which the amount of items/stacks that were evaluated will be compared to.

Examples

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

This example will check if 10 or more slots are occupied by any items in the entity’s inventory.

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

This example will check if 15 or less individual items that are included in the #minecraft:flowers (data/minecraft/tags/items/flowers.json) item tag are in the inventory of the entity.