Skip to content

@minecraft/server


@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 ​

readonly canAlwaysEat: 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 ​

readonly isValid: 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 ​

ItemComponent.isValid


nutrition ​

readonly nutrition: 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 ​

readonly saturationModifier: 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 ​

readonly typeId: string

Defined in: @minecraft/server/index.d.ts:6240

Remarks ​

Identifier of the component.

Inherited from ​

ItemComponent.typeId


usingConvertsTo ​

readonly usingConvertsTo: 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 ​

readonly static componentId: "minecraft:food" = 'minecraft:food'

Defined in: @minecraft/server/index.d.ts:14324