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

minecraft:behavior.fire_at_target

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

Overview

minecraft:behavior.fire_at_target 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 shoot a projectile at its target after a short wind-up, like a breeze. Its anchor and offset settings replace the ones in the projectile.

Fields

FieldTypeDefaultDescription
filtersFilter Group{"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null}Conditions that must pass before the mob shoots.
attack_rangeFloatRange{"max":0,"min":0}Closest and farthest the target can be for a shot.
attack_cooldownnumber0.5Seconds to wait before the goal can run again.Range: 0 to …
pre_shoot_delaynumber0.75Seconds of wind-up before the shot.Range: 0 to …
post_shoot_delaynumber0.2Seconds after the shot before the goal ends.Range: 0 to …
max_head_rotation_xnumber30Most degrees the head can tilt up or down to aim.
max_head_rotation_ynumber30Most degrees the head can turn sideways to aim.
ranged_fovnumber90Field of view in degrees used to spot a target.
projectile_defstring""The entity fired. It must be a projectile, and the goal does nothing without it.
owner_anchorProjectileAnchorProxy2Point on the shooter where the projectile appears.
owner_offsetvec3[0,0,0]Shift from the owner_anchor point.
target_anchorProjectileAnchorProxy2Point on the target that the projectile aims at.
target_offsetvec3[0,0,0]Shift from the target_anchor point.
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.fire_at_target": {
    "filters": {
      "AND": null,
      "NOT": null,
      "OR": null,
      "all": null,
      "all_of": null,
      "any": null,
      "any_of": null,
      "none_of": null
    },
    "attack_range": {
      "max": 0,
      "min": 0
    },
    "attack_cooldown": 0.5,
    "pre_shoot_delay": 0.75,
    "post_shoot_delay": 0.2,
    "max_head_rotation_x": 30,
    "max_head_rotation_y": 30,
    "ranged_fov": 90
  }
}

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