--- a/net/minecraft/world/item/crafting/ShapelessRecipes.java +++ b/net/minecraft/world/item/crafting/ShapelessRecipes.java @@ -13,6 +13,13 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.World; +// CraftBukkit start +import org.bukkit.NamespacedKey; +import org.bukkit.craftbukkit.inventory.CraftItemStack; +import org.bukkit.craftbukkit.inventory.CraftRecipe; +import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe; +// CraftBukkit end + public class ShapelessRecipes implements RecipeCrafting { final String group; @@ -27,6 +34,22 @@ this.ingredients = nonnulllist; } + // CraftBukkit start + @SuppressWarnings("unchecked") + @Override + public org.bukkit.inventory.ShapelessRecipe toBukkitRecipe(NamespacedKey id) { + CraftItemStack result = CraftItemStack.asCraftMirror(this.result); + CraftShapelessRecipe recipe = new CraftShapelessRecipe(id, result, this); + recipe.setGroup(this.group); + recipe.setCategory(CraftRecipe.getCategory(this.category())); + + for (RecipeItemStack list : this.ingredients) { + recipe.addIngredient(CraftRecipe.toBukkit(list)); + } + return recipe; + } + // CraftBukkit end + @Override public RecipeSerializer getSerializer() { return RecipeSerializer.SHAPELESS_RECIPE;