Expand description
§Piston-MC
A Rust library for interacting with Mojang’s Piston Meta API to fetch Minecraft version manifests, download game clients/servers, and manage game assets.
§Features
- Version Manifest Fetching - Query all Minecraft versions from Mojang’s official API
- Client & Server Downloads - Download Minecraft client and server JARs with progress tracking
- Library Downloads - Download game libraries including platform-specific native libraries
- Asset Management - Download and validate game assets (textures, sounds, etc.)
- Java Runtime Management - Fetch and install Java runtimes for any platform
- Patch Notes - Fetch patch notes for Java Edition, Bedrock Edition, Dungeons, and Launcher
- News - Fetch Minecraft news from Mojang’s launcher content API
- SHA1 Validation - Verify file integrity after downloads
- Parallel Downloads - Configurable concurrent downloads for faster asset retrieval
- Progress Reporting - Real-time download progress via async channels
§Installation
Add to your Cargo.toml:
[dependencies]
piston-mc = "0.0.1-alpha"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }§Quick Start
ⓘ
use piston_mc::manifest_v2::ManifestV2;
#[tokio::main]
async fn main() {
// Fetch the version manifest
let manifest = ManifestV2::fetch().await.expect("Failed to fetch manifest");
// Display latest versions
println!("Latest Release: {}", manifest.latest.release);
println!("Latest Snapshot: {}", manifest.latest.snapshot);
// Get a specific version and download the client
if let Ok(Some(version)) = manifest.version("1.21.4").await {
version.download_client("client.jar", true, None).await.unwrap();
}
}§Modules
| Module | Description |
|---|---|
| ManifestV2 | Fetch and query the Minecraft version manifest |
| VersionManifest | Detailed version info with client/server downloads |
| Assets | Download and validate game assets |
| Java | Fetch and install Java runtimes from Mojang |
| PatchNotes | Fetch patch notes for all Minecraft editions |
| DownloadUtil | File download utilities with progress tracking |
| ShaValidation | SHA1 file hash validation |
§Examples
The library includes several examples demonstrating common use cases:
| Example | Description |
|---|---|
get_minecraft_versions | Fetch and list all Minecraft versions |
get_specific_minecraft_version | Get detailed info for a specific version |
download_minecraft_client | Download a client JAR |
download_minecraft_client_with_progress | Download client with progress reporting |
download_minecraft_server | Download a server JAR |
download_minecraft_server_with_progress | Download server with progress reporting |
download_libraries | Download game libraries with progress |
download_assets | Download game assets with progress |
get_java_installation_files | List files in a Java runtime |
install_java | Install Java runtime with progress |
get_java_patch_notes | Fetch Java Edition patch notes |
get_bedrock_patch_notes | Fetch Bedrock Edition patch notes |
get_dungeons_patch_notes | Fetch Minecraft Dungeons patch notes |
get_launcher_patch_notes | Fetch Minecraft Launcher patch notes |
Run examples with:
cargo run --example get_minecraft_versions
cargo run --example download_minecraft_client§API Sources
This library fetches data from Mojang’s official APIs:
| API | URL |
|---|---|
| Version Manifest | https://piston-meta.mojang.com/mc/game/version_manifest_v2.json |
| Java Runtimes | https://piston-meta.mojang.com/v1/products/java-runtime/2ec0cc96c44e5a76b9c8b7c39df7210883d12871/all.json |
| Asset CDN | https://resources.download.minecraft.net/ |
| Java Patch Notes | https://launchercontent.mojang.com/javaPatchNotes.json |
| Bedrock Patch Notes | https://launchercontent.mojang.com/bedrockPatchNotes.json |
| Dungeons Patch Notes | https://launchercontent.mojang.com/dungeonsPatchNotes.json |
| Launcher Patch Notes | https://launchercontent.mojang.com/launcherPatchNotes_v2.json |
| News | https://launchercontent.mojang.com/news.json |
§Requirements
- Rust 2024 Edition
- Tokio async runtime
Modules§
- assets
- The
Assetsmodule provides functionality for downloading and validating Minecraft game assets (textures, sounds, etc.) from Mojang’s resource CDN. - java
- The
Javamodule provides functionality for fetching and installing Java runtimes from Mojang’s Piston API. This enables automatic Java runtime management for Minecraft launchers. - manifest_
v2 - The
ManifestV2module provides access to Mojang’s Piston Meta API, allowing you to fetch and query the Minecraft version manifest. - sha_
validation - The
ShaValidationmodule provides SHA1 hash validation for files, ensuring downloaded files are not corrupted or tampered with. - version_
manifest - The
VersionManifestmodule provides detailed information about a specific Minecraft version, including download URLs for the client and server JARs, asset information, and launch arguments.