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

minecraft:behavior.avoid_block

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

Overview

minecraft:behavior.avoid_block 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 move away from certain blocks, like hoglins avoiding warped fungus.

Fields

FieldTypeDefaultDescription
walk_speed_modifiernumber1Speed multiplier while walking away. 1.0 keeps normal speed.
sprint_speed_modifiernumber1Speed multiplier while sprinting away. 1.0 keeps normal speed.
search_rangeinteger0How far sideways, in blocks, the mob looks for blocks to avoid.
search_heightinteger0How far up and down, in blocks, the mob looks for blocks to avoid.
tick_intervalinteger1How often, in ticks, the goal checks whether it should start.
target_selection_methodstring"nearest"How the block to avoid is picked, for example the nearest one.
on_escapeActorDefinitionTrigger[]noneEvents that fire when the mob has escaped the block.
target_blocksItem Descriptor[]noneThe blocks this mob stays away from.
avoid_block_soundLevelSoundEvent"undefined"Sound event played while avoiding a block.
sound_intervalFloatRange{"max":8,"min":3}Random wait range in seconds between avoid 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_block": {
    "walk_speed_modifier": 1,
    "sprint_speed_modifier": 1,
    "search_range": 0,
    "search_height": 0,
    "tick_interval": 1,
    "target_selection_method": "nearest",
    "on_escape": [],
    "target_blocks": []
  }
}

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