Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-86325

[Solved] Escape characters are lost when adding a command to a command block / minecart

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Works As Intended
    • None
    • Minecraft 15w33c
    • None
    • Windows 8.1
    • Unconfirmed

      The changes to JSON in the 1.9 snapshots mean that we have to use escape characters to make certain commands work (such as tellraw) due to having quotes within quotes.
      I have been creating a 'One Command Block' contraption that summons command block minecarts riding one another to execute commands in a certain order.

      I am trying to create 3 signs, each with colours and clickEvents.

      For example, here is a command that creates a sign with the words 'Right Click to Destroy Machine' in red.

      /setblock ~1 ~1 ~ minecraft:wall_sign 4 replace {Text1:"{\"text\":\"\"}",Text2:"{\"text\":\"Right Click To\",\"color\":\"dark_red\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/fill ~ ~-1 ~1 ~6 ~2 ~-3 air\"}}",Text3:"{\"text\":\"Destroy Machine\",\"color\":\"dark_red\"}",Text4:"{\"text\":\"\"}"}
      

      This command works on its own like this, however when a command block minecart is summoned preloaded with this command with this command:

      /summon MinecartCommandBlock ~2 ~ ~ {Command:/setblock ~1 ~ ~1 minecraft:wall_sign 4 replace {Text1:"{\"text\":\"\"}",Text2:"{\"text\":\"Right Click To\",\"color\":\"dark_red\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/fill ~ ~-1 ~1 ~6 ~2 ~-3 air\"}}",Text3:"{\"text\":\"Destroy Machine\",\"color\":\"dark_red\"}",Text4:"{\"text\":\"\"}"}}
      

      The command block has this command (below) inside, which does not work as it results in this error: Data tag parsing failed: Unexpected token 't'...

      Note how all of the escape characters are missing.

      /setblock ~1 ~ ~1 minecraft:wall_sign 4 replace {Text1:"{"text":""}",Text2:"{"text":"Right Click To","color":"dark_red","clickEvent":{"action":"run_command","value":"/fill ~ ~-1 ~1 ~6 ~2 ~-3 air"}}",Text3:"{"text":"Destroy Machine","color":"dark_red"}",Text4:"{"text":""}"}
      

      I have also tried surrounding the command with quotation marks like so:

      /summon MinecartCommandBlock ~2 ~ ~ {Command:"/setblock ~1 ~ ~1 minecraft:wall_sign 4 replace {Text1:\"{\"text\":\"\"}\",Text2:\"{\"text\":\"Right Click To\",\"color\":\"dark_red\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/fill ~ ~-1 ~1 ~6 ~2 ~-3 air\"}}\",Text3:\"{\"text\":\"Destroy Machine\",\"color\":\"dark_red\"}\",Text4:\"{\"text\":\"\"}\"}"}
      

      The escape characters were still missing after running this one.

      This has been annoying me because it means that I cannot have interactive signs on my contraption at the moment.

      Thank you for reading, please let me know if there's anything I missed or need to clear up.

      Charlie

            Unassigned Unassigned
            bombom3000 Charlie
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: