From f45c9d35c8b1e1a863e765f7616129a541979df6 Mon Sep 17 00:00:00 2001 From: nostalgic853 Date: Tue, 25 Oct 2022 15:50:09 +0800 Subject: [PATCH] Fixed StackOverflowError in RecipeManager --- patches/server/0025-Use-optimized-RecipeManager.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/patches/server/0025-Use-optimized-RecipeManager.patch b/patches/server/0025-Use-optimized-RecipeManager.patch index 0b73d2a..328a767 100644 --- a/patches/server/0025-Use-optimized-RecipeManager.patch +++ b/patches/server/0025-Use-optimized-RecipeManager.patch @@ -11,7 +11,7 @@ This is a fully vanilla optimization. Improves: [Blast]Furnace/Campfire/Smoker/S This was mostly made for the auto crafting table, since the performance boost is much more visible while using that mod diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -index 4872f70977e73c889fe6e2339d00ebc64459613d..3e9cce51080addf294abab30532244628a9c63a2 100644 +index 4872f70977e73c889fe6e2339d00ebc64459613d..7f6bd5fb335ea33c52d510461a1f17371c36576a 100644 --- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java +++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java @@ -11,14 +11,7 @@ import com.google.gson.JsonParseException; @@ -54,7 +54,7 @@ index 4872f70977e73c889fe6e2339d00ebc64459613d..3e9cce51080addf294abab3053224462 + //compare size to quickly remove recipes that are not even close. Plus remove streams + for (int slot = 0; slot < inventory.getContainerSize(); slot++) + if (!inventory.getItem(slot).isEmpty()) slots++; -+ for (Recipe recipe : this.getAllRecipesFor(type)) { ++ for (Recipe recipe : this.byType(type).values()) { + count = 0; + if (recipe instanceof CustomRecipe) { + if (recipe.matches(inventory, world)) { @@ -78,7 +78,7 @@ index 4872f70977e73c889fe6e2339d00ebc64459613d..3e9cce51080addf294abab3053224462 public > List getAllRecipesFor(RecipeType type) { - return List.copyOf(this.byType(type).values()); -+ return new ArrayList<>(this.getAllRecipesFor(type)); // KeYi ++ return new ArrayList<>(this.byType(type).values()); // KeYi } public > List getRecipesFor(RecipeType type, C inventory, Level world) {