Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 11:00:06 +01:00
Fix Custom Shapeless Crafting Recipes
Mojang implemented Shapeless different than Shaped Make shaped also support the RecipeChoice API
Dieser Commit ist enthalten in:
Ursprung
c83601bcff
Commit
e56f465acd
@ -0,0 +1,54 @@
|
||||
From 5c3f33e9438c90516f8475769ebfb3d3e2c1ff9e Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 18 Jan 2019 00:08:15 -0500
|
||||
Subject: [PATCH] Fix Custom Shapeless Crafting Recipes
|
||||
|
||||
Mojang implemented Shapeless different than Shaped
|
||||
|
||||
Make shaped also support the RecipeChoice API
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ShapelessRecipes.java b/src/main/java/net/minecraft/server/ShapelessRecipes.java
|
||||
index 819b4ac2da..fce3ff4b6c 100644
|
||||
--- a/src/main/java/net/minecraft/server/ShapelessRecipes.java
|
||||
+++ b/src/main/java/net/minecraft/server/ShapelessRecipes.java
|
||||
@@ -59,21 +59,30 @@ public class ShapelessRecipes implements IRecipe {
|
||||
if (!(iinventory instanceof InventoryCrafting)) {
|
||||
return false;
|
||||
} else {
|
||||
- AutoRecipeStackManager autorecipestackmanager = new AutoRecipeStackManager();
|
||||
- int i = 0;
|
||||
-
|
||||
+ // Paper start - use RecipeItemStack.test
|
||||
+ java.util.List<ItemStack> provided = new java.util.ArrayList<>();
|
||||
for (int j = 0; j < iinventory.n(); ++j) {
|
||||
for (int k = 0; k < iinventory.U_(); ++k) {
|
||||
ItemStack itemstack = iinventory.getItem(k + j * iinventory.U_());
|
||||
|
||||
if (!itemstack.isEmpty()) {
|
||||
- ++i;
|
||||
- autorecipestackmanager.b(new ItemStack(itemstack.getItem()));
|
||||
+ provided.add(itemstack.cloneItemStack());
|
||||
}
|
||||
}
|
||||
}
|
||||
-
|
||||
- return i == this.ingredients.size() && autorecipestackmanager.a(this, (IntList) null);
|
||||
+ INGREDIENTS:
|
||||
+ for (RecipeItemStack ingredient : ingredients) {
|
||||
+ for (Iterator<ItemStack> iterator = provided.iterator() ; iterator.hasNext() ; ) {
|
||||
+ ItemStack itemStack = iterator.next();
|
||||
+ if (ingredient.test(itemStack)) {
|
||||
+ iterator.remove();
|
||||
+ continue INGREDIENTS;
|
||||
+ }
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+ return true;
|
||||
+ // Paper end
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.20.1
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren