Metadata-Version: 2.4
Name: minecraft-launcher-lib
Version: 5.3
Summary: A library for creating a custom Minecraft launcher
Author-email: JakobDev <jakobdev@gmx.de>
License: BSD-2-Clause
Project-URL: Documentation, https://minecraft-launcher-lib.readthedocs.io/en/stable/index.html
Project-URL: Issues, https://codeberg.org/JakobDev/minecraft-launcher-lib/issues
Project-URL: Source, https://codeberg.org/JakobDev/minecraft-launcher-lib
Project-URL: Changelog, https://minecraft-launcher-lib.readthedocs.io/en/stable/changelog.html
Project-URL: Donation, https://ko-fi.com/jakobdev
Keywords: JakobDev,Minecraft,Mojang,launcher,minecraft-launcher,java
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Environment :: Other Environment
Classifier: License :: OSI Approved :: BSD License
Classifier: Topic :: Games/Entertainment
Classifier: Operating System :: OS Independent
Classifier: Operating System :: POSIX
Classifier: Operating System :: POSIX :: BSD
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Typing :: Typed
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests
Dynamic: license-file

# minecraft-launcher-lib

![PyPI](https://img.shields.io/pypi/v/minecraft-launcher-lib)
![PyPI - Downloads](https://img.shields.io/pypi/dm/minecraft-launcher-lib)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/minecraft-launcher-lib)
![PyPI - License](https://img.shields.io/pypi/l/minecraft-launcher-lib)
![PyPI - Implementation](https://img.shields.io/pypi/implementation/minecraft-launcher-lib)
![Read the Docs](https://img.shields.io/readthedocs/minecraft-launcher-lib)

A Python library for creating a custom minecraft launcher. This library containts functions to install and execute minecraft and interacting with mojang accounts.

```python
import minecraft_launcher_lib
import subprocess
import sys

# Set the data for your Azure Application here. For more information look at the documentation.
CLIENT_ID = "YOUR CLIENT ID"
REDIRECT_URL = "YOUR REDIRECT URL"

# Get latest version
latest_version = minecraft_launcher_lib.utils.get_latest_version()["release"]

# Get Minecraft directory
minecraft_directory = minecraft_launcher_lib.utils.get_minecraft_directory()

# Make sure, the latest version of Minecraft is installed
minecraft_launcher_lib.install.install_minecraft_version(latest_version, minecraft_directory)

# Login
login_url, state, code_verifier = minecraft_launcher_lib.microsoft_account.get_secure_login_data(CLIENT_ID, REDIRECT_URL)
print(f"Please open {login_url} in your browser and copy the url you are redirected into the prompt below.")
code_url = input()

# Get the code from the url
try:
    auth_code = minecraft_launcher_lib.microsoft_account.parse_auth_code_url(code_url, state)
except AssertionError:
    print("States do not match!")
    sys.exit(1)
except KeyError:
    print("Url not valid")
    sys.exit(1)

# Get the login data
login_data = minecraft_launcher_lib.microsoft_account.complete_login(CLIENT_ID, None, REDIRECT_URL, auth_code, code_verifier)

# Get Minecraft command
options = {
    "username": login_data["name"],
    "uuid": login_data["id"],
    "token": login_data["access_token"]
}
minecraft_command = minecraft_launcher_lib.command.get_minecraft_command(latest_version, minecraft_directory, options)

# Start Minecraft
subprocess.call(minecraft_command)
```

Features:
- Easy installing
- Get command to run Minecraft
- Login to Microsoft account
- Support Forge, Fabric and Liteloader
- Old versions like alpha or beta supported
- All functions have type annotations and docstrings
- Only depents on [requests](https://pypi.org/project/requests)
- Supports [PyPy](https://www.pypy.org)
- Full Documention with tutorial online available
- All public APIs are static typed
- Examples available
- OpenSource

[View more examples](https://codeberg.org/JakobDev/minecraft-launcher-lib/src/branch/master/examples)

[Read the documentation](https://minecraft-launcher-lib.readthedocs.io)

[Thanks to tomsik68 who documented how a minecraft launcher works](https://github.com/tomsik68/mclauncher-api/wiki)

[Buy me a coffe](https://ko-fi.com/jakobdev)
