funcdetect#

detect(
game: GameDir,
version_id: str,
) → Loader | None#

Find the mod loader an installed version starts, from its files alone.

The version JSON and those it inherits from are read, and each registered loader is asked whether it recognises them. This works for versions the official launcher or a loader’s own installer set up, not only for versions Modsmith installed.

Parameters:
  • game (GameDir) – The game directory.

  • version_id (str) – The version, such as a launcher profile’s version_id.

Returns:

The loader, with the Minecraft version it runs on, or None if the version starts no loader that is registered. For a vanilla version, the version id is the Minecraft version.

Raises:

UnsupportedError – The version, or one it inherits from, is not installed.

Return type:

Loader | None