概览
minecraft:behavior.play 是一个实体组件:写在自定义生物的 components 对象中,或其中某个组件组里。 让生物(通常是村民小孩)找个伙伴玩追逐游戏,在附近随机地点跑来跑去。
字段
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
speed_multiplier | number | 1 | 这个目标运行时让生物加速或减速:1 为正常速度。范围:0 到 … |
max_play_duration_seconds | number | 50 | 生物玩耍的最长时间(秒),之后会停下。范围:0 到 … |
chance_to_start | number | 0.0025 | 生物开始玩耍的几率,从 0 到 1。范围:0 到 1 |
friend_types | EntityTypes | 无 | 哪些实体可以成为玩伴。 |
friend_search_area | vec3 | [6,3,6] | 以生物为中心、用来寻找玩伴的范围盒大小。 |
random_pos_search_range | integer | 16 | 生物在水平方向上寻找随机奔跑地点的范围。范围:1 到 … |
random_pos_search_height | integer | 3 | 生物在上下方向上寻找随机奔跑地点的范围。范围:1 到 … |
follow_distance | integer | 2 | 生物跟随伙伴时尽量保持的距离。范围:0 到 … |
priority | integer | 0 | 多个目标同时想运行时决定谁优先:数字越小越先运行。范围:0 到 … |
control_flags | Goal's control flags[] | 无 | 列出这个目标要控制的身体部分(比如移动、看向或跳跃),这样需要同一部分的目标就不会同时运行。 |
示例
写在 BP/entities/<name>.json 的 components 对象中(值为默认值或占位值):
BP/entities/<name>.json
{
"minecraft:behavior.play": {
"speed_multiplier": 1,
"max_play_duration_seconds": 50,
"chance_to_start": 0.0025,
"friend_types": {},
"friend_search_area": [
6,
3,
6
],
"random_pos_search_range": 16,
"random_pos_search_height": 3,
"follow_distance": 2
}
}