1
0
mirror of https://github.com/SKCraft/Launcher.git synced 2024-12-03 13:44:18 +01:00

Swap order of loader libs and ignore Mojang's libs.

This commit is contained in:
sk89q 2015-02-18 16:46:38 -08:00
parent 994175c5b7
commit a0b1bdf8c0

View File

@ -33,6 +33,7 @@ import lombok.extern.java.Log;
import java.io.*; import java.io.*;
import java.net.URL; import java.net.URL;
import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
import java.util.jar.JarFile; import java.util.jar.JarFile;
@ -116,19 +117,27 @@ public class PackageBuilder {
public void addLoaders(File dir, File librariesDir) { public void addLoaders(File dir, File librariesDir) {
logSection("Checking for mod loaders to install..."); logSection("Checking for mod loaders to install...");
LinkedHashSet<Library> collected = new LinkedHashSet<Library>();
File[] files = dir.listFiles(new JarFileFilter()); File[] files = dir.listFiles(new JarFileFilter());
if (files != null) { if (files != null) {
for (File file : files) { for (File file : files) {
try { try {
processLoader(file, librariesDir); processLoader(collected, file, librariesDir);
} catch (IOException e) { } catch (IOException e) {
log.log(Level.WARNING, "Failed to add the loader at " + file.getAbsolutePath(), e); log.log(Level.WARNING, "Failed to add the loader at " + file.getAbsolutePath(), e);
} }
} }
} }
this.loaderLibraries.addAll(collected);
VersionManifest version = manifest.getVersionManifest();
collected.addAll(version.getLibraries());
version.setLibraries(collected);
} }
private void processLoader(File file, File librariesDir) throws IOException { private void processLoader(LinkedHashSet<Library> loaderLibraries, File file, File librariesDir) throws IOException {
log.info("Installing " + file.getName() + "..."); log.info("Installing " + file.getName() + "...");
JarFile jarFile = new JarFile(file); JarFile jarFile = new JarFile(file);
@ -162,8 +171,11 @@ public class PackageBuilder {
// Add libraries // Add libraries
List<Library> libraries = profile.getVersionInfo().getLibraries(); List<Library> libraries = profile.getVersionInfo().getLibraries();
if (libraries != null) { if (libraries != null) {
version.getLibraries().addAll(libraries); for (Library library : libraries) {
loaderLibraries.addAll(libraries); if (!version.getLibraries().contains(library)) {
loaderLibraries.add(library);
}
}
} }
// Copy main class // Copy main class