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
 
(One intermediate revision by the same user not shown)
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 525: Line 525:


===== decorated_pot =====
===== decorated_pot =====
Render a decorated pot. Uses values from {{DCL|pot_decorations}} component.{{verify|still the case in 26.3}}
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.

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