mojira.dev
MC-77706

Command Block Command data not accepting JSON format on /setblock

When using one command block to place another command block with a command such as

/setblock ~1 ~ ~ minecraft:command_block 0 replace {Command:"{text:\"/say Test\"}"}

I expect the created command block to have the command

/say Test

but instead the JSON is not interpreted, leaving the command

{text:"/say Test"}

Linked issues

Attachments

Comments 4

The Command argument of a command block must be plain text - also there is no need to put it in JSON.
If you need to put a tellraw command in the setblock'ed command block, then the argument of tellraw can be in JSON, e.g.

setblock ~1 ~ ~ minecraft:command_block 0 replace {Command:"tellraw @p {\"bold\":\"false\",\"color\":\"blue\",\"text\":\"Hey Steve \",\"extra\":[{\"bold\":\"false\",\"color\":\"white\",\"text\":\"Have a nice day!\"}]}"}

The /say Test example is itself workaround-able by using a plain string. The true application I needed JSON for includes a command closer to

/setblock ~1 ~ ~ minecraft:command_block 0 replace {Command:"{text:\"tp @p[score_ID=\"}, extra:[ {score:{name:\"x\",\"var\"}}, {text:\"] ~ ~ ~\"} ]"}

Which relies on JSON for the score component.

Ok, got it.
But this is not a bug (it's deliberately coded the way it is), it's a feature request.

Ok, thanks. I'll look for another way for my application to work.

Reuben Willson

(Unassigned)

Unconfirmed

Minecraft 1.8.1

Retrieved