PaperMC/paper-server/nms-patches/net/minecraft/world/item/crafting/ShapelessRecipes.patch
CraftBukkit/Spigot 43702a9e10 Update to Minecraft 1.18-pre5
By: md_5 <git@md-5.net>
2021-11-22 09:00:00 +11:00

36 lines
1.2 KiB
Diff

--- 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;
@@ -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 getId() {
return this.id;