1. Wiki
  2. /Entities
  3. /minecraft:behavior.look_at_player

minecraft:behavior.look_at_player

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

Overview

minecraft:behavior.look_at_player 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 glance at players who come close. Most mobs use it to feel alive.

Fields

FieldTypeDefaultDescription
angle_of_view_verticalinteger360How many degrees up and down the mob can see.Range: 0 to 360
angle_of_view_horizontalinteger360How many degrees left and right the mob can see.Range: 0 to 360
look_timeFloatRange{"max":4,"min":2}Random range of time the mob keeps looking.
look_distancenumber8How close, in blocks, an entity must be to be looked at.Range: 0 to …
probabilitynumber0.02Chance to start looking each time it is checked. 1.0 means 100%.Range: 0 to 1
priorityinteger0Lower numbers run first: when two goals compete, the one with the smaller priority wins.Range: 0 to …
control_flagsGoal's control flags[]noneWhich 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_player": {
    "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": []
  }
}

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