The launcher core is responsible for preparing and launching the Minecraft client. This involves downloading assets, libraries, and mods, setting up the Java runtime, and constructing the launch command.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/CCBlueX/LiquidLauncher/llms.txt
Use this file to discover all available pages before exploring further.
Launch Flow Overview
Prelauncher
The prelauncher (src-tauri/src/minecraft/prelauncher.rs) handles pre-launch setup:
Version Profile Loading
Version profiles define how to launch a specific Minecraft version:let mc_version_manifest = VersionManifest::fetch
.retry(ExponentialBuilder::default())
.notify(|err, dur| {
launcher_data.log(&format!(
"Failed to load version manifest. Retrying in {:?}. Error: {}",
dur, err
));
})
.await?;
let manifest_url = match subsystem {
LoaderSubsystem::Fabric { manifest, .. } => manifest
.replace("{MINECRAFT_VERSION}", &build.mc_version)
.replace(
"{FABRIC_LOADER_VERSION}",
&build.subsystem_specific_data.fabric_loader_version,
),
LoaderSubsystem::Forge { manifest, .. } => manifest.clone(),
};
let mut version = (|| async { VersionProfile::load(&manifest_url).await })
.retry(ExponentialBuilder::default())
.await?;
if let Some(inherited_version) = &version.inherits_from {
let url = mc_version_manifest
.versions
.iter()
.find(|x| &x.id == inherited_version)
.map(|x| &x.url)
.ok_or_else(|| {
LauncherError::InvalidVersionProfile(format!(
"unable to find inherited version manifest {}",
inherited_version
))
})?;
let parent_version = (|| async { VersionProfile::load(url).await })
.retry(ExponentialBuilder::default())
.await?;
version.merge(parent_version)?;
}
Version Profile Structure
Version profiles are JSON files that describe:src-tauri/src/minecraft/version.rs:81-101
Version profiles can inherit from other profiles. For example, Fabric 1.20.1 inherits from vanilla Minecraft 1.20.1.
Mod Management
The prelauncher handles mod downloading and installation:Mod Download Process
Mod Download Process
src-tauri/src/minecraft/prelauncher.rs:84-102
- Repository: Maven-style artifact download
- SkipAd: Ad-supported download with premium bypass
- Local: Custom user-installed mods
Launcher Core
The launcher (src-tauri/src/minecraft/launcher/mod.rs) executes the launch process:
Launch Parameters
All launch configuration is passed viaStartParameter:
src-tauri/src/minecraft/launcher/mod.rs:263-279
Directory Setup
The launcher creates necessary directories:src-tauri/src/minecraft/launcher/mod.rs:99-104
Java Runtime Setup
The launcher ensures the correct Java version is available:src-tauri/src/minecraft/launcher/mod.rs:106-118
Java Runtime Detection
Java Runtime Detection
The JRE loader (
src-tauri/src/minecraft/launcher/jre.rs) handles:- Distribution Selection: Checks which Java distribution to use (Adoptium, Azul, etc.)
- Version Detection: Determines required Java version from manifest
- Download: Downloads JRE if not present
- Extraction: Extracts JRE archive
- Path Resolution: Returns path to java/javaw binary
Client JAR Setup
src-tauri/src/minecraft/launcher/mod.rs:120-129
Library Setup
src-tauri/src/minecraft/launcher/mod.rs:131-142
Library Download Logic
Library Download Logic
Libraries are downloaded from Maven repositories:The process:
src-tauri/src/minecraft/version.rs:640-645
- Check if library exists and SHA1 matches
- Download if missing or checksum mismatch
- Verify downloaded file’s checksum
- Extract natives (platform-specific DLLs/SOs)
- Add to classpath
Asset Setup
src-tauri/src/minecraft/launcher/mod.rs:144-152
Command Construction
The launcher builds the Java command with all necessary arguments:JVM Arguments
src-tauri/src/minecraft/launcher/mod.rs:160-178
src-tauri/src/minecraft/version.rs:232-238:
Main Class
src-tauri/src/minecraft/launcher/mod.rs:180-189
Game Arguments
src-tauri/src/minecraft/launcher/mod.rs:191-194
Template Processing
Arguments contain templates like${game_directory} that must be replaced:
src-tauri/src/minecraft/launcher/mod.rs:198-228
Process Execution
The final step is spawning the Java process:Spawning the Process
src-tauri/src/minecraft/launcher/mod.rs:233-235
JavaRuntime wrapper (src-tauri/src/minecraft/java/runtime.rs):
src-tauri/src/minecraft/java/runtime.rs:34-48
I/O Handling
The launcher streams stdout/stderr to the UI:src-tauri/src/minecraft/java/runtime.rs:67-88
The
tokio::select! macro allows concurrent handling of multiple async operations: reading stdout, reading stderr, waiting for termination signal, and waiting for process exit.Window Management
src-tauri/src/minecraft/launcher/mod.rs:237-240
- Hide and restore on game exit
- Stay visible to show logs
Progress Tracking
The launcher reports progress through theProgressReceiver trait:
- SetLabel: Status message (“Downloading assets…”)
- SetProgress: Numeric progress (0-100)
- SetToMax: Set progress to maximum
- SetForStep: Progress for a specific step
Error Handling
The launch process uses comprehensive error handling:- Network failures (manifest/library download)
- File system errors (permissions, disk space)
- Process spawn failures (Java not found)
- Runtime errors (incompatible Java version)
Launch Example
A complete launch command might look like:Best Practices
Always verify checksums - Libraries and assets should be verified against SHA1 hashes
Use retry logic - Network operations should retry with exponential backoff
Report progress - Keep the user informed during long operations
Handle process lifecycle - Properly manage process termination and cleanup
Merge version profiles correctly - Respect inheritance hierarchy when merging profiles
Next Steps
Backend Architecture
Learn about Rust modules and command structure
Frontend Architecture
Explore Svelte components and UI