Add depends property to Mod annotation for conditional entrypoints#393
Conversation
and fix the located bug, thank you unit testing!
|
|
@hedgehog1029, this PR introduces breaking changes.
|
Leave it up to the modder whether they specify optional dependencies or not
|
why not add a new mod depency type to mods.toml to impl this feature? |
Personally as a maintainer, I would not like to have a class name in the toml. I already have seen so many times where a class gets renamed and shit breaks. Yeah it takes like 5 minutes to fix, but given that everybody has made that mistake at least once, the time wasted on shit like that is huge, so I would prefer something that follows: one) precedent (which this does because of the dist flag), and two) is potentially something the ide follows (which at least for me string constants are). If it where up to me it would be some Java language spec default, like a ServiceLoader (because the IDE automatically recognizes it and renames it as well), but that is difficult for us to do. So realistically I think the @mod is the best we can do at the moment. |
I mean, we hava mod's'.toml, so we can put different mod in same jar. and don't load this optional EntryPoint when its dependencies not satisfied something like [[mods]]
modId = "optional_entrypoint"
[[dependencies.optional_entrypoint]]
modId = "jei"
type = "conditional"
versionRange = "[${jei_version},)"
ordering = "NONE"
side = "BOTH"and we will ignore optional_entrypoint if jei doesn't exist |
Technici4n
left a comment
There was a problem hiding this comment.
This is good, thank you for writing the tests as well!
|
🚀 This PR has been released as FancyModLoader version |
Fixes #201, alternative to #212
This PR adds the ability to specify entrypoints that will only be loaded if the specified mod ID(s) are present:
This is implemented by checking against the
LoadingModList- entrypoints withdependsmissing from the loading list are filtered out early.We enforce inNo longer enforced, leave it up to developers to choose.validatethat any dependencies specified in the annotation are also specified in the mods.toml - this ensures the mods are loaded in the correct order.Please let me know if this is a sane approach! Otherwise I suppose I'll have to rethink and move the filtering to a later step.
Unit tests have been added to validate the new behaviour.