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

testfor NBT parsing error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Minecraft 14w07a
    • Minecraft 14w05b
    • None
    • Windows 7 Ultimate
    • Unconfirmed

      When trying to use testfor to detect an item entity with a specific name, the game fails to correctly parse the testfor command. The command in question is:
      /testfor @e[type=Item,r=5] {OnGround:1b,Item:{id:"minecraft:bow",tag:{display:{Name:"Reds Bow"}}}}
      For testing purposes, you can give yourself a bow to test this with using:
      /give @p minecraft:bow 1 0 {display:{Name:"Reds Bow"}}

      Running the testfor command above returns:
      "/testfor <player> [dataTag]"
      ...which means that it did not correctly parse the NBT and is telling you the proper parameters for the command. If you remove the "tag" tag, and use the following command:
      /testfor @e[type=Item,r=5] {OnGround:1b,Item:{id:"minecraft:bow"}}
      The game will output:
      "Found item.item.bow"

      Curiously the command will work if you expand it as far as:
      /testfor @e[type=Item,r=5] {OnGround:1b,Item:{id:"minecraft:bow",tag:{display:{}}}}
      But as soon as the Name tag is added, the game fails to parse the command.

      UPDATE:
      It looks like the problem is actually being caused by the space inside of the string. Other commands that also parse NBT strings, such as "clear," have this same behavior.

            searge [Mojang] Searge (Michael Stoyke)
            texelelf Elf Elf
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: