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

minecraft:behavior.avoid_mob_type

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

Overview

minecraft:behavior.avoid_mob_type 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 run from certain other entities, like creepers fleeing cats.

Fields

FieldTypeDefaultDescription
ignore_visibilitybooleanfalseIf true, the mob flees even when it cannot see the threat.
avoid_target_xzinteger16How far sideways the mob may pick its next escape spot.
avoid_target_yinteger7How far up or down the mob may pick its next escape spot.
max_distnumber3How far away the mob notices something to avoid.
max_fleenumber10Once this many blocks from the threat, the mob stops running.
probability_per_strengthnumber1Chance, based on the threat's strength, that the mob gives up fleeing. 1.0 means 100%.Range: … to 1
river_speed_multipliernumber0.75Speed multiplier when the escape follows a river. 1.0 keeps normal speed.
walk_speed_multipliernumber1Speed multiplier while walking away. 1.0 keeps normal speed.
sprint_speed_multipliernumber1Speed multiplier while sprinting away. 1.0 keeps normal speed.
sprint_distancenumber7When the threat is closer than this many blocks, the mob starts to sprint.
entity_typesEntityTypesnoneWhich entities to run from, written as filters.
remove_targetbooleanfalseIf true, the mob forgets its current target while fleeing.
on_escape_eventActorDefinitionTrigger{"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 the mob gets away.
avoid_mob_soundLevelSoundEvent"undefined"Sound event played while running away.
sound_intervalFloatRange{"max":8,"min":3}Random wait range in seconds between flee sounds.
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.avoid_mob_type": {
    "ignore_visibility": false,
    "avoid_target_xz": 16,
    "avoid_target_y": 7,
    "max_dist": 3,
    "max_flee": 10,
    "probability_per_strength": 1,
    "river_speed_multiplier": 0.75,
    "walk_speed_multiplier": 1
  }
}

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