Stored Enchantments (Expression) — Skript

Addon: Skript · Category: Expression · Since: 2.16

Syntax

[the] stored enchant[ment]s of %itemtypes%

Description

The enchantments stored inside an enchanted book. This is different from enchanting the book, as for example a book of sharpness does not deal more damage when used as a weapon. Corresponds to the <code>minecraft:stored_enchantments</code> data component. Note that for example resetting the stored enchantments of an enchanted book of Sharpness III removes the sharpness enchantment, since it is impossible to know what the original enchantments of the item were. Note also that only one entry can exist per enchantment type; adding Sharpness III to a book with Sharpness V will convert it to a book of Sharpness III.

Examples

command /godbook:
	trigger:
		set {_item} to minecraft:enchanted_book
		add mending to stored enchants of {_item} # adds mending 1
		add knockback 12 to stored enchants of {_item}
		add fire aspect 3 to stored enchants of {_item}
		give {_item} to player

View source