diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/helper/MakeProfileHelper.java b/LaunchServer/src/main/java/pro/gravit/launchserver/helper/MakeProfileHelper.java index bb03de78..f5fe8bc9 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/helper/MakeProfileHelper.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/helper/MakeProfileHelper.java @@ -60,6 +60,7 @@ public static ClientProfile makeProfile(ClientProfile.Version version, String ti // ----------- Optional forge = findOption(options, MakeProfileOptionForge.class); Optional fabric = findOption(options, MakeProfileOptionFabric.class); + Optional quilt = findOption(options, MakeProfilesOptionsQuilt.class); if (version.compareTo(ClientProfileVersions.MINECRAFT_1_12_2) > 0) { jvmArgs.add("-Djava.library.path=natives"); OptionalFile optionalMacOs = new OptionalFile(); @@ -73,6 +74,9 @@ public static ClientProfile makeProfile(ClientProfile.Version version, String ti if (fabric.isPresent()) { builder.setAltClassPath(fabric.orElseThrow().getAltClassPath()); } + if(quilt.isPresent()) { + builder.setClassLoaderConfig(ClientProfile.ClassLoaderConfig.SYSTEM_ARGS); + } if (findOption(options, MakeProfileOptionLwjgl.class).isPresent()) { OptionalFile optionalMac = new OptionalFile(); optionalMac.name = "MacLwjgl"; @@ -152,7 +156,7 @@ public static ClientProfile makeProfile(ClientProfile.Version version, String ti } else if (version.compareTo(ClientProfileVersions.MINECRAFT_1_12_2) > 0) { if (forge.isPresent()) { clientArgs.addAll(forge.get().makeClientArgs()); - builder.setClassLoaderConfig(ClientProfile.ClassLoaderConfig.AGENT); + builder.setClassLoaderConfig(ClientProfile.ClassLoaderConfig.SYSTEM_ARGS); if (version.compareTo(ClientProfileVersions.MINECRAFT_1_16_5) <= 0) { builder.setMaxJavaVersion(15); } @@ -178,6 +182,9 @@ public static String getMainClassByVersion(ClientProfile.Version version, MakePr if (findOption(options, MakeProfileOptionFabric.class).isPresent()) { return "net.fabricmc.loader.launch.knot.KnotClient"; } + if(findOption(options, MakeProfilesOptionsQuilt.class).isPresent()) { + return "org.quiltmc.loader.impl.launch.knot.KnotClient"; + } return "net.minecraft.client.main.Main"; } @@ -216,6 +223,9 @@ public static MakeProfileOption[] getMakeProfileOptionsFromDir(Path dir, ClientP if (Files.exists(dir.resolve("libraries/net/fabricmc/fabric-loader"))) { options.add(new MakeProfileOptionFabric(dir)); } + if (Files.exists(dir.resolve("libraries/org/quiltmc/quilt-loader"))) { + options.add(new MakeProfilesOptionsQuilt()); + } { String log4jVersion = getLog4jVersion(dir); if (log4jVersion != null) { @@ -344,6 +354,10 @@ public List getAltClassPath() { } } + public static class MakeProfilesOptionsQuilt implements MakeProfileOption { + + } + public static class MakeProfileOptionLiteLoader implements MakeProfileOption { } diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/ClientProfile.java b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/ClientProfile.java index 69f2037b..a5475723 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/ClientProfile.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/ClientProfile.java @@ -467,10 +467,27 @@ public Version(long[] data, String original, boolean isObjectSerialized) { @Override public int compareTo(Version some) { int result = 0; - for (int i = 0; i < data.length; ++i) { - if (i > some.data.length) break; - result = Long.compare(data[i], some.data[i]); - if (result != 0) return result; + if(data.length == some.data.length) { + for (int i = 0; i < data.length; ++i) { + result = Long.compare(data[i], some.data[i]); + if (result != 0) return result; + } + } else if(data.length < some.data.length) { + for (int i = 0; i < data.length; ++i) { + result = Long.compare(data[i], some.data[i]); + if (result != 0) return result; + } + for(int i = data.length; i < some.data.length;++i) { + if(some.data[i] > 0) return -1; + } + } else { + for (int i = 0; i < some.data.length; ++i) { + result = Long.compare(data[i], some.data[i]); + if (result != 0) return result; + } + for(int i = some.data.length; i < data.length;++i) { + if(data[i] > 0) return 1; + } } return result; } diff --git a/LauncherAPI/src/test/java/pro/gravit/launcher/ClientVersionTest.java b/LauncherAPI/src/test/java/pro/gravit/launcher/ClientVersionTest.java new file mode 100644 index 00000000..b676e662 --- /dev/null +++ b/LauncherAPI/src/test/java/pro/gravit/launcher/ClientVersionTest.java @@ -0,0 +1,29 @@ +package pro.gravit.launcher; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import pro.gravit.launcher.profiles.ClientProfile; + +public class ClientVersionTest { + @Test + public void parseTest() { + Assertions.assertEquals(ClientProfile.Version.of("1.0.0").toCleanString(), "1.0.0"); + Assertions.assertEquals(ClientProfile.Version.of("1.0.0-1").toCleanString(), "1.0.0.1"); + Assertions.assertEquals(ClientProfile.Version.of("-----1.0.0").toCleanString(), "1.0.0"); + } + + @Test + public void compareTest() { + Assertions.assertTrue(ClientProfile.Version.of("1.0.0").compareTo(ClientProfile.Version.of("1.0.0")) == 0); + Assertions.assertTrue(ClientProfile.Version.of("1.1.0").compareTo(ClientProfile.Version.of("1.0.0")) > 0); + Assertions.assertTrue(ClientProfile.Version.of("2.0.0").compareTo(ClientProfile.Version.of("1.0.0")) > 0); + Assertions.assertTrue(ClientProfile.Version.of("1.0.0").compareTo(ClientProfile.Version.of("1.0.1")) < 0); + Assertions.assertTrue(ClientProfile.Version.of("1.1.0").compareTo(ClientProfile.Version.of("1.0.0")) > 0); + Assertions.assertTrue(ClientProfile.Version.of("1.0.0").compareTo(ClientProfile.Version.of("1.1.0")) < 0); + Assertions.assertTrue(ClientProfile.Version.of("1.0").compareTo(ClientProfile.Version.of("1.0.0")) == 0); + Assertions.assertTrue(ClientProfile.Version.of("1.0.0").compareTo(ClientProfile.Version.of("1.0")) == 0); + Assertions.assertTrue(ClientProfile.Version.of("1.0.1").compareTo(ClientProfile.Version.of("1.0")) > 0); + Assertions.assertTrue(ClientProfile.Version.of("1.0").compareTo(ClientProfile.Version.of("1.0.1")) < 0); + Assertions.assertTrue(ClientProfile.Version.of("1.0").compareTo(ClientProfile.Version.of("1.0.1")) < 0); + } +} diff --git a/modules b/modules index 06e98102..19e9cf3d 160000 --- a/modules +++ b/modules @@ -1 +1 @@ -Subproject commit 06e98102578275e84ba8d3b7aed65228ecbfc30e +Subproject commit 19e9cf3d6ce7148db4374e3736862d52b5854638