How can I /give myself something stronger than the maximum book enchantment level? [duplicate]

I'm new to commands but I made a few which are a bit complicated, in 1.12.2. But recently after the Aquatic update, I've been unable to use commands to give me items stronger than the enchantment book maximum level. I would like to make a command where I can get items with enchantments of 999. How can I do this?

I have a solution but it gets annoying: go on 1.12.2, use the command for items, turn Minecraft off, and reload it on 1.3.1. The item will be saved in my toolbar. But like I said, this is pretty annoying. Is there another way to do this?


Solution 1:

I think I have a solution to your problem as I had the same problem a few weeks ago. The format of the /give command changed quite a bit in 1.13. One now puts the tags next to the command instead of as a seperate argument. For example, this is a command that gives you a diamond sword with sharpness 20:

/give @p minecraft:diamond_sword{Enchantments:[{id:"minecraft:sharpness",lvl:20}]} 1

You can put other enchantments in here by replacing "minecraft:sharpness" with something else and of course the lvl tag is just the level of the enchant. Multiple enchantments can be done like this:

/give @p minecraft:diamond_sword{Enchantments:[{id:"minecraft:sharpness",lvl:20},{id:"minecraft:knockback",lvl:10}]} 1

I hope this helps.