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

In commands, block states are attempted to be read after the end of the previous value

XMLWordPrintable

    • Confirmed

      The bug

      After the value of a block state has been read in a command, if there are any characters which are not "]" or "," directly following the read string value, parser attempts to read an additional property. For example, the command:

      /setblock ~ ~ ~ minecraft:acacia_button["face"=ceiling ]
      Give the error:
      Block minecraft:acacia_button does not have property '' at position 53: ...e"=ceiling<--[HERE]
      

      Please note that this error is also given without the final `]`, but to make the parser give this error in the logs I had to add the ], which could be any character as after pos 53 nothing is parsed.
      Additionally, the command:

      /setblock ~ ~ ~ minecraft:acacia_button["face"=ceiling"hello"
      Gives the error:
      Block minecraft:acacia_button does not have property 'hello' at position 53: ...e"=ceiling<--[HERE]
      

      I would expect this to give an error about not having closed the `[`

      Furthermore, the command:

      /setblock ~ ~ ~ minecraft:acacia_button["face"=ceiling"powered"=true]
      

      runs successfully, when it should give an error that there is no seperator between ceiling and "powered".


      Code analysis

      The following is based on Minecraft 17w50a Decompiled using cfr v123, with the code being obfuscated
      In class CJ, method g, the last if statement of the while loop is:

      if (this.i.peek() != ']')
          continue;
      

      This means that if a "]" is not found, the states parser tries to read an additional property.
      This then continues parsing as if there had been a ",".
      The line continue; should be,

      throw g.createWithContext(this.i);
      

      where g is the argument.block.property.unclosed error.

            dinnerbone [Mojang] Nathan Adams
            montz13 Levertion
            Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: