Minecraft – Why does the item name not show up in 1.13

minecraft-commandsminecraft-java-edition

I am in 1.13 Pre-Release 7 trying to make a one command creation and I need an item with a specific name. The command I use is /give @p diamond_sword{display:{Name:"Sword of Power"}} and it gives my a diamond sword, but it doesn't have the name.

This is me trying the command This is me running the command.

This is the command not working This is the command not working.

Best Answer

In 1.13 many things are JSON that were previously just simple strings. So the syntax is now:

give @p diamond_sword{display:{Name:"{\"text\":\"Sword of Power\"}"}}

This also means that you can colour the text, make it underlined, translatable, obfuscated, etc.

With Minecraft 1.14, support for single-quoted strings has now been added. This means that you can shorten JSON strings by surrounding them in single quotes ' instead of double quotes:

give @p diamond_sword{display:{Name:'{"text":"Sword of Power"}'}}

Whenever an NBT check doesn't work like you expected, I always recommend /data get. For example in this case you can hold the item and run:

/data get entity @s SelectedItem