概览
minecraft:behavior.jump_to_block 是一个实体组件:写在自定义生物的 components 对象中,或其中某个组件组里。 让生物跳到附近随机方块上的 AI 目标,比如青蛙跳上睡莲。
字段
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
search_width | integer | 8 | 生物周围搜索区域的宽度(格),范围 1 到 15。范围:1 到 15 |
search_height | integer | 10 | 生物周围搜索区域的高度(格),范围 1 到 15。范围:1 到 15 |
minimum_path_length | integer | 5 | 只有步行路径至少这么长的方块才会被选中。 |
minimum_distance | integer | 2 | 只有至少这么远的方块才会被选中。 |
scale_factor | number | 0.7 | 跳跃时生物碰撞箱的尺寸倍率。 |
max_velocity | number | 1.5 | 生物跳跃的最大速度。 |
cooldown_range | FloatRange | {"max":20,"min":10} | 两次尝试跳跃之间的随机等待秒数范围。 |
preferred_blocks | Item Descriptor[] | 无 | 生物喜欢落在上面的方块。 |
preferred_blocks_chance | number | 1 | 范围内有偏好方块时选择它的几率,取值 0.0 到 1.0。范围:0 到 1 |
forbidden_blocks | Item Descriptor[] | 无 | 生物绝不会跳上去的方块。 |
priority | integer | 0 | 数字越小越先执行:两个目标冲突时,priority 更小的那个胜出。范围:0 到 … |
control_flags | Goal's control flags[] | 无 | 此目标接管哪些身体部分(移动、看向、跳跃),占用相同部分的目标不能同时运行。 |
示例
写在 BP/entities/<name>.json 的 components 对象中(值为默认值或占位值):
BP/entities/<name>.json
{
"minecraft:behavior.jump_to_block": {
"search_width": 8,
"search_height": 10,
"minimum_path_length": 5,
"minimum_distance": 2,
"scale_factor": 0.7,
"max_velocity": 1.5,
"cooldown_range": {
"max": 20,
"min": 10
},
"preferred_blocks": []
}
}