From a393e0a2f2c3678a3ea869dc1417fa269f2b1040 Mon Sep 17 00:00:00 2001 From: Filip Wandzio Date: Sat, 24 Jan 2026 08:29:14 +0100 Subject: Resolve audio not loading bug Ensure all assets are downloading for each version Temporarily disable minecraft versions older than 1.8 because of the asset/manifest loading issues Implement basic documentation of modules Implement basic async/multithreading for downloading assets --- src/minecraft/manifests.rs | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) (limited to 'src/minecraft/manifests.rs') diff --git a/src/minecraft/manifests.rs b/src/minecraft/manifests.rs index 3cc59af..8bdec26 100644 --- a/src/minecraft/manifests.rs +++ b/src/minecraft/manifests.rs @@ -1,4 +1,7 @@ #![allow(dead_code)] + +use std::collections::HashMap; + use reqwest; use serde::Deserialize; @@ -13,6 +16,17 @@ pub struct Version { pub downloads: Downloads, pub libraries: Vec, + + #[serde(rename = "assetIndex")] + pub asset_index: Option, +} + +#[derive(Debug, Deserialize)] +pub struct AssetIndex { + pub id: String, + pub sha1: String, + pub size: u64, + pub url: String, } #[derive(Debug, Deserialize)] @@ -29,12 +43,22 @@ pub struct DownloadInfo { #[derive(Debug, Deserialize)] pub struct Library { + pub name: Option, pub downloads: LibraryDownloads, + + #[serde(default)] + pub natives: Option>, + + #[serde(default)] + pub rules: Option>, } #[derive(Debug, Deserialize)] pub struct LibraryDownloads { pub artifact: Option, + + #[serde(default)] + pub classifiers: Option>, } #[derive(Debug, Deserialize)] @@ -45,7 +69,20 @@ pub struct LibraryArtifact { pub size: u64, } -pub async fn load_version(cfg: &crate::config::Config) -> Result { +#[derive(Debug, Deserialize)] +pub struct Rule { + pub action: String, + pub os: Option, +} + +#[derive(Debug, Deserialize)] +pub struct OsRule { + pub name: String, +} + +pub async fn load_version( + cfg: &crate::config::Config, +) -> Result { let manifest_text = reqwest::get(VERSION_MANIFEST_URL) .await? .text() @@ -67,7 +104,9 @@ pub async fn load_version(cfg: &crate::config::Config) -> Result