跳到主要内容

📡 值调配型

概述

先计算物品堆叠内给定的一个数值属性,游戏会按照给定阈值从小到大排序,找到数值属性第一个超过或等于的阈值,并使用对应物品模型映射。如果数值属性小于所有阈值,则使用回落物品模型映射。如果此项不存在,则使用无效模型。

items:
demo:shield:
material: shield
model:
type: minecraft:range_dispatch
property: minecraft:damage
scale: 1.0
entries:
- threshold: 0.0
model:
type: minecraft:model
path: minecraft:item/custom/shield_full
- threshold: 0.5
model:
type: minecraft:model
path: minecraft:item/custom/shield_cracked
fallback:
type: minecraft:model
path: minecraft:item/custom/shield_full

字段

字段类型必需默认值说明
typestringminecraft:range_dispatch
propertystring数值属性类型(见下方)
scalefloat1.0比较前与属性值相乘的系数
entrieslist{threshold, model} 配对的列表
fallbackmodel无效模型回落物品模型映射,检查数值小于所有阈值时使用
transformationobject物品模型变换(26.1+)

每个条目:

字段类型说明
thresholdfloat使用此模型的最小属性值
modelmodel属性 ≥ 此阈值(且 < 下一阈值)时使用的模型

属性

无额外字段

属性返回值(除标注外均为 0.0–1.0)
minecraft:crossbow/pull弩的拉弦进度
minecraft:bundle/fullnessminecraft:bundle_contents 的重量(无组件则为 0)
minecraft:cooldown剩余冷却比例(不在物品栏则为 0)
minecraft:use_cycle剩余使用 tick 对 period 取模

minecraft:compass

返回 x-z 平面内朝向目标的 0.0–1.0 角度。目标无效时返回随机值。

property: minecraft:compass
target: spawn
wobble: true
字段类型默认值说明
targetstring目标类型:spawnlodestonerecoverynone
wobblebooltrue模拟指南针摆动

minecraft:count

返回物品堆叠的数量。若 normalize 为 true,返回数量除以最大堆叠数,钳制至 0.0–1.0;否则返回原始数量。

property: minecraft:count
normalize: true
字段类型默认值说明
normalizebooltrue缩放到 0.0–1.0;false 则返回原始数量

minecraft:damage

返回 minecraft:damage 组件的值,不存在则为 0。若 normalize 为 true,返回损坏值除以最大耐久度,钳制至 0.0–1.0;否则返回原始损坏值。

property: minecraft:damage
normalize: true
字段类型默认值说明
normalizebooltrue缩放到 0.0–1.0;false 则返回原始损坏值

minecraft:time

返回缩放到 0.0–1.0 的游戏内时间值。来源可为 daytime(太阳角度)、moon_phase(月相)或 random(每帧随机)。

property: minecraft:time
source: daytime
wobble: true
字段类型默认值说明
sourcestring时间来源:daytimemoon_phaserandom
wobblebooltrue平滑摆动

minecraft:use_duration

返回物品已使用的 tick 数(或剩余 tick)。

property: minecraft:use_duration
remaining: false
字段类型默认值说明
remainingboolfalse返回剩余而非已过的 tick

minecraft:custom_model_data

读取 minecraft:custom_model_data 组件中的 floats 列表。

property: minecraft:custom_model_data
index: 0
字段类型默认值说明
indexint0floats 数组中的位置