1. Wiki
  2. /Entities
  3. /minecraft:looked_at

minecraft:looked_at

Don't want to write this by hand? GodCraft sets minecraft:looked_at for you with a switch.Get GodCraft

Overview

minecraft:looked_at is an entity component: it goes in the components object of a custom mob, or in one of its component groups. Fires events when another entity, usually a player, looks straight at this one. Endermen use it to get angry when stared at.

Fields

FieldTypeDefaultDescription
field_of_viewDecimal"26"Width in degrees of the view cone used to decide if someone is looking.
filtersMinecraft FilternoneWhich entities are checked as possible lookers.
find_players_onlyBoolean"false"Only check the nearest player that passes the filters.
line_of_sight_obstruction_typeString"collision"Which block shape blocks sight: "outline", "collision" or "collision_for_camera".
look_at_locationsListnonePoints on the entity to test; at least one must be visible.
looked_at_cooldownRange [a, b]"[0, 0]"Random wait in seconds before checking again after being looked at.
looked_at_eventStringnoneEvent fired when someone is looking at the entity.
min_looked_at_durationDecimal"0"Seconds someone must keep looking before it counts.
not_looked_at_eventStringnoneEvent fired when nobody is looking at the entity.
scale_fov_by_distanceBoolean"true"Narrows the view cone the farther away the looker is, so it stays about the same width at the entity.
search_radiusDecimal"10"How far in blocks to search for lookers.
set_targetBoolean"once_and_stop_scanning"Whether the looker becomes an attack target: "never", "once_and_stop_scanning" or "once_and_keep_scanning".

Example

Inside the components object of BP/entities/<name>.json (values are the defaults or placeholders):

BP/entities/<name>.json
{
  "minecraft:looked_at": {
    "field_of_view": "26",
    "filters": {},
    "find_players_only": "false",
    "line_of_sight_obstruction_type": "collision",
    "look_at_locations": {},
    "looked_at_cooldown": "[0, 0]",
    "looked_at_event": "",
    "min_looked_at_duration": "0"
  }
}

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