lyceris 0.2.0

An open source Minecraft launcher library.
Documentation

lyceris

An open source minecraft launcher library.

Quick Start

  async fn launch() {
    let config = Config {
        game_dir: "Path to the game directory".into(),
        version: "1.20".to_string(),
        authentication: auth::AuthMethod::Offline {
            username: "Notch".to_string(),
            uuid: "4c4ae28c-16c8-49f4-92a6-8d21e0d8b4a0".to_string(),
        },
        memory: None,
        java_version: None,
        version_name: None,
        loader: Some(Quilt("0.27.1".into())),
        runtime_dir: None,
        custom_args: vec![],
        custom_java_args: vec![],
    };

    let mut emitter = EventEmitter::new();

    // Handling single download progression
    emitter.on("single_download_progress", |(path, current, max): (String, u64, u64)| {
        println!("{}-{}/{}", path, current, max);
    });

    // Handling multi download progression
    emitter.on(
        "multiple_download_progress",
        |(path, current, max): (String, u64, u64)| {
            println!("{}-{}/{}", path, current, max);
        },
    );

    // Handling console outputs
    emitter.on("console", |line: String| {
        println!("Line: {}", line);
    });

    let emitter = Arc::new(Mutex::new(emitter));

    install(&config, Some(&emitter)).await?;

    let child = launch(&config, Some(emitter)).await?;

    child.wait().await?;

  }