Provide api jar for common projects
Exopandora opened this issue · 2 comments
It would be great if the would be an api jar of some sort that can be added as a dependency for common projects (i.e. projects based on MultiLoader). It would just contain the forge config api without the fabric mod. This would enable modders to write their config code in a common project without complicated wrappers.
Hi this is already possible, you can simply add the Fabric jar to the common project. This is demonstrated here and here. It won’t compile in the common project alone, but since the common project on itself is not meant to compile anyways that’s fine.
You may need to use Loom in the common project (this is done in the first linked repo) for the jar to be properly deobfuscated, I‘m not sure if VanillaGradle is capable of that.
I get that it’s not nice to have this uncertainty of possibly using a Fabric only method/field which you won’t find out about until actually compiling the Forge version. But honestly the differences in public facing methods/fields are extremely few, what’s really different I‘ve purposefully placed in the api package, so that’s what you need to stay away from in common.
It’s just that Forge unfortunately doesn’t separate api and underlying implementation at all, so this being a direct port it carried over as well. I don’t want to change too much about that to be able to easily maintain any changes Forge makes.
And if you want to be extra safe for now, creating a wrapper is not exactly complicated, I’ve done it here by simply letting IntelliJ automatically extract an interface from the ForgeConfigSpec$Builder.