How to Use lighty-launch

Basic Usage

Step 1: Initialize AppState

use lighty_core::AppState;

const QUALIFIER: &str = "com";
const ORGANIZATION: &str = "MyLauncher";
const APPLICATION: &str = "";

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let _app = AppState::new(
        QUALIFIER.to_string(),
        ORGANIZATION.to_string(),
        APPLICATION.to_string(),
    )?;

    let launcher_dir = AppState::get_project_dirs();

    Ok(())
}

Step 2: Create Instance

Step 3: Authenticate

Step 4: Launch

Launch with Custom JVM Options

Common JVM Options:

  • Xmx - Maximum heap size (e.g., "4G", "8G")

  • Xms - Initial heap size (e.g., "2G")

  • XX:+UseG1GC - Use G1 garbage collector

  • XX:+UnlockExperimentalVMOptions - Enable experimental features

  • XX:MaxGCPauseMillis - Target max GC pause time

Launch with Custom Game Options

Common Game Options:

  • width / height - Window dimensions

  • fullscreen - Fullscreen mode

  • quickPlayPath - Quick play server path

  • quickPlaySingleplayer - Quick play singleplayer world

  • quickPlayMultiplayer - Quick play multiplayer server

Instance Management

Get Running Instance PID

Get All PIDs (Multiple Instances)

Close Instance

Delete Instance

Note: delete_instance() will fail if the instance is running. Close it first.

Instance Size Calculation

With Events

Track launch progress with events:

Installation Only (No Launch)

Sometimes you want to download assets without launching:

Complete Launch Flow

Error Handling

Feature Flags

Available features:

  • events - Enables LaunchEvent emission (requires lighty-event)

Exports

In lighty_launch:

In lighty_launcher:

Last updated