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

minecraft:behavior.nearest_prioritized_attackable_target

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

概览

minecraft:behavior.nearest_prioritized_attackable_target 是一个实体组件:写在自定义生物的 components 对象中,或其中某个组件组里。 类似 nearest_attackable_target,但每种实体类型都可以有自己的优先级,让生物更偏好某些目标。适合让生物优先猎杀玩家,附近没有玩家时才去找动物。

字段

字段类型默认值说明
attack_intervalinteger0选择目标前等待的秒数。
entity_typesEntityTypes无生物可以锁定哪些实体,每项都可设置过滤器和优先级。
within_radiusnumber0目标要离多近,生物才会去追它。
must_seebooleanfalse设为 true 时,只选择生物能看见的目标。
must_see_forget_durationnumber3目标离开视线后,生物继续寻找它多少秒才会选择新目标。
must_reachbooleanfalse设为 true 时,只选择生物能走到的目标。
reselect_targetsbooleanfalse设为 true 时,一旦出现更近的目标,生物就会切换过去。
scan_intervalinteger10两次寻找目标之间的刻数。
target_search_heightnumber-1在上下方向上寻找目标的范围。设为 -1 则忽略高度。
persist_timenumber0目标失效后生物继续保持锁定的秒数。
hurt_ownerbooleanfalse设为 true 时,生物也会攻击伤害它主人的生物。
set_persistentbooleanfalse设为 true 时,生物锁定玩家后就不会消失。
priorityinteger0多个目标同时想运行时决定谁优先:数字越小越先运行。范围:0 到 …
control_flagsGoal's control flags[]无列出这个目标要控制的身体部分(比如移动、看向或跳跃),这样需要同一部分的目标就不会同时运行。

示例

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

BP/entities/<name>.json
{
  "minecraft:behavior.nearest_prioritized_attackable_target": {
    "attack_interval": 0,
    "entity_types": {},
    "within_radius": 0,
    "must_see": false,
    "must_see_forget_duration": 3,
    "must_reach": false,
    "reselect_targets": false,
    "scan_interval": 10
  }
}

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