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

From SAS Gaming Wiki

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 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:Cd, which references the Minecraft:resource location 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 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.
      • 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 supporte 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:Cd component or default if not present

firework

Return average of colors from Template:Cd 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:Cd component or default color if component is not present.

potion

Return color from Template:Cd 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:Cd 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:Cd component.


select

Render an items model based on discrete property.

Property types

block_state

Return value for some property from Template:Cd component.

  • additional fields:

Values: Any string.

charge_type

Return charge type stored in Template:Cd 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.

  • additional fields:
    • Template:Nbt: Optional. Value describing locale. Default Template:Cd which means "root" locale (a set of defaults, including English names).
      • Template:Cd: English language (used for things like week names), formating as in USA.
      • cs_AU@numbers=thai;calendar=japanese: Czech language, Australian formatting, Thai numerals and Japanese calendar.
    • Template:Nbt: Optional. Value describing time zone. If not present, defaults to timezone set on client.
    • Template:Nbt: Describes format to be used for time formatting
      • Template:Cd: 4-digit year number, then 2-digit month number, then 2-digit day of month number, all zero-padded if needed, separated by Template:Cd.
      • Template:Cd: current time (hours, minutes, seconds), 24-hour cycle, all zero-padded to 2 digits of needed, separated by Template:Cd.

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:Cd 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:Cd 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:Cd 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:Cd 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:Cd 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:Cd 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:Cd component.

bed

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

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:Cd component.

No additional fields for this type.

end_cube

Render a cube with the same texture effects as the End Portal and the End Gateway blocks.

head

Render a head.

player_head

Render a player head. Use the data into the [[Minecraft:Data component format#profile|Template:Cd]] component to select the texture to render.

No additional fields for this type.

shield

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

No additional fields for this type.

shulker_box

Render a shulker box.

standing_sign

Renders a standing sign.

hanging_sign

Renders a hanging sign.

trident

Render a trident.

No additional fields for this type.

History

Template:HistoryTable

References

Template:Reflist

Navigation

Template:Navbox Java Edition technical

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

Contents