Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minecraft:Items model definition: Difference between revisions

From SAS Gaming Wiki
SyncBot (talk | contribs)
Sync: updated from Minecraft
SyncBot (talk | contribs)
Sync: updated from Minecraft
 
(10 intermediate revisions by the same user not shown)
Line 9: Line 9:
Items models are stored as [[Minecraft:JSON]] files in a [[Minecraft:resource pack]] in the {{cd|assets/{{ph|namespace}}/items}} folder.
Items models are stored as [[Minecraft:JSON]] files in a [[Minecraft:resource pack]] in the {{cd|assets/{{ph|namespace}}/items}} folder.


Which items model is used by an item is based on the component {{cd|minecraft:item_model}}, which references the [[Minecraft:identifier]] of the items model at {{cd|/assets/{{ph|namespace}}/items/{{ph|id}}}}, and can be changed through [[Minecraft:commands]].
Which items model is used by an item is based on the component {{DCL|item_model}}, which references the [[Minecraft:identifier]] of the items model at {{cd|/assets/{{ph|namespace}}/items/{{ph|id}}}}, and can be changed through [[Minecraft:commands]].


== JSON format ==
== JSON format ==
Line 25: Line 25:
* {{nbt|compound}} An '''Items model''' object
* {{nbt|compound}} An '''Items model''' object
** {{nbt|string|type}}: One of {{cd|d=or|minecraft:model|minecraft:composite|minecraft:condition|minecraft:select|minecraft:range_dispatch|minecraft:empty|minecraft:bundle/selected_item|minecraft:special}}.
** {{nbt|string|type}}: One of {{cd|d=or|minecraft:model|minecraft:composite|minecraft:condition|minecraft:select|minecraft:range_dispatch|minecraft:empty|minecraft:bundle/selected_item|minecraft:special}}.
** {{nbt|compound|transformation}}: This field use the same format as the transformation field of the [[Minecraft:display]] entity, i.e. either an array of 16 numbers representing a matrix or structure with decomposed translation, scale and rotation info.
** {{nbt|compound|transformation}}: This field uses the same format as the transformation field of the [[Minecraft:display]] entity, i.e. either an array of 16 numbers representing a matrix or structure with decomposed translation, scale and rotation info.
*** For types with children ({{cd|d=or|minecraft:composite|minecraft:condition|minecraft:select|minecraft:range_dispatch}}), the transformation will be composed with the transformation of the children, except for {{cd|bundle/selected_item}}.
*** For types with children ({{cd|d=or|minecraft:composite|minecraft:condition|minecraft:select|minecraft:range_dispatch}}), the transformation will be composed with the transformation of the children, except for {{cd|bundle/selected_item}}.
*** Model transformations will be applied AFTER item display transformations (i.e. display section in model files).
*** Model transformations will be applied AFTER item display transformations (i.e. display section in model files).
*** Model transformations is not supporte in {{cd|d=and|minecraft:empty|minecraft:bundle/selected_item}} type.
*** Model transformations is not supported in {{cd|d=and|minecraft:empty|minecraft:bundle/selected_item}} type.
** Additional fields depending on value of type, see {{slink||Items model types}}.
** Additional fields depending on value of type, see {{slink||Items model types}}.
</div>
</div>
Line 58: Line 58:


===== dye =====
===== dye =====
Return value from {{cd|minecraft:dyed_color}} component or '''default''' if not present
Return value from {{DCL|dyed_color}} component or '''default''' if not present


<div class="treeview">
<div class="treeview">
Line 67: Line 67:


===== firework =====
===== firework =====
Return average of colors from {{cd|minecraft:firework_explosion}} component or '''default''' color if there are none.
Return average of colors from {{DCL|firework_explosion}} component or '''default''' color if there are none.


<div class="treeview">
<div class="treeview">
Line 86: Line 86:


===== map_color =====
===== map_color =====
Return value from {{cd|minecraft:map_color}} component or '''default''' color if component is not present.
Return value from {{DCL|map_color}} component or '''default''' color if component is not present.


<div class="treeview">
<div class="treeview">
Line 95: Line 95:


===== potion =====
===== potion =====
Return color from {{cd|minecraft:potion_contents}} component:
Return color from {{DCL|potion_contents}} component:
* if component is present:
* if component is present:
** ''custom_color'' value, if there is one present in component
** ''custom_color'' value, if there is one present in component
Line 118: Line 118:


===== custom_model_data =====
===== custom_model_data =====
Return value from {{cd|colors}} list in {{cd|minecraft:custom_model_data}} component.
Return value from {{cd|colors}} list in {{DCL|custom_model_data}} component.


<div class="treeview">
<div class="treeview">
Line 170: Line 170:
* additional fields:
* additional fields:
** {{nbt|string|predicate}}: Type of component predicate (member of {{cd|minecraft:data_component_predicate_type}} registry).
** {{nbt|string|predicate}}: Type of component predicate (member of {{cd|minecraft:data_component_predicate_type}} registry).
** {{nbt|string|value}}: Value to match.
** {{nbt|string}}{{nbt|list}}{{nbt|compound|value}}: Value to match against the predicate. The required data structure [[Minecraft:Data component predicate|depends on the predicate]].
</div>
</div>


Line 223: Line 223:


===== custom_model_data =====
===== custom_model_data =====
Return value from {{cd|flags}} list in {{cd|minecraft:custom_model_data}} component.
Return value from {{cd|flags}} list in {{DCL|custom_model_data}} component.


<div class="treeview">
<div class="treeview">
Line 248: Line 248:
==== Property types ====
==== Property types ====
===== block_state =====
===== block_state =====
Return value for some property from {{cd|minecraft:block_state}} component.
Return value for some property from {{DCL|block_state}} component.


<div class="treeview">
<div class="treeview">
Line 258: Line 258:


===== charge_type =====
===== charge_type =====
Return charge type stored in {{cd|minecraft:charged_projectiles}} component.
Return charge type stored in {{DCL|charged_projectiles}} component.


No additional fields for this type.
No additional fields for this type.
Line 313: Line 313:
<div class="treeview">
<div class="treeview">
* additional fields:
* additional fields:
** {{nbt|string|locale}}: Optional. Value describing locale. Default {{cd|""}} which means "root" locale (a set of defaults, including English names).
** {{nbt|string|locale}}: Optional. A [https://unicode.org/reports/tr35/tr35-12.html#Unicode_Language_and_Locale_Identifiers Unicode locale identifier (LDML 1.7)]. Defaults to {{cd|""}}, which results in the "root" locale (a set of defaults, including English names).
*** {{cd|en_US}}: English language (used for things like week names), formating as in USA.  
*** {{cd|en_US}}: English language (used for things like week names), formating as in USA.  
*** <code>cs_AU@numbers=thai;calendar=japanese</code>: Czech language, Australian formatting, Thai numerals and Japanese calendar.
*** <code>cs_AU@numbers=thai;calendar=japanese</code>: Czech language, Australian formatting, Thai numerals and Japanese calendar.
** {{nbt|string|time_zone}}: Optional. Value describing time zone. If not present, defaults to timezone set on client.
** {{nbt|string|time_zone}}: Optional. A time zone code. Defaults to the client timezone. Also see [https://javadoc.io/doc/com.ibm.icu/icu4j/77.1/com/ibm/icu/util/TimeZone.html the ICU4J TimeZone documentation].
*** Examples: {{cd|d=,|Europe/Stockholm|GMT+0:45}}
*** Examples: {{cd|d=,|Europe/Stockholm|GMT+0:45}}
** {{nbt|string|pattern}}: Describes format to be used for time formatting
** {{nbt|string|pattern}}: Describes format to be used for time formatting. See the corresponding [https://unicode.org/reports/tr35/tr35-12.html#Date_Format_Patterns Unicode Technical Standard] for details.
*** {{cd|yyyy-MM-dd}}: 4-digit year number, then 2-digit month number, then 2-digit day of month number, all zero-padded if needed, separated by {{cd|-}}.
*** {{cd|yyyy-MM-dd}}: 4-digit year number, then 2-digit month number, then 2-digit day of month number, all zero-padded if needed, separated by {{cd|-}}.
*** {{cd|HH:mm:ss}}: current time (hours, minutes, seconds), 24-hour cycle, all zero-padded to 2 digits of needed, separated by {{cd|:}}.
*** {{cd|HH:mm:ss}}: current time (hours, minutes, seconds), 24-hour cycle, all zero-padded to 2 digits of needed, separated by {{cd|:}}.
Line 333: Line 333:


===== trim_material =====
===== trim_material =====
Return value of {{cd|material}} field from {{cd|minecraft:trim}} component, if present.
Return value of {{cd|material}} field from {{DCL|trim}} component, if present.


No additional fields for this type.
No additional fields for this type.
Line 340: Line 340:


===== custom_model_data =====
===== custom_model_data =====
Return value from {{cd|strings}} list in {{cd|minecraft:custom_model_data}} component.
Return value from {{cd|strings}} list in {{DCL|custom_model_data}} component.


<div class="treeview">
<div class="treeview">
Line 367: Line 367:
==== Numeric property types ====
==== Numeric property types ====
===== bundle/fullness =====
===== bundle/fullness =====
Return weight of {{cd|minecraft:bundle_contents}} component or {{cd|0}} if not present.
Return weight of {{DCL|bundle_contents}} component or {{cd|0}} if not present.


No additional fields for this type.
No additional fields for this type.
Line 378: Line 378:
** {{nbt|string|target}}: One of:
** {{nbt|string|target}}: One of:
*** {{cd|spawn}}: points at world spawn.
*** {{cd|spawn}}: points at world spawn.
*** {{cd|lodestone}}: points at location stored in {{cd|minecraft:lodestone_tracker}} component.
*** {{cd|lodestone}}: points at location stored in {{DCL|lodestone_tracker}} component.
*** {{cd|recovery}}: points at last player death location.
*** {{cd|recovery}}: points at last player death location.
*** {{cd|none}}: always return an invalid target.
*** {{cd|none}}: always return an invalid target.
Line 395: Line 395:
* additional fields:
* additional fields:
** {{nbt|bool|normalize}}: Optional. Default: {{cd|true}}.
** {{nbt|bool|normalize}}: Optional. Default: {{cd|true}}.
*** If {{cd|true}}, return count divided by {{cd|minecraft:max_stack_size}} component, clamped to {{cd|0.0}} to {{cd|1.0}}.
*** If {{cd|true}}, return count divided by {{DCL|max_stack_size}} component, clamped to {{cd|0.0}} to {{cd|1.0}}.
*** If {{cd|false}}, return count clamped to {{cd|0}} to {{cd|minecraft:max_stack_size}}.
*** If {{cd|false}}, return count clamped to {{cd|0}} to {{cd|minecraft:max_stack_size}}.
</div>
</div>
Line 405: Line 405:


===== damage =====
===== damage =====
Return value for {{cd|minecraft:damage}} component or {{cd|0}} if not present.
Return value for {{DCL|damage}} component or {{cd|0}} if not present.


<div class="treeview">
<div class="treeview">
* additional fields:
* additional fields:
** {{nbt|bool|normalize}}: Optional. Default: {{cd|true}}.
** {{nbt|bool|normalize}}: Optional. Default: {{cd|true}}.
*** If {{cd|true}}, return value of damage divided by {{cd|minecraft:max_damage}} component, clamped to {{cd|0.0}} to {{cd|1.0}}.
*** If {{cd|true}}, return value of damage divided by {{DCL|max_damage}} component, clamped to {{cd|0.0}} to {{cd|1.0}}.
*** If {{cd|false}}, return raw value of damage, clamped to {{cd|0}} to {{cd|minecraft:max_damage}}.
*** If {{cd|false}}, return raw value of damage, clamped to {{cd|0}} to {{DCL|max_damage}}.
</div>
</div>


Line 419: Line 419:
<div class="treeview">
<div class="treeview">
* additional fields:
* additional fields:
** {{nbt|string|source}}: Time source to return. One of {{cd|d=or|daytime|moon_phase|random}}.
** {{nbt|string|source}}: Time source to return. One of {{cd|d=or|daytime|moon_phase|random}}. For {{cd|daytime}}, the source value is the {{cd|minecraft:visual/sun_angle}} [[Minecraft:environment attribute]] divided by 360.0, meaning {{cd|0.0}} represents noon and {{cd|0.5}} represents midnight. For {{cd|moon_phase}}, the source value is the {{cd|minecraft:visual/moon_phase}} environment attribute, with {{cd|d=and|full_moon|waning_gibbous|third_quarter|waning_crescent|new_moon|waxing_crescent|first_quarter|waxing_gibbous}} mapped to {{fraction|0|8}}, {{fraction|1|8}}, {{fraction|2|8}}, {{fraction|3|8}}, {{fraction|4|8}}, {{fraction|5|8}}, {{fraction|6|8}}, and {{fraction|7|8}} respectively. In both cases, the source value will default to {{cd|0.0}} in locations that don't specify those environment attributes, like [[Minecraft:the Nether]] and [[Minecraft:the End]]. For {{cd|random}}, the source value is a new random value every frame.
** {{nbt|bool|wobble}}: Optional. If {{cd|true}}, value will oscillate for some time around target before settling. Default: {{cd|true}}.
** {{nbt|bool|wobble}}: Optional. If {{cd|false}}, source value will be used directly. If {{cd|true}}, value will oscillate for some time around source value before settling. Default: {{cd|true}}.
</div>
</div>


Line 440: Line 440:


===== custom_model_data =====
===== custom_model_data =====
Return value from {{cd|floats}} list in {{cd|minecraft:custom_model_data}} component or {{cd|0}} if not present.
Return value from {{cd|floats}} list in {{DCL|custom_model_data}} component or {{cd|0}} if not present.


<div class="treeview">
<div class="treeview">
Line 454: Line 454:


=== bundle/selected_item ===
=== bundle/selected_item ===
Render the selected stack in {{cd|minecraft:bundle_contents}} component, if present, otherwise does nothing.
Render the selected stack in {{DCL|bundle_contents}} component, if present, otherwise does nothing.


No additional fields for this type.
No additional fields for this type.
Line 473: Line 473:
==== special model types ====
==== special model types ====
===== banner =====
===== banner =====
Render a banner with patterns from {{cd|minecraft:banner_patterns}} component.
Render a banner with patterns from {{DCL|banner_patterns}} component.


<div class="treeview">
<div class="treeview">
Line 480: Line 480:
** {{nbt|string|attachment}}: Optional. Selects a model to be used, one of {{cd|d=or|ground|wall}}. Default: {{cd|ground}}.
** {{nbt|string|attachment}}: Optional. Selects a model to be used, one of {{cd|d=or|ground|wall}}. Default: {{cd|ground}}.
** {{nbt|string|color}}: Color of the banner base, one of 16 predefined colors.
** {{nbt|string|color}}: Color of the banner base, one of 16 predefined colors.
</div>
===== bed =====
{{In development|je||26.2|removed=1|section=1}}
Render one half of a bed. To render both halves, and so the whole bed, use a {{cd|minecraft:composite}} model.
<div class="treeview">
* {{nbt|compound}} Root '''bed''' special type object
** {{nbt|string|type}}: {{cd|minecraft:bed}}
** {{nbt|string|part}}: Select the half to render between {{cd|d=or|head|foot}}.
** {{nbt|string|texture}}: Namespaced ID for the texture in the beds texture atlas without the {{cd|.png}} suffix. By default this includes textures in {{cd|textures/entity/bed/}}, without the prefix.
</div>
</div>


Line 536: Line 525:


===== decorated_pot =====
===== decorated_pot =====
Render a decorated pot. Uses values from {{cd|minecraft:pot_decorations}} component.
Render a decorated pot. Uses values from {{DCL|pot_decorations}} component.{{verify|still the case in 26.3?}}


No additional fields for this type.
No additional fields for this type.


===== end_cube =====
===== end_cube =====
Render a cube with the same texture effects as the End Portal and the End Gateway blocks.
Render a block-sized [[Minecraft:starfield]] cube.


<div class="treeview">
<div class="treeview">
* {{nbt|compound}} Root '''end_cube''' special type object
* {{nbt|compound}} Root '''end_cube''' special type object
** {{nbt|string|type}}: {{cd|minecraft:end_cube}}
** {{nbt|string|type}}: {{cd|minecraft:end_cube}}
** {{nbt|string|effect}}: Select the texture effect to apply between {{cd|d=or|gateway|portal}}.
** {{nbt|string|effect}}: Select the specific effect to apply between {{cd|d=or|gateway|portal}}.
</div>
</div>


Line 565: Line 554:
===== player_head =====
===== player_head =====


Render a player head. Use the data into the [[Minecraft:Data component format#profile|{{cd|minecraft:profile}}]] component to select the texture to render.
Render a player head. Use the data into the {{DCL|profile}} component to select the texture to render.


No additional fields for this type.
No additional fields for this type.


===== shield =====
===== shield =====
Render a shield. Uses patterns from {{cd|minecraft:banner_patterns}} component and color from {{cd|minecraft:base_color}} component.
Render a shield. Uses patterns from {{DCL|banner_patterns}} component and color from {{DCL|base_color}} component.


No additional fields for this type.
No additional fields for this type.
Line 582: Line 571:
** {{nbt|string|texture}}: Namespaced ID for the texture in the shulker boxes texture atlas without the {{cd|.png}} suffix. By default this includes textures in {{cd|textures/entity/shulker/}}, without the prefix.
** {{nbt|string|texture}}: Namespaced ID for the texture in the shulker boxes texture atlas without the {{cd|.png}} suffix. By default this includes textures in {{cd|textures/entity/shulker/}}, without the prefix.
** {{nbt|float|openness}}: Optional. Render the shulker box in the specified open state, between {{cd|0.0}} (fully closed) to {{cd|1.0}} (fully open). Default: {{cd|0.0}}.
** {{nbt|float|openness}}: Optional. Render the shulker box in the specified open state, between {{cd|0.0}} (fully closed) to {{cd|1.0}} (fully open). Default: {{cd|0.0}}.
</div>
===== standing_sign =====
Renders a standing sign.
<div class="treeview">
* {{nbt|compound}} Root '''standing_sign''' special type object
** {{nbt|string|type}}: {{cd|minecraft:standing_sign}}
** {{nbt|string|attachement}}{{sic}}<ref name="MC-307498">{{Bug|MC-307498|The JSON field name is misspelled as "attachement" instead of "attachment" in the game's source code.|}}</ref>: Optional. Selects a model to be used, one of {{cd|d=or|wall|ground}}. Default: {{cd|ground}}.
** {{nbt|string|wood_type}}: One of {{cd|d=or|oak|spruce|birch|acacia|cherry|jungle|dark_oak|pale_oak|mangrove|bamboo|crimson|warped}}.
** {{nbt|string|texture}}: Optional. Namespaced ID for the texture in the signs texture atlas without the {{cd|.png}} suffix. By default this includes textures in {{cd|textures/entity/signs/}}, without the prefix. If present, {{cd|wood_type}} field is ignored.
</div>
===== hanging_sign =====
Renders a hanging sign.
<div class="treeview">
* {{nbt|compound}} Root '''hanging_sign''' special type object
** {{nbt|string|type}}: {{cd|minecraft:hanging_sign}}
** {{nbt|string|attachment}}: Optional. Selects a model to be used, one of {{cd|d=or|wall|ceiling|ceiling_middle}}. Default: {{cd|ceiling_middle}}.
** {{nbt|string|wood_type}}: One of {{cd|d=or|oak|spruce|birch|acacia|cherry|jungle|dark_oak|pale_oak|mangrove|bamboo|crimson|warped}}.
** {{nbt|string|texture}}: Optional. Namespaced ID for the texture in the signs texture atlas without the {{cd|.png}} suffix. By default this includes textures in {{cd|textures/entity/signs/}}, without the prefix. If present, {{cd|wood_type}} field is ignored.
</div>
</div>


Line 644: Line 611:
|Added {{cd|d=and|bell|book}} special model types.
|Added {{cd|d=and|bell|book}} special model types.
|Added {{cd|attachment}} field to {{cd|d=and|banner|hanging_sign}} special model types.
|Added {{cd|attachment}} field to {{cd|d=and|banner|hanging_sign}} special model types.
|Added {{cd|attachement}}{{sic}}<ref name="MC-307498"/> field to {{cd|standing_sign}} special model type.
|Added {{cd|attachement}}{{sic}}<ref name="MC-307498">{{Bug|MC-307498|The JSON field name is misspelled as "attachement" instead of "attachment" in the game's source code.}}</ref> field to {{cd|standing_sign}} special model type.
|Added {{cd|part}} field to {{cd|bed}} special model type.
|Added {{cd|part}} field to {{cd|bed}} special model type.
|Added {{cd|chest_type}} field to {{cd|chest}} special model type.
|Added {{cd|chest_type}} field to {{cd|chest}} special model type.
|Removed {{cd|orientation}} field from {{cd|shulker_box}} special model type.}}
|Removed {{cd|orientation}} field from {{cd|shulker_box}} special model type.}}
|{{HistoryLine|||dev=pre1|Added {{cd|end_cube}} special model types.}}
|{{HistoryLine|||dev=pre1|Added {{cd|end_cube}} special model types.}}
|{{HistoryLine|java upcoming}}
|{{HistoryLine||26.2|dev=snap3|Removed the {{cd|bed}} special model type.}}
|{{HistoryLine||26.2|dev=snap3|Removed the {{cd|bed}} special model type.}}
|{{HistoryLine|||dev=snap7|Removed {{cd|d=and|standing_sign|hanging_sign}} special model types.}}
}}
}}
=== Removed special model types ===
===== bed =====
Render one half of a bed. To render both halves, and so the whole bed, use a {{cd|minecraft:composite}} model.
Version added: [[Minecraft:Java Edition 24w45a|24w45a]]. Version removed: [[Minecraft:Java Edition 26.2 Snapshot 3|26.2 snapshot 3]].
<div class="treeview">
* {{nbt|compound}} Root '''bed''' special type object
** {{nbt|string|type}}: {{cd|minecraft:bed}}
** {{nbt|string|part}}: Select the half to render between {{cd|d=or|head|foot}}.
** {{nbt|string|texture}}: Namespaced ID for the texture in the beds texture atlas without the {{cd|.png}} suffix. By default this includes textures in {{cd|textures/entity/bed/}}, without the prefix.
</div>
===== standing_sign =====
Renders a standing sign.
Version added: [[Minecraft:Java Edition 24w46a|24w46a]]. Version removed: [[Minecraft:Java Edition 26.2 Snapshot 7|26.2 snapshot 7]].
<div class="treeview">
* {{nbt|compound}} Root '''standing_sign''' special type object
** {{nbt|string|type}}: {{cd|minecraft:standing_sign}}
** {{nbt|string|attachement}}{{sic}}<ref name="MC-307498"/>: Optional. Selects a model to be used, one of {{cd|d=or|wall|ground}}. Default: {{cd|ground}}.
** {{nbt|string|wood_type}}: One of {{cd|d=or|oak|spruce|birch|acacia|cherry|jungle|dark_oak|pale_oak|mangrove|bamboo|crimson|warped}}.
** {{nbt|string|texture}}: Optional. Namespaced ID for the texture in the signs texture atlas without the {{cd|.png}} suffix. By default this includes textures in {{cd|textures/entity/signs/}}, without the prefix. If present, {{cd|wood_type}} field is ignored.
</div>
===== hanging_sign =====
Renders a hanging sign.
Version added: [[Minecraft:Java Edition 24w46a|24w46a]]. Version removed: [[Minecraft:Java Edition 26.2 Snapshot 7|26.2 snapshot 7]].
<div class="treeview">
* {{nbt|compound}} Root '''hanging_sign''' special type object
** {{nbt|string|type}}: {{cd|minecraft:hanging_sign}}
** {{nbt|string|attachment}}: Optional. Selects a model to be used, one of {{cd|d=or|wall|ceiling|ceiling_middle}}. Default: {{cd|ceiling_middle}}.
** {{nbt|string|wood_type}}: One of {{cd|d=or|oak|spruce|birch|acacia|cherry|jungle|dark_oak|pale_oak|mangrove|bamboo|crimson|warped}}.
** {{nbt|string|texture}}: Optional. Namespaced ID for the texture in the signs texture atlas without the {{cd|.png}} suffix. By default this includes textures in {{cd|textures/entity/signs/}}, without the prefix. If present, {{cd|wood_type}} field is ignored.
</div>


== References ==
== References ==

Latest revision as of 11:03, 23 July 2026

Template:Exclusive Template:TOC

Items models<ref>Name from the official name ("Item model", 24w45a news) and file directory (assets/<namespace>/items).</ref>, commonly referred to as Client Items, Item definitions or Itemstates, are processor files used by the game to define and select which Minecraft:model to use for rendering items, depending of various criteria such as components, item interactions, their position in the inventory, or numerous other in-game values.

Items models are stored as Minecraft:JSON files in a Minecraft:resource pack in the Template:Cd folder.

Which items model is used by an item is based on the component Template:DCL, which references the Minecraft:identifier of the items model at Template:Cd, and can be changed through Minecraft:commands.

JSON format

  • Template:Nbt Root object
    • Template:Nbt: Optional. Describes if a down-and-up animation should be played in first-person view when the item slot is changed (either type, count, components or by swapping the item into the other hand). Default: Template:Cd.
    • Template:Nbt: Optional. Describes if the items model is allowed to render bigger than the item slot. If Template:Cd the render will be clipped to the item slot size. Default: Template:Cd.
      • The ability of items being rendered outside of their slots is not considered officially supported by Mojang. It's a backward compatibility until an official functionality is developed at some point in the future.<ref>Template:Mcnet</ref>
    • Template:Nbt: Optional. Indicates how fast the item moves up and down when swapping items in hotbar. Large speeds can allow items that take more of the screen space to fully duck before swapped into the next item. Default: Template:Cd.
    • Template:Nbt: Set the basic Items model object.

Items model

  • Template:Nbt An Items model object
    • Template:Nbt: One of Template:Cd.
    • Template:Nbt: This field uses the same format as the transformation field of the Minecraft:display entity, i.e. either an array of 16 numbers representing a matrix or structure with decomposed translation, scale and rotation info.
      • For types with children (Template:Cd), the transformation will be composed with the transformation of the children, except for Template:Cd.
      • Model transformations will be applied AFTER item display transformations (i.e. display section in model files).
      • Model transformations is not supported in Template:Cd type.
    • Additional fields depending on value of type, see Template:Slink.

Items model types

model

Render a plain model from the Template:Cd directory.

Tint sources types

constant

Return a constant RGB color.

dye

Return value from Template:DCL component or default if not present

firework

Return average of colors from Template:DCL component or default color if there are none.

grass

Return grass color at specific climate parameters, based on Template:Cd

map_color

Return value from Template:DCL component or default color if component is not present.

potion

Return color from Template:DCL component:

  • if component is present:
    • custom_color value, if there is one present in component
    • default color, if effect list is empty
    • average of effect colors
  • else, default color
team

Returns the team color of context entity, if any. Else, when there is no context entity, entity is not in a team or team has no color, return default.

custom_model_data

Return value from Template:Cd list in Template:DCL component.

composite

Render multiple sub-models in the same space.


condition

Boolean property types

broken

Return Template:Cd if the item is damageable and has only one use remaining before breaking.

No additional fields for this type.

bundle/has_selected_item

Return Template:Cd if bundle is "open", i.e. it has selected item visible in GUI.

No additional fields for this type.

carried

Return Template:Cd if item is carried between slots in GUI.

No additional fields for this type.

component

Uses component Minecraft:data component predicates to match item components.

damaged

Return Template:Cd if the item is damageable and has been used at least once.

No additional fields for this type.

extended_view

Return Template:Cd if player has requested extended details by holding shift key down. Only works when item is displayed in UI. Note: not a keybind, can't be rebound.

No additional fields for this type.

fishing_rod/cast

Return Template:Cd if there is a fishing bobber attached to currently used fishing rod.

No additional fields for this type.

has_component

Return Template:Cd if the given component is present on the item.

  • additional fields:
    • Template:Nbt: Component name.
    • Template:Nbt: Optional. If default component value should be handled as "no component". Default: false.
keybind_down

Return Template:Cd if keybind is currently active.

selected

Return Template:Cd if item is selected on a hotbar.

No additional fields for this type.

using_item

Return Template:Cd if player is currently using this item.

No additional fields for this type.

view_entity
  • When not spectating, return Template:Cd if context entity is the local player entity, i.e. the one controlled by client.
  • When spectating, return Template:Cd if context entity is the spectated entity.
  • If context entity is not present, will return Template:Cd.

No additional fields for this type.

custom_model_data

Return value from Template:Cd list in Template:DCL component.


select

Render an items model based on discrete property.

Property types

block_state

Return value for some property from Template:DCL component.

  • additional fields:

Values: Any string.

charge_type

Return charge type stored in Template:DCL component.

No additional fields for this type.

Values:

component

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.

  • additional fields:

Values: Depends on the target component type.

context_dimension

Return the ID of the dimension in context, if any.

No additional fields for this type.

Values: Namespaced dimension ID.

context_entity_type

Return the holding entity type, if present.

No additional fields for this type.

Values: Namespaced entity type ID.

display_context

Return context this item is rendered in.

No additional fields for this type.

Values:

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.

Values: Any string.

main_hand

Return main hand of holding player.

No additional fields for this type.

Values: Template:Cd.

trim_material

Return value of Template:Cd field from Template:DCL component, if present.

No additional fields for this type.

Values: Namespaced ID trim material.

custom_model_data

Return value from Template:Cd list in Template:DCL component.

Values: Any string.

range_dispatch

Render an items model based on numeric property. Will select last entry with threshold less or equal to property value.

Numeric property types

bundle/fullness

Return weight of Template:DCL component or Template:Cd if not present.

No additional fields for this type.

compass

Return an angle, scaled from Template:Cd to Template:Cd in x-z plane between holder position and target. If target is not valid (not present, in other dimension or too close to holder position) random value will be returned.

cooldown

Return remaining cooldown for item, scaled between Template:Cd to Template:Cd.

No additional fields for this type.

count

Return stack size.

crossbow/pull

Return crossbow-specific use time.

No additional fields for this type.

damage

Return value for Template:DCL component or Template:Cd if not present.

time

Return value of an in-game time, scaled between Template:Cd to Template:Cd.

use_cycle

Return remaining use ticks modulo Template:Cd.

use_duration

Return item use ticks.

custom_model_data

Return value from Template:Cd list in Template:DCL component or Template:Cd if not present.

empty

Does not render anything.

No additional fields for this type.


bundle/selected_item

Render the selected stack in Template:DCL component, if present, otherwise does nothing.

No additional fields for this type.


special

Render a special model.

special model types

Render a banner with patterns from Template:DCL component.

bell

Render the animated part of a Bell block.

No additional fields for this type.

book

Render the book that normally is a part of Enchanting Table and Lectern.

chest

Render a single chest.

conduit

Render conduit.

No additional fields for this type.

copper_golem_statue

Render a Minecraft:copper golem statue.

decorated_pot

Render a decorated pot. Uses values from Template:DCL component.Template:Verify

No additional fields for this type.

end_cube

Render a block-sized Minecraft:starfield cube.

head

Render a head.

player_head

Render a player head. Use the data into the Template:DCL component to select the texture to render.

No additional fields for this type.

shield

Render a shield. Uses patterns from Template:DCL component and color from Template:DCL component.

No additional fields for this type.

shulker_box

Render a shulker box.

trident

Render a trident.

No additional fields for this type.

History

Template:HistoryTable

Removed special model types

bed

Render one half of a bed. To render both halves, and so the whole bed, use a Template:Cd model.

Version added: 24w45a. Version removed: 26.2 snapshot 3.

standing_sign

Renders a standing sign.

Version added: 24w46a. Version removed: 26.2 snapshot 7.

hanging_sign

Renders a hanging sign.

Version added: 24w46a. Version removed: 26.2 snapshot 7.

References

Template:Reflist

Navigation

Template:Navbox Java Edition technical

Minecraft:de:Gegenstandsmodelldefinition Minecraft:zh:物品模型映射

Contents