0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git synced 2024-11-22 11:16:17 +00:00
craftbukkit/nms-patches/net/minecraft/world/item/crafting/ShapelessRecipes.patch
2024-10-23 02:15:00 +11:00

40 lines
1.4 KiB
Diff

--- a/net/minecraft/world/item/crafting/ShapelessRecipes.java
+++ b/net/minecraft/world/item/crafting/ShapelessRecipes.java
@@ -17,6 +17,13 @@
import net.minecraft.world.item.crafting.display.SlotDisplay;
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;
@@ -33,6 +40,22 @@
this.ingredients = list;
}
+ // 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<ShapelessRecipes> getSerializer() {
return RecipeSerializer.SHAPELESS_RECIPE;