Table of Contents

Class MinecraftRange

Namespace
McServerLauncher.Services
Assembly
McServerLauncher.dll

Does this Minecraft version satisfy the range a mod declares?

public static class MinecraftRange
Inheritance
MinecraftRange
Inherited Members

Remarks

Fabric mods state their requirement in fabric.mod.json as "minecraft": ">=26.2" or similar. What appears there is handled: a wildcard, a comparison, an exact version, a component wildcard like 1.21.x, several alternatives separated by || or commas, and several conditions separated by spaces. Anything else is treated as unsatisfied rather than guessed at — refusing to install is recoverable, installing a mod the server cannot load is a silent failure the user has to diagnose.

The two separators mean opposite things and used to be treated as one. A space is and: ">=1.21 <1.22" is a window, and splitting it into alternatives made 1.22 satisfy a range that excludes it. || and a comma are or. And an operator may be written apart from its version — ">= 1.21" — which the old split turned into two fragments, neither of which satisfied anything.

Methods

Satisfies(string?, string?)

Whether mcVersion is inside range.

public static bool Satisfies(string? mcVersion, string? range)

Parameters

mcVersion string
range string

Returns

bool