Disenchanting items
I've been trying to update a datapack for disenchanting items from 1.20 to 1.21 and have no clue how to remove only one enchantment at a time.
This is the original command for pre 1.21: data modify entity @e[type=minecraft:item,nbt={Item:{id:"minecraft:enchanted_book"}},limit=1,sort=nearest] Item.tag.StoredEnchantments append from entity @s Item.tag.Enchantments[-1] And this is what I've come up with for 1.21: data modify entity @n[type=minecraft:item,nbt={Item:{id:"minecraft:enchanted_book"}}] Item.components.minecraft:stored_enchantments set from entity @s Item.components.minecraft:enchantments{}
I only got it to remove all enchantments in the end. Any help is much appreciated.