1. Wiki
  2. /实体
  3. /minecraft:behavior.melee_box_attack

minecraft:behavior.melee_box_attack

不想手写?在 GodCraft 里打开一个开关,就能帮你设置好 minecraft:behavior.melee_box_attack。Get GodCraft

概览

minecraft:behavior.melee_box_attack 是一个实体组件:写在自定义生物的 components 对象中,或其中某个组件组里。 近战 AI 目标:攻击范围是生物碰撞箱周围的一个盒子,所以大型生物的攻击距离和它们的体型相符。

字段

字段类型默认值说明
horizontal_reachnumber0.8攻击在水平方向上超出生物碰撞箱多远仍能命中。范围:0 到 …
on_killActorDefinitionTrigger{"event":"","filters":{"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null},"target":"self"}此生物杀死目标时触发的事件。
cooldown_timenumber1两次攻击之间等待的秒数。范围:0 到 …
melee_fovnumber90用于发现可攻击目标的视野角度。范围:0 到 …
x_max_rotationnumber30注视目标时生物最多能上下倾斜的角度。范围:0 到 …
y_max_head_rotationnumber30注视目标时生物头部最多能左右转动的角度。范围:0 到 …
random_stop_intervalinteger0有 N 分之 1 的几率停止攻击,N 就是这个数字。范围:0 到 …
attack_oncebooleanfalse为 true 时,生物只会进行一次这种攻击。
can_spread_on_firebooleanfalse为 true 时,空手且着火的生物击中目标时会把目标点燃。
min_path_timenumber0.2重新计算通往目标的路径前最短等待秒数。范围:0 到 …
max_path_timenumber0.55重新计算通往目标的路径前最长等待秒数。范围:0 到 …
path_fail_time_increasenumber0.75生物被卡住时,路径等待时间增加的秒数。范围:0 到 …
inner_boundary_time_increasenumber0.25目标超出 path_inner_boundary 时,路径等待时间增加的秒数。范围:0 到 …
outer_boundary_time_increasenumber0.5目标超出 path_outer_boundary 时,路径等待时间增加的秒数。范围:0 到 …
path_inner_boundarynumber16超过此距离后应用 inner_boundary_time_increase。范围:0 到 …
path_outer_boundarynumber32超过此距离后应用 outer_boundary_time_increase。范围:0 到 …
speed_multipliernumber1朝目标移动时的速度倍率。范围:0 到 …
require_complete_pathbooleanfalse为 true 时,只有存在通往目标的完整路径,生物才会追击。
track_targetbooleanfalse为 true 时,即使没有感知组件,生物也会持续追踪目标。
attack_typesstring""此生物会攻击哪些实体类型。
on_attackActorDefinitionTrigger{"event":"","filters":{"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null},"target":"self"}每次攻击命中时触发的事件。
priorityinteger0数字越小越先执行:两个目标冲突时,priority 更小的那个胜出。范围:0 到 …
control_flagsGoal's control flags[]无此目标接管哪些身体部分(移动、看向、跳跃),占用相同部分的目标不能同时运行。

示例

写在 BP/entities/<name>.json 的 components 对象中(值为默认值或占位值):

BP/entities/<name>.json
{
  "minecraft:behavior.melee_box_attack": {
    "horizontal_reach": 0.8,
    "on_kill": {
      "event": "",
      "filters": {
        "AND": null,
        "NOT": null,
        "OR": null,
        "all": null,
        "all_of": null,
        "any": null,
        "any_of": null,
        "none_of": null
      },
      "target": "self"
    },
    "cooldown_time": 1,
    "melee_fov": 90,
    "x_max_rotation": 30,
    "y_max_head_rotation": 30,
    "random_stop_interval": 0,
    "attack_once": false
  }
}

We use cookies to improve your experience and analyse site traffic. Learn more