Set Item Components
Description
Sets or removes data components on an item. Components are written the same way as in the /give command, as a [name=value,...] list, and a component prefixed with ! is removed.
Use it for vanilla item data such as dye colors, armor trims and enchantments. These are data components since Minecraft 1.20.5, so SetItemNBT, which writes the item's custom data, cannot change them.
Values use the component syntax of your server's Minecraft version, which can differ between versions. For example, before 1.21.5 enchantments are written as enchantments={levels:{sharpness:5}}.
On Minecraft 1.21.4 or newer, the components this mechanic sets on a Mythic item stay on it when the Item Updater updates the item (see Preserve.SkillComponents), and when the item is placed as furniture and broken again.
Attributes
| Attribute | Aliases | Description | Default |
|---|---|---|---|
| components | component, c | The components to set or remove | |
| equipslot | slot, s | The slot of the item to modify. If not set, the item that triggered the skill is modified |
Examples
Skills:
- setItemComponents{slot=CHEST;components="[dyed_color=16711680]"} @self
Skills:
- setItemComponents{slot=CHEST;components="[trim={material:iron,pattern:wild},enchantments={unbreaking:2}]"} @self
Skills:
- setItemComponents{slot=CHEST;components="[dyed_color=<caster.var.color>]"} @self
Skills:
- setItemComponents{components="[enchantment_glint_override=true]"} @self ~onUse
Skills:
- setItemComponents{slot=CHEST;components="[!dyed_color]"} @self
Aliases
- setItemComponent