minecraft:behavior.move_to_block

Allows mob to move towards a block.

Properties

PropertyTypeDefaultWhat it does
speed_multiplierDecimal1Movement speed multiplier of the mob when using this AI Goal.
search_rangeInteger0The distance in blocks that the mob will look for the block.
search_heightInteger1The height in blocks that the mob will look for the block.
tick_intervalInteger20Average interval in ticks to try to run this behavior.
stay_durationDecimal0Number of ticks needed to complete a stay at the block.
goal_radiusDecimal0.5Distance in blocks within the mob considers it has reached the goal. This is the "wiggle room" to stop the AI from bouncing back and forth trying to reach a specific spot.
start_chanceDecimal1Chance to start the behavior (applied after each random tick_interval).
target_selection_methodTextnearest, random"nearest"Kind of block to find fitting the specification. Valid values are "random" and "nearest".
target_offsetList of decimal or Object[0, 0, 0]Offset to add to the selected target position.
xDecimal0
yDecimal0
zDecimal0
on_reachList of object[]Event to run on block reached.
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.
on_stay_completedList of object[]Event to run on completing a stay of stay_duration at the block.
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[]Block types to move to.
target_block_filtersObject or List of object{"AND": null, "NOT": null, "OR": null, "all": null, "all_…Conditions that need to be met for a block to be a valid target.
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.
priorityIntegermin 00
control_flagsList of text[]

Example from the game files

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

{
  "minecraft:behavior.move_to_block": {
    "priority": 10,
    "tick_interval": 1,
    "start_chance": 0.5,
    "search_range": 6,
    "search_height": 4,
    "goal_radius": 1.0,
    "stay_duration": 20.0,
    "target_selection_method": "random",
    "target_offset": [
      0,
      0.25,
      0
    ],
    "target_block_filters": {
      "test": "is_waterlogged",
      "subject": "block",
      "operator": "==",
      "value": false
    },
    "target_blocks": [
      "minecraft:poppy",
      "minecraft:blue_orchid",
      "minecraft:allium",
      "minecraft:azure_bluet",
      "minecraft:red_tulip",
      "minecraft:orange_tulip",
      "minecraft:white_tulip",
      "minecraft:pink_tulip",
      "minecraft:oxeye_daisy",
      "minecraft:cornflower",
      "minecraft:lily_of_the_valley",
      "minecraft:dandelion",
      "minecraft:wither_rose",
      "minecraft:sunflower",
      "minecraft:lilac",
      "minecraft:rose_bush",
      "minecraft:peony",
      "minecraft:flowering_azalea",
      "minecraft:azalea_leaves_flowered",
      "minecraft:mangrove_propagule",
      "minecraft:pitcher_plant",
      "minecraft:torchflower",
      "minecraft:cherry_leaves",
      "minecraft:pink_petals",
      "minecraft:open_eyeblossom",
      "minecraft:wildflowers",
      "minecraft:cactus_flower",
      "minecraft:chorus_flower",
      "minecraft:spore_blossom"
    ],
    "on_stay_completed": [
      {
        "event": "collected_nectar",
        "target": "self"
      }
    ]
  }
}

Used by 1

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

Related components