minecraft-launcher-lib


Nameminecraft-launcher-lib JSON
Version 6.5 PyPI version JSON
download
home_pageNone
SummaryA library for creating a custom Minecraft launcher
upload_time2024-05-17 13:53:29
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
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)
```

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.8",
    "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/9a/73/b099eec1dfa6f26cce27aeb60a9a1f07ff183a04ace127bb07bb66d7723d/minecraft_launcher_lib-6.5.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)\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": "6.5",
    "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": "3e32d2991db2f002e5262cad4b38b48891566d05b88958a850ed54111e3e0772",
                "md5": "9c06a65d812016e639c948247d012e84",
                "sha256": "9b87545e99071209ee182fb7f6387713fec65f76a756c65fcee569165804e5d5"
            },
            "downloads": -1,
            "filename": "minecraft_launcher_lib-6.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9c06a65d812016e639c948247d012e84",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 45412,
            "upload_time": "2024-05-17T13:53:27",
            "upload_time_iso_8601": "2024-05-17T13:53:27.712653Z",
            "url": "https://files.pythonhosted.org/packages/3e/32/d2991db2f002e5262cad4b38b48891566d05b88958a850ed54111e3e0772/minecraft_launcher_lib-6.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9a73b099eec1dfa6f26cce27aeb60a9a1f07ff183a04ace127bb07bb66d7723d",
                "md5": "62b293ce0449b1fea0d955551b3d377f",
                "sha256": "2903fe423d9ca90027e9829d8dbc7573a7159364d74f149208a343619cacaa03"
            },
            "downloads": -1,
            "filename": "minecraft_launcher_lib-6.5.tar.gz",
            "has_sig": false,
            "md5_digest": "62b293ce0449b1fea0d955551b3d377f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 47576,
            "upload_time": "2024-05-17T13:53:29",
            "upload_time_iso_8601": "2024-05-17T13:53:29.996592Z",
            "url": "https://files.pythonhosted.org/packages/9a/73/b099eec1dfa6f26cce27aeb60a9a1f07ff183a04ace127bb07bb66d7723d/minecraft_launcher_lib-6.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-17 13:53:29",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": true,
    "codeberg_user": "JakobDev",
    "codeberg_project": "minecraft-launcher-lib",
    "lcname": "minecraft-launcher-lib"
}
        
Elapsed time: 0.24049s