fix(tools): forge libraries erasing themselves
This was due to a side effect of our de-doubling algorithm Port of: https://github.com/PojavLauncherTeam/PojavLauncher/commit/5656176c950b9 50271221436700777196233b31f
This commit is contained in:
1 parent
3f0ec78b24
commit
b2aa432848
1 file changed
+23
-20
@@ -341,30 +341,33 @@ createLibraryInfo(libItem);
|
||||
"releaseTime", "time", "type"
|
||||
);
|
||||
|
||||
List<DependentLibrary> libList = new ArrayList<DependentLibrary>(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(":"));
|
||||
|
||||
if (!libAdded.name.equals(lib.name) && libAddedName.equals(libName)) {
|
||||
System.out.println("Library " + libName + ": Replaced version " +
|
||||
libAdded.name.substring(libAddedName.length() + 1) + " with " +
|
||||
lib.name.substring(libName.length() + 1));
|
||||
libList.set(i, lib);
|
||||
libName = null;
|
||||
}
|
||||
}
|
||||
// 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 (libName != null) libList.add(0, lib);
|
||||
for(DependentLibrary inheritLibrary : inheritLibraryList) {
|
||||
String inheritLibName = inheritLibrary.name.substring(0, inheritLibrary.name.lastIndexOf(":"));
|
||||
|
||||
if(libName.equals(inheritLibName)){
|
||||
System.out.println("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;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
inheritsVer.libraries = libList.toArray(new DependentLibrary[0]);
|
||||
}
|
||||
|
||||
// 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();
|
||||
|
||||
Reference in new issue
Block a user