跳转至

Eat Block

文档版本:1.21.0.24

Allows the entity to consume a block, replace the eaten block with another block, and trigger an event as a result.

架构

eat_block:
{
  priority "priority"
  trigger "on_eat"
  0 "success_chance"
  number "time_until_eat" : opt
  array "eat_and_replace_block_pairs" : opt
  {
    object "<any array element>" : opt
    {
      identifier "eat_block"
      identifier "replace_block"
    }
  }
}
prioritypriority
priority:
integer
on_eattrigger
The event to trigger when the block eating animation has completed.
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>
success_chance0
A molang expression defining the success chance the entity has to consume a block.
0:
string
0:
number
time_until_eatnumber
The amount of time (in seconds) it takes for the block to be eaten upon a successful eat attempt.
eat_and_replace_block_pairsarray
A collection of pairs of blocks; the first ("eat_block")is the block the entity should eat, the second ("replace_block") is the block that should replace the eaten block.
eat_and_replace_block_pairs
<any array element>object
The block to eat and the block to replace it with.
<any array element>
eat_blockidentifier
The block to eat.
identifier:
string
replace_blockidentifier
The block to replace the eaten block with.