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

Recipe book entries are no longer sorted in any meaningful manner

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 24w40a
    • Minecraft 1.12.2, Minecraft 17w50a, Minecraft 1.13-pre1, Minecraft 1.13.1, 1.15.1, 1.15.2 Pre-release 2, 1.15.2, 20w21a, 1.16.1, 20w27a, 21w03a, 1.16.5, 21w08b, 1.19.3, 1.20.2, 23w46a, 1.20.3 Pre-Release 1, 1.20.3 Pre-Release 3, 1.20.3 Pre-Release 4, 1.20.3, 1.20.4, 24w04a, 24w07a, 24w09a, 24w11a, 1.20.5 Pre-Release 1, 1.20.5, 1.21
    • Confirmed
    • Crafting, UI
    • Normal
    • Gameplay

      Recipe book entries are not sorted in any meaningful manner (even changing randomly upon reloading) leading to inconsistent and confusing usage of the recipe book. This is especially interesting, considering that the recipe book used to be sorted alphabetically, and that block sets were grouped together. Here is a demonstration:
      2024-04-28_16-27-39.mp4

      How to reproduce

      1. Give the player all vanilla recipes
        /recipe give @p *
      2. Place down a crafting table
      3. Open the recipe book
      4. Set to "Showing All" mode

      Observed & Expected behavior

      - The item recipes will be randomly placed with no real rhyme or reason for where they are inside each category, leaving the player to search through each category randomly to find the item they want to craft.
      - Each recipe entry would be neatly sorted by item type, colors, category, etc. just as the creative inventory is currently.

      Suggested fix:

      Either sort the recipe book categories by their alphabetical order, color, id, or just as the creative inventory is done.

      Code analysis:

      (Mappings: MCP Reborn 1.20.2 // Class: RecipeBookComponent.java // Method: updateCollections(boolean)):

         private void updateCollections(boolean p_100383_) {
            List<RecipeCollection> list = this.book.getCollection(this.selectedTab.getCategory());
            list.forEach((p_296197_) -> p_296197_.canCraft(this.stackedContents, this.menu.getGridWidth(), this.menu.getGridHeight(), this.book));
            List<RecipeCollection> list1 = Lists.newArrayList(list);
            list1.removeIf((p_100368_) -> !p_100368_.hasKnownRecipes());
            list1.removeIf((p_100360_) -> !p_100360_.hasFitting());
            String s = this.searchBox.getValue();
            if (!s.isEmpty()) {
               ObjectSet<RecipeCollection> objectset = new ObjectLinkedOpenHashSet<>(this.minecraft.getSearchTree(SearchRegistry.RECIPE_COLLECTIONS).search(s.toLowerCase(Locale.ROOT)));
               list1.removeIf((p_301525_) -> !objectset.contains(p_301525_));
            }
      
            if (this.book.isFiltering(this.menu)) {
               list1.removeIf((p_100331_) -> !p_100331_.hasCraftable());
            }
      
            this.recipeBookPage.updateCollections(list1, p_100383_);
         }
      

      Here, the result list list1 is not sorted in any way before passing it to RecipeBookPage.updateCollections, which does pagination and layout of the recipes onto the buttons of each page.

            Unassigned Unassigned
            Jingy [Mod] Jiingy
            Votes:
            23 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: