mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
Upstream has released updates that appear to apply and compile correctly Purpur Changes: PurpurMC/Purpur@4b57bed Updated Upstream (Paper)
52 lines
2.6 KiB
Diff
52 lines
2.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
|
Date: Sun, 12 May 2024 18:12:53 +0300
|
|
Subject: [PATCH] Carpet-Fixes: RecipeManager Optimize
|
|
|
|
Original project: https://github.com/fxmorin/carpet-fixes
|
|
Improves: [Blast]Furnace/Campfire/Smoker/Stonecutter/Crafting/Sheep Color Choosing + auto crafting table
|
|
|
|
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 de7c77c1b25680ecc65f0f43f2391aff269a974f..0d6aad130ba4c90ce1c90c53daa1a15a1391a582 100644
|
|
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
|
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
|
@@ -21,6 +21,7 @@ import java.util.Map.Entry;
|
|
import java.util.Optional;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Stream;
|
|
+import java.util.ArrayList;
|
|
import javax.annotation.Nullable;
|
|
import net.minecraft.core.HolderLookup;
|
|
import net.minecraft.core.NonNullList;
|
|
@@ -128,16 +129,24 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
|
|
}
|
|
|
|
public <I extends RecipeInput, T extends Recipe<I>> List<RecipeHolder<T>> getAllRecipesFor(RecipeType<T> type) {
|
|
- return List.copyOf(this.byType(type));
|
|
+ return new java.util.ArrayList<>(this.byType(type)); // DivineMC - Carpet-Fixes: RecipeManager Optimize
|
|
}
|
|
|
|
+ // DivineMC start - Carpet-Fixes: RecipeManager Optimize
|
|
public <I extends RecipeInput, T extends Recipe<I>> List<RecipeHolder<T>> getRecipesFor(RecipeType<T> type, I input, Level world) {
|
|
- return (List) this.byType(type).stream().filter((recipeholder) -> {
|
|
- return recipeholder.value().matches(input, world);
|
|
- }).sorted(Comparator.comparing((recipeholder) -> {
|
|
- return recipeholder.value().getResultItem(world.registryAccess()).getDescriptionId();
|
|
- })).collect(Collectors.toList());
|
|
+ List<RecipeHolder<T>> list = new java.util.ArrayList<>();
|
|
+
|
|
+ for (RecipeHolder<T> recipeholder : this.byType(type)) {
|
|
+ if (recipeholder.value().matches(input, world)) {
|
|
+ list.add(recipeholder);
|
|
+ }
|
|
+ }
|
|
+
|
|
+ list.sort(Comparator.comparing((recipeholder) -> recipeholder.value().getResultItem(world.registryAccess()).getDescriptionId()));
|
|
+
|
|
+ return list;
|
|
}
|
|
+ // DivineMC end
|
|
|
|
private <I extends RecipeInput, T extends Recipe<I>> Collection<RecipeHolder<T>> byType(RecipeType<T> type) {
|
|
return (Collection) this.byType.get(type); // CraftBukkit - decompile error
|