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

testfor NBT parsing error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: Minecraft 14w05b
    • Fix Version/s: Minecraft 14w07a
    • Labels:
      None
    • Environment:

      Windows 7 Ultimate

    • Confirmation Status:
      Unconfirmed

      Description

      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.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: