⚖️ Condition
Overview
Switches between two child models based on a boolean property. Evaluates the property on the item stack — if true, uses on_true; otherwise on_false.
items:
demo:bow:
material: bow
model:
type: minecraft:condition
property: minecraft:using_item
on_true:
type: minecraft:model
path: minecraft:item/custom/bow_pull
on_false:
type: minecraft:model
path: minecraft:item/custom/bow
Fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
type | string | Yes | — | minecraft:condition |
property | string | Yes | — | Boolean property type (see below) |
on_true | model | Yes | — | Model when property is true |
on_false | model | Yes | — | Model when property is false |
transformation | object | No | — | Display transform overlay (26.1+) |
Properties
No extra fields
These properties require only the property name — no additional parameters.
| Property | Triggers when… |
|---|---|
minecraft:broken | Item is about to break |
minecraft:carried | Item is being carried between slots in GUI |
minecraft:damaged | Item is damageable and has been used at least once |
minecraft:extended_view | Player holds Shift while item is in a GUI |
minecraft:fishing_rod/cast | A fishing bobber is attached to this rod |
minecraft:selected | Item is on the selected hotbar slot |
minecraft:using_item | Player is currently using this item (eating, bow drawing, etc.) |
minecraft:view_entity | Context entity is the local player (or spectated entity) |
minecraft:bundle/has_selected_item | Bundle is "open" with a selected item visible in GUI |
minecraft:component (1.21.5+)
Uses a data component predicate to match item components.
property: minecraft:component
predicate: minecraft:damage # Component predicate type
value: # Structure depends on the predicate
damage: 0
| Field | Type | Description |
|---|---|---|
predicate | string | Component predicate type from minecraft:data_component_predicate_type registry |
value | varies | Predicate-specific value |
minecraft:has_component
true if the specified component exists on the item.
property: minecraft:has_component
component: minecraft:enchantments
ignore_default: false # If true, default-valued components count as absent
| Field | Type | Default | Description |
|---|---|---|---|
component | string | — | Namespaced component ID |
ignore_default | bool | false | Treat default-valued components as absent |
minecraft:keybind_down
true while the specified key is held down.
property: minecraft:keybind_down
keybind: key.left # Keybind ID from Controls menu
| Field | Type | Description |
|---|---|---|
keybind | string | Keybind identifier (e.g. key.left, key.sprint) |
minecraft:custom_model_data
Reads from the flags list in minecraft:custom_model_data component.
property: minecraft:custom_model_data
index: 0 # Position in the flags array
| Field | Type | Default | Description |
|---|---|---|---|
index | int | 0 | Position in the flags array |