概览
minecraft:behavior.follow_owner 是一个实体组件:写在自定义生物的 components 对象中,或其中某个组件组里。 让驯服的生物跟随主人玩家的 AI 目标,比如狗。
字段
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
speed_multiplier | number | 1 | 跟随主人时的速度倍率。 |
start_distance | number | 10 | 主人至少离开这么远时,生物开始跟随。 |
stop_distance | number | 2 | 生物离主人这么近时停止跟随。 |
can_teleport | boolean | true | 为 true 时,生物落后太远会传送到主人身边。 |
post_teleport_distance | integer | 3 | 传送后生物落在离主人多远的地方。 |
ignore_vibration | boolean | false | 为 true 时,生物注意到振动也不会停止跟随。 |
max_distance | number | 60 | 开始跟随时主人的最远距离。仅在 can_teleport 为 false 时使用。 |
priority | integer | 0 | 数字越小越先执行:两个目标冲突时,priority 更小的那个胜出。范围:0 到 … |
control_flags | Goal's control flags[] | 无 | 此目标接管哪些身体部分(移动、看向、跳跃),占用相同部分的目标不能同时运行。 |
示例
写在 BP/entities/<name>.json 的 components 对象中(值为默认值或占位值):
BP/entities/<name>.json
{
"minecraft:behavior.follow_owner": {
"speed_multiplier": 1,
"start_distance": 10,
"stop_distance": 2,
"can_teleport": true,
"post_teleport_distance": 3,
"ignore_vibration": false,
"max_distance": 60,
"priority": 0
}
}