Class NeoForgeVersions
- Namespace
- McServerLauncher.Services
- Assembly
- McServerLauncher.dll
Turning "which Minecraft version?" into "which NeoForge build?".
public static class NeoForgeVersions
- Inheritance
-
NeoForgeVersions
- Inherited Members
Remarks
Forge answers this with a promotions feed that names a recommended build per Minecraft version. NeoForge has no such thing: it publishes one flat list of every build ever, and the Minecraft version is encoded inside the build number. So the only way to pick correctly is to know how that encoding works.
Getting it wrong fails quietly and expensively — it would install a build for a different Minecraft version, which downloads and installs perfectly and then refuses to start. That is why this is a pure, separately tested pair of functions rather than a regex buried in the installer.
Methods
MinecraftVersionOf(string?)
The Minecraft version a NeoForge build belongs to — the inverse of PrefixFor(string?), used when reading an already-installed server off disk, where the build number is all there is to go on. Null if the build number isn't in a shape NeoForge uses.
public static string? MinecraftVersionOf(string? neoForgeVersion)
Parameters
neoForgeVersionstring
Returns
Pick(IEnumerable<string>, string?)
Picks the build to install for mcVersion out of the full published list,
or null when NeoForge has nothing for that Minecraft version at all.
public static NeoForgeVersions.Choice? Pick(IEnumerable<string> allVersions, string? mcVersion)
Parameters
allVersionsIEnumerable<string>mcVersionstring
Returns
Remarks
Stable wins whenever one exists. Six Minecraft versions (1.20.3, 1.20.5, 1.21.2, 1.21.6, 1.21.7, 1.21.9) have only ever had betas, and refusing those would mean telling people NeoForge is unavailable when in practice it is what everyone runs — so a beta is offered, and IsBeta exists so the app can say so before installing rather than after.
PrefixFor(string?)
The prefix every NeoForge build for mcVersion starts with, or null when
the Minecraft version isn't in a shape NeoForge uses.
public static string? PrefixFor(string? mcVersion)
Parameters
mcVersionstring
Returns
Remarks
Two schemes exist, because Minecraft itself changed how it numbers releases:
- Classic
1.MINOR[.PATCH]maps toMINOR.PATCH.— 1.21.1 → "21.1.", and 1.21 → "21.0.", because a missing patch is zero, not absent. - The newer
YY.N[.PATCH]maps toYY.N.PATCH.— 26.2 → "26.2.0.", 26.1.2 → "26.1.2.". Same rule, one component further along.
The trailing dot is deliberate: without it "21.1" would also match every "21.10.x" and "21.11.x" build, quietly offering a Minecraft 1.21.10 loader to a 1.21.1 server.