5

I'm making a mini game (bomb squad) and the armor needs to be enchanted. I know that armor can be enchanted through command blocks and that is what I intend to do. I am wondering if it is possible to enchant armor twice in one command block or should I need multiple command blocks as I have done in the past?

2 Answers 2

6

If you are using the command enchant, you can only do one enchantment per command block. There is a ways to do this though:

DataTags

When you summon or give an item, you can specify 'DataTags'. These tags give minecraft additional information about the item, for example it's display name or the enchantments it has (see further down for more information).

An example command for adding enchantments would be this one (gives Iron Leggings with Fire Protection III and Unbreaking I):

give @p iron_leggings 1 0 {ench:[{id:1,lvl:3},{id:34,lvl:1}]}

Or dropping an item on the ground:

summon Item ~ ~1 ~ {Item:{id:308,Count:1,Damage:0,tag:{ench:[{id:1,lvl:3},{id:34,lvl:1}]}}}

(You need a command block to test this, the chat will cut off the command)


In depth explanation

Looking at the syntax of the give command:

/give <player> <item> [amount] [data] [dataTags]

You can see the last argument, dataTags. Do not confuse this with data, which is the damage value of the item. They are formatted in JSON, and you can find a good tutorial here, but I will try to explain it too:

The the outer brackets {} mark a group of tags. In there, there is a key ench. This specifies a list of enchantments (surrounded by []). In the list, there are pairs of values with each an id and a lvl. These specify an enchantment.

You can get the ID's from this list: Minecraft Wiki

The level has to be a number, but you don't have to follow the normal Minecraft enchantment limits (you could make a tool with efficiency 100). Note that high enchantments will be displayed weirdly (but are fully functional).

-2

give @p item here 1 0 {ench:[{id:id here,lvl:level here},{id:id here,lvl:level here}]} get the id's for enchanting at http://www.planetminecraft.com/blog/minecraft-enchantment-id-list/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .