Skip to content
This repository has been archived by the owner on Apr 28, 2020. It is now read-only.

Add versioning and dependencies to Rift loader #21

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

LemmaEOF
Copy link

Adds new elements to a Rift mod json: a version String and a dependencies Map<String, String>. The first String in the dependency map is the mod's id, and the second is the minimum version needed.

Version strings are parsed as loose SemVer, and will fail to load (without crashing the game) if there is a missing version (though we might want to give them a dummy version instead for backwards compat). Incorrect dependencies will throw a new MissingDependencyException.

To keep OptiFine being loadable, it has been given its own version string of "1.13".

This is tested and works perfectly. In the future, it would be good to make this crash without closing the Minecraft window a la Forge's dependency catcher, but that's not something I'm able to write at the moment.

@Runemoro
Copy link
Member

Thanks for the PR, but I'd like to do dependencies differently. Rather than a map from modid string to version string, I'd like to have a list of Dependency objects with more information about whether they're a soft or hard dependency, whether it should be loaded before or after, what version range is allowed.

I'd also like to implement library dependencies, where the library is automatically downloaded from maven central, or other whitelisted maven repos. This way, mods can remain small in size, yet stay easy to install for users.

Another problem is that you set the Optifine version to 1.13, while it should in fact be 1.13-alpha8, or just "alpha8", with the information that it's just for a 1.13 as a dependency on "minecraft" with the version range [1.13, 1.13].

Adding a dependency on semver isn't necessary, I think. We're using just one feature of it, so that can probably be reimplemented as a simple compareVersions method.

@LemmaEOF
Copy link
Author

SemVer is also being used to enforce SemVer versioning, cancelling the mod loading if it has a malformed version.

I don't know Gson that well, so I'm not sure how to add a Dependency into the mod json. Would I just do that by having a Dependency class and let gson work it out?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants