launch_from_dot_minecraft/
launch_from_dot_minecraft.rs

1use std::path::PathBuf;
2
3use mc_bootstrap::{ClientAuth, ClientBootstrap, ClientSettings, ClientVersion};
4
5fn get_mc_dir() -> PathBuf {
6    return PathBuf::from("E:\\Workspaces\\downloader\\.minecraft");
7}
8
9fn main() {
10    let bootstrap = ClientBootstrap::new(ClientSettings {
11        assets: get_mc_dir().join("assets"),
12        auth: ClientAuth {
13            username: "Sammwy_".to_string(),
14            access_token: None,
15            uuid: None,
16        },
17        game_dir: get_mc_dir(),
18        java_bin: PathBuf::from(
19            "C:\\Program Files\\Eclipse Adoptium\\jdk-17.0.7.7-hotspot\\bin\\java.exe",
20        ),
21        libraries_dir: get_mc_dir().join("libraries"),
22        manifest_file: get_mc_dir()
23            .join("versions")
24            .join("1.19.4")
25            .join("1.19.4.json"),
26        natives_dir: get_mc_dir().join("versions").join("1.19.4").join("natives"),
27        version: ClientVersion {
28            version: "1.19.4".to_string(),
29            version_type: "release".to_string(),
30        },
31        version_jar_file: get_mc_dir()
32            .join("versions")
33            .join("1.19.4")
34            .join("1.19.4.jar"),
35    });
36
37    bootstrap.launch().unwrap();
38}