[1.12.2] Late recipe registration
Exaxxion opened this issue ยท 3 comments
We noticed while trying to fix an issue in Shadows of Greg that Forestry is registering at least some of its recipes during FMLPostInitializationEvent
which causes problems in environments that use CraftTweaker. Namely, such recipes are registered after scripts are processed so they are out of reach of CraftTweaker scripts entirely. This complicates things for modpack developers wanting to customize recipes for pack balance.
Per the Forge documentation, recipes are expected (by convention) to be registered as a response to the FMLInitializationEvent
:
Called after FMLPreInitializationEvent and before FMLPostInitializationEvent during mod startup. This is the second of three commonly called events during mod initialization. Recommended activities: Register your recipes and Ore Dictionary entries in the GameRegistry and OreDictionary Dispatch requests through FMLInterModComms to other mods, to tell them what you wish them to do.
If possible, it would be greatly appreciated if recipes currently registered in the post-initialization phase could instead be registered in the initialization phase to correct this problem.
Our recipes are registered during the FMLInitializationEvent. I have no idea what you're referencing.
ForestryMC/src/main/java/forestry/apiculture/ModuleApiculture.java
Lines 486 to 487 in c094f16
ForestryMC/src/main/java/forestry/apiculture/ModuleApiculture.java
Lines 711 to 714 in c094f16
ForestryMC/src/main/java/forestry/Forestry.java
Lines 153 to 158 in c094f16
ForestryMC/src/main/java/forestry/modules/InternalModuleHandler.java
Lines 129 to 137 in c094f16
Recipes should be registered in the RegistryEvent.Register<IRecipe>
SubscribeEvent instead of in one of the main EventHandler stages. Registering recipes in init will mean CraftTweaker is unable to modify them since the recipes are created after CraftTweaker runs its scripts.
Thanks Dan, admittedly I may not be doing the best job of explaining the problem. @DStrand1 is the submitter of the PR to SoG and the opening comment on that PR details how CraftTweaker loading works.