minecraft:behavior.random_search_and_dig

Allows this entity to locate a random target block that it can path find to. Once found, the entity will move towards it and dig up an item. [Default target block types: Dirt, Grass, Podzol, DirtWithRoots, MossBlock, Mud, MuddyMangroveRoots].

Properties

PropertyTypeDefaultWhat it does
cooldown_rangeObject{"max": 0, "min": 0}Goal cooldown range in seconds.
minDecimal0
maxDecimal0
speed_multiplierDecimalmin 01Searching movement speed multiplier.
find_valid_position_retriesInteger5Amount of retries to find a valid target position within search range.
target_dig_position_offsetDecimal2.25Dig target position offset from the feet position of the mob in their facing direction.
search_range_xzInteger10Width and length of the volume around the entity used to find a valid target position
search_range_yInteger7Height of the volume around the entity used to find a valid target position
goal_radiusDecimal1.5Distance in blocks within the entity to considers it has reached it's target position.
target_blocksList of object or text[]List of target block types the goal will look to dig on. Overrides the default list.
digging_duration_rangeObject{"max": 10, "min": 8}Digging duration in seconds.
minDecimal0
maxDecimal0
item_tableText""File path relative to the resource pack root for items to spawn list (loot table format).
spawn_item_after_secondsDecimalmin 00Digging duration before spawning item in seconds.
spawn_item_pos_offsetDecimalmin 00Distance to offset the item's spawn location in the direction the mob is facing.
on_searching_startObject{"event": "", "filters": {"AND": null, "NOT": null, "OR":…Event to run when the goal starts searching.
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_fail_during_searchingObject{"event": "", "filters": {"AND": null, "NOT": null, "OR":…Event to run when the goal failed while in searching state.
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_digging_startObject{"event": "", "filters": {"AND": null, "NOT": null, "OR":…Event to run when the goal ends searching has begins digging.
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_item_foundObject{"event": "", "filters": {"AND": null, "NOT": null, "OR":…Event to run when the goal find a item.
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_fail_during_diggingObject{"event": "", "filters": {"AND": null, "NOT": null, "OR":…Event to run when the goal failed while in digging state.
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_successObject{"event": "", "filters": {"AND": null, "NOT": null, "OR":…Event to run when searching and digging has ended.
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.
priorityIntegermin 00
control_flagsList of text[]

Example from the game files

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

{
  "minecraft:behavior.random_search_and_dig": {
    "priority": 5,
    "speed_multiplier": 1.25,
    "find_valid_position_retries": 5,
    "target_blocks": [
      "minecraft:dirt",
      "minecraft:coarse_dirt",
      "minecraft:grass",
      "minecraft:podzol",
      "minecraft:dirt_with_roots",
      "minecraft:moss_block",
      "minecraft:pale_moss_block",
      "minecraft:mud",
      "minecraft:muddy_mangrove_roots"
    ],
    "goal_radius": 2.0,
    "search_range_xz": 20,
    "search_range_y": 3,
    "cooldown_range": {
      "min": 0.0,
      "max": 0.0
    },
    "digging_duration_range": {
      "min": 8.0,
      "max": 10.0
    },
    "item_table": "loot_tables/gameplay/entities/sniffer_seeds.json",
    "spawn_item_after_seconds": 6.0,
    "spawn_item_pos_offset": 2.25,
    "on_searching_start": {
      "event": "on_searching_start",
      "target": "self"
    },
    "on_fail_during_searching": {
      "event": "on_fail_during_searching",
      "target": "self"
    },
    "on_digging_start": {
      "event": "on_digging_start",
      "target": "self"
    },
    "on_item_found": {
      "event": "on_item_found",
      "target": "self"
    },
    "on_fail_during_digging": {
      "event": "on_fail_during_digging",
      "target": "self"
    },
    "on_success": {
      "event": "on_search_and_digging_success",
      "target": "self"
    }
  }
}

Used by 1

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

Related components