mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
[FEATURE] MirrorHelper Quilt support
This commit is contained in:
parent
26c017a277
commit
6caa34e255
4 changed files with 66 additions and 6 deletions
|
@ -60,6 +60,7 @@ public static ClientProfile makeProfile(ClientProfile.Version version, String ti
|
|||
// -----------
|
||||
Optional<MakeProfileOptionForge> forge = findOption(options, MakeProfileOptionForge.class);
|
||||
Optional<MakeProfileOptionFabric> fabric = findOption(options, MakeProfileOptionFabric.class);
|
||||
Optional<MakeProfilesOptionsQuilt> 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<String> getAltClassPath() {
|
|||
}
|
||||
}
|
||||
|
||||
public static class MakeProfilesOptionsQuilt implements MakeProfileOption {
|
||||
|
||||
}
|
||||
|
||||
public static class MakeProfileOptionLiteLoader implements MakeProfileOption {
|
||||
|
||||
}
|
||||
|
|
|
@ -467,11 +467,28 @@ public Version(long[] data, String original, boolean isObjectSerialized) {
|
|||
@Override
|
||||
public int compareTo(Version some) {
|
||||
int result = 0;
|
||||
if(data.length == some.data.length) {
|
||||
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;
|
||||
}
|
||||
} 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
2
modules
2
modules
|
@ -1 +1 @@
|
|||
Subproject commit 06e98102578275e84ba8d3b7aed65228ecbfc30e
|
||||
Subproject commit 19e9cf3d6ce7148db4374e3736862d52b5854638
|
Loading…
Reference in a new issue