ItemComponent - Food Component Apply (Section) — SkBee

Addon: SkBee · Category: Section · Since: 3.5.8

Syntax

apply food component to %itemstacks/itemtypes/slots%

Description

Apply a food component to any item giving it food properties. You will also require a `consumable` component to actually make the item consumable. Requires Paper 1.21.3+ See [**Food Component**](https://minecraft.wiki/w/Data_component_format#food) on McWiki for more details.

**Entries/Sections**: - `nutrition` = The number of food points restored by this item when eaten. Must be a non-negative integer. - `saturation` = The amount of saturation restored by this item when eaten. - `can always eat` = If true, this item can be eaten even if the player is not hungry. Defaults to false. [Optional]

Examples

apply food component to player's tool:
	nutrition: 5
	saturation: 3

set {_i} to 1 of book
apply food component to {_i}:
	nutrition: 5
	saturation: 3
	can_always_eat: true
give player 1 of {_i}

View source