mojira.dev
MC-123980

nbt arrays don't use correct syntax causing errors

When inputting nbt data as part of an item description which uses an array the game throws an error for example: display:[Name: hello world] this is not accepted and instead says that there should be a square bracket [Name<-- HERE where as it is very clear that there should be a colon there.

[media]

Please Note that I have so far only tested this with the give command and replace item command.

Attachments

Comments 2

display is a compound, not a list. As well, Name is now required to be a JSON text component:

{display:{Name:"\"Name: Hello World\""}}

As far as the error goes, it's correct. The whitelist of characters for a valid unquoted string are: alphanumeric characters, +, -, and _. Colons are not in that whitelist, thus they are invalid characters for unquoted strings. The string the parser sees is "Name" and is then expecting the end of the list since there are no other valid characters after "Name" to add to the string, and no list value separator (comma).

If that were the case (e.g. list:[Name]:), you'd get the next error where the colon is expected to be a closing curly bracket as it is a syntax-breaking character outside of any quotes and is not a valid key-value separator due to there being no key.

While your intention was to use a compound with "Name" being the key rather than the value, for an actual string containing a colon (such as item IDs) you'd have to surround the value entirely in quotes:

string:"minecraft:id"
list_of_strings:["minecraft:id"]

yep realised that one, I always get it confused. sigh.

Joseph david strong

(Unassigned)

Unconfirmed

Minecraft 18w01a

Retrieved