A minecraft launcher core library for python
Project description
pmccc
关于
这是一个基于python的Minecraft启动器核心
示例
启动器信息
import pmccc
launcher_info = pmccc.launcher_info("启动器名称", "启动器版本")
玩家信息
import pmccc
# 离线登录(可自定义UUID)
player = pmccc.player.player_base()
player.name = "名称"
player.uuid = "UUID"
print(player)
# 离线登录
player = pmccc.player.player_offline("名称")
print(player)
# 微软登录
player = pmccc.player_online()
url = input(f"请访问地址: {player.login_url()}\n把跳转后的链接粘贴过来\n>")
# microsoft_refresh_token 若90天不使用就会过期,一定不能泄露
microsoft_refresh_token = player.login_auto_init(url)
print(player)
# 以后改用 login_auto 登录即可
player.login_auto(microsoft_refresh_token)
# 可使用 get_profile 获取玩家档案
print(player.get_profile(player.access_token))
获取Java
import pmccc
java_manager = pmccc.java_manager()
# 会通过环境变量寻找可用Java
java_manager.search()
print(java_manager)
版本文件
import pmccc
import json
with open("xxx.json", encoding="utf-8") as fp:
version = pmccc.version(json.load(fp))
# 游戏jvm与游戏参数
jvm, game = version.get_args()
# 获取库(注意这里返回的是相对路径,绝对路径需要你自行拼接)
library = version.get_library()
native = version.get_native()
# 获取classpath
class_path = version.merge_cp(library, "游戏jar文件路径")
# 获取启动参数
args = version.replace_args(
launcher_info,
java_manager.java[21][0].path, # 使用Java 21
version.merge_args(jvm, game),
class_path,
player,
"游戏目录(版本文件夹)",
"asset目录",
"natives目录"
)
解压native
import pmccc
# 清理目录
pmccc.native.clear("natives目录")
# 注意刚刚说的,这里native默认是相对路径,记得自行拼接
pmccc.native.unzip_all(native)
启动游戏
import subprocess
subprocess.run(args, cwd="游戏目录")
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
pmccc-0.2.5-py3-none-any.whl
(15.1 kB
view details)
File details
Details for the file pmccc-0.2.5-py3-none-any.whl.
File metadata
- Download URL: pmccc-0.2.5-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db87865f4143c8fa5407bdf91b48bdfbc7a3da087ecfad078bc7a17fc0334be0
|
|
| MD5 |
490ac46039841a1b5cba7286bc76fa99
|
|
| BLAKE2b-256 |
9abcb6867575414f9b1c7d8873024b7955653511c96f470aba4fe199bf422c24
|
Provenance
The following attestation bundles were made for pmccc-0.2.5-py3-none-any.whl:
Publisher:
build.yml on cueavyqwp/pmccc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pmccc-0.2.5-py3-none-any.whl -
Subject digest:
db87865f4143c8fa5407bdf91b48bdfbc7a3da087ecfad078bc7a17fc0334be0 - Sigstore transparency entry: 640293992
- Sigstore integration time:
-
Permalink:
cueavyqwp/pmccc@31081951a6e87cae3f734cf0cc293666d52ee6d6 -
Branch / Tag:
refs/tags/0.2.5 - Owner: https://github.com/cueavyqwp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yml@31081951a6e87cae3f734cf0cc293666d52ee6d6 -
Trigger Event:
push
-
Statement type: