mojira.dev
MC-58629

Set command block with command problems

When using the command

/setblock 316 30 -1390 minecraft:command_block 0 replace {Command:"/title @a subtitle {text:"--3 Chambers Remain--",color:"gold"}"}

the command will not work as it says data tag parsing failed as it says in the 'text' field the '-' is unexpected although it should not be looking at this as it is after the ". The command works if I remove the " " around the text however the actual command

/title @a subtitle {text:"--3 Chambers Remain--",color:"gold"}

doesn't work without the " ".

Attachments

Comments 4

Try getting rid of the quotes of the command tag, but keep it in the actual command itselve, so keep it in text and color, maby it helps

Here is a fix:

/setblock 316 30 -1390 minecraft:command_block 0 replace {Command:"/title @a subtitle [{text:\"--3 Chambers Remain--\",color:\"gold\"}]"}

Whenever there is a JSON inside the Command tag, you have to encapsulate it in square brackets ([]) and escape all quotation marks inside the JSON using the backslash (replace " with \").

Otherwise, the quotation mark ends the Command tag and the JSON is left incomplete.

Confirmed for 14w25b
How to fix this for you (Mateo's version works also):

/setblock 316 30 -1390 minecraft:command_block 0 replace {Command:/title @a subtitle{text:"--3 Chambers Remain--",color:gold}}

Mikeey

(Unassigned)

Unconfirmed

Minecraft 14w25b

Retrieved