A library for creating a custom Minecraft launcher
Project description
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.
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
- Supports PyPy
- Full Documention with tutorial online available
- All public APIs are static typed
- Examples available
- OpenSource
Thanks to tomsik68 who documented how a minecraft launcher works
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
minecraft-launcher-lib-5.3.tar.gz
(20.9 kB
view hashes)
Built Distribution
Close
Hashes for minecraft-launcher-lib-5.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86d5615d6c94836590356385fabc2ec430077a816c1d495adeefc0b51f38e369 |
|
MD5 | 038945ff24783e259b3585bcc6262e33 |
|
BLAKE2b-256 | c336a63a18bb1d0438133fafc1fbf6c7da5268b317c2655fbc9bd207974dce4e |
Close
Hashes for minecraft_launcher_lib-5.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab06a17daa2964f228efc7bf115c7f79e0b105808cbe99a81aa2541f9a0668f8 |
|
MD5 | 18030cdcf22f3a7af856a9c75649d76d |
|
BLAKE2b-256 | 587301f049d80280acca5deecdaf907df9ab43db137e3f67d2c91f3a16ace7aa |