minecraft-launcher-lib


Nameminecraft-launcher-lib JSON
Version 7.1 PyPI version JSON
download
home_pageNone
SummaryA library for creating a custom Minecraft launcher
upload_time2024-12-21 21:26:04
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseBSD-2-Clause
keywords jakobdev minecraft mojang launcher minecraft-launcher java
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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.run(minecraft_command, cwd=minecraft_directory)
```

Features:
- Easy installing
- Get command to run Minecraft
- Login to Microsoft account
- Supports [Forge](https://minecraftforge.net), [Fabric](https://fabricmc.net), [Quilt](https://quiltmc.org) 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
- Supports reading and writing profiles of the Vanilla Launcher
- Install of [mrpack modpacks](https://docs.modrinth.com/docs/modpacks/format_definition)
- 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)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "minecraft-launcher-lib",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "JakobDev, Minecraft, Mojang, launcher, minecraft-launcher, java",
    "author": null,
    "author_email": "JakobDev <jakobdev@gmx.de>",
    "download_url": "https://files.pythonhosted.org/packages/4f/a8/ad8fa1fd79bc82cc0b5a402fdb42c0022073d8ba015fcb30248cc3940fc0/minecraft_launcher_lib-7.1.tar.gz",
    "platform": null,
    "description": "# minecraft-launcher-lib\n\n![PyPI](https://img.shields.io/pypi/v/minecraft-launcher-lib)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/minecraft-launcher-lib)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/minecraft-launcher-lib)\n![PyPI - License](https://img.shields.io/pypi/l/minecraft-launcher-lib)\n![PyPI - Implementation](https://img.shields.io/pypi/implementation/minecraft-launcher-lib)\n![Read the Docs](https://img.shields.io/readthedocs/minecraft-launcher-lib)\n\nA Python library for creating a custom minecraft launcher. This library containts functions to install and execute minecraft and interacting with mojang accounts.\n\n```python\nimport minecraft_launcher_lib\nimport subprocess\nimport sys\n\n# Set the data for your Azure Application here. For more information look at the documentation.\nCLIENT_ID = \"YOUR CLIENT ID\"\nREDIRECT_URL = \"YOUR REDIRECT URL\"\n\n# Get latest version\nlatest_version = minecraft_launcher_lib.utils.get_latest_version()[\"release\"]\n\n# Get Minecraft directory\nminecraft_directory = minecraft_launcher_lib.utils.get_minecraft_directory()\n\n# Make sure, the latest version of Minecraft is installed\nminecraft_launcher_lib.install.install_minecraft_version(latest_version, minecraft_directory)\n\n# Login\nlogin_url, state, code_verifier = minecraft_launcher_lib.microsoft_account.get_secure_login_data(CLIENT_ID, REDIRECT_URL)\nprint(f\"Please open {login_url} in your browser and copy the url you are redirected into the prompt below.\")\ncode_url = input()\n\n# Get the code from the url\ntry:\n    auth_code = minecraft_launcher_lib.microsoft_account.parse_auth_code_url(code_url, state)\nexcept AssertionError:\n    print(\"States do not match!\")\n    sys.exit(1)\nexcept KeyError:\n    print(\"Url not valid\")\n    sys.exit(1)\n\n# Get the login data\nlogin_data = minecraft_launcher_lib.microsoft_account.complete_login(CLIENT_ID, None, REDIRECT_URL, auth_code, code_verifier)\n\n# Get Minecraft command\noptions = {\n    \"username\": login_data[\"name\"],\n    \"uuid\": login_data[\"id\"],\n    \"token\": login_data[\"access_token\"]\n}\nminecraft_command = minecraft_launcher_lib.command.get_minecraft_command(latest_version, minecraft_directory, options)\n\n# Start Minecraft\nsubprocess.run(minecraft_command, cwd=minecraft_directory)\n```\n\nFeatures:\n- Easy installing\n- Get command to run Minecraft\n- Login to Microsoft account\n- Supports [Forge](https://minecraftforge.net), [Fabric](https://fabricmc.net), [Quilt](https://quiltmc.org) and Liteloader\n- Old versions like alpha or beta supported\n- All functions have type annotations and docstrings\n- Only depents on [requests](https://pypi.org/project/requests)\n- Supports [PyPy](https://www.pypy.org)\n- Full Documention with tutorial online available\n- Supports reading and writing profiles of the Vanilla Launcher\n- Install of [mrpack modpacks](https://docs.modrinth.com/docs/modpacks/format_definition)\n- All public APIs are static typed\n- Examples available\n- OpenSource\n\n[View more examples](https://codeberg.org/JakobDev/minecraft-launcher-lib/src/branch/master/examples)\n\n[Read the documentation](https://minecraft-launcher-lib.readthedocs.io)\n\n[Thanks to tomsik68 who documented how a minecraft launcher works](https://github.com/tomsik68/mclauncher-api/wiki)\n\n[Buy me a coffe](https://ko-fi.com/jakobdev)\n",
    "bugtrack_url": null,
    "license": "BSD-2-Clause",
    "summary": "A library for creating a custom Minecraft launcher",
    "version": "7.1",
    "project_urls": {
        "Changelog": "https://minecraft-launcher-lib.readthedocs.io/en/stable/changelog.html",
        "Documentation": "https://minecraft-launcher-lib.readthedocs.io/en/stable/index.html",
        "Donation": "https://ko-fi.com/jakobdev",
        "Issues": "https://codeberg.org/JakobDev/minecraft-launcher-lib/issues",
        "Source": "https://codeberg.org/JakobDev/minecraft-launcher-lib"
    },
    "split_keywords": [
        "jakobdev",
        " minecraft",
        " mojang",
        " launcher",
        " minecraft-launcher",
        " java"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cbca3f0e13d10a55ac08a3bb11eab09a0618d4c15db6dd7894bcb59d8b7c89d9",
                "md5": "b422445fbcac63e8584bb4ef364ca82b",
                "sha256": "7e8ec49a25bd93d6a388553abf34ee2cda8e884a992129e1198fac0e75421a91"
            },
            "downloads": -1,
            "filename": "minecraft_launcher_lib-7.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b422445fbcac63e8584bb4ef364ca82b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 49754,
            "upload_time": "2024-12-21T21:26:01",
            "upload_time_iso_8601": "2024-12-21T21:26:01.858873Z",
            "url": "https://files.pythonhosted.org/packages/cb/ca/3f0e13d10a55ac08a3bb11eab09a0618d4c15db6dd7894bcb59d8b7c89d9/minecraft_launcher_lib-7.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4fa8ad8fa1fd79bc82cc0b5a402fdb42c0022073d8ba015fcb30248cc3940fc0",
                "md5": "ae80b017177d0473b8b2489473b39cd1",
                "sha256": "f179dc520c388b2b032202a60380c0427fa92316f89aae22061512f51258aca4"
            },
            "downloads": -1,
            "filename": "minecraft_launcher_lib-7.1.tar.gz",
            "has_sig": false,
            "md5_digest": "ae80b017177d0473b8b2489473b39cd1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 48532,
            "upload_time": "2024-12-21T21:26:04",
            "upload_time_iso_8601": "2024-12-21T21:26:04.375825Z",
            "url": "https://files.pythonhosted.org/packages/4f/a8/ad8fa1fd79bc82cc0b5a402fdb42c0022073d8ba015fcb30248cc3940fc0/minecraft_launcher_lib-7.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-21 21:26:04",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": true,
    "codeberg_user": "JakobDev",
    "codeberg_project": "minecraft-launcher-lib",
    "lcname": "minecraft-launcher-lib"
}
        
Elapsed time: 0.94457s