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]

abstractmethod profile_url() → str#

Return where this loader’s version JSON is served.

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