新增 debug 子命令,自动准备开发世界、注册内置调试 MOD,并将项目行为包和资源包链接到网易运行目录,方便启动游戏后直接进入调试世界。 调试 MOD 资源随仓库一起嵌入,避免依赖本机绝对路径;Windows junction 写入剥离 verbatim 前缀后的 DOS 路径,保证 Minecraft 能正确读取链接包。
21 lines
544 B
Python
21 lines
544 B
Python
# -*- coding: utf-8 -*-
|
|
from json import loads
|
|
_DEBUG_INFO = "{#debug_options}"
|
|
_TARGET_MOD_DIRS = "{#target_mod_dirs}"
|
|
|
|
try:
|
|
DEBUG_CONFIG = loads(_DEBUG_INFO) if not isinstance(_DEBUG_INFO, dict) else _DEBUG_INFO
|
|
except:
|
|
DEBUG_CONFIG = {}
|
|
|
|
try:
|
|
TARGET_MOD_DIRS = loads(_TARGET_MOD_DIRS) if not isinstance(_TARGET_MOD_DIRS, list) else _TARGET_MOD_DIRS
|
|
except:
|
|
TARGET_MOD_DIRS = []
|
|
|
|
def GET_DEBUG_IPC_PORT():
|
|
import os
|
|
port = os.getenv("MCDEV_DEBUG_IPC_PORT")
|
|
if port is None:
|
|
return None
|
|
return int(port) |