9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-22 00:19:20 +00:00
Files
Leaf/patches/server/0024-Carpet-Fixes-Use-optimized-RecipeManager.patch
Dreeam e703cd5445 Update 1.20.6 (#49)
* Update Leaf API patches to 1.20.5

* Updated Upstream (Purpur API)

* Some server patches work

* Update 1.20.6

* Some server patches work

* Some some server patches work

* 0oO0oO0oOo

* iI1IiI1i|!il|

* Updated Upstream (Gale/Purpur)

* Server patches work

* Updated Upstream (Gale)
2024-05-01 12:08:20 -04:00

26 lines
1.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: nostalgic853 <yuu8583@proton.me>
Date: Tue, 25 Oct 2022 00:57:45 +0800
Subject: [PATCH] Carpet-Fixes: Use optimized RecipeManager
Original license: MIT
Original project: https://github.com/fxmorin/carpet-fixes
Optimized the RecipeManager getFirstMatch call to be up to 3x faster
This is a fully vanilla optimization. Improves: [Blast]Furnace/Campfire/Smoker/Stonecutter/Crafting/Sheep Color Choosing
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 a31326e24cb68472c81cd781c5e3041772712862..0662e7afca15cab700dc61fe7de1d62eed27405d 100644
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
@@ -132,7 +132,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
}
public <C extends Container, T extends Recipe<C>> List<RecipeHolder<T>> getAllRecipesFor(RecipeType<T> type) {
- return List.copyOf(this.byType(type));
+ return new java.util.ArrayList<>(this.byType(type)); // Leaf - Carpet-Fixes
}
public <C extends Container, T extends Recipe<C>> List<RecipeHolder<T>> getRecipesFor(RecipeType<T> type, C inventory, Level world) {