--- a/net/minecraft/world/item/crafting/RecipeHolder.java +++ b/net/minecraft/world/item/crafting/RecipeHolder.java @@ -4,8 +4,19 @@ import net.minecraft.network.codec.StreamCodec; import net.minecraft.resources.MinecraftKey; +// CraftBukkit start +import org.bukkit.craftbukkit.util.CraftNamespacedKey; +import org.bukkit.inventory.Recipe; +// CraftBukkit end + public record RecipeHolder>(MinecraftKey id, T value) { + // CraftBukkit start + public final Recipe toBukkitRecipe() { + return this.value.toBukkitRecipe(CraftNamespacedKey.fromMinecraft(this.id)); + } + // CraftBukkit end + public static final StreamCodec> STREAM_CODEC = StreamCodec.composite(MinecraftKey.STREAM_CODEC, RecipeHolder::id, IRecipe.STREAM_CODEC, RecipeHolder::value, RecipeHolder::new); public boolean equals(Object object) {