跳转至

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_eatboolean
If true you can always eat this item (even when not hungry). Default is set to false.
nutritioninteger
Value that is added to the entity's nutrition when the item is used. Default is set to 0.
saturation_modifiernumber
saturation_modifier is used in this formula: (nutrition * saturation_modifier * 2) when applying the saturation buff. Default is set to 0.6.
saturation_modifierstring
using_converts_toitem_descriptor
When used, converts to the item specified by the string in this field. Default does not convert item.
item_descriptor:
string
item_descriptor:
{
  string "<any object property>" : opt
}
<any object property>string
on_use_actionstring
on_use_rangearray
on_use_range
<any array element>number
cooldown_typestring
cooldown_timeinteger
effectsarray
effects
<any array element>object
<any array element>
namestring
durationinteger
amplifierinteger
chancenumber
remove_effectsarray
remove_effects
<any array element>string
on_consumedefinition_trigger
Event trigger for when the item is consumed.
definition_trigger:
string
definition_trigger:
{
  string "event" : opt
  string "target" : opt
  expression_node "condition"
}
eventstring
targetstring
conditionexpression_node
expression_node:
string
expression_node:
number
expression_node:
{
  string "expression" : opt
  integer "version" : opt
}
expressionstring
versioninteger