mc_bootstrap

Crates.iomc_bootstrap
lib.rsmc_bootstrap
version0.1.1
sourcesrc
created_at2023-09-11 23:12:00.090127
updated_at2023-09-11 23:12:00.090127
descriptionA library for launching Minecraft.
homepage
repositoryhttps://github.com/minecraft-rs/bootstrap
max_upload_size
id970208
size79,005
Sammwy (sammwyy)

documentation

README

MC Bootstrap

Launch minecraft from rust.

Usage

Launch from .minecraft folder

use mc_bootstrap::{ClientAuth, ClientBootstrap, ClientSettings, ClientVersion};

fn get_mc_dir() -> PathBuf {
    return PathBuf::from("/home/sammwy/.minecraft");
}

fn get_java_path() -> PathBuf {
    return PathBuf::from("/usr/lib/jvm/java-16-openjdk/bin/java");
}

fn main() {
    let bootstrap = ClientBootstrap::new(ClientSettings {
        assets: get_mc_dir().join("assets"),
        auth: ClientAuth {
            username: "Sammwy_".to_string(),
            access_token: None,
            uuid: None,
        },
        game_dir: get_mc_dir(),
        java_bin: get_java_path(),
        libraries_dir: get_mc_dir().join("libraries"),
        manifest_file: get_mc_dir().join("versions").join("1.19.4").join("1.19.4.json"),
        natives_dir: get_mc_dir().join("versions").join("1.19.4").join("natives"),
        version: ClientVersion {
            version: "1.19.4".to_string(),
            version_type: "release".to_string(),
        },
        version_jar_file: get_mc_dir().join("versions").join("1.19.4").join("1.19.4.jar"),
    });

    bootstrap.launch().unwrap();
}

Contribution

Feel free to contribute to the development of the library.

Commit count: 4

cargo fmt