[FEATURE] 1.17 support

This commit is contained in:
Gravita 2021-06-11 10:14:22 +07:00
parent 32a4729970
commit 3431fae109
2 changed files with 46 additions and 2 deletions

View file

@ -58,11 +58,46 @@ public static ClientProfile makeProfile(ClientProfile.Version version, String ti
} }
OptionalFile optionalMacOs = new OptionalFile(); OptionalFile optionalMacOs = new OptionalFile();
optionalMacOs.name = "MacOSArgs"; optionalMacOs.name = "MacOSArgs";
optionalMacOs.visible = false;
optionalMacOs.actions = new ArrayList<>(1); optionalMacOs.actions = new ArrayList<>(1);
optionalMacOs.actions.add(new OptionalActionJvmArgs(List.of("-XstartOnFirstThread"))); optionalMacOs.actions.add(new OptionalActionJvmArgs(List.of("-XstartOnFirstThread")));
optionalMacOs.triggers = new OptionalTrigger[]{new OptionalTrigger(OptionalTrigger.TriggerType.OS_TYPE, 2)}; optionalMacOs.triggers = new OptionalTrigger[]{new OptionalTrigger(OptionalTrigger.TriggerType.OS_TYPE, 2)};
optionals.add(optionalMacOs); optionals.add(optionalMacOs);
} }
if (optionContains(options, MakeProfileOption.LWJGLMAC)) {
OptionalFile optionalMac = new OptionalFile();
optionalMac.name = "MacLwjgl";
optionalMac.visible = false;
optionalMac.actions.add(new OptionalActionFile(Map.of(
"libraries/libraries/org/lwjgl/lwjgl/3.2.1", "",
"libraries/libraries/org/lwjgl/lwjgl-glfw/3.2.1", "",
"libraries/libraries/org/lwjgl/lwjgl-openal/3.2.1", "",
"libraries/libraries/org/lwjgl/lwjgl-stb/3.2.1", "",
"libraries/libraries/org/lwjgl/lwjgl-tinyfd/3.2.1", "",
"libraries/libraries/org/lwjgl/lwjgl-opengl/3.2.1", "",
"libraries/libraries/org/lwjgl/lwjgl-jemalloc/3.2.1", ""
)));
optionalMac.triggers = new OptionalTrigger[]{new OptionalTrigger(OptionalTrigger.TriggerType.OS_TYPE, true, 2, 0)};
optionals.add(optionalMac);
OptionalFile optionalOther = new OptionalFile();
optionalOther.name = "NonMacLwjgl";
optionalOther.visible = false;
optionalOther.actions.add(new OptionalActionFile(Map.of(
"libraries/libraries/org/lwjgl/lwjgl/3.2.2", "",
"libraries/libraries/org/lwjgl/lwjgl-glfw/3.2.2", "",
"libraries/libraries/org/lwjgl/lwjgl-openal/3.2.2", "",
"libraries/libraries/org/lwjgl/lwjgl-stb/3.2.2", "",
"libraries/libraries/org/lwjgl/lwjgl-tinyfd/3.2.2", "",
"libraries/libraries/org/lwjgl/lwjgl-opengl/3.2.2", "",
"libraries/libraries/org/lwjgl/lwjgl-jemalloc/3.2.2", ""
)));
optionalOther.triggers = new OptionalTrigger[]{new OptionalTrigger(OptionalTrigger.TriggerType.OS_TYPE, true, 2, 0)};
optionals.add(optionalOther);
}
if (version.compareTo(ClientProfile.Version.MC117) >= 0) {
builder.setMinJavaVersion(16);
builder.setRecommendJavaVersion(16);
}
jvmArgs.add("-Dfml.ignorePatchDiscrepancies=true"); jvmArgs.add("-Dfml.ignorePatchDiscrepancies=true");
jvmArgs.add("-Dfml.ignoreInvalidMinecraftCertificates=true"); jvmArgs.add("-Dfml.ignoreInvalidMinecraftCertificates=true");
builder.setJvmArgs(jvmArgs); builder.setJvmArgs(jvmArgs);
@ -80,6 +115,11 @@ public static ClientProfile makeProfile(ClientProfile.Version version, String ti
} else { } else {
clientArgs.add("cpw.mods.fml.common.launcher.FMLTweaker"); clientArgs.add("cpw.mods.fml.common.launcher.FMLTweaker");
} }
if (version.compareTo(ClientProfile.Version.MC1122) <= 0) {
builder.setMinJavaVersion(8);
builder.setRecommendJavaVersion(8);
builder.setMaxJavaVersion(8);
}
} }
} }
builder.setClientArgs(clientArgs); builder.setClientArgs(clientArgs);
@ -106,6 +146,9 @@ public static MakeProfileOption[] getMakeProfileOptionsFromDir(Path dir, ClientP
if (Files.exists(dir.resolve("liteloader.jar"))) { if (Files.exists(dir.resolve("liteloader.jar"))) {
options.add(MakeProfileOption.LITELOADER); options.add(MakeProfileOption.LITELOADER);
} }
if (Files.exists(dir.resolve("libraries/libraries/org/lwjgl/lwjgl/3.2.2")) && Files.exists(dir.resolve("libraries/libraries/org/lwjgl/lwjgl/3.2.1"))) {
options.add(MakeProfileOption.LWJGLMAC);
}
if (version.compareTo(ClientProfile.Version.MC1122) <= 0) { if (version.compareTo(ClientProfile.Version.MC1122) <= 0) {
options.add(MakeProfileOption.LAUNCHWRAPPER); options.add(MakeProfileOption.LAUNCHWRAPPER);
} }
@ -187,6 +230,6 @@ public void invoke(String... args) throws Exception {
} }
public enum MakeProfileOption { public enum MakeProfileOption {
LAUNCHWRAPPER, VANILLA, FORGE, FABRIC, LITELOADER LAUNCHWRAPPER, VANILLA, FORGE, FABRIC, LITELOADER, LWJGLMAC
} }
} }

View file

@ -488,7 +488,8 @@ public enum Version {
MC1162("1.16.2", 751), MC1162("1.16.2", 751),
MC1163("1.16.3", 753), MC1163("1.16.3", 753),
MC1164("1.16.4", 754), MC1164("1.16.4", 754),
MC1165("1.16.5", 754); MC1165("1.16.5", 754),
MC117("1.17", 755);
private static final Map<String, Version> VERSIONS; private static final Map<String, Version> VERSIONS;
static { static {