Please revise "minecraft:enchantments" and "minecraft:stored_enchantments" compounds. Before, the level and id values were seperated in a list which made it easy to check and modify them individually in a datapack. Now they are merged under the 'levels' field, which makes it impossible to change the level without knowing the id.
EX. on an enchanted book, it's like this in the snapshot:
{components: {"minecraft:stored_enchantments":{levels:{"minecraft:efficiency":5, "minecraft:silk_touch":1}}}}
As far as this format is concerned, "minecraft:efficiency" is equivalent to the value 5 which is extremely difficult to work with. And because it's all sandwiched in the { } compound instead of a list, I can't get the id without knowing it, or what position it's at on an enchanted book.
I recommend going back to its old format.
{components:{"minecraft:stored_enchantments":[{id:"minecraft:efficiency", lvl: 5},{id:"minecraft:silk_touch",lvl:1}]}}
Point proven, when holding an enchanted book there is no equivalent of this command from 1.20.4 :
/data get entity @s SelectedItem.tag.StoredEnchantments[0].id
Attachments
Comments 3
nodeee, that assumes that you already know what the ID is. It’s impossible to change the ID or level in a single command that works across everything.
It’s a bug because it’s a loss of functionality that mojang were asking for with components.
for example for the value "{A:{B:C}}" the value "C" can’t be retrieved without knowing the path A.B, and B is literally the book id.
Thank you for your report!
However, this issue is Invalid.
You have posted a feature request or a suggestion. This site is for bug reports only.
For suggestions, please visit The Minecraft Feedback Site or visit the Minecraft Feedback Discord server.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
not a bug
btw, you can easily get and set the value. example command: