â Select
Introdcutionâ
Render an item model based on discrete property.
When using minecraft:select
, you need to specify a property type. cases
represent a list of scenarios to match against, while fallback
represents the item model object that will be used if no valid entry is found. It is optional, but if not provided, a "missing" error model will be rendered.
items:
default:select_item:
model:
type: "minecraft:select"
property: "minecraft:charge_type"
cases:
- when: arrow
model:
type: minecraft:model
path: "minecraft:item/custom/model_1"
- when: rocket
model:
type: minecraft:model
path: "minecraft:item/custom/model_2"
fallback:
type: minecraft:model
path: "minecraft:item/custom/model_3"
Propertiesâ
Check https://minecraft.wiki/w/Items_model_definition#select for the explanation of each argument.
minecraft:charge_typeâ
Return charge type stored in
minecraft:charged_projectiles
component.
minecraft:context_dimensionâ
Return the ID of the dimension in context, if any.
minecraft:context_entity_typeâ
Return the holding entity type, if present.
minecraft:display_contextâ
Return context this item is rendered in.
minecraft:main_handâ
Return main hand of holding player.
minecraft:trim_materialâ
Return value of
material
field fromminecraft:trim
component, if present.
minecraft:block_stateâ
Return value for some property from
minecraft:block_state
component.
type: "minecraft:select"
property: "minecraft:block_state"
block-state-property: "facing"
minecraft:component (1.21.5+)â
Return value from a component. If the selected value comes from a registry and the current datapacks does not provide it, the entry will be silently ignored.
type: "minecraft:select"
property: "minecraft:component"
component: "minecraft:unbreakable"
minecraft:custom_model_dataâ
Return value from
strings
list inminecraft:custom_model_data
component.
type: "minecraft:select"
property: "minecraft:custom_model_data"
index: 0
minecraft:local_timeâ
Returns the current time formatted according to a given pattern. The value is updated every second. For full format documentation for locale, time zone and pattern, see ICU (International Components for Unicode) documentation.
type: "minecraft:select"
property: "minecraft:local_time"
locale: "en_US"
time-zone: "GMT+0:45"
pattern: "HH:mm:ss"