minecraft:behavior.look_at_entity for you with a switch.Get GodCraftOverview
minecraft:behavior.look_at_entity is an entity component: it goes in the components object of a custom mob, or in one of its component groups. AI goal that makes the mob turn its head toward nearby entities that match its filter.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
filters | Filter Group | {"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null} | Which entities the mob will look at. |
angle_of_view_vertical | integer | 360 | How many degrees up and down the mob can see.Range: 0 to 360 |
angle_of_view_horizontal | integer | 360 | How many degrees left and right the mob can see.Range: 0 to 360 |
look_time | FloatRange | {"max":4,"min":2} | Random range of time the mob keeps looking. |
look_distance | number | 8 | How close, in blocks, an entity must be to be looked at.Range: 0 to … |
probability | number | 0.02 | Chance to start looking each time it is checked. 1.0 means 100%.Range: 0 to 1 |
priority | integer | 0 | Lower numbers run first: when two goals compete, the one with the smaller priority wins.Range: 0 to … |
control_flags | Goal's control flags[] | none | Which body parts this goal takes over (move, look, jump), so goals using the same parts cannot run together. |
Example
Inside the components object of BP/entities/<name>.json (values are the defaults or placeholders):
BP/entities/<name>.json
{
"minecraft:behavior.look_at_entity": {
"filters": {
"AND": null,
"NOT": null,
"OR": null,
"all": null,
"all_of": null,
"any": null,
"any_of": null,
"none_of": null
},
"angle_of_view_vertical": 360,
"angle_of_view_horizontal": 360,
"look_time": {
"max": 4,
"min": 2
},
"look_distance": 8,
"probability": 0.02,
"priority": 0,
"control_flags": []
}
}