Eat Block¶
文档版本:1.21.50.25
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"
}
}
}
priority
:priority
on_eat
:trigger- The event to trigger when the block eating animation has completed.
event
:string- The event to run when the conditions for this trigger are met.
filters
:filters- 一个过滤器组。The list of conditions for this trigger to execute.
target
:subject- The target of the event.
trigger:
array
{
object "<any array element>" : opt
{
string "event" : opt
filters "filters"
subject "target"
}
}
<any array element>
:object
<any array element>
success_chance
:0- A molang expression defining the success chance the entity has to consume a block.
time_until_eat
:number- The amount of time (in seconds) it takes for the block to be eaten upon a successful eat attempt.
eat_and_replace_block_pairs
:array- 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_block
:identifier- The block to eat.
replace_block
:identifier- The block to replace the eaten block with.