Item Models

To add or override an Item model file, add the item model name at Sune/item_definitions.yml.

Add a type node to that. There are 4 item model types: model, condition, composite and select.

Example
diamond:
    type: model

There are additional fields based on the type you picked.


Additional Fields

Model

model - The path of the model to use. (references namespace/models folder)

Example
diamond: #Generic item model
    type: model
    model: item/diamond

Composite

The specified item models will stack on top of another. The first models will show up behind.

models - A list of item models

Example
diamond:
    type: composite
    models: #A list of item models
        - type: model
          model: item/diamond
        - type: model
          model: item/emerald

Condition

Item model to show based on a condition.

property - The type of condition. *additional fields based on the property*

has_component: # ↓ If the item has the specified component
    component: # a component name
keybind_down: # ↓ If the player is using the specified keybind by id
    keybind: #
selected: #none
using_item: #none
view_entity: #none
extended_view: #none
bundle/has_selected_item: #none
fishing_rod/cast: #none
carried: #none
damaged: #none
broken: #none

on_true - The item model to show if the condition is true on_false - The item model to show if the condition is false

Example
diamond:
    type: condition
    property: has_component
    component: unbreakable
    on_true:
        type: model
        model: item/emerald
    on_false:
        type: model
        model: item/emerald

Select

Pick an item model based on a specific property

property - The type of property.

context_dimension: #Returns the ID of the item dimension. No additional fields.
context_entity_type: #Returns the holding entity type. No additional fields.
display_context: #Return view this item is rendered in. ()
local_time: #Returns the current time formatted according to a given pattern.
    pattern: #Time format, yyyy-MM-dd => 2025-04-1. HH:mm:ss => 18:15:00
    #More info at 
main_hand: #Return main hand of holding player (Left / Right)

cases - a list of case objects

Case Object

when - list of string(s), the value to match the property with. If matched. model - the item model to use if matched

fallback - An item model in-case there wasn't a matching.

Example
diamond:
    type: select
    property: main_hand
    cases:
        - when: "right"
          model:
            type: model
            model: item/diamond
        - when: "left"
          model:
            type: model
            model: item/emerald
  fallback:
    type: model
    model: item/apple

Complex Item models

Because we are just reusing item model objects until we are getting to model type, we can make the item model much more complex.

Example
diamond:
    type: composite
    models:
      - type: model
        model: item/emerald
      - type: select
        property: main_hand
        cases:
          - when: "right"
            model:
              type: model
              model: item/blaze_rod
          - when: "left"
            model:
              type: model
              model: item/breeze_rod
        fallback:
          type: model
          model: item/apple

Last updated