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

minecraft:behavior.move_to_block

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

Overview

minecraft:behavior.move_to_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 walk to a chosen kind of block and can run events when it gets there or stays a while. Use it for mobs that seek out flowers, beds or similar.

Fields

FieldTypeDefaultDescription
speed_multipliernumber1Speed multiplier while walking to the block.
search_rangeinteger0How far sideways, in blocks, the mob looks for the block.
search_heightinteger1How far up and down, in blocks, the mob looks for the block.
tick_intervalinteger20About how many ticks pass between tries to start the goal.
stay_durationnumber0Ticks the mob must stay at the block to finish its visit.
goal_radiusnumber0.5How close the mob must get to count as arrived, which stops it jittering around the spot.
start_chancenumber1Chance to start each time the tick interval passes.
target_selection_methodTarget Selection Method"nearest"How the block is picked: "random" or "nearest".
target_offsetvec3[0,0,0]X, Y and Z shift added to the chosen block position.
on_reachActorDefinitionTrigger[]noneEvents that fire when the mob reaches the block.
on_stay_completedActorDefinitionTrigger[]noneEvents that fire after the mob has stayed for stay_duration.
target_blocksItem Descriptor[]noneThe block types the mob walks to.
target_block_filtersFilter Group{"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null}Conditions a block must pass to be picked.
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.move_to_block": {
    "speed_multiplier": 1,
    "search_range": 0,
    "search_height": 1,
    "tick_interval": 20,
    "stay_duration": 0,
    "goal_radius": 0.5,
    "start_chance": 1,
    "target_selection_method": "nearest"
  }
}

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