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

Cannot execute a block that has a colored custom name

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • None
    • Minecraft 1.13-pre9
    • None
    • OS: Arch Linux 64-bit.
      CPU: AMD
      GPU: Nvidia
      Memory: 8GB
    • Unconfirmed

      Trying to use

      execute as @a at @a if block (...)

      with a block that supports the CustomName nbt data (like dispensers for example) will fail if the CustomName contains a color code. Here is such an example.

       

      Run this on a dispenser:

      data merge block ~ ~-1 ~ {CustomName:"{\"text\":\"\\u00a73Special Crafts\"}"}

      Then try this:

      execute as @s at @s if block ~ ~-1 ~ minecraft:dispenser{CustomName:"{\"text\":\"\\u00a73Special Crafts\"}"} run say Hi.
      

      The code will not execute. I ran

      data get block ~ ~-1 ~
      

      on the block, and noticed that the escape code is not present in CustomName. Instead, the text is colored.

      This may suggest that instead of the nbt being saved as literally:

      {\"text\":\"\\u00a73Special Crafts\"}
      

      It is saved as this instead:

      {\"text\":\"§4Special Crafts\"}

      If it is indeed stored that way, testing for a colored custom name is not possible, as "§" is not a typeable character in command blocks. Please fix this.

      Edit: Added world download to showcase issue

            Unassigned Unassigned
            Develon5543 Develon Trujillo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: