mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2026-04-28 21:38:09 -04:00
fix(tools): forge libraries erasing themselves (#5260)
This was due to a side effect of our de-doubling algorithm
This commit is contained in:
@@ -756,31 +756,34 @@ public final class Tools {
|
||||
"releaseTime", "time", "type"
|
||||
);
|
||||
|
||||
List<DependentLibrary> libList = new ArrayList<>(Arrays.asList(inheritsVer.libraries));
|
||||
try {
|
||||
loop_1:
|
||||
for (DependentLibrary lib : customVer.libraries) {
|
||||
String libName = lib.name.substring(0, lib.name.lastIndexOf(":"));
|
||||
for (int i = 0; i < libList.size(); i++) {
|
||||
DependentLibrary libAdded = libList.get(i);
|
||||
String libAddedName = libAdded.name.substring(0, libAdded.name.lastIndexOf(":"));
|
||||
// Go through the libraries, remove the ones overridden by the custom version
|
||||
List<DependentLibrary> inheritLibraryList = new ArrayList<>(Arrays.asList(inheritsVer.libraries));
|
||||
outer_loop:
|
||||
for(DependentLibrary library : customVer.libraries){
|
||||
// Clean libraries overridden by the custom version
|
||||
String libName = library.name.substring(0, library.name.lastIndexOf(":"));
|
||||
|
||||
if (libAddedName.equals(libName)) {
|
||||
Log.d(APP_NAME, "Library " + libName + ": Replaced version " +
|
||||
libName.substring(libName.lastIndexOf(":") + 1) + " with " +
|
||||
libAddedName.substring(libAddedName.lastIndexOf(":") + 1));
|
||||
libList.set(i, lib);
|
||||
continue loop_1;
|
||||
}
|
||||
for(DependentLibrary inheritLibrary : inheritLibraryList) {
|
||||
String inheritLibName = inheritLibrary.name.substring(0, inheritLibrary.name.lastIndexOf(":"));
|
||||
|
||||
if(libName.equals(inheritLibName)){
|
||||
Log.d(APP_NAME, "Library " + libName + ": Replaced version " +
|
||||
libName.substring(libName.lastIndexOf(":") + 1) + " with " +
|
||||
inheritLibName.substring(inheritLibName.lastIndexOf(":") + 1));
|
||||
|
||||
// Remove the library , superseded by the overriding libs
|
||||
inheritLibraryList.remove(inheritLibrary);
|
||||
continue outer_loop;
|
||||
}
|
||||
|
||||
libList.add(0, lib);
|
||||
}
|
||||
} finally {
|
||||
inheritsVer.libraries = libList.toArray(new DependentLibrary[0]);
|
||||
preProcessLibraries(inheritsVer.libraries);
|
||||
}
|
||||
|
||||
// Fuse libraries
|
||||
inheritLibraryList.addAll(Arrays.asList(customVer.libraries));
|
||||
inheritsVer.libraries = inheritLibraryList.toArray(new DependentLibrary[0]);
|
||||
preProcessLibraries(inheritsVer.libraries);
|
||||
|
||||
|
||||
// Inheriting Minecraft 1.13+ with append custom args
|
||||
if (inheritsVer.arguments != null && customVer.arguments != null) {
|
||||
List totalArgList = new ArrayList(Arrays.asList(inheritsVer.arguments.game));
|
||||
|
||||
Reference in New Issue
Block a user