Skip to main content

⚖️ 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

FieldTypeRequiredDefaultDescription
typestringYesminecraft:condition
propertystringYesBoolean property type (see below)
on_truemodelYesModel when property is true
on_falsemodelYesModel when property is false
transformationobjectNoDisplay transform overlay (26.1+)

Properties

No extra fields

These properties require only the property name — no additional parameters.

PropertyTriggers when…
minecraft:brokenItem is about to break
minecraft:carriedItem is being carried between slots in GUI
minecraft:damagedItem is damageable and has been used at least once
minecraft:extended_viewPlayer holds Shift while item is in a GUI
minecraft:fishing_rod/castA fishing bobber is attached to this rod
minecraft:selectedItem is on the selected hotbar slot
minecraft:using_itemPlayer is currently using this item (eating, bow drawing, etc.)
minecraft:view_entityContext entity is the local player (or spectated entity)
minecraft:bundle/has_selected_itemBundle 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
FieldTypeDescription
predicatestringComponent predicate type from minecraft:data_component_predicate_type registry
valuevariesPredicate-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
FieldTypeDefaultDescription
componentstringNamespaced component ID
ignore_defaultboolfalseTreat 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
FieldTypeDescription
keybindstringKeybind 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
FieldTypeDefaultDescription
indexint0Position in the flags array