PaperMC/paper-server/nms-patches/net/minecraft/world/item/crafting/ShapelessRecipes.patch
CraftBukkit/Spigot 65bc2541a3 Update to Minecraft 1.20.5
By: md_5 <git@md-5.net>
2024-04-24 01:15:00 +10:00

39 lines
1.3 KiB
Diff

--- a/net/minecraft/world/item/crafting/ShapelessRecipes.java
+++ b/net/minecraft/world/item/crafting/ShapelessRecipes.java
@@ -15,6 +15,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;
@@ -29,6 +36,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;