classGameDir#

class GameDir(
path: Path | str,
)#

A .minecraft directory and the layout of the files inside it.

Parameters:

path (Path | str) – The directory. It does not have to exist. A relative path is made absolute, so it stays valid if the working directory changes.

path#

The absolute path of the directory.

classmethod default() → GameDir#

Return the official launcher’s default directory for this system.

property versions_dir: Path#

The directory that holds installed versions.

property libraries_dir: Path#

The directory that holds libraries.

version_json(
version_id: str,
) → Path#

Return the path of a version’s JSON file.

client_jar(
version_id: str,
) → Path#

Return the path of a version’s client jar.

library(
coord: str,
) → Path#

Return the path of the library with a Maven coordinate.

has_version(
version_id: str,
) → bool#

Return whether a version’s JSON file exists.

installed_versions() → list[str]#

List the installed version ids, sorted by name.

version(
version_id: str,
) → Version#

Read an installed version.

Parameters:

version_id (str) – The version id.

Returns:

The parsed version.

Raises:

UnsupportedError – The version is not installed.

Return type:

Version

write_version(
version_id: str,
data: dict[str, Any],
) → None#

Write a version’s JSON file.

Parameters:
  • version_id (str) – The version id.

  • data (dict[str, Any]) – The version JSON.