Expand description
Building blocks for a Rust Minecraft launcher.
mc-launcher-core focuses on the parts a launcher backend needs before it
can hand control to Java:
- resolving and installing vanilla, Fabric, Quilt, Forge, and NeoForge profiles;
- downloading client jars, libraries, assets, and native libraries;
- merging inherited version metadata into a launchable
core::version::VersionJson; - building a
command::builder::LaunchCommandthat can be passed tostd::process::Command; - applying compatibility metadata for older Minecraft versions on macOS Apple Silicon.
The easiest entry point is launcher::Launcher. Most applications should
import prelude and keep lower-level modules for custom install or
inspection workflows.
§Quick Start
Install Fabric, load the resulting profile, build a launch command, and run it with an offline account:
use std::process::Command;
use mc_launcher_core::prelude::*;
fn main() -> mc_launcher_core::Result<()> {
let minecraft_dir = std::env::current_dir()?.join(".minecraft");
let launcher = Launcher::new(minecraft_dir);
let install = launcher.install(InstallRequest {
minecraft_version: "1.20.1".to_string(),
loader: Some(LoaderSpec::Fabric {
version: LoaderVersion::LatestStable,
}),
java: JavaInstallPolicy::Auto,
})?;
let version = launcher.load_version(&install.version_id)?;
let command = launcher.build_launch_command_from_version(
&version,
LaunchOptions {
account: Account::offline("Steve"),
..Default::default()
},
)?;
let mut child = Command::new(&command.executable)
.args(&command.args)
.current_dir(&command.working_dir)
.spawn()?;
child.wait()?;
Ok(())
}§Module Map
preludere-exports the stable facade types for launcher applications.launchercontains the high-level install and command-building facade.installplans and executes client, asset, library, loader, and native installation work.commandturns version metadata and launch options into Java process arguments.compatibilityadjusts metadata for known platform gaps such as legacy macOS arm64 LWJGL support.authcontains offline and Microsoft account helpers.core,io, andnethold lower-level primitives used by the facade.
§Java Runtime
The crate does not currently bundle or manage a production Java runtime for
the new facade. Use command::builder::LaunchOptions::java_executable to
point at the runtime your launcher selected. Older compatibility wrappers in
runtime are retained for existing callers.
§Error Handling
New facade APIs return Result, an alias over LauncherError. Errors
preserve their source where possible, so callers can display simple messages
or inspect variants for recovery.
Re-exports§
pub use error::LauncherError;pub use error::Result;
Modules§
- account
- Account identities used when constructing launch arguments.
- auth
- Account authentication helpers.
- command
- Command builders and legacy command helpers.
- compatibility
- Platform compatibility adjustments for Minecraft metadata.
- core
- Core launcher domain primitives.
- error
- Error types returned by the launcher facade and lower-level modules.
- forge
- Deprecated Forge compatibility wrappers.
- install
- Installation planning and execution.
- io
- IO helpers for launcher data.
- launcher
- High-level launcher facade.
- loader
- Loader metadata and installer helpers.
- net
- Network helpers.
- platform
- Platform detection and Minecraft metadata naming helpers.
- prelude
- Common imports for launcher applications.
- progress
- Progress events emitted while installation work is performed.
- runtime
- Legacy Java runtime discovery and installation helpers.
- types
- Legacy and wire-format data types.
- utils
- Compatibility utilities and convenience helpers.