📐 模型
概述
指定游戏使用哪一个物品模型进行渲染,并且指定各个着色索引使用的颜色。type 默认为 minecraft:model。
items:
demo:sword:
material: diamond_sword
model:
path: minecraft:item/custom/sword
字段
| 字段 | 类型 | 必需 | 默认值 | 说明 |
|---|---|---|---|---|
type | string | 否 | minecraft:model | 模型类型标识 |
path | 资源路径 | 是 | — | 模型 JSON 的命名空间路径(如 demo:item/sword) |
generation | object | 否 | — | 从父模板自动生成模型 JSON |
tints | list | 否 | — | 指定各个着色索引使用的颜色提供器,数组下标对应着色索引 |
transformation | object | 否 | — | 物品模型变换(26.1+) |
Generation
设置 generation 后,CraftEngine 自动生成模型 JSON —— 无需手动提供模型文件。只有 parent 是必填的。
items:
demo:sword:
material: diamond_sword
model:
path: demo:item/sword
generation:
parent: minecraft:item/handheld
textures:
layer0: demo:item/sword
layer1: demo:item/sword_glow
display:
thirdperson_righthand:
rotation: 0,0,0
translation: 0,1,1
scale: 0.85,0.85,0.85
gui_light: front
| 字段 | 类型 | 必需 | 说明 |
|---|---|---|---|
parent | 资源路径 | 是 | 继承的父模型(如 minecraft:item/generated) |
textures | map | 否 | 纹理变量覆盖(layer0、layer1 …) |
display | object | 否 | 各上下文显示变换(thirdperson_righthand、gui、ground、fixed、head、firstperson_righthand …) |
gui_light | string | 否 | GUI 光照模式:front 或 side |
Tints
items:
demo:dyeable_armor:
material: leather_chestplate
model:
path: minecraft:item/custom/armor
generation:
parent: minecraft:item/generated
textures:
layer0: minecraft:item/custom/armor
layer1: minecraft:item/custom/armor_overlay
tints:
- type: minecraft:dye
default: 16777215
指定物品模型各个着色索引使用的颜色,数组下标对应着色索引。
所有颜色值接受以下格式:
value: 16711680 # 十进制 (0x00FF0000)
value: 255,0,0 # RGB 0–255
value: 1.0,0.0,0.0 # RGB 0.0–1.0
minecraft:constant
返回固定 RGB 颜色。
tints:
- type: minecraft:constant
value: 16711680 # 红色
minecraft:dye
返回 minecraft:dyed_color 组件的值,组件不存在时使用 default。
- type: minecraft:dye
default: 16777215
minecraft:firework
返回 minecraft:firework_explosion 组件中颜色的平均值,若无颜色则使用 default。
- type: minecraft:firework
default: 16777215
minecraft:grass
根据气候采样 textures/colormap/grass.png。
- type: minecraft:grass
temperature: 0.5 # 0.0–1.0
downfall: 0.5 # 0.0–1.0
minecraft:map_color
返回 minecraft:map_color 组件的值,组件不存在时使用 default。
- type: minecraft:map_color
default: 16777215
minecraft:potion
返回 minecraft:potion_contents 组件的颜色:优先 custom_color,其次效果颜色平均值,最后 default。组件不存在时返回 default。
- type: minecraft:potion
default: 16777215
minecraft:team
返回上下文实体的队伍颜色,若无实体、无队伍或队伍无颜色时使用 default。
- type: minecraft:team
default: 16777215
minecraft:custom_model_data
读取 minecraft:custom_model_data 组件中的 colors 列表。
- type: minecraft:custom_model_data
index: 0 # colors 数组中的位置
default: 16777215