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:
[media]
How to reproduce
Give the player all vanilla recipes
/recipe give @p *
Place down a crafting table
Open the recipe book
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.
Linked issues
is duplicated by 2
relates to 2
Attachments
Comments 8
Still an issue on 1.18.x, would be much better if entries were to be sorted by either output item or recipe ID.
Can confirm in 1.20.1. Walls and Bamboo Mosaic are in the items tab instead of the building blocks tab. The tabs need reorganization.
This is for sorting within a tab, not for which tab a recipe is assigned. Make a seperate report for that.
RE Alex: while I agree, that leaves recipe groups. Recipe groups are a plain string and not namespaced, so how should they be sorted? Based on the first recipe ID?
Can confirm in 23w46a. I would like to request ownership of this issue to maintain it going forward seeing as the original poster is inactive since 2020.
Specifically, I would like to add actual code to the analysis, as currently it is just an explanation.
Can confirm for 1.16.3/1.16.4PR1