minecraft:looked_at for you with a switch.Get GodCraftOverview
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
| Field | Type | Default | Description |
|---|---|---|---|
field_of_view | Decimal | "26" | Width in degrees of the view cone used to decide if someone is looking. |
filters | Minecraft Filter | none | Which entities are checked as possible lookers. |
find_players_only | Boolean | "false" | Only check the nearest player that passes the filters. |
line_of_sight_obstruction_type | String | "collision" | Which block shape blocks sight: "outline", "collision" or "collision_for_camera". |
look_at_locations | List | none | Points on the entity to test; at least one must be visible. |
looked_at_cooldown | Range [a, b] | "[0, 0]" | Random wait in seconds before checking again after being looked at. |
looked_at_event | String | none | Event fired when someone is looking at the entity. |
min_looked_at_duration | Decimal | "0" | Seconds someone must keep looking before it counts. |
not_looked_at_event | String | none | Event fired when nobody is looking at the entity. |
scale_fov_by_distance | Boolean | "true" | Narrows the view cone the farther away the looker is, so it stays about the same width at the entity. |
search_radius | Decimal | "10" | How far in blocks to search for lookers. |
set_target | Boolean | "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"
}
}