概览
minecraft:flocking 是一个实体组件:写在自定义生物的 components 对象中,或其中某个组件组里。 让实体和同类成群移动,就像鱼群一样。有很多权重参数可以调整群体聚得多紧。
字段
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
in_water | boolean | false | 如果群体生活在水中,设为 true。 |
match_variants | boolean | false | 只与变种、标记变种和颜色都相同的实体成群。 |
use_center_of_mass | boolean | false | 朝群体中心移动。 |
low_flock_limit | integer | 0 | 一个群体最少应有的实体数量。 |
high_flock_limit | integer | 0 | 一个群体最多允许的实体数量。 |
goal_weight | number | 0 | 成群结果对移动的影响程度。 |
loner_chance | number | 0 | 实体生成为独行者、永不入群的概率,范围 0 到 1。 |
influence_radius | number | 0 | 其他实体可以加入这个实体所在群体的距离。 |
breach_influence | number | 0 | 群体成员跃出水面时被推回的力度。 |
separation_weight | number | 1 | 成员之间保持间距的力度。 |
separation_threshold | number | 2 | 成员因距离太近开始散开的距离。 |
cohesion_weight | number | 1 | 成员彼此靠拢的力度。 |
cohesion_threshold | number | 1 | 成员开始相互靠拢的距离。 |
innner_cohesion_threshold | number | 0 | 成员停止继续靠近的距离。 |
min_height | number | 0 | 群体可移动的最低高度。 |
max_height | number | 0 | 群体可移动的最高高度。 |
block_distance | number | 0 | 实体向前检测多少格方块来避开障碍。 |
block_weight | number | 0 | 实体避开方块的力度。 |
示例
写在 BP/entities/<name>.json 的 components 对象中(值为默认值或占位值):
BP/entities/<name>.json
{
"minecraft:flocking": {
"in_water": false,
"match_variants": false,
"use_center_of_mass": false,
"low_flock_limit": 0,
"high_flock_limit": 0,
"goal_weight": 0,
"loner_chance": 0,
"influence_radius": 0
}
}