mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-31 04:46:38 +00:00
36 lines
1.8 KiB
Diff
36 lines
1.8 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 ab6dc3449a1d3b7acf1d7bf5ac1c24224cc252c7..15db40b1bcf56e0eecb9b4a709aa0e4c1e8c9b75 100644
|
|
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
|
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
|
@@ -11,8 +11,8 @@ import com.google.gson.JsonParseException;
|
|
import com.google.gson.JsonSyntaxException;
|
|
import com.mojang.datafixers.util.Pair;
|
|
import com.mojang.logging.LogUtils;
|
|
+import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.Comparator;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
@@ -131,7 +131,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
|
|
}
|
|
|
|
public <C extends Container, T extends Recipe<C>> List<T> getAllRecipesFor(RecipeType<T> type) {
|
|
- return List.copyOf(this.byType(type).values());
|
|
+ return (List<T>)new ArrayList<>(this.byType(type).values()); // KeYi // Leaf
|
|
}
|
|
|
|
public <C extends Container, T extends Recipe<C>> List<T> getRecipesFor(RecipeType<T> type, C inventory, Level world) {
|