feat(debug): 支持网易 Minecraft 调试启动
新增 debug 子命令,自动准备开发世界、注册内置调试 MOD,并将项目行为包和资源包链接到网易运行目录,方便启动游戏后直接进入调试世界。 调试 MOD 资源随仓库一起嵌入,避免依赖本机绝对路径;Windows junction 写入剥离 verbatim 前缀后的 DOS 路径,保证 Minecraft 能正确读取链接包。
This commit is contained in:
50
debug_mod/DEBUG_ENV_SCRIPT/Game.py
Normal file
50
debug_mod/DEBUG_ENV_SCRIPT/Game.py
Normal file
@@ -0,0 +1,50 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from common.utils import xupdate
|
||||
import mod.client.extraClientApi as clientApi
|
||||
from .Config import TARGET_MOD_DIRS
|
||||
|
||||
def _RELOAD_MOD():
|
||||
state = False
|
||||
for rootModDir in TARGET_MOD_DIRS:
|
||||
try:
|
||||
if xupdate.updata_all(rootModDir):
|
||||
state = True
|
||||
except Exception:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
return state
|
||||
|
||||
def INIT_RELOAD_TIME():
|
||||
return xupdate.set_load_time()
|
||||
|
||||
def SEND_CLIENT_MSG(msg):
|
||||
import gui
|
||||
print(msg)
|
||||
gui.set_left_corner_notify_msg(msg)
|
||||
|
||||
def RELOAD_MOD():
|
||||
import gui
|
||||
msg = "[Dev] Scripts reloaded successfully."
|
||||
if not _RELOAD_MOD():
|
||||
msg = "[Dev] No script updates found."
|
||||
SEND_CLIENT_MSG(msg)
|
||||
|
||||
def RELOAD_ONCE_MODULE(moduleName):
|
||||
return xupdate.update(moduleName)
|
||||
|
||||
def RELOAD_ADDON():
|
||||
import gui
|
||||
import clientlevel
|
||||
clientlevel.refresh_addons()
|
||||
SEND_CLIENT_MSG("[Dev] Add-ons reloaded successfully.")
|
||||
|
||||
def RELOAD_WORLD():
|
||||
import clientlevel
|
||||
clientlevel.restart_local_game()
|
||||
|
||||
def RELOAD_SHADERS():
|
||||
import gui
|
||||
if clientApi.ReloadAllShaders():
|
||||
SEND_CLIENT_MSG("[Dev] Shaders reloaded successfully.")
|
||||
return
|
||||
SEND_CLIENT_MSG("[Dev] No shader updates found.")
|
||||
Reference in New Issue
Block a user