Fabric API

Fabric API

106M Downloads

Enhancement Request - Improved Datagen Support for Recipe Generation

xanthian opened this issue ยท 4 comments

commented

Bug/Feature Description:
Presently, there exists a limitation in the datagen process, particularly concerning recipe generation in scenarios where certain mods may not be available during development due to mappings choice or buggy implementation. This results in blank recipe outputs and empty advancements, introducing unnecessary challenges in the development workflow.

Feature Request:
I propose an enhancement to the recipe datagen system that facilitates the direct use of string entries for recipes. This improvement would eliminate the reliance on accessing block/item registries during the datagen process, providing greater flexibility and ease of use.

Enabling the use of string entries directly in recipe datagen would simplify the process and reduce the need for conditional statements or fallback configurations.

Developers can define recipes with string entries without being bound to the availability of specific mods during the development phase, promoting autonomy and efficiency.

Suggested Approach:
Introduce a mechanism in the recipe datagen system that accepts string entries for ingredients within recipe data generation method without requiring direct access to block/item registries.

Here is an example of my existing datagen method

offerChiseledBookshelfRecipe(withConditions(exporter, DefaultResourceConditions.allModsLoaded("beachparty")), 
BeachParty.LDBP_PALM_CHISELED_BOOKSHELF, Registries.ITEM.get(new Identifier("beachparty:palm_planks")), 
Registries.ITEM.get(new Identifier("beachparty:palm_slab")));

Here is a suggestion how it should be

offerChiseledBookshelfRecipe(withConditions(exporter, DefaultResourceConditions.allModsLoaded("beachparty")), 
BeachParty.LDBP_PALM_CHISELED_BOOKSHELF, "beachparty:palm_planks", "beachparty:palm_slab");

I'm well aware that if a typo is made the recipe generated will be wrong, but equally thats the case for model, language, tags already

commented

I think this would be quite hard to add tbh, right now all the recipe generation is basically all vanilla code.

Developers can define recipes with string entries without being bound to the availability of specific mods during the development phase, promoting autonomy and efficiency.

I think the easy solution around this is to register a fake item under the id of the other mod only for use in your data generation.

commented

:(

commented

I don't pretend to understand how this works or how its implemented but the fabric load conditions that write to the same recipe json takes a string entry, why cant that be passed to recipe entries?

eg

        {
          "condition": "fabric:registry_contains",
          "registry": "minecraft:block",
          "values": [
            "botania:dreamwood_planks"
          ]
        }
commented

This is very much out of scope I think, it would require replacing vast amounts of vanilla datagen code. The trivial work around is to register a dummy item in the other mods namespace only during datagen.