mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-15 12:13:54 -07:00
[Bleeding] Recipe API improvements and fixes. Addresses BUKKIT-738 and BUKKIT-624
Add a recipe iterator to make it possible to retrieve and remove recipes (BUKKIT-738), and updated the recipe classes to not clip the data to 127 (BUKKIT-624)
This commit is contained in:
committed by
EvilSeph
parent
84ecdb5439
commit
326091c130
@@ -4,6 +4,12 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe;
|
||||
import org.bukkit.inventory.ShapelessRecipe;
|
||||
// CraftBukkit end
|
||||
|
||||
public class ShapelessRecipes implements CraftingRecipe {
|
||||
|
||||
private final ItemStack a;
|
||||
@@ -14,6 +20,20 @@ public class ShapelessRecipes implements CraftingRecipe {
|
||||
this.b = list;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
@SuppressWarnings("unchecked")
|
||||
public ShapelessRecipe toBukkitRecipe() {
|
||||
CraftItemStack result = new CraftItemStack(this.a);
|
||||
CraftShapelessRecipe recipe = new CraftShapelessRecipe(result, this);
|
||||
for (ItemStack stack : (List<ItemStack>) this.b) {
|
||||
if (stack != null) {
|
||||
recipe.addIngredient(org.bukkit.Material.getMaterial(stack.id), stack.getData());
|
||||
}
|
||||
}
|
||||
return recipe;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public ItemStack b() {
|
||||
return this.a;
|
||||
}
|
||||
|
Reference in New Issue
Block a user