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

Criterion names in advancement selector argument limited to unquoted strings

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • Minecraft 1.13.2, Minecraft 18w47a, Minecraft 19w09a, Minecraft 19w11b, Minecraft 19w12a, Minecraft 19w12b, Minecraft 19w13a, Minecraft 19w13b, Minecraft 19w14a, Minecraft 19w14b, Minecraft 1.14 Pre-Release 1, Minecraft 1.14 Pre-Release 2, Minecraft 1.14 Pre-Release 3, Minecraft 1.14 Pre-Release 5, Minecraft 1.14, Minecraft 1.14.1 Pre-Release 1, Minecraft 1.14.1 Pre-Release 2, Minecraft 1.14.1, Minecraft 1.14.2 Pre-Release 3, Minecraft 1.14.2, Minecraft 1.14.3 Pre-Release 2, Minecraft 1.14.3 Pre-Release 3, 1.15.1, 20w14a, 20w16a, 1.16.4, 20w49a, 1.18.1, 1.19, 1.19.3, 1.19.4 Release Candidate 3, 1.19.4, 1.20.1, 1.20.2, 23w43b
    • None
    • Confirmed
    • Commands
    • Low
    • Platform

      The bug

      In entity selectors, the advancement selector has support for testing that certain criteria are set or unset. When parsing the selector, these can only be parsed successfully if they are made up of a limited subset of characters.

      How to reproduce

      Attempt to run either of the following two commands:

      /execute if entity @s[advancements={minecraft:adventure/adventuring_time={"minecraft:bamboo_jungle_hills"=true}}]
      /execute if entity @s[advancements={minecraft:adventure/adventuring_time={minecraft:bamboo_jungle_hills=true}}]
      

      Expected behavior

      There should not be a parsing error. For example, the following the following similar command parses successfully.

      /execute if entity @s[advancements={minecraft:adventure/ol_betsy={shot_crossbow=true}}]
      

      Actual behavior

      There is a parsing error (Expected "=")

      Code analysis

      Based on MC version 18w47a, decompiled with CFR version 131.

      The bug is in ea.java, soon after the string "advancements" is used (this is one of only four references to the string "advancements" in the entire codebase decompiled from the client jar). The following is an excerpt from the second (nested in the first) while loop:

      while (stringReader.canRead() && stringReader.peek() != '}') {
          stringReader.skipWhitespace();
          String string = stringReader.readUnquotedString();
          stringReader.skipWhitespace();
          stringReader.expect('=');
          stringReader.skipWhitespace();
          // <...>
      }
      

      To fix this bug, the third line should call StringReader::readString as opposed to the current StringReader::readUnquotedString, which would support quoted strings and hence a wider array of the supported characters.

            Unassigned Unassigned
            jirauser71590 user-f2760 (Inactive)
            Votes:
            19 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              CHK: