craftbukkit/nms-patches/net/minecraft/world/item/crafting/IRecipeComplex.patch

37 lines
1.2 KiB
Diff
Raw Normal View History

2021-03-16 09:00:00 +11:00
--- a/net/minecraft/world/item/crafting/IRecipeComplex.java
+++ b/net/minecraft/world/item/crafting/IRecipeComplex.java
@@ -3,6 +3,15 @@
2024-04-24 01:15:00 +10:00
import net.minecraft.core.HolderLookup;
2023-09-22 02:40:00 +10:00
import net.minecraft.world.item.ItemStack;
+// CraftBukkit start
+import net.minecraft.core.IRegistryCustom;
2023-09-22 02:40:00 +10:00
+import org.bukkit.NamespacedKey;
+import org.bukkit.craftbukkit.inventory.CraftComplexRecipe;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.craftbukkit.inventory.CraftRecipe;
2023-09-22 02:40:00 +10:00
+import org.bukkit.inventory.Recipe;
+// CraftBukkit end
+
public abstract class IRecipeComplex implements RecipeCrafting {
private final CraftingBookCategory category;
@@ -25,4 +34,17 @@
2022-12-08 03:00:00 +11:00
public CraftingBookCategory category() {
return this.category;
2019-12-11 09:00:00 +11:00
}
+
+ // CraftBukkit start
+ @Override
2023-09-22 02:40:00 +10:00
+ public Recipe toBukkitRecipe(NamespacedKey id) {
+ CraftItemStack result = CraftItemStack.asCraftMirror(getResultItem(IRegistryCustom.EMPTY));
+
+ CraftComplexRecipe recipe = new CraftComplexRecipe(id, result, this);
+ recipe.setGroup(this.getGroup());
+ recipe.setCategory(CraftRecipe.getCategory(this.category()));
+
+ return recipe;
2019-12-11 09:00:00 +11:00
+ }
+ // CraftBukkit end
}