Force using Java 8 when launching Minecraft 1.13 or later

This commit is contained in:
huangyuhui
2018-06-17 18:13:47 +08:00
parent 28ed103ec0
commit 573f41611d
4 changed files with 26 additions and 4 deletions

View File

@@ -84,6 +84,7 @@ public class DefaultLauncher extends Launcher {
if (OperatingSystem.CURRENT_OS != OperatingSystem.WINDOWS)
res.add("-Duser.home=" + options.getGameDir().getParent());
// Force using G1GC with its settings
if (options.getJava().getParsedVersion() >= JavaVersion.JAVA_7) {
res.add("-XX:+UnlockExperimentalVMOptions");
res.add("-XX:+UseG1GC");
@@ -103,6 +104,12 @@ public class DefaultLauncher extends Launcher {
res.add("-XX:-OmitStackTraceInFastThrow");
res.add("-Xmn128m");
// As 32-bit JVM allocate 320KB for stack by default rather than 64-bit version allocating 1MB,
// causing Minecraft 1.13 crashed accounting for java.lang.StackOverflowError.
if (options.getJava().getPlatform() == Platform.BIT_32) {
res.add("-Xss1M");
}
if (options.getMaxMemory() != null && options.getMaxMemory() > 0)
res.add("-Xmx" + options.getMaxMemory() + "m");