Skip to content

Commit

Permalink
🐛 fix: old forge libraries and new fabric loader deps
Browse files Browse the repository at this point in the history
Signed-off-by: Pauline <[email protected]>
  • Loading branch information
pauliesnug committed Aug 22, 2024
1 parent e4fc495 commit f873093
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 105 deletions.
174 changes: 73 additions & 101 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 19 additions & 4 deletions crates/interface/src/api/modded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,23 @@ pub struct Processor {
/// Merges a partial version into a complete one
pub fn merge_partial_version(partial: PartialVersionInfo, merge: VersionInfo) -> VersionInfo {
let merge_id = merge.id.clone();
let mut libraries = vec![];

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 {
Expand Down Expand Up @@ -132,13 +149,11 @@ pub fn merge_partial_version(partial: PartialVersionInfo, merge: VersionInfo) ->
downloads: merge.downloads,
id: partial.id.replace(DUMMY_REPLACE_STRING, &merge_id),
java_version: merge.java_version,
libraries: partial
.libraries
libraries: libraries
.into_iter()
.chain(merge.libraries)
.chain(partial.libraries)
.map(|mut x| {
x.name = x.name.replace(DUMMY_REPLACE_STRING, &merge_id);

x
})
.collect::<Vec<_>>(),
Expand Down
Loading

0 comments on commit f873093

Please sign in to comment.