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:
ench:{[],[],[]}
And within those curly brackets you have unnamed lists, which breaks syntax. The ench
tag is instead a list of compounds:
ench:[{},{},{}]
You have also declared the id
and lvl
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 the display
compound.
Fixed command, using the correct tag-types for enchantments:
/give x_xstolasx_x diamond_sword 1 0 {display:{Name:"Hellbringer",Lore:["Guilty."]},ench:[{id:20s,lvl:2s},{id:16s,lvl:10s},{id:19s,lvl:2s}]}
Alternative, using integers to show that the game will accept it:
/give x_xstolasx_x diamond_sword 1 0 {display:{Name:"Hellbringer",Lore:["Guilty."]},ench:[{id:20,lvl:2},{id:16,lvl:10},{id:19,lvl:2}]}
It is recommended to declare correct tag-types for the sake of consistency, since enchantments applied through normal means will be shorts.
You need to add more escape characters to deeper-nested quotation marks. You open the Text1
tag with a "
, thus the very next "
character closes it. You open the value
tag for the click event with \"
, meaning the next \"
you use will close it, which occurs in your nested /give
command's NBT data (specifically just after the Name
tag). That it what's causing your issue.
The formula to determine the number of backslashes required is: 2n+1
, where n
is the number of current backslashes. For the nested NBT data, you need 3 backslashes per quotation mark (\\\"
).
Fixed command:
/give @p sign 1 0 {BlockEntityTag:{Text1:"{\"text\":\"[Sell]\",\"color\":\"dark_purple\",\"bold\":true,\"clickEvent\":{\"action\":\"run_command\",\"value\":\"clear @p[name=rainbowlack,r=3] cactus 0 2304\"}}",Text2:"{\"text\":\"2304 Cacti\",\"color\":\"red\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"give @p[name=rainbowlack,r=3] minecraft:cookie 18 0 {display:{Name:\\\"$100 Cookie\\\",Lore:[$100]}}\"}}",Text3:"{\"text\":\"iIiIiIi\",\"color\":\"light_purple\",\"strikethrough\":true,\"obfuscated\":true}",Text4:"{\"text\":\"[Sell]\",\"color\":\"dark_purple\",\"bold\":true}"},display:{Name:"Custom Sign"}}
Best Answer
There are 3 things wrong with this command:
Firstly, the
sign
item name has been renamed tooak_sign
(for definite future-proofness, I'd recommend you useminecraft:oak_sign
instead).Secondly, positioning for the NBT tag of an item is right after the item name itself. For example:
Thirdly, I tried running your exact command and the syntax for the NBT data didn't seem to be correct. I can't figure out why, but if anyone can they should feel free to edit this answer