minecraft:food¶
文档版本:1.21.0.24
When an item has a food component, it becomes edible to the player. Must have the 'minecraft:use_duration' component in order to function properly.
架构¶
minecraft:food:
{
boolean "can_always_eat" : opt
integer "nutrition" : opt
number "saturation_modifier" : opt
string "saturation_modifier" : opt
item_descriptor "using_converts_to"
string "on_use_action" : opt
array "on_use_range" : opt
{
number "<any array element>" : opt
}
string "cooldown_type" : opt
integer "cooldown_time" : opt
array "effects" : opt
{
object "<any array element>" : opt
{
string "name" : opt
integer "duration" : opt
integer "amplifier" : opt
number "chance" : opt
}
}
array "remove_effects" : opt
{
string "<any array element>" : opt
}
definition_trigger "on_consume"
}
can_always_eat
:boolean- If true you can always eat this item (even when not hungry). Default is set to false.
nutrition
:integer- Value that is added to the entity's nutrition when the item is used. Default is set to 0.
saturation_modifier
:number- saturation_modifier is used in this formula: (nutrition * saturation_modifier * 2) when applying the saturation buff. Default is set to 0.6.
saturation_modifier
:string
using_converts_to
:item_descriptor- When used, converts to the item specified by the string in this field. Default does not convert item.
<any object property>
:string
on_use_action
:string
on_use_range
:array
on_use_range
<any array element>
:number
cooldown_type
:string
cooldown_time
:integer
effects
:array
effects
<any array element>
:object
<any array element>
name
:string
duration
:integer
amplifier
:integer
chance
:number
remove_effects
:array
remove_effects
<any array element>
:string
on_consume
:definition_trigger- Event trigger for when the item is consumed.