概览
minecraft:use_modifiers 是一个物品组件:写在自定义物品的 components 对象中。 控制按住使用键时的表现:一次使用需要多长时间,以及期间玩家走得多慢。食物、药水和弓都需要它。
字段
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
start_using | StartUsing | "if_first" | 是只在没有其他使用时才开始("if_first"),还是每次都重新开始("always")。 |
use_duration | number | 0 | 物品完成使用所需的秒数,比如吃东西的时间。范围:0 到 … |
emit_vibrations | boolean | true | 为 true 时,开始和停止使用会产生幽匿感测体能听到的振动。 |
start_sound | LevelSoundEvent | 无 | 玩家开始使用物品时播放的声音。 |
movement_modifier | number | 无 | 使用时的行走速度:1 为正常速度,0.35 是吃东西时的慢速。范围:0 到 1 |
示例
写在 BP/items/<name>.json 的 components 对象中(值为默认值或占位值):
BP/items/<name>.json
{
"minecraft:use_modifiers": {
"start_using": "if_first",
"use_duration": 0,
"emit_vibrations": true,
"start_sound": {},
"movement_modifier": 0
}
}