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

Command outputs which should be sorted don't get sorted

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 1.15 Pre-release 4
    • 1.14.4, 19w35a, 19w38b, 19w39a, 19w41a, 19w42a, 19w44a, 19w45a, 19w46a, 19w46b, 1.15 Pre-Release 2, 1.15 Pre-release 3
    • Confirmed
    • Commands
    • Important

      Steps to reproduce:

      • Run the commands
      /tag @s add a
      /tag @s add b
      /tag @s add p
      /tag @s add q
      /tag @s list
      • The feedback is
      Player has 4 tags: p, a, q, b

      but it should be ordered alphabetically

      Player has 4 tags: a, b, p, q

      Other affected commands: /scoreboard players list and /team list <team>

       

      Code analysis (official mappings)

      public static Component formatAndSortList(Collection in, Function formatter) {
          if (in.isEmpty()) {
              return new TextComponent("");
          } else if (in.size() == 1) {
              return (Component)formatter.apply(in.iterator().next());
          } else {
              ArrayList sorted = Lists.newArrayList(in);
              sorted.sort(Comparable::compareTo);
              return formatList(in, formatter);
          }
      }
      

      The method formatAndSortList in ComponentUtils ignores the sorting result.

            searge [Mojang] Searge (Michael Stoyke)
            Zonteek Zonteek
            Votes:
            7 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: