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

Input range entry and limits are reversed in error messages

XMLWordPrintable

    • Confirmed

      Background

      The command completion interface will warn the user when input is entered out of range for number types (integer, float, double).

      The bug

      The number that is invalid and the bound for the number range are reversed in the error messages telling the user that the number is invalid.

      For these commands:

      /playsound entity.lighting.thunder weather @s ~ ~ ~ -1.0
      /weather clear 775849392

      Expected Output:

      Float must not be less than 0.0, found -1.0 at position: ...
      Integer must not be larger than 1000000, found 775849392 at position: ...

      Actual Output:

      Float must not be less than -1.0, found 0.0 at position: ...
      Integer must not be larger than 775849392, found 1000000 at position: ...

      Affected platforms

      This translation string is shown client side, above the text entry field during live command feedback.  The message is also shown server side when the input is a valid integer or float or double but still out of range.

      Furthermore, these translation strings do not appear to be present in snapshot 18w21b.

      Causes

      There are multiple possible sources.  It could be created by the game building the message with the arguments in the wrong order, or it could be in the translation file where the arguments are specified in the string.

      Translation File:

      "argument.double.low": "Double must not be less than %s, found %s",
      "argument.double.big": "Double must not be more than %s, found %s",
      "argument.float.low": "Float must not be less than %s, found %s",
      "argument.float.big": "Float must not be more than %s, found %s",
      "argument.integer.low": "Integer must not be less than %s, found %s",
      "argument.integer.big": "Integer must not be more than %s, found %s"

      Solution

      This problem can be fixed without even changing the code by updating the argument index of the translation strings to use the second argument first, and the first argument second.

      Fixed Translation File:

      "argument.double.low": "Double must not be less than %2$s, found %1$s",
      "argument.double.big": "Double must not be more than %2$s, found %1$s",
      "argument.float.low": "Float must not be less than %2$s, found %1$s",
      "argument.float.big": "Float must not be more than %2$s, found %1$s",
      "argument.integer.low": "Integer must not be less than %2$s, found %1$s",
      "argument.integer.big": "Integer must not be more than %2$s, found %1$s"

      A resource pack with the updated language strings is provided, which fixes the issue.

        1. screenshot-2.png
          screenshot-2.png
          29 kB
        2. screenshot-1.png
          screenshot-1.png
          28 kB
        3. fix-lang.zip
          1.0 kB
        4. Command.png
          Command.png
          17 kB
        5. 2018-05-30_09.23.03.png
          2018-05-30_09.23.03.png
          2.70 MB
        6. 2018-05-30_09.22.50.png
          2018-05-30_09.22.50.png
          2.72 MB

            boq [Mojang] Bartosz Bok
            Tedstar Tedstar (Curtis Anderson)
            Votes:
            12 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: