PatchworkMC / patchwork-patcher

Patches Forge mod jars, allowing them to be loaded by Fabric
GNU Lesser General Public License v3.0
315 stars 33 forks source link

ForgeInitializer.onForgeInitialize should return the Forge Mod instance #53

Open rikka0w0 opened 4 years ago

rikka0w0 commented 4 years ago

The Forge ModContainer has a function Object ModContainer.getMod() which returns the instance of the forge mod class (annotated by @Mod()), this feature is widely used. However, in current version of Patchwork, we don't have any method to get that instance.

We should make net/patchworkmc/api/ForgeInitializer.onForgeInitialize return that instance: Changing void onForgeInitialize(); to Object onForgeInitialize().

This feature is required by Patchwork-API PR: https://github.com/PatchworkMC/patchwork-api/pull/87

The Patchwork-API dispatcher needs to call this method to store the mod instance: https://github.com/rikka0w0/patchwork-api/blob/1e18e1218c9030f3a903b088c67e66f5dbbf0829/patchwork-fml/src/main/java/net/minecraftforge/fml/javafmlmod/FMLModContainer.java#L62