minecraft:behavior.avoid_mob_type
Allows the entity to run away from other entities that meet the criteria specified.
Properties
| Property | Type | Default | What it does |
|---|---|---|---|
ignore_visibility | Boolean | false | Whether or not to ignore direct line of sight while this entity is running away from other specified entities. |
avoid_target_xz | Integer | 16 | The next target position the entity chooses to avoid another entity will be chosen within this XZ Distance. |
avoid_target_y | Integer | 7 | The next target position the entity chooses to avoid another entity will be chosen within this Y Distance. |
max_dist | Decimal | 3 | Maximum distance to look for an avoid target for the entity. |
max_flee | Decimal | 10 | How many blocks away from its avoid target the entity must be for it to stop fleeing from the avoid target. |
probability_per_strength | Decimalmax 1 | 1 | Percent chance this entity will stop avoiding another entity based on that entity's strength, where 1.0 = 100%. |
river_speed_multiplier | Decimal | 0.75 | Multiplier for speed when following river. 1.0 means keep the regular speed, while higher numbers make the speed faster. |
walk_speed_multiplier | Decimal | 1 | Multiplier for walking speed. 1.0 means keep the regular speed, while higher numbers make the walking speed faster. |
sprint_speed_multiplier | Decimal | 1 | Multiplier for sprint speed. 1.0 means keep the regular speed, while higher numbers make the sprint speed faster. |
sprint_distance | Decimal | 7 | How many blocks within range of its avoid target the entity must be for it to begin sprinting away from the avoid target. |
entity_types | List of object or Object | [] | The list of conditions another entity must meet to be a valid target to avoid. |
filters | Object or List of object | {"AND": null, "NOT": null, "OR": null, "all": null, "all_… | Conditions that make this entry in the list valid |
max_dist | Decimal | 16 | Maximum distance this mob can be away to be a valid choice |
max_height | Decimal | -1 | Maximum height this mob can be away to be a valid choice |
max_flee | Decimal | 10 | Maximum distance this mob can be from the target to stop fleeing |
walk_speed_multiplier | Decimal | 1 | Multiplier for the walking speed. A value of 1.0 means the speed is unchanged |
sprint_speed_multiplier | Decimal | 1 | Multiplier for the sprinting speed. A value of 1.0 means the speed is unchanged |
priority | Integer | 0 | Priority for this mob type |
check_if_outnumbered | Boolean | false | If true, the mob will check if its outnumbered |
reevaluate_description | Boolean | false | If true, the mob will stop being targeted if it stops meeting any conditions. |
cooldown | Integer | 0 | The amount of time in seconds that the mob has to wait before selecting a target of the same type again |
must_see | Boolean | — | If true, the mob has to be visible to be a valid choice |
must_see_forget_duration | Integer | 3 | Determines the amount of time in seconds that this mob will look for a target before forgetting about it and looking for a new one when the target isn't visible any more |
remove_target | Boolean | false | Determine if we should remove target when fleeing or not. |
on_escape_event | Object | {"event": "", "filters": {"AND": null, "NOT": null, "OR":… | Event that is triggered when escaping from a mob. |
event | Text | "" | |
target | Textself, other, player, target, parent, baby, block, damager, holder, item | "self" | |
filters | Object or List of object | {"AND": null, "NOT": null, "OR": null, "all": null, "all_… | Filters allow data objects to specify test criteria which allows their use. Filters can be defined by a single object of type (Filter Test), an array of tests, collection groups, or a combination of these objects. |
test | Text | — | The name of the test to apply. |
subject | Boolean or Integer or Decimal or Text | — | The subject of this filter test. |
operator | Boolean or Integer or Decimal or Text | — | The comparison to apply with 'value'. |
domain | Boolean or Integer or Decimal or Text | — | The domain the test should be performed in. |
value | Boolean or Integer or Decimal or Text | — | The value being compared with the test. |
avoid_mob_sound | Textitem.use.on, hit, step, step.baby, fly, jump, jump.prevent, break, place, heavy.step, gallop, fall, hurt, hurt.baby, hurt.in.water, death, death.baby, death.in.water, death.to.zombie, ambient, ambient.baby, ambient.in.water, ambient.in.air, ambient.tame … | "undefined" | The sound event to play when the mob is avoiding another mob. |
sound_interval | Object | {"max": 8, "min": 3} | The range of time in seconds to randomly wait before playing the sound again. |
min | Decimal | 0 | |
max | Decimal | 0 | |
priority | Integermin 0 | 0 | |
control_flags | List of text | [] |
Example from the game files
This is how vanilla Piglin uses it in Minecraft Bedrock 1.26.60.5:
{
"minecraft:behavior.avoid_mob_type": {
"priority": 4,
"remove_target": true,
"entity_types": [
{
"filters": {
"any_of": [
{
"test": "is_family",
"subject": "other",
"value": "zombie_pigman"
}
]
},
"max_dist": 6
},
{
"filters": {
"any_of": [
{
"test": "is_family",
"subject": "other",
"value": "zoglin"
}
]
},
"max_dist": 6
},
{
"filters": {
"all_of": [
{
"test": "has_target",
"subject": "other"
},
{
"test": "is_family",
"subject": "other",
"value": "hoglin"
}
]
},
"sprint_speed_multiplier": 1.2,
"check_if_outnumbered": true
}
],
"on_escape_event": {
"event": "become_calm_event",
"target": "self"
},
"avoid_mob_sound": "retreat",
"sound_interval": {
"min": 2.0,
"max": 5.0
}
}
}Used by 28
Vanilla entities with minecraft:behavior.avoid_mob_type in their definition: