概览
minecraft:behavior.follow_mob 是一个实体组件:写在自定义生物的 components 对象中,或其中某个组件组里。 让生物跟在附近其他生物后面的 AI 目标。
字段
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
speed_multiplier | number | 1 | 跟随时的速度倍率。 |
stop_distance | number | 无 | 此生物在被跟随生物后方多少格处停下。 |
search_range | integer | 0 | 生物在多少格范围内寻找可跟随的对象。 |
use_home_position_restriction | boolean | false | 为 true 时,只能跟随此生物家园范围内的生物。 |
preferred_actor_type | string | "" | 优先跟随的生物类型。留空则在附近随机选择一只。 |
filters | Filter Group | {"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null} | 附近哪些生物可以被跟随。留空时使用内置列表,会跳过玩家和其他一些实体。 |
priority | integer | 0 | 数字越小越先执行:两个目标冲突时,priority 更小的那个胜出。范围:0 到 … |
control_flags | Goal's control flags[] | 无 | 此目标接管哪些身体部分(移动、看向、跳跃),占用相同部分的目标不能同时运行。 |
示例
写在 BP/entities/<name>.json 的 components 对象中(值为默认值或占位值):
BP/entities/<name>.json
{
"minecraft:behavior.follow_mob": {
"speed_multiplier": 1,
"stop_distance": 1,
"search_range": 0,
"use_home_position_restriction": false,
"preferred_actor_type": "",
"filters": {
"AND": null,
"NOT": null,
"OR": null,
"all": null,
"all_of": null,
"any": null,
"any_of": null,
"none_of": null
},
"priority": 0,
"control_flags": []
}
}