install

install allows you to install minecraft.

install_minecraft_version(version: str, minecraft_directory: str | PathLike, callback: CallbackDict | None = None) None

Installs a Minecraft version to the specified path. It also verifies and repairs an existing installation, so call it before launching. Only missing or corrupted files will be downloaded.

You can pass a dict with functions as callback parameter to monitor the progress:

callback = {
    "setStatus": some_function, # This function is called to set a text
    "setProgress" some_function, # This function is called to set the progress.
    "setMax": some_function, # This function is called to set to max progress.
}

For more details, check the corresponding tutorial.

Example:

minecraft_directory = minecraft_launcher_lib.utils.get_minecraft_directory()
minecraft_launcher_lib.install.install_minecraft_version("1.21", minecraft_directory)
Parameters:
  • version (str) – The Minecraft version

  • minecraft_directory (str | PathLike) – The path to your Minecraft directory

  • callback (CallbackDict | None) – Some functions that are called to monitor the progress

Raises:
Return type:

None

View the source code of this module