Fabric API

Fabric API

152M Downloads

[Feature Request] Better crafting recipe API

LuckyMika opened this issue ยท 3 comments

commented

In version 1.21, Mojang added allowed components to be used in custom crafting recipes, but in versions prior this was not possible. A workaround was to create a custom item and simply change its name. This solution however does not address the main issue of fabric lacking a good dynamic API for creating crafting recipes.
Projects like NBT Crafting have attempted to solve this issue for versions below 1.21 by manually parsing a data property in the JSON of the recipe and applied the properties to the item, but there is still not way to programmatically do this.
My suggestion is that something similar to Bukkit's API is implemented, where a developer can simply add a recipe to the server's RecipeManager with a few simple function calls.

commented

You can just make a custom RecipeSerializer, which will give you full control over how to parse a json recipe, and how to then perform the matching. You can also look into the custom ingredients API that Fabric provides.

commented

There will not be a supported API to register recipes in a way that bypasses the JSON parsing. The Bukkit API is extremely outdated: back when it was written, vanilla used a similar way of registering recipes through code, but they replaced that by data packs a long time ago, and as such datapacks are the only supported way of adding recipes. There's still a lot of options to create "dynamic" recipes: custom Recipe implementations, custom ingredients, and also resource conditions to conditionally load recipes. Virtual resource packs are also an option.

commented

I dont think this addresses the underlying issue, because it still sounds like it requires a json recipe without a clear way to load it yourself to essentially create dynamic recipes