From 679ffbcce75660410569e0538525b87b972a2fb1 Mon Sep 17 00:00:00 2001 From: Jai A Date: Wed, 21 Aug 2024 18:42:02 -0700 Subject: [PATCH] Fix Fabric Loader 0.16.0, old forge versions --- daedalus/Cargo.toml | 2 +- daedalus/src/modded.rs | 27 +++++++++++++++++++++++---- daedalus_client/src/fabric.rs | 1 + 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/daedalus/Cargo.toml b/daedalus/Cargo.toml index 1b28e72..a57f4c6 100644 --- a/daedalus/Cargo.toml +++ b/daedalus/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "daedalus" -version = "0.2.2" +version = "0.2.3" authors = ["Jai A "] edition = "2021" license = "MIT" diff --git a/daedalus/src/modded.rs b/daedalus/src/modded.rs index c510fe7..e7043a4 100644 --- a/daedalus/src/modded.rs +++ b/daedalus/src/modded.rs @@ -98,6 +98,27 @@ pub fn merge_partial_version( ) -> VersionInfo { let merge_id = merge.id.clone(); + let mut libraries = vec![]; + + // We skip duplicate libraries that exist already in the partial version + for mut lib in merge.libraries { + let lib_artifact = lib.name.rsplit_once(':').map(|x| x.0); + + if let Some(lib_artifact) = lib_artifact { + if !partial.libraries.iter().any(|x| { + let target_artifact = x.name.rsplit_once(':').map(|x| x.0); + + target_artifact == Some(lib_artifact) && x.include_in_classpath + }) { + libraries.push(lib); + } else { + lib.include_in_classpath = false; + } + } else { + libraries.push(lib); + } + } + VersionInfo { arguments: if let Some(partial_args) = partial.arguments { if let Some(merge_args) = merge.arguments { @@ -133,10 +154,8 @@ pub fn merge_partial_version( downloads: merge.downloads, id: partial.id.replace(DUMMY_REPLACE_STRING, &merge_id), java_version: merge.java_version, - libraries: partial - .libraries - .into_iter() - .chain(merge.libraries) + libraries: libraries.into_iter() + .chain(partial.libraries) .map(|mut x| { x.name = x.name.replace(DUMMY_REPLACE_STRING, &merge_id); diff --git a/daedalus_client/src/fabric.rs b/daedalus_client/src/fabric.rs index a7e352b..2c394bc 100644 --- a/daedalus_client/src/fabric.rs +++ b/daedalus_client/src/fabric.rs @@ -47,6 +47,7 @@ pub async fn fetch_quilt( .await } +#[allow(clippy::too_many_arguments)] #[tracing::instrument(skip(semaphore, upload_files, mirror_artifacts))] async fn fetch( format_version: usize,