Skip to content
This repository was archived by the owner on Dec 30, 2022. It is now read-only.

Mods and SemVer an odyssey

DeathsGun edited this page Oct 4, 2021 · 3 revisions

When writing ModManager I stumbled across inconsistencies in the ways to define versions in the minecraft community.
Which provides challenges as version should be in the best case comparable.

Whats the deal about versioning?

Versions are there to tell something has been further developed.
A version can be just a number or letter something more complex like 1.0.0-alpha+1.17-build.8a8eea4.
Every version should have a logical pattern which follows some rules.
This is where SemVer comes into play, it defines rules how version numbers are assigned and incremented.

SemVer

Most of the people will choose something like 1.0.0 (Major.Minor.Patch) as version as it seems logical and is also
part of SemVer. But maybe you asking yourself "What about the additional information some mods wan't to provide",
this is also something which SemVer defines as "Build metadata".
It can be added by using a plus sign and then appending your information like the Minecraft version.
An example version would look like this: 1.0.0+1.17

Maybe you asking yourself what about alpha and beta versions.
This is also defined by SemVer. It will be just appended with a minus sign.
An example would look like this: 1.0.0-alpha

A combined version with both "features"would look like this: 1.0.0-alpha+1.17

Why should mods follow SemVer?

Following SemVer is very important for distributing mods as it helps to compare versions.
Humans can differentiate between a version v2.0.5 and only 2.0.5an algorithm following rules can't do that.
The Fabric Loader uses SemVer to check if compatible mod versions are loaded and the new loader version 0.12.0 tries to
resolve dependency issues.
Also do I have an own interest in mods following SemVer as I'm using Fabric's SemVer implementation to compare versions to
get the latest version of a mod.

What can I do?

As a user? You can ask the authors of your favorite mods nicely to use SemVer if they haven't.

As a developer you can do several things:

  1. Follow SemVer described here
  2. Use the same version in the fabric.mod.json and the versionNumber field of Modrinth

Extras: For better compatibility with ModManager I suggest setting the project id via fabric.mod.json
the documentation for that can be found here

Clone this wiki locally