mojira.dev
MC-175504

Single quotation marks are not supported in NBT paths

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.

Attachments

Comments 10

It might be WAI:

/data

  • (...)

  • "quoted strings" may be used if a name of a key needs to be escaped

Source: https://gist.github.com/Dinnerbone/943fbcd763c19be188ed6b72a12d7e65

Can confirm in 20w51a.

Can confirm in 21w03a.

Can confirm in 1.16.5 and 21w08b.

Can confirm in 21w10a. Video attached.

Can confirm in 1.17.

Can confirm in 1.17.1.

Can confirm in 1.18.2 and 22w18a.

Can confirm in 1.19.

Can confirm in 1.19.2.

SPGoding

(Unassigned)

Confirmed

Commands

nbt-path

1.15.2, 20w12a, 20w13a, 20w14a, 20w16a, ..., 1.17.1, 1.18.2, 22w18a, 1.19, 1.19.2

1.20 Pre-release 2

Retrieved