PaperMC/paper-server/nms-patches/net/minecraft/world/item/crafting/ShapelessRecipes.patch

37 lines
1.2 KiB
Diff
Raw Normal View History

2021-03-15 23:00:00 +01:00
--- a/net/minecraft/world/item/crafting/ShapelessRecipes.java
+++ b/net/minecraft/world/item/crafting/ShapelessRecipes.java
@@ -14,6 +14,12 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.World;
+// CraftBukkit start
+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 {
private final MinecraftKey id;
2021-03-15 23:00:00 +01:00
@@ -28,6 +34,20 @@
this.ingredients = nonnulllist;
}
+ // CraftBukkit start
+ @SuppressWarnings("unchecked")
+ public org.bukkit.inventory.ShapelessRecipe toBukkitRecipe() {
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
+ CraftShapelessRecipe recipe = new CraftShapelessRecipe(result, this);
+ recipe.setGroup(this.group);
+
+ for (RecipeItemStack list : this.ingredients) {
+ recipe.addIngredient(CraftRecipe.toBukkit(list));
+ }
+ return recipe;
+ }
+ // CraftBukkit end
+
@Override
public MinecraftKey getKey() {
return this.id;