跳转至

Nearest Attackable Target

文档版本:1.21.0.24

Allows an entity to attack the closest target within a given subset of specific target types.

架构

nearest_attackable_target:
{
  priority "priority"
  entity_types "entity_types"
  integer "attack_interval" : opt
  number "attack_interval_min" : opt
  boolean "attack_owner" : opt
  boolean "must_reach" : opt
  boolean "must_see" : opt
  number "must_see_forget_duration" : opt
  number "persist_time" : opt
  boolean "reselect_targets" : opt
  integer "scan_interval" : opt
  boolean "set_persistent" : opt
  number "target_invisible_multiplier" : opt
  number "target_search_height" : opt
  number "target_sneak_visibility_multiplier" : opt
  number "within_radius" : opt
}
prioritypriority
priority:
integer
entity_typesentity_types
Filters which types of targets are valid for this entity
entity_types:
array
{
  object "<any array element>" : opt
  {
    filters "filters"
    number "cooldown" : opt
    number "max_dist" : opt
    number "max_height" : opt
    number "max_flee" : opt
    number "priority" : opt
    number "within_default" : opt
    boolean "check_if_outnumbered" : opt
    boolean "must_see" : opt
    number "must_see_forget_duration" : opt
    boolean "reevaluate_description" : opt
    number "sprint_speed_multiplier" : opt
    number "walk_speed_multiplier" : opt
  }
}
<any array element>object
The entity type.
<any array element>
filtersfilters
一个过滤器组
cooldownnumber
The amount of time in seconds that the mob has to wait before selecting a target of the same type again
max_distnumber
Maximum distance this mob can be away to be a valid choice.
max_heightnumber
UNDOCUMENTED.
max_fleenumber
UNDOCUMENTED.
prioritynumber
UNDOCUMENTED.
within_defaultnumber
UNDOCUMENTED.
check_if_outnumberedboolean
UNDOCUMENTED.
must_seeboolean
If true, the mob has to be visible to be a valid choice.
must_see_forget_durationnumber
Determines the amount of time in seconds that this mob will look for a target before forgetting about it and looking for a new one when the target isn't visible any more.
reevaluate_descriptionboolean
If true, the mob will stop being targeted if it stops meeting any conditions.
sprint_speed_multipliernumber
Multiplier for the running speed. A value of 1.0 means the speed is unchanged
walk_speed_multipliernumber
Multiplier for the walking speed. A value of 1.0 means the speed is unchanged
entity_types:
{
  filters "filters"
  number "cooldown" : opt
  number "max_dist" : opt
  number "max_height" : opt
  number "max_flee" : opt
  number "priority" : opt
  number "within_default" : opt
  boolean "check_if_outnumbered" : opt
  boolean "must_see" : opt
  number "must_see_forget_duration" : opt
  boolean "reevaluate_description" : opt
  number "sprint_speed_multiplier" : opt
  number "walk_speed_multiplier" : opt
}
attack_intervalinteger
Time range (in seconds) between searching for an attack target, range is in (0, attack_interval]. Only used if attack_interval is greater than 0, otherwise scan_interval is used.
attack_interval_minnumber
Alias for attack_interval; provides the same functionality as attack_interval.
attack_ownerboolean
If true, this entity can attack its owner.
must_reachboolean
If true, this entity requires a path to the target.
must_seeboolean
Determines if target-validity requires this entity to be in range only, or both in range and in sight.
must_see_forget_durationnumber
Time (in seconds) the target must not be seen by this entity to become invalid. Used only if must_see is true.
persist_timenumber
Time (in seconds) this entity can continue attacking the target after the target is no longer valid.
reselect_targetsboolean
Allows the attacking entity to update the nearest target, otherwise a target is only reselected after each scan_interval or attack_interval.
scan_intervalinteger
If attack_interval is 0 or isn't declared, then between attacks: scanning for a new target occurs every amount of ticks equal to scan_interval, minimum value is 1. Values under 10 can affect performance.
set_persistentboolean
Allows the actor to be set to persist upon targeting a player.
target_invisible_multipliernumber
Multiplied with the target's armor coverage percentage to modify max_dist when detecting an invisible target.
target_search_heightnumber
Maximum vertical target-search distance, if it's greater than the target type's max_dist. A negative value defaults to entity_types greatest max_dist.
target_sneak_visibility_multipliernumber
Multiplied with the target type's max_dist when trying to detect a sneaking target.
within_radiusnumber
Maximum distance this entity can be from the target when following it, otherwise the target becomes invalid. This value is only used if the entity doesn't declare minecraft:follow_range.