feat(debug): 支持网易 Minecraft 调试启动
新增 debug 子命令,自动准备开发世界、注册内置调试 MOD,并将项目行为包和资源包链接到网易运行目录,方便启动游戏后直接进入调试世界。 调试 MOD 资源随仓库一起嵌入,避免依赖本机绝对路径;Windows junction 写入剥离 verbatim 前缀后的 DOS 路径,保证 Minecraft 能正确读取链接包。
This commit is contained in:
15
src/commands/debug.rs
Normal file
15
src/commands/debug.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::{commands::DebugArgs, debug};
|
||||
|
||||
pub fn execute(args: &DebugArgs) {
|
||||
let project_dir = args
|
||||
.path
|
||||
.as_deref()
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|| PathBuf::from("."));
|
||||
|
||||
if let Err(err) = debug::run(&project_dir) {
|
||||
eprintln!("Error: {}", err);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ use clap::{Args, Parser, Subcommand, arg};
|
||||
|
||||
pub mod components;
|
||||
pub mod create;
|
||||
pub mod debug;
|
||||
pub mod init;
|
||||
pub mod release;
|
||||
|
||||
@@ -29,6 +30,8 @@ pub enum Commands {
|
||||
Init(InitArgs),
|
||||
/// Create a new component
|
||||
Components(ComponentsArgs),
|
||||
/// Launch NetEase Minecraft with debug MOD, IPC logging, and hot reload
|
||||
Debug(DebugArgs),
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
@@ -83,3 +86,10 @@ pub struct ComponentsArgs {
|
||||
#[arg(short, long)]
|
||||
pub identifier: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct DebugArgs {
|
||||
/// The path of the project (default: current directory)
|
||||
#[arg(short, long)]
|
||||
pub path: Option<String>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user