minecraft:behavior.ranged_attack

Allows an entity to attack by using ranged shots. "charge_shoot_trigger" must be greater than 0 to enable charged up burst-shot attacks. Requires minecraft:shooter to define projectile behaviour.

Properties

PropertyTypeDefaultWhat it does
burst_shotsInteger1Number of shots fired every time the attacking entity uses a charged up attack.
target_in_sight_timeDecimal1Minimum amount of time (in seconds) the attacking entity needs to see the target before moving toward it.
burst_intervalDecimal0Time (in seconds) between each individual shot when firing a burst of shots from a charged up attack.
charge_charged_triggerDecimal0Time (in seconds, then add "charge_shoot_trigger"), before a charged up attack is done charging. Charge-time decays while target is not in sight.
charge_shoot_triggerDecimal0Amount of time (in seconds, then doubled) a charged shot must be charging before reloading burst shots. Charge-time decays while target is not in sight.
attack_intervalObject{"max": -1, "min": -1}Reload-time range (in seconds), when not using a charged shot. Reload-time range scales with target-distance.
minDecimal0
maxDecimal0
attack_rangeObject{"max": 0, "min": 0}Range of distances from the target within which the entity can perform a ranged attack.
minDecimal0
maxDecimal0
x_max_rotationDecimalmin 030Maximum rotation (in degrees), on the X-axis, this entity can rotate while trying to look at the target.
y_max_head_rotationDecimalmin 030Maximum rotation (in degrees), on the Y-axis, this entity can rotate its head while trying to look at the target.
ranged_fovDecimalmin 090Field of view (in degrees) when using sensing to detect a target for attack.
speed_multiplierDecimal1During attack behavior, this multiplier modifies the entity's speed when moving toward the target.
set_persistentBooleanfalseAllows the actor to be set to persist upon targeting a player
swingBooleanfalseIf a swing animation (using variable.attack_time) exists, this causes the actor to swing their arm(s) upon firing the ranged attack.
in_range_movement_modeTexthold_position, follow_target"hold_position"Controls how the entity moves while its target is within the configured attack range. "hold_position" makes the entity stop and hold its position while facing and attacking the target. "follow_target" makes the entity continue moving toward the target while attacking, stopping just outside the minimum attack range.
priorityIntegermin 00
control_flagsList of text[]

Example from the game files

This is how vanilla Blaze uses it in Minecraft Bedrock 1.26.60.5:

{
  "minecraft:behavior.ranged_attack": {
    "charge_shoot_trigger": 4.0,
    "attack_interval": {
      "min": 3.0,
      "max": 5.0
    },
    "attack_range": {
      "min": 0.0,
      "max": 48.0
    },
    "burst_interval": 0.3,
    "burst_shots": 3,
    "priority": 3
  }
}

Used by 14

Vanilla entities with minecraft:behavior.ranged_attack in their definition:

Related components