44 lines
1.1 KiB
Rust
44 lines
1.1 KiB
Rust
|
|
pub mod addon;
|
|||
|
|
pub mod config;
|
|||
|
|
pub mod env;
|
|||
|
|
pub mod hotreload;
|
|||
|
|
pub mod ipc;
|
|||
|
|
pub mod level;
|
|||
|
|
pub mod log;
|
|||
|
|
pub mod nbt;
|
|||
|
|
pub mod process;
|
|||
|
|
pub mod win;
|
|||
|
|
|
|||
|
|
use std::path::Path;
|
|||
|
|
|
|||
|
|
use crate::error::Result;
|
|||
|
|
|
|||
|
|
pub fn run(project_dir: &Path) -> Result<()> {
|
|||
|
|
let mut config = config::load_or_create(project_dir)?;
|
|||
|
|
config::ensure_game_executable(project_dir, &mut config)?;
|
|||
|
|
|
|||
|
|
let mod_dirs = config.included_mod_dirs(project_dir)?;
|
|||
|
|
let mut linked_packs = Vec::new();
|
|||
|
|
|
|||
|
|
if !config::env_is_subprocess_mode() {
|
|||
|
|
env::clean_runtime_packs()?;
|
|||
|
|
|
|||
|
|
if config.include_debug_mod {
|
|||
|
|
let debug_pack = addon::register_debug_mod(&config, &mod_dirs)?;
|
|||
|
|
println!("[MCDK] 已注册调试MOD:{}", debug_pack.uuid);
|
|||
|
|
linked_packs.push(debug_pack);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
addon::link_user_mod_dirs(&mod_dirs, &mut linked_packs)?;
|
|||
|
|
level::prepare_world(&config, &linked_packs)?;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
let config_arg = if config.auto_join_game_effective() && !config::env_is_subprocess_mode() {
|
|||
|
|
Some(level::write_dev_config(&config)?)
|
|||
|
|
} else {
|
|||
|
|
None
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
process::launch_game(&config, config_arg.as_deref(), &mod_dirs)
|
|||
|
|
}
|