Fabric API

Fabric API

108M Downloads

Data generator can incorrectly override recipe IDs

Juuxel opened this issue ยท 3 comments

commented

FabricRecipeProvider.getRecipeIdentifier replaces the namespace of the recipe with the mod id of the data generator:

protected Identifier getRecipeIdentifier(Identifier identifier) {
return new Identifier(output.getModId(), identifier.getPath());
}

This can easily lead to invalid recipe advancements where the advancement's default has_the_recipe criterion still references the original namespace.

commented

I think the proper fix is to remove getRecipeIndentifier entirely, and inject into offerTo(Consumer, String) to make it use the modid of the current running FabricRecipeProvider instead of minecraft (accessed via ThreadLocal).

Since this is a breaking change (but necessary due to an unfixable oversight in the API, imo), we should only do this in 1.20. The behavior will remain broken in older versions.

@FabricMC/fabric-triage thoughts?

commented

The current implementation allows you to overwrite vanilla recipes, which is a common request. With the removal of FabricRecipeProvider::getRecipeIdentifier this will no longer be possible

commented

Maybe a better fix would be to deprecate the offerTo that doesn't take an Identifier. A bit more verbose for modders, but it would fix recipe advancements. Maybe we can log a warning.