概览
minecraft:behavior.fire_at_target 是一个实体组件:写在自定义生物的 components 对象中,或其中某个组件组里。 让生物短暂蓄力后向目标发射弹射物的 AI 目标,比如旋风人。这里的锚点和偏移设置会覆盖弹射物自身的设置。
字段
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
filters | Filter Group | {"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null} | 生物射击前必须满足的条件。 |
attack_range | FloatRange | {"max":0,"min":0} | 可以射击时目标的最近和最远距离。 |
attack_cooldown | number | 0.5 | 此目标再次运行前需要等待的秒数。范围:0 到 … |
pre_shoot_delay | number | 0.75 | 射击前蓄力的秒数。范围:0 到 … |
post_shoot_delay | number | 0.2 | 射击后到目标结束的秒数。范围:0 到 … |
max_head_rotation_x | number | 30 | 瞄准时头部最多能上下倾斜的角度。 |
max_head_rotation_y | number | 30 | 瞄准时头部最多能左右转动的角度。 |
ranged_fov | number | 90 | 用于发现目标的视野角度。 |
projectile_def | string | "" | 发射的实体。必须是弹射物,没有它此目标不起作用。 |
owner_anchor | ProjectileAnchorProxy | 2 | 弹射物在射击者身上出现的位置。 |
owner_offset | vec3 | [0,0,0] | 相对于 owner_anchor 点的偏移。 |
target_anchor | ProjectileAnchorProxy | 2 | 弹射物瞄准的目标身上的位置。 |
target_offset | vec3 | [0,0,0] | 相对于 target_anchor 点的偏移。 |
priority | integer | 0 | 数字越小越先执行:两个目标冲突时,priority 更小的那个胜出。范围:0 到 … |
control_flags | Goal's control flags[] | 无 | 此目标接管哪些身体部分(移动、看向、跳跃),占用相同部分的目标不能同时运行。 |
示例
写在 BP/entities/<name>.json 的 components 对象中(值为默认值或占位值):
BP/entities/<name>.json
{
"minecraft:behavior.fire_at_target": {
"filters": {
"AND": null,
"NOT": null,
"OR": null,
"all": null,
"all_of": null,
"any": null,
"any_of": null,
"none_of": null
},
"attack_range": {
"max": 0,
"min": 0
},
"attack_cooldown": 0.5,
"pre_shoot_delay": 0.75,
"post_shoot_delay": 0.2,
"max_head_rotation_x": 30,
"max_head_rotation_y": 30,
"ranged_fov": 90
}
}