### Basic Lyceris Usage (Rust) Source: https://github.com/batuhanaksoyy/lyceris/blob/main/README.md Demonstrates how to use the Lyceris library to install and launch a Minecraft instance. It shows how to set up event listeners for download progress and console output, configure the game instance, and execute the installation and launch processes. Requires `tokio` for async operations. ```Rust use std::env; use lyceris::minecraft::{ config::ConfigBuilder, emitter::{Emitter, Event}, install::{install, FileType}, launch::launch, }; #[tokio::main] async fn main() -> Result<(), Box> { // Emitter uses `EventEmitter` inside of it // and it uses tokio::Mutex for locking. // That causes emitter methods to be async. let emitter = Emitter::default(); // Single download progress event send when // a file is being downloaded. emitter .on( Event::SingleDownloadProgress, |(path, current, total): (String, u64, u64)| { println!("Downloading {} - {}/{}", path, current, total); }, ) .await; // Multiple download progress event send when // multiple files are being downloaded. // Java, libraries and assets are downloaded in parallel and // this event is triggered for each file. emitter .on( Event::MultipleDownloadProgress, |(_, current, total, _): (String, u64, u64, FileType)| { println!("Downloading {}/{}", current, total); }, ) .await; // Console event send when a line is printed to the console. // It uses a seperated tokio thread to handle this operation. emitter .on(Event::Console, |line: String| { println!("Line: {}", line); }) .await; let current_dir = env::current_dir()?; let config = ConfigBuilder::new( current_dir.join("game"), "1.21.4".into(), lyceris::auth::AuthMethod::Offline { username: "Lyceris".into(), // If none given, it will be generated. uuid: None, }, ) .build(); // Install method also checks for broken files // and downloads them again if they are broken. install(&config, Some(&emitter)).await?; // This method never downloads any file and just runs the game. launch(&config, Some(&emitter)).await?.wait().await?; Ok(()) } ``` -------------------------------- ### Adding Lyceris Dependency (Shell) Source: https://github.com/batuhanaksoyy/lyceris/blob/main/README.md Command to add the Lyceris library as a dependency to a Rust project using Cargo. This is the first step to integrate Lyceris into your application. ```Shell cargo add lyceris ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.