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
| Property | Type | Default | What it does |
|---|---|---|---|
cooldown_range | Object | {"max": 0, "min": 0} | Goal cooldown range in seconds. |
min | Decimal | 0 | |
max | Decimal | 0 | |
speed_multiplier | Decimalmin 0 | 1 | Searching movement speed multiplier. |
find_valid_position_retries | Integer | 5 | Amount of retries to find a valid target position within search range. |
target_dig_position_offset | Decimal | 2.25 | Dig target position offset from the feet position of the mob in their facing direction. |
search_range_xz | Integer | 10 | Width and length of the volume around the entity used to find a valid target position |
search_range_y | Integer | 7 | Height of the volume around the entity used to find a valid target position |
goal_radius | Decimal | 1.5 | Distance in blocks within the entity to considers it has reached it's target position. |
target_blocks | List of object or text | [] | List of target block types the goal will look to dig on. Overrides the default list. |
digging_duration_range | Object | {"max": 10, "min": 8} | Digging duration in seconds. |
min | Decimal | 0 | |
max | Decimal | 0 | |
item_table | Text | "" | File path relative to the resource pack root for items to spawn list (loot table format). |
spawn_item_after_seconds | Decimalmin 0 | 0 | Digging duration before spawning item in seconds. |
spawn_item_pos_offset | Decimalmin 0 | 0 | Distance to offset the item's spawn location in the direction the mob is facing. |
on_searching_start | Object | {"event": "", "filters": {"AND": null, "NOT": null, "OR":… | Event to run when the goal starts searching. |
event | Text | "" | |
target | Textself, other, player, target, parent, baby, block, damager, holder, item | "self" | |
filters | Object 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. |
test | Text | — | The name of the test to apply. |
subject | Boolean or Integer or Decimal or Text | — | The subject of this filter test. |
operator | Boolean or Integer or Decimal or Text | — | The comparison to apply with 'value'. |
domain | Boolean or Integer or Decimal or Text | — | The domain the test should be performed in. |
value | Boolean or Integer or Decimal or Text | — | The value being compared with the test. |
on_fail_during_searching | Object | {"event": "", "filters": {"AND": null, "NOT": null, "OR":… | Event to run when the goal failed while in searching state. |
event | Text | "" | |
target | Textself, other, player, target, parent, baby, block, damager, holder, item | "self" | |
filters | Object 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. |
test | Text | — | The name of the test to apply. |
subject | Boolean or Integer or Decimal or Text | — | The subject of this filter test. |
operator | Boolean or Integer or Decimal or Text | — | The comparison to apply with 'value'. |
domain | Boolean or Integer or Decimal or Text | — | The domain the test should be performed in. |
value | Boolean or Integer or Decimal or Text | — | The value being compared with the test. |
on_digging_start | Object | {"event": "", "filters": {"AND": null, "NOT": null, "OR":… | Event to run when the goal ends searching has begins digging. |
event | Text | "" | |
target | Textself, other, player, target, parent, baby, block, damager, holder, item | "self" | |
filters | Object 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. |
test | Text | — | The name of the test to apply. |
subject | Boolean or Integer or Decimal or Text | — | The subject of this filter test. |
operator | Boolean or Integer or Decimal or Text | — | The comparison to apply with 'value'. |
domain | Boolean or Integer or Decimal or Text | — | The domain the test should be performed in. |
value | Boolean or Integer or Decimal or Text | — | The value being compared with the test. |
on_item_found | Object | {"event": "", "filters": {"AND": null, "NOT": null, "OR":… | Event to run when the goal find a item. |
event | Text | "" | |
target | Textself, other, player, target, parent, baby, block, damager, holder, item | "self" | |
filters | Object 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. |
test | Text | — | The name of the test to apply. |
subject | Boolean or Integer or Decimal or Text | — | The subject of this filter test. |
operator | Boolean or Integer or Decimal or Text | — | The comparison to apply with 'value'. |
domain | Boolean or Integer or Decimal or Text | — | The domain the test should be performed in. |
value | Boolean or Integer or Decimal or Text | — | The value being compared with the test. |
on_fail_during_digging | Object | {"event": "", "filters": {"AND": null, "NOT": null, "OR":… | Event to run when the goal failed while in digging state. |
event | Text | "" | |
target | Textself, other, player, target, parent, baby, block, damager, holder, item | "self" | |
filters | Object 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. |
test | Text | — | The name of the test to apply. |
subject | Boolean or Integer or Decimal or Text | — | The subject of this filter test. |
operator | Boolean or Integer or Decimal or Text | — | The comparison to apply with 'value'. |
domain | Boolean or Integer or Decimal or Text | — | The domain the test should be performed in. |
value | Boolean or Integer or Decimal or Text | — | The value being compared with the test. |
on_success | Object | {"event": "", "filters": {"AND": null, "NOT": null, "OR":… | Event to run when searching and digging has ended. |
event | Text | "" | |
target | Textself, other, player, target, parent, baby, block, damager, holder, item | "self" | |
filters | Object 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. |
test | Text | — | The name of the test to apply. |
subject | Boolean or Integer or Decimal or Text | — | The subject of this filter test. |
operator | Boolean or Integer or Decimal or Text | — | The comparison to apply with 'value'. |
domain | Boolean or Integer or Decimal or Text | — | The domain the test should be performed in. |
value | Boolean or Integer or Decimal or Text | — | The value being compared with the test. |
priority | Integermin 0 | 0 | |
control_flags | List 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
behavior.pickup_itemsbehavior.move_to_villagebehavior.harvest_farm_blockbehavior.lay_eggbehavior.move_indoorsbehavior.move_outdoorsbehavior.place_blockbehavior.raid_gardenbehavior.digbehavior.dragonscanningbehavior.drop_item_forbehavior.eat_blockbehavior.eat_carried_itembehavior.eat_mobbehavior.fertilize_farm_blockbehavior.hold_groundbehavior.inspect_bookshelfbehavior.move_through_villagebehavior.open_doorbehavior.restrict_open_doorbehavior.snackingbehavior.stroll_towards_villagebehavior.take_blockbehavior.transport_items