Class: ItemFoodComponent
When present on an item, this item is consumable by entities. Note that this component only applies to data-driven items.
Extends
Constructors
new ItemFoodComponent()
private
new ItemFoodComponent():ItemFoodComponent
Returns
Overrides
Properties
canAlwaysEat
readonly
canAlwaysEat:boolean
Remarks
If true, the player can always eat this item (even when not hungry).
Throws
This property can throw when used.
nutrition
readonly
nutrition:number
Remarks
Represents how much nutrition this food item will give an entity when eaten.
Throws
This property can throw when used.
saturationModifier
readonly
saturationModifier:number
Remarks
When an item is eaten, this value is used according to this formula (nutrition * saturation_modifier * 2) to apply a saturation buff.
Throws
This property can throw when used.
typeId
readonly
typeId:string
Remarks
Identifier of the component.
Inherited from
usingConvertsTo
readonly
usingConvertsTo:string
Remarks
When specified, converts the active item to the one specified by this property.
Throws
This property can throw when used.
componentId
static
readonly
componentId:"minecraft:food"
='minecraft:food'
Methods
isValid()
isValid():
boolean
Returns
boolean
Whether the component is valid.
Inherited from
Remarks
Returns whether the component is valid. A component is considered valid if its owner is valid, in addition to any addition to any additional validation required by the component.