This question already has an answer here:

I am making a minigame and want to be able to give players enchanted items by the click of a button. I know how to use /give but can you also enchant it?

I have tried this:

/give @p diamond_sword 1 0 {ench:[{id:17,lvl:2},{id:19,lvl:2}]}

If it does not work I can just have them click buttons while holding the items.

marked as duplicate by Virusbomb, Joachim, Gigazelle, Tim S., pinckerman Jul 10 at 22:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I have tried this /give @p bow 1 0 {ench:[{id:51,lvl:1},{id:34,lvl:3}]} – Clark Nelson Jul 1 '17 at 1:29

As of 1.1.3, there is no way you can use the /give command to give already enchanted items as you can't edit the NBT tag.

However, you could connect the button to multiple command blocks. One of them would say /give @p diamond_sword. The other ones would say /enchant @p smite 2 and /enchant @p knockback 2.

I’m assuming the ids you’ve given are for the Java Edition, because the ids for PE are different and id 19 in PE is power, which is not available on a sword. Smite on PE is 10 and knockback is 12. A list of all the ids can be found on the wiki.

NOTE: The /enchant commands won’t work if the player is not holding the dimaond sword.


Sadly, json only supports CanPlaceOn and CanDestroy functions for adventure and you can give yourself enchanted items only with custom mods. I hope Mojang is working on this...


Use this: /replaceitem entity [Player/@p/@a/@e/@r/@s] slot.weapon.mainhand 0 diamond_sword Then after do /enchant @p -enchantment-


You could clone a dispenser of the enchanted item of your liking and have a command block triggering dispenser as well as teleporting that item to @p. A little harder to set up then a single command but an easy way to not have to use /enchant in case they switch what they are holding on accident


I'm not sure that's possible, unless you change an items ID

  • 1
    How do you do that. I am not very good with commands. – Clark Nelson Jul 1 '17 at 1:28
  • 2
    If you cannot answer, PLEASE DON'T ANSWER. – aytimothy Jul 1 '17 at 11:22

Yes! I think I've found the solution! It might not work though, but here :

/give @p diamond_sword 1 0 {tag:{ench:[{id:10,lvl:1},{id:12,lvl:1}]}}

  • 1
    PE does not have NBT data. If it did and matched the structure of JE, that would not work because the NBT data for /give already starts in the tag compound. – Skylinerw Dec 23 '17 at 0:44
  • Same to do with Skylinerw... I've tried everything, de-compiling MCPE's data and trying to type stuff like that in commands, using caps and no-caps, strings and no-strings, but to no avail. Looks like we'll just have to wait until it comes in a future update. Expect it soon though, as the next update is major. – machinebuilder Jan 24 '18 at 3:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.