ItemComponent - Consumable Component Apply (Section) — SkBee
Addon: SkBee · Category: Section · Since: 3.8.0
Syntax
apply consumable [component] to %itemstacks/itemtypes/slots%Description
Apply a consumable component to an item. If present, this item can be consumed by the player. Requires Paper 1.21.3+ See [**Consumable Component**](https://minecraft.wiki/w/Data_component_format#consumable) on McWiki for more info. **Entries**: - `consume_seconds` = The amount of time it takes for a player to consume the item. Defaults to 1.6 seconds. [Optional] - `animation` = The animation used during consumption of the item. [Optional] Must be one of "none", "eat", "drink", "block", "bow", "spear", "crossbow", "spyglass", "toot_horn" or "brush". Defaults to "eat"] - `sound` = A sound key to player when consumed. Defaults to "entity.generic.eat" [Optional] - `has_consume_particles` = Whether consumption particles are emitted while consuming this item. Defaults to true. [Optional] - `on_consume_effect` = A `consume effect` to by applied to the component (supports a list) [Optional]. - `on_consume_effects` = A section to apply `consume effects` [Optional].
Examples
apply consumable to {_i}:
animation: "drink"
consume_seconds: 2.5 seconds
on_consume_effects:
apply -> potion effect of slowness for 10 seconds with probability 0.5
apply -> clear all effects
apply -> remove effects night vision
apply -> play sound "blah.blah"
apply -> teleport randomly within 15
apply -> teleport randomly within 20 meters
apply -> teleport randomly within 100 blocks
set {_effects} to apply_effects(potion effect of night vision for 10 seconds, 0.5)
set {_i} to 1 of stick
apply consumable component to {_i}:
consume_seconds: 3.2 seconds
animation: "brush"
sound: "block.stone.break"
has_consume_particles: false
on_consume_effect: {_effects}
give {_i} to player