mirror of
https://github.com/SKCraft/Launcher.git
synced 2024-11-23 12:05:44 +01:00
Add support for NeoForge
This commit is contained in:
parent
11808457fe
commit
b5fe175650
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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<String> split = Splitter.on(':').splitToList(mavenName);
|
||||
int size = split.size();
|
||||
|
Loading…
Reference in New Issue
Block a user