📡 值调配型
概述
先计算物品堆叠内给定的一个数值属性,游戏会按照给定阈值从小到大排序,找到数值属性第一个超过或等于的阈值,并使用对应物品模型映射。如果数值属性小于所有阈值,则使用回落物品模型映射。如果此项不存在,则使用无效模型。
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
字段
| 字段 | 类型 | 必需 | 默认值 | 说明 |
|---|---|---|---|---|
type | string | 是 | — | minecraft:range_dispatch |
property | string | 是 | — | 数值属性类型(见下方) |
scale | float | 否 | 1.0 | 比较前与属性值相乘的系数 |
entries | list | 是 | — | {threshold, model} 配对的列表 |
fallback | model | 否 | 无效模型 | 回落物品模型映射,检查数值小于所有阈值时使用 |
transformation | object | 否 | — | 物品模型变换(26.1+) |
每个条目:
| 字段 | 类型 | 说明 |
|---|---|---|
threshold | float | 使用此模型的最小属性值 |
model | model | 属性 ≥ 此阈值(且 < 下一阈值)时使用的模型 |
属性
无额外字段
| 属性 | 返回值(除标注外均为 0.0–1.0) |
|---|---|
minecraft:crossbow/pull | 弩的拉弦进度 |
minecraft:bundle/fullness | minecraft: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
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
target | string | — | 目标类型:spawn、lodestone、recovery、none |
wobble | bool | true | 模拟指南针摆动 |
minecraft:count
返回物品堆叠的数量。若 normalize 为 true,返回数量除以最大堆叠数,钳制至 0.0–1.0;否则返回原始数量。
property: minecraft:count
normalize: true
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
normalize | bool | true | 缩放到 0.0–1.0;false 则返回原始数量 |
minecraft:damage
返回 minecraft:damage 组件的值,不存在则为 0。若 normalize 为 true,返回损坏值除以最大耐久度,钳制至 0.0–1.0;否则返回原始损坏值。
property: minecraft:damage
normalize: true
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
normalize | bool | true | 缩放到 0.0–1.0;false 则返回原始损坏值 |
minecraft:time
返回缩放到 0.0–1.0 的游戏内时间值。来源可为 daytime(太阳角度)、moon_phase(月相)或 random(每帧随机)。
property: minecraft:time
source: daytime
wobble: true
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
source | string | — | 时间来源:daytime、moon_phase、random |
wobble | bool | true | 平滑摆动 |
minecraft:use_duration
返回物品已使用的 tick 数(或剩余 tick)。
property: minecraft:use_duration
remaining: false
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
remaining | bool | false | 返回剩余而非已过的 tick |
minecraft:custom_model_data
读取 minecraft:custom_model_data 组件中的 floats 列表。
property: minecraft:custom_model_data
index: 0
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
index | int | 0 | floats 数组中的位置 |