minecraft:behavior.avoid_block

Allows this entity to avoid certain blocks.

Properties

PropertyTypeDefaultWhat it does
walk_speed_modifierDecimal1Modifier for walking speed. 1.0 means keep the regular speed, while higher numbers make the walking speed faster.
sprint_speed_modifierDecimal1Modifier for sprint speed. 1.0 means keep the regular speed, while higher numbers make the sprint speed faster.
search_rangeInteger0Maximum distance to look for a block in xz.
search_heightInteger0Maximum distance to look for a block in y.
tick_intervalInteger1Should start tick interval.
target_selection_methodText"nearest"Block search method.
on_escapeList of object[]Escape triggers.
eventText""
targetTextself, other, player, target, parent, baby, block, damager, holder, item"self"
filtersObject 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.
testText—The name of the test to apply.
subjectBoolean or Integer or Decimal or Text—The subject of this filter test.
operatorBoolean or Integer or Decimal or Text—The comparison to apply with 'value'.
domainBoolean or Integer or Decimal or Text—The domain the test should be performed in.
valueBoolean or Integer or Decimal or Text—The value being compared with the test.
target_blocksList of text or object[]List of block types this mob avoids.
avoid_block_soundTextitem.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 a block.
sound_intervalObject{"max": 8, "min": 3}The range of time in seconds to randomly wait before playing the sound again.
minDecimal0
maxDecimal0
priorityIntegermin 00
control_flagsList of text[]

Example from the game files

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

{
  "minecraft:behavior.avoid_block": {
    "priority": 1,
    "tick_interval": 5,
    "search_range": 8,
    "search_height": 4,
    "walk_speed_modifier": 1,
    "sprint_speed_modifier": 1,
    "avoid_block_sound": "retreat",
    "sound_interval": {
      "min": 2.0,
      "max": 5.0
    },
    "target_selection_method": "nearest",
    "target_blocks": [
      "minecraft:warped_fungus",
      "minecraft:portal",
      "minecraft:respawn_anchor"
    ],
    "on_escape": [
      {
        "event": "escaped_event",
        "target": "self"
      }
    ]
  }
}

Used by 2

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

Related components