概览
minecraft:behavior.tempt 是一个实体组件:写在自定义生物的 components 对象中,或其中某个组件组里。 让生物跟随手持它喜欢物品的玩家,比如牛喜欢小麦。很适合把动物引回家。
字段
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
can_get_scared | Boolean | "false" | 设为 true 时,玩家在它附近移动太快会让生物停止跟随。 |
can_tempt_vertically | Boolean | "false" | 设为 true 时,判断玩家距离时也会计算高度差。 |
can_tempt_while_ridden | Boolean | "false" | 设为 true 时,即使有人骑在生物身上,它也能被吸引。 |
items | Array | "[]" | 生物会跟随哪些物品。 |
sound_interval | Range [a, b] | "[0.0, 0.0]" | 两次被吸引音效之间的随机等待时间(刻)。 |
speed_multiplier | Decimal | "1.0" | 这个目标运行时让生物加速或减速:1 为正常速度。 |
stop_distance | Decimal | "1.5" | 生物靠近玩家到多近时停止移动。 |
tempt_sound | String | 无 | 生物被吸引时发出的声音。 |
within_radius | Decimal | "0.0" | 玩家要离多近,物品才能吸引生物。 |
示例
写在 BP/entities/<name>.json 的 components 对象中(值为默认值或占位值):
BP/entities/<name>.json
{
"minecraft:behavior.tempt": {
"can_get_scared": "false",
"can_tempt_vertically": "false",
"can_tempt_while_ridden": "false",
"items": "[]",
"sound_interval": "[0.0, 0.0]",
"speed_multiplier": "1.0",
"stop_distance": "1.5",
"tempt_sound": ""
}
}