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
| Field | Type | Default | Description |
|---|---|---|---|
inventory_types | Array of Inventory Type | ["inventory"] | Whether to count items in the entity's inventory, in the inventories of its powers, or both. |
process_mode | Process Mode | "items" | Whether individual items or whole stacks are counted. |
item_condition | Item Condition Type | optional | Only items that pass this condition are counted. |
slots | Array of Item Slot | optional | Only the items in these slots are checked. |
slot | Item Slot | optional | Only the item in this slot is checked. |
power | Identifier | optional | When inventory_types includes "power", the inventory power whose items are checked. |
comparison | Comparison | ">" | How the count is compared with compare_to. |
compare_to | Integer | 0 | The 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.