Nearest Attackable Target¶
文档版本:1.21.50.25
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
}
priority
:priority
entity_types
:entity_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>
filters
:filters- 一个过滤器组。
cooldown
:number- The amount of time in seconds that the mob has to wait before selecting a target of the same type again
max_dist
:number- Maximum distance this mob can be away to be a valid choice.
max_height
:number- UNDOCUMENTED.
max_flee
:number- UNDOCUMENTED.
priority
:number- UNDOCUMENTED.
within_default
:number- UNDOCUMENTED.
check_if_outnumbered
:boolean- UNDOCUMENTED.
must_see
:boolean- If true, the mob has to be visible to be a valid choice.
must_see_forget_duration
:number- 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_description
:boolean- If true, the mob will stop being targeted if it stops meeting any conditions.
sprint_speed_multiplier
:number- Multiplier for the running speed. A value of 1.0 means the speed is unchanged
walk_speed_multiplier
:number- 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_interval
:integer- Time range (in seconds) between searching for an attack target, range is in (0,
attack_interval
]. Only used ifattack_interval
is greater than 0, otherwisescan_interval
is used.
attack_interval_min
:number- Alias for
attack_interval
; provides the same functionality asattack_interval
.
attack_owner
:boolean- If true, this entity can attack its owner.
must_reach
:boolean- If true, this entity requires a path to the target.
must_see
:boolean- Determines if target-validity requires this entity to be in range only, or both in range and in sight.
must_see_forget_duration
:number- Time (in seconds) the target must not be seen by this entity to become invalid. Used only if
must_see
is true.
persist_time
:number- Time (in seconds) this entity can continue attacking the target after the target is no longer valid.
reselect_targets
:boolean- Allows the attacking entity to update the nearest target, otherwise a target is only reselected after each
scan_interval
orattack_interval
.
scan_interval
:integer- If
attack_interval
is 0 or isn't declared, then between attacks: scanning for a new target occurs every amount of ticks equal toscan_interval
, minimum value is 1. Values under 10 can affect performance.
set_persistent
:boolean- Allows the actor to be set to persist upon targeting a player.
target_invisible_multiplier
:number- Multiplied with the target's armor coverage percentage to modify
max_dist
when detecting an invisible target.
target_search_height
:number- Maximum vertical target-search distance, if it's greater than the target type's
max_dist
. A negative value defaults toentity_types
greatestmax_dist
.
target_sneak_visibility_multiplier
:number- Multiplied with the target type's
max_dist
when trying to detect a sneaking target.
within_radius
:number- 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
.