classModpack#
- class Modpack(
- format: str,
- name: str,
- version: str,
- minecraft: str,
- loader_kind: str | None,
- loader_version: str | None,
- entries: tuple[PackEntry, ...],
- archive: Path,
- override_roots: Mapping[str, str] = {},
- memory_mb: int | None = None,
A parsed modpack archive, independent of its format and platform.
- loader_kind#
The mod loader’s name as platforms use it, such as
fabricfor a pack that saysfabric-loader, or None for a vanilla pack.- Type:
str | None
- override_roots#
Archive folders with extra files, keyed by
common,clientorserver.
- property loader: Loader | None#
The pack’s mod loader, or None for a vanilla pack.
- Raises:
UnsupportedError – The loader is not supported.
- install_game(
- 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,
Install the game the pack runs on: its mod loader, or plain Minecraft.
- Parameters:
game (GameDir) – The game directory.
java (Path | None) – The Java binary for loaders that need one. Found or downloaded automatically if omitted.
cache_dir (Path | None) – The cache directory. Defaults to the per-user cache.
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 version id to put in a launcher profile.
- Raises:
UnsupportedError – The loader or the Minecraft version is not supported.
NetworkError – A service could not be reached.
DownloadError – A file could not be downloaded.
LoaderError – The loader could not be installed.
Cancelled –
cancelwas triggered.
- Return type:
- override_members(
- side: Literal['client', 'server'] = 'client',
Return the pack’s override files without reading their contents.
- iter_override_files(
- side: Literal['client', 'server'] = 'client',
- only: Collection[str] | None = None,
Yield override files as open streams, so large files stay out of memory.
- Parameters:
side (Literal['client', 'server']) – The side to read.
only (Collection[str] | None) – The relative paths to read. Defaults to every file.
- Yields:
Each file’s path relative to the instance, and a stream of its contents. The stream closes when the iteration moves on.
- Raises:
PackError – A file’s path is unsafe.
- iter_overrides(
- side: Literal['client', 'server'] = 'client',
Yield the pack’s override files with their contents.
Each file is read into memory whole. Use
iter_override_filesfor packs with large files.