diff --git a/launcher-builder/src/main/java/com/skcraft/launcher/builder/PackageBuilder.java b/launcher-builder/src/main/java/com/skcraft/launcher/builder/PackageBuilder.java index 705735c..9981a17 100644 --- a/launcher-builder/src/main/java/com/skcraft/launcher/builder/PackageBuilder.java +++ b/launcher-builder/src/main/java/com/skcraft/launcher/builder/PackageBuilder.java @@ -164,7 +164,7 @@ public class PackageBuilder { if (basicProfile.isLegacy()) { processor = new OldForgeLoaderProcessor(); - } else if (basicProfile.getProfile().equalsIgnoreCase("forge")) { + } else { processor = new ModernForgeLoaderProcessor(); } } else if (BuilderUtils.getZipEntry(jarFile, "fabric-installer.json") != null) { diff --git a/launcher-builder/src/main/java/com/skcraft/launcher/builder/loaders/ModernForgeLoaderProcessor.java b/launcher-builder/src/main/java/com/skcraft/launcher/builder/loaders/ModernForgeLoaderProcessor.java index b59201b..fd599bf 100644 --- a/launcher-builder/src/main/java/com/skcraft/launcher/builder/loaders/ModernForgeLoaderProcessor.java +++ b/launcher-builder/src/main/java/com/skcraft/launcher/builder/loaders/ModernForgeLoaderProcessor.java @@ -158,7 +158,7 @@ public class ModernForgeLoaderProcessor implements ILoaderProcessor { libraryName = libraryName.substring(1, libraryName.length() - 1); for (Library lib : result.getLoaderLibraries()) { - if (lib.getName().equals(libraryName)) { + if (lib.matches(libraryName)) { lib.setGenerated(true); log.info(String.format("Setting generated flag on library '%s'", lib.getName())); break; diff --git a/launcher/src/main/java/com/skcraft/launcher/model/loader/LoaderManifest.java b/launcher/src/main/java/com/skcraft/launcher/model/loader/LoaderManifest.java index c1b567c..6d6cb7a 100644 --- a/launcher/src/main/java/com/skcraft/launcher/model/loader/LoaderManifest.java +++ b/launcher/src/main/java/com/skcraft/launcher/model/loader/LoaderManifest.java @@ -19,7 +19,7 @@ public class LoaderManifest { public Library findLibrary(String name) { for (Library library : getLibraries()) { - if (library.getName().equals(name)) { + if (library.matches(name)) { return library; } } diff --git a/launcher/src/main/java/com/skcraft/launcher/model/minecraft/Library.java b/launcher/src/main/java/com/skcraft/launcher/model/minecraft/Library.java index 2fa1c35..3945c10 100644 --- a/launcher/src/main/java/com/skcraft/launcher/model/minecraft/Library.java +++ b/launcher/src/main/java/com/skcraft/launcher/model/minecraft/Library.java @@ -203,6 +203,12 @@ public class Library { } public void setName(String name) { + int classifierPos = name.indexOf("@"); + if (classifierPos != -1) { + // Take off classifiers + name = name.substring(0, classifierPos); + } + this.name = name; // [DEEP SIGH] @@ -228,6 +234,20 @@ public class Library { } } + /** + * Classifier-independent library name check + * @param mavenName Maven name of a library, possibly with a classifier + * @return True if this library is named 'mavenName'. + */ + public boolean matches(String mavenName) { + int classifierPos = mavenName.indexOf('@'); + if (classifierPos != -1) { + mavenName = mavenName.substring(0, classifierPos); + } + + return this.name.equals(mavenName); + } + public static String mavenNameToPath(String mavenName) { List split = Splitter.on(':').splitToList(mavenName); int size = split.size();