Skip to main content

A Modern Async Python Library for Minecraft Launcher Development

Project description

Async MC Launcher Core 🚀

A modern async Python library for custom Minecraft launchers

中文說明請見 README-Chinese.md

Test Build Python Package Ask DeepWiki

This project is a fork of JakobDev/minecraft-launcher-lib.

A Python library for building custom Minecraft launchers. Supports installing, launching Minecraft, and interacting with Mojang/Microsoft accounts.

Features

  • Easy installation
  • Generate Minecraft launch commands
  • Microsoft account login support
  • Supports Forge, Fabric, Quilt, and Liteloader
  • Supports alpha/beta and legacy versions
  • All functions are type-annotated and documented
  • PyPy support
  • Full online documentation and tutorials
  • Vanilla launcher profiles read/write support
  • mrpack modpacks support
  • All public APIs are statically typed
  • Rich examples
  • Open source

Installation

Install via pip:

pip install async-mc-launcher-core

Or with uv (faster install):

uv pip install async-mc-launcher-core

Microsoft Account Login Example

import logging
from launcher_core import microsoft_account
import asyncio
from launcher_core.setting import setup_logger
from launcher_core.mojang import have_minecraft

logger = setup_logger(enable_console=False, level=logging.INFO, filename="microsoft_account.log")

async def login_microsoft_account():
    AZURE_APP = microsoft_account.AzureApplication()
    Login = microsoft_account.Login(azure_app=AZURE_APP)
    login_url = await Login.get_login_url()
    print(f"Please open {login_url} in your browser and copy the URL you are redirected into the prompt below.")
    code_url = input()
    code = await microsoft_account.Login.extract_code_from_url(code_url)
    auth_code = await Login.get_ms_token(code)
    print(f"Refresh token: {auth_code['refresh_token']}")
    xbl_token = await microsoft_account.Login.get_xbl_token(auth_code["access_token"])
    xsts_token = await microsoft_account.Login.get_xsts_token(xbl_token["Token"])
    uhs = xbl_token["DisplayClaims"]["xui"][0]["uhs"]
    mc_token = await microsoft_account.Login.get_minecraft_access_token(xsts_token["Token"], uhs)
    await have_minecraft(mc_token["access_token"])
    login_data = {
        "access_token": mc_token["access_token"],
        "refresh_token": auth_code["refresh_token"],
        "expires_in": auth_code["expires_in"],
        "uhs": uhs,
        "xsts_token": xsts_token["Token"],
        "xbl_token": xbl_token["Token"]
    }
    return login_data["access_token"]

if __name__ == "__main__":
    access_token = asyncio.run(login_microsoft_account())
    print(f"Access token: {access_token}")

Documentation & More Examples

Comparison: This Fork vs. JakobDev/minecraft-launcher-lib

Feature/Design This Fork JakobDev Original
Python Version Support 3.10+, more complete type annotations 3.7+, partial type annotations
Logging System Built-in setup_logger, file & console output No built-in logging, user must implement
Microsoft Login Flow Example & API fully async/await All sync
Dependencies aiofiles, aiohttp, requests, requests-mock requests
Documentation Primarily in Chinese, tailored for TW/Chinese users English
Branch Strategy main/dev auto-sync (GitHub Actions) Single main branch
Others Optimized for async/await and type annotations Focus on broad compatibility

Please refer to both the original and this fork to choose the version that best fits your needs!

Contributing

PRs and issues are welcome!

Acknowledgements

Thanks to tomsik68 for documenting Minecraft launcher internals.

Thanks to JakobDev for the original code (BSD-2).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

async_mc_launcher_core-0.3.2.tar.gz (56.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

async_mc_launcher_core-0.3.2-py3-none-any.whl (63.6 kB view details)

Uploaded Python 3

File details

Details for the file async_mc_launcher_core-0.3.2.tar.gz.

File metadata

File hashes

Hashes for async_mc_launcher_core-0.3.2.tar.gz
Algorithm Hash digest
SHA256 d112de35e46913e4268e62e8f2478ec891f5ae1fd5873503587ce4936c092ad0
MD5 29fd9c8a2310d29cfc7c72fb56e62ec1
BLAKE2b-256 6f1b510e00c5d74b23f5c31e77be16db3d0f6b2aa175e032b74c834c7f165fa1

See more details on using hashes here.

File details

Details for the file async_mc_launcher_core-0.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for async_mc_launcher_core-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f4640b039e15596fe9edab09b2b04516d8e11074fbb36a45600fc7365c7921d5
MD5 ca0aae47fbdfbaceaeb26cdad1a4a10b
BLAKE2b-256 32f60dba394f87957d3323ba1792493bd067295b551d24a1370c4d4d71d2c8f7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page