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

Single quotation marks are not supported in NBT paths


    • Icon: Bug Bug
    • Resolution: Fixed
    • 1.20 Pre-release 2
    • 1.15.2, 20w12a, 20w13a, 20w14a, 20w16a, 20w17a, 20w18a, 20w22a, 1.16 Pre-release 2, 1.16 Pre-release 3, 1.16 Pre-release 6, 1.16.2 Release Candidate 1, 1.16.3, 20w45a, 20w51a, 21w03a, 1.16.5, 21w08b, 21w10a, 1.17, 1.17.1, 1.18.2, 22w18a, 1.19, 1.19.2
    • Confirmed
    • Commands

      To Reproduce

      1. Double quotation marks work
        /data get entity @s "Inventory"
      2. Single quotation marks don't work. Instead, the error message “Found no element matching 'Inventory'” is shown.
        /data get entity @s 'Inventory'

      Code Analysis

      Super duper Mojang mappings, 20w12a.

      The function net/minecraft/commands/arguments/NbtPathArgument#parseNode calls the StringReader#readString method, which does support single quotation marks. However, it is only called if the string starts with a double quotation mark ("). Otherwise the node is considered as an unquoted name.

      The missing case for single quotation marks (') should be added in the parseNode method.

      Also, you might want to add character != '\'' to net/minecraft/commands/arguments/NbtPathArgument#isAllowedInUnquotedName as well.

        1. MC-175504.mp4
          2.79 MB
        2. MC-175504.png
          1.26 MB

            Unassigned Unassigned
            SPGoding [Mod] SPGoding
            7 Vote for this issue
            5 Start watching this issue