Revert "Fix Custom Shapeless Crafting Recipes"

This reverts commit e56f465acd.
This commit is contained in:
Aikar 2019-02-26 01:25:27 -05:00
parent e56f465acd
commit 2ced55d05f
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE

View File

@ -1,54 +0,0 @@
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