classMetaLoader#

class MetaLoader(
version: str,
minecraft: str,
meta_url: str = '',
)#

A loader described by a version JSON from a metadata service.

meta_url#

The service’s base URL.

Type:

str

default_maven#

The repository for libraries that do not name one.

Type:

ClassVar[str]

library#

The loader’s own library, as group:artifact.

Type:

ClassVar[str]

classmethod from_version(
version: Version,
minecraft: str,
) → Self | None#

Recognise the loader by its own library on the class path.

abstractmethod profile_url() → str#

Return where this loader’s version JSON is served.

classmethod available(
minecraft: str,
*,
session: Session | None = None,
meta_url: str | None = None,
) → list[LoaderVersion]#

List this loader’s versions for a Minecraft version, newest first.

Versions such as 0.20.0-beta.9 are pre-releases. Fabric marks only its current build as stable, so that one is recommended; otherwise the newest stable version is.

Parameters:
  • minecraft (str) – The Minecraft version.

  • session (Session | None) – The session to use. A temporary one is created if omitted.

  • meta_url (str | None) – The metadata service. Defaults to the loader’s own.

Returns:

The versions, empty if the service does not know the Minecraft version.

Raises:

NetworkError – The service could not be reached.

Return type:

list[LoaderVersion]

expected_id() → str#

Return the version id that the metadata service gives this loader.

profile(
session: Session | None = None,
) → dict[str, Any]#

Fetch this loader’s version JSON.

Parameters:

session (Session | None) – The session to use. A temporary one is created if omitted.

Returns:

The decoded JSON.

Raises:

NetworkError – The service failed or does not know this version.

Return type:

dict[str, Any]

version_id(
*,
session: Session | None = None,
cache_dir: Path | None = None,
) → str#

Return the id from the metadata service.

Parameters:
  • session (Session | None) – The session to use. A temporary one is created if omitted.

  • cache_dir (Path | None) – Not used by this loader.

Returns:

The version id.

Raises:

NetworkError – The service failed or does not know this version.

Return type:

str

install(
game: GameDir,
*,
java: Path | None = None,
cache_dir: Path | None = None,
session: Session | None = None,
progress: Callable[[Progress], None] | None = None,
cancel: CancelToken | None = None,
) → str#

Install vanilla Minecraft, the libraries and the version JSON.

This does nothing if the version is already installed.

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

  • java (Path | None) – The Java binary to use. Not used by this loader.

  • cache_dir (Path | None) – The cache directory. Not used by this loader.

  • session (Session | None) – The session to use. A temporary one is created if omitted.

  • progress (Callable[[Progress], None] | None) – Receives updates for each stage.

  • cancel (CancelToken | None) – Stops the install.

Returns:

The installed version id.

Raises:
Return type:

str