Data tags have the form name
:
value
. The name/value separator is :
. You need to put :
between the name (ench
) and the value ([{id:49,lvl:100,{id:51,lvl:1}}]
) of the tag.
There is also a typo in the value itself. Each enchantment has to be given as a compound tag, enclosed in curly brackets. You need to close the first enchantment by putting }
after lvl:100
, then remove the duplicate one at the end:
ench:[{id:49,lvl:100},{id:51,lvl:1}]
The easiest way to find mismatched braces is to expand the command into a multi-line format with properly indented lines. This makes it easier to find errors and subsequently fix them.
A nifty little tool to automatically format your data tags can be found at http://jsonviewer.stack.hu/. Using the Format and Remove White Space buttons, you can expand or collapse your command, respectively. Using the sample data tag given in the questions, we can turn this
{Profession:3,Career:2,Offers:{Recipes:[{buy:{id:minecraft:diamond,Count:6b}},sell:{id:minecraft:diamond_hoe,tag:{ench:[{id:16s,lvl:10s}]}]}}
into this
{
Profession: 3,
Career: 2,
Offers: {
Recipes: [
{
buy: {
id: minecraft: diamond,
Count: 6b
}
},
sell: {
id: minecraft: diamond_hoe,
tag: {
ench: [
{
id: 16s,
lvl: 10s
}
]
}
]
}
}
Now all that is left is compare the opening and closing brackets at each indentation level. You can see that there is no closing bracket at the last indentation level, the last bracket is indented once, showing us that there is a closing bracket missing on some level.
If you check all the tags starting at the top, you can see that there's a problem with the sell
tag: There's a closing square bracket instead of a curly bracket on that indentation level. To make this even more visible, we can copy-paste our data tag into an advanced text editor like Notepad++, which highlights matching brackets for us:
Have the missing curly bracket problem:
Here it is immediately apparent that a closing curly bracket is needed for the sell
tag.
Without the missing bracket:
Best Answer
A compound tag surrounds its data in curly brackets, while a list tag surrounds its data in square brackets. All tags except for those directly within a list must have a name.
The
ench
tag is a list, yet you have declared it as a compound because it's opened using curly brackets:And within those curly brackets you have unnamed lists, which breaks syntax. The
ench
tag is instead a list of compounds:You have also declared the
id
andlvl
tags as strings by using quotation marks, when they are supposed to be numerical (specifically a short; a number between -32,768 and 32,767).The game will not auto-correct any tag-types within item data, so by declaring it as an integer (number between -2,147,483,648 and 2,147,483,647) it will remain an integer and not the standard short. The game will still recognize that it's a numerical value even in that case. To declare a short, you append a numerical value with an "s". To declare an integer, you simply use a numerical value.
The
Lore
list must be placed within thedisplay
compound.Fixed command, using the correct tag-types for enchantments:
Alternative, using integers to show that the game will accept it:
It is recommended to declare correct tag-types for the sake of consistency, since enchantments applied through normal means will be shorts.