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

minecraft:behavior.melee_box_attack

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

Overview

minecraft:behavior.melee_box_attack is an entity component: it goes in the components object of a custom mob, or in one of its component groups. Melee AI goal where the hit range is a box around the mob's hitbox, so big mobs reach as far as they look.

Fields

FieldTypeDefaultDescription
horizontal_reachnumber0.8How far past the mob's hitbox, sideways, an attack can still hit.Range: 0 to …
on_killActorDefinitionTrigger{"event":"","filters":{"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null},"target":"self"}Event that fires when this mob kills its target.
cooldown_timenumber1Seconds to wait between two attacks.Range: 0 to …
melee_fovnumber90Field of view in degrees used to spot a target to hit.Range: 0 to …
x_max_rotationnumber30Most degrees the mob can tilt up or down while looking at the target.Range: 0 to …
y_max_head_rotationnumber30Most degrees the mob can turn its head sideways while looking at the target.Range: 0 to …
random_stop_intervalinteger0Gives a 1 in N chance to stop attacking, where N is this number.Range: 0 to …
attack_oncebooleanfalseIf true, the mob only ever does this attack one time.
can_spread_on_firebooleanfalseIf true, a burning mob with empty hands sets its target on fire when it hits.
min_path_timenumber0.2Shortest wait in seconds before the path to the target is worked out again.Range: 0 to …
max_path_timenumber0.55Longest wait in seconds before the path to the target is worked out again.Range: 0 to …
path_fail_time_increasenumber0.75Seconds added to the path wait when the mob gets stuck.Range: 0 to …
inner_boundary_time_increasenumber0.25Seconds added to the path wait when the target is past path_inner_boundary.Range: 0 to …
outer_boundary_time_increasenumber0.5Seconds added to the path wait when the target is past path_outer_boundary.Range: 0 to …
path_inner_boundarynumber16Distance after which inner_boundary_time_increase is applied.Range: 0 to …
path_outer_boundarynumber32Distance after which outer_boundary_time_increase is applied.Range: 0 to …
speed_multipliernumber1Speed multiplier while moving toward the target.Range: 0 to …
require_complete_pathbooleanfalseIf true, the mob only chases when a full path to the target exists.
track_targetbooleanfalseIf true, the mob keeps following its target even without a sensing component.
attack_typesstring""Which entity types this mob will attack.
on_attackActorDefinitionTrigger{"event":"","filters":{"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null},"target":"self"}Event that fires each time an attack lands.
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.melee_box_attack": {
    "horizontal_reach": 0.8,
    "on_kill": {
      "event": "",
      "filters": {
        "AND": null,
        "NOT": null,
        "OR": null,
        "all": null,
        "all_of": null,
        "any": null,
        "any_of": null,
        "none_of": null
      },
      "target": "self"
    },
    "cooldown_time": 1,
    "melee_fov": 90,
    "x_max_rotation": 30,
    "y_max_head_rotation": 30,
    "random_stop_interval": 0,
    "attack_once": false
  }
}

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