Annotation for loading class if mod is present
Its common practice for mods to add apis or features other devs can use to add integration. For optional integration its common place for a dev to put the compat in a different class and then call that class with an if check for if the mod is loaded. This is fine, but I think itd be super helpful to have something to conditionally load a class with an annotation. like
@Mod(value = "modid", required = "argonauts")
So that the class will only ever load if the mod "argonauts" is present.
required would ideally be a list of modids where all modids present would then run the class
ideally this could be added to EventBusSubscriber as well
required would ideally be a list of modids where all modids present would then run the class
I could see an use case where the list could be treated as an OR too (i.e. run this code if any recipe viewer is present or if any jade-like mod is present or if any mod with which I have optional recipes is present). Heck, could even see it useful to run code when the mod isn't present (maybe when iris or a mod that adds connected textures isn't present)
This might be complicating it but a list of @Dependency annotations with their combination strategies would be interesting.
If we do it, we should go full hog with conditionals, in my opinion.
Why not just load the class via reflection in the mod, instead of adding more magic just to save a few LOC?
Why not just load the class via reflection in the mod, instead of adding more magic just to save a few LOC?
The same argument could be applied to dist-conditions