@minecraft/server / ItemFoodComponent
Class: ItemFoodComponent ​
Defined in: @minecraft/server/index.d.ts:14289
When present on an item, this item is consumable by entities. Note that this component only applies to data-driven items.
Extends ​
Properties ​
canAlwaysEat ​
readonlycanAlwaysEat:boolean
Defined in: @minecraft/server/index.d.ts:14298
Remarks ​
If true, the player can always eat this item (even when not hungry).
Throws ​
This property can throw when used.
isValid ​
readonlyisValid:boolean
Defined in: @minecraft/server/index.d.ts:6234
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.
Inherited from ​
nutrition ​
readonlynutrition:number
Defined in: @minecraft/server/index.d.ts:14306
Remarks ​
Represents how much nutrition this food item will give an entity when eaten.
Throws ​
This property can throw when used.
saturationModifier ​
readonlysaturationModifier:number
Defined in: @minecraft/server/index.d.ts:14315
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 ​
readonlytypeId:string
Defined in: @minecraft/server/index.d.ts:6240
Remarks ​
Identifier of the component.
Inherited from ​
usingConvertsTo ​
readonlyusingConvertsTo:string
Defined in: @minecraft/server/index.d.ts:14323
Remarks ​
When specified, converts the active item to the one specified by this property.
Throws ​
This property can throw when used.
componentId ​
readonlystaticcomponentId:"minecraft:food"='minecraft:food'
Defined in: @minecraft/server/index.d.ts:14324