跳转至

Random Look Around

文档版本:1.21.0.24

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.

架构

random_search_and_dig:
{
  priority "priority"
  speed_multiplier "speed_multiplier"
  vector_of_2_items "cooldown_range"
  number "cooldown_range" : opt
  vector_of_2_items "digging_duration_range"
  number "find_valid_position_retries" : opt
  number "goal_radius" : opt
  string "item_table" : opt
  trigger "on_digging_start"
  trigger "on_fail_during_digging"
  trigger "on_fail_during_searching"
  trigger "on_item_found"
  trigger "on_searching_start"
  trigger "on_success"
  number "search_range_xz" : opt
  number "search_range_y" : opt
  number "spawn_item_after_seconds" : opt
  number "spawn_item_pos_offset" : opt
  array "target_blocks" : opt
  {
    reference "<any array element>"
  }
  number "target_dig_position_offset" : opt
}
prioritypriority
priority:
integer
speed_multiplierspeed_multiplier
speed_multiplier:
number
cooldown_rangevector_of_2_items
Goal cooldown range in seconds.
vector_of_2_items:
array
{
  number "0..0" : opt
  number "1..1" : opt
}
0..0number
The X component.
1..1number
The Y component.
cooldown_rangenumber
Goal cooldown range in seconds.
digging_duration_rangevector_of_2_items
Digging duration in seconds.
find_valid_position_retriesnumber
Amount of retries to find a valid target position within search range.
goal_radiusnumber
Distance in blocks within the entity to considers it has reached it's target position.
item_tablestring
File path relative to the resource pack root for items to spawn list (loot table format).
on_digging_starttrigger
Event to run when the goal ends searching has begins digging.
trigger:
string
trigger:
{
  string "event" : opt
  filters "filters"
  subject "target"
}
eventstring
The event to run when the conditions for this trigger are met.
filtersfilters
一个过滤器组。The list of conditions for this trigger to execute.
targetsubject
The target of the event.
subject:
string
trigger:
array
{
  object "<any array element>" : opt
  {
    string "event" : opt
    filters "filters"
    subject "target"
  }
}
<any array element>object
<any array element>
on_fail_during_diggingtrigger
Event to run when the goal failed while in digging state.
on_fail_during_searchingtrigger
Event to run when the goal failed while in searching state.
on_item_foundtrigger
Event to run when the goal find a item.
on_searching_starttrigger
Event to run when the goal starts searching.
on_successtrigger
Event to run when searching and digging has ended.
search_range_xznumber
Width and length of the volume around the entity used to find a valid target position
search_range_ynumber
Height of the volume around the entity used to find a valid target position
spawn_item_after_secondsnumber
Digging duration before spawning item in seconds.
spawn_item_pos_offsetnumber
Distance to offset the item's spawn location in the direction the mob is facing.
target_blocksarray
List of target block types the goal will look to dig on. Overrides the default list.
target_blocks
<any array element>reference
identifier:
string
reference:
{
  identifier "name"
  object "states" : opt
  {
    ['boolean', 'integer', 'string'] "\w*:?\w+" : opt
  }
  0 "tags"
}
nameidentifier
statesobject
states
\w*:?\w+['boolean', 'integer', 'string']
The key of property is the name of the block state/property, the value must be the same as the block properties accepted values.
tags0
A condition using Molang queries that results to true/false that can be used to query for blocks with certain tags.
0:
string
target_dig_position_offsetnumber
Dig target position offset from the feet position of the mob in their facing direction.