概览
minecraft:behavior.harvest_farm_block 是一个实体组件:写在自定义生物的 components 对象中,或其中某个组件组里。 让生物收获成熟作物,并在空耕地上种下物品栏中种子的 AI 目标,比如农民村民。需要 minecraft:inventory 和导航组件。
字段
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
max_seconds_before_search | number | 1 | 第一次寻找耕地前最长的随机等待秒数。 |
search_cooldown_max_seconds | number | 8 | 一无所获后再次搜索前最长的随机等待秒数。 |
seconds_until_new_task | number | 0.5 | 收获或种植后休息多少秒,此目标才能再次开始。 |
search_range | integer | 16 | 生物在水平方向上寻找耕地的范围(格)。 |
search_height | integer | 1 | 生物在上下方向上寻找耕地的范围(格)。 |
goal_radius | number | 1.5 | 生物需要离耕地多近才算到达。 |
search_count | integer | 0 | 每刻随机检查的方块数量。0 表示检查范围内的所有方块。范围:0 到 … |
speed_multiplier | number | 0.5 | 走向耕地时的速度倍率。范围:0 到 … |
priority | integer | 0 | 数字越小越先执行:两个目标冲突时,priority 更小的那个胜出。范围:0 到 … |
control_flags | Goal's control flags[] | 无 | 此目标接管哪些身体部分(移动、看向、跳跃),占用相同部分的目标不能同时运行。 |
示例
写在 BP/entities/<name>.json 的 components 对象中(值为默认值或占位值):
BP/entities/<name>.json
{
"minecraft:behavior.harvest_farm_block": {
"max_seconds_before_search": 1,
"search_cooldown_max_seconds": 8,
"seconds_until_new_task": 0.5,
"search_range": 16,
"search_height": 1,
"goal_radius": 1.5,
"search_count": 0,
"speed_multiplier": 0.5
}
}