跳转至

Looked At

文档版本:1.21.50.25

Defines the behavior when another entity looks at this entity.

架构

looked_at:
{
  number "field_of_view" : opt
  filters "filters"
  boolean "find_players_only" : opt
  string "line_of_sight_obstruction_type" : opt
  array "look_at_locations" : opt
  {
    string "<any array element>" : opt
  }
  range_number_type "looked_at_cooldown"
  event_object "looked_at_event"
  event_object "not_looked_at_event"
  boolean "scale_fov_by_distance" : opt
  number "search_radius" : opt
  string "set_target" : opt
}
field_of_viewnumber
[Beta] Defines, in degrees, the width of the field of view for entities looking at the owner entity. If 'scale_fov_by_distance' is set to true, this value corresponds to the field of view at a distance of one block between the entities.
filtersfilters
一个过滤器组。Defines the entities that can trigger this component.
find_players_onlyboolean
[Beta] Limits the search to only the nearest Player that meets the specified "filters" rather than all nearby entities.
line_of_sight_obstruction_typestring
[Beta] Defines the type of block shape used to check for line of sight obstructions.
look_at_locationsarray
[Beta] A list of locations on the owner entity towards which line of sight checks are performed. At least one location must be unobstructed for the entity to be considered as looked at.
look_at_locations
<any array element>string
looked_at_cooldownrange_number_type
The range for the random amount of time during which the entity is cooling down and won't get angered or look for a target.
range_number_type:
number
range_number_type:
array
{
  number "0..0" : opt
  number "1..1" : opt
}
0..0number
The first value of the range.
1..1number
The second value of the range.
range_number_type:
{
  number "range_min" : opt
  number "range_max" : opt
}
range_minnumber
The minimum value of the range.
range_maxnumber
The maximum value of the range.
looked_at_eventevent_object
The event identifier to run when the entities specified in filters look at this entity.
event_object:
{
  filters "filters"
  string "event" : opt
  string "target" : opt
}
filtersfilters
一个过滤器组
eventstring
The event to fire.
targetstring
The target of the event.
not_looked_at_eventevent_object
[Beta] Defines the event to trigger when no entity is found looking at the owner entity.
scale_fov_by_distanceboolean
[Beta] When true, the field of view narrows as the distance between the owner entity and the entity looking at it increases. This ensures that the width of the view cone remains somewhat constant towards the owner entity position, regardless of distance.
search_radiusnumber
Maximum distance this entity will look for another entity looking at it.
set_targetstring
Defines if and how the owner entity will set entities that are looking at it as its combat targets. Valid values:
"never", looking entities are never set as targets, but events are emitted.
"once_and_stop_scanning", the first detected looking entity is set as target. Scanning and event emission is suspended if and until the owner entity has a target.
[Beta] "once_and_keep_scanning", the first detected looking entity is set as target. Scanning and event emission continues.