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

NBT data as command output has incomplete String escaping

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Minecraft 1.12
    • Minecraft 15w42a, Minecraft 15w45a, Minecraft 16w42a, Minecraft 1.11, Minecraft 1.11.2, Minecraft 17w15a, Minecraft 17w16a, Minecraft 17w16b, Minecraft 17w17a
    • Confirmed

      Introduction

      When a command modifies or for some commands also not modifies the NBT data of an entity or a block, the chat shows the current NBT data.

      The bug

      I noticed a bug after recompiling Minecraft 1.8 using MCP which is still present in the latest version. When the toString() method of a NBTTagString is called, it only replaces double quotes (") with escaped double quotes (\").
      This can cause problems as the output is supposed to represent the correct NBT data of an object. As it is missing the backslash escaping it would cause two backslashes to become one.

      For 1.9 see __null's comment

      How to reproduce

      1. Use the following command:
        /summon armor_stand ~ ~ ~ {CustomName:"\"\\a"}
        
      2. Use the following command:
        /entitydata @e[type=armor_stand,c=1] {CustomNameVisible:1b}
        

      The output probably shows something like this:

      ...CustomName:"\"\a"...
      

      But as you see that was not what you entered.

            grum [Mojang] Grum (Erik Broes)
            marcono1234 Marcono1234
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: