minecraft-java-rs-core
A Rust library that provides the core logic for launching Minecraft Java Edition. It handles everything the official launcher does — downloading game files, assets, Java runtimes, mod loaders, and spawning the game process — exposing a clean async API with real-time progress events.
Features
- Vanilla & modded — supports Forge, NeoForge, Fabric, LegacyFabric, and Quilt out of the box
- Automatic downloads — game JARs, libraries, assets, and Java runtimes fetched on demand
- Integrity checks — SHA-1 verification before every launch
- Instance isolation — each instance gets its own game directory
- Event-driven — progress, speed, logs, and exit codes delivered over a
tokiochannel - Async — built on
tokio; non-blocking from download to process management
Installation
Add to your Cargo.toml:
[]
= { = "https://github.com/fitzxel/minecraft-java-rs-core" }
= { = "1", = ["full"] }
Quick start
use ;
use mpsc;
async
With a mod loader
Set the loader field in LaunchOptions:
use LoaderType;
use LoaderConfig;
// Fabric — latest build
let loader = LoaderConfig ;
// NeoForge — specific build
let loader = LoaderConfig ;
// Forge — recommended build
let loader = LoaderConfig ;
Available loader types: Forge, NeoForge, Fabric, LegacyFabric, Quilt.
Valid build values: "latest", "recommended", or an exact version string (e.g. "0.19.2").
Utilities
offline_uuid
Generates a deterministic offline UUID from a username. Useful when building
your own offline-mode Authenticator without a real Microsoft account.
use offline_uuid;
let uuid = offline_uuid;
// e.g. "2a6b3c4d-1e2f-3a4b-8c9d-0e1f2a3b4c5d"
The same username always produces the same UUID, so the player's inventory and world progress are preserved across sessions.
Download only (no launch)
Download and verify all game files without spawning the game process:
launcher.download_game.await.expect;
Listening to events
All progress and game output is delivered as LaunchEvent variants over a tokio::sync::mpsc channel:
| Event | Description |
|---|---|
Progress { downloaded, total, kind } |
Download batch progress. kind is e.g. "libraries", "assets", "java" |
Speed(f64) |
Current download speed in bytes/sec |
Estimated(f64) |
Estimated seconds remaining |
Check { current, total, kind } |
File integrity check progress |
Extract(String) |
A file is being extracted from an archive |
Patch(String) |
A Forge processor step is running |
GameDownloadFinished |
All files downloaded and verified |
Data(String) |
A line of stdout/stderr from the Minecraft process |
Close(i32) |
Minecraft exited; carries the exit code |
Error(String) |
Non-fatal warning from the launcher |
while let Some = rx.recv.await
Running the built-in example
The repo ships an example launcher at examples/launch.rs:
# Vanilla 1.21.1
# With Fabric (latest)
# With NeoForge (specific build)
# With Forge (recommended)
# With Quilt (latest)
# Use a named instance (saves to ./minecraft/instances/myworld)
# Download only (no game launch)
# Custom memory and auto-close after 60 seconds
Example options
| Flag | Default | Description |
|---|---|---|
--version <VERSION> |
1.20.4 |
Minecraft version |
--username <NAME> |
Player |
Offline username |
--path <PATH> |
./minecraft |
Root game directory |
--instance <NAME> |
— | Instance name (<path>/instances/<name>) |
--min-mem <SIZE> |
2G |
JVM minimum heap |
--max-mem <SIZE> |
4G |
JVM maximum heap |
--loader-type <TYPE> |
— | forge | neoforge | fabric | legacyfabric | quilt |
--loader-build <BUILD> |
latest |
latest | recommended | exact version |
--only-download |
— | Download files without launching |
--auto-close <SECS> |
— | Kill Minecraft after N seconds |
A note on AI-assisted development
My programming background is mainly web development. While I've been picking up Rust along the way, this project was born out of necessity rather than passion for the language or a desire to practice it. I needed a solid Minecraft Java launcher core in Rust and there are very few options that actually cover what this project aims to do.
Because of that, the code is — in principle — 100% AI-generated. If this ends up public it isn't a "look what I can build" statement. It's closer to "I built this, it's useful to me, and maybe it'll be useful to someone else too."
Bug reports, improvements, and pull requests are genuinely welcome.
License
MIT