From c834ca971abae6363c7c431e3a6516b9300a01fd Mon Sep 17 00:00:00 2001 From: Daniel Scalzi Date: Thu, 14 Feb 2019 20:22:12 -0500 Subject: [PATCH] Order the launch arguments better. Classpath -> JVM -> Main Class -> Liteloader -> Minecraft -> Client Options -> Mod list --- app/assets/js/processbuilder.js | 75 +++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 32 deletions(-) diff --git a/app/assets/js/processbuilder.js b/app/assets/js/processbuilder.js index b1b2e705..6e255700 100644 --- a/app/assets/js/processbuilder.js +++ b/app/assets/js/processbuilder.js @@ -241,20 +241,26 @@ class ProcessBuilder { */ constructJVMArguments(mods, tempNativePath){ - let args = ['-Xmx' + ConfigManager.getMaxRAM(), - '-Xms' + ConfigManager.getMinRAM(), - '-Djava.library.path=' + tempNativePath, - '-cp', - this.classpathArg(mods, tempNativePath).join(process.platform === 'win32' ? ';' : ':'), - this.forgeData.mainClass] + let args = [] + // Classpath Argument + args.push('-cp') + args.push(this.classpathArg(mods, tempNativePath).join(process.platform === 'win32' ? ';' : ':')) + + // Java Arguments if(process.platform === 'darwin'){ - args.unshift('-Xdock:name=WesterosCraft') - args.unshift('-Xdock:icon=' + path.join(__dirname, '..', 'images', 'minecraft.icns')) + args.push('-Xdock:name=WesterosCraft') + args.push('-Xdock:icon=' + path.join(__dirname, '..', 'images', 'minecraft.icns')) } + args.push('-Xmx' + ConfigManager.getMaxRAM()) + args.push('-Xms' + ConfigManager.getMinRAM()) + args = args.concat(ConfigManager.getJVMOptions()) + args.push('-Djava.library.path=' + tempNativePath) - args.splice(2, 0, ...ConfigManager.getJVMOptions()) + // Main Java Class + args.push(this.forgeData.mainClass) + // Forge Arguments args = args.concat(this._resolveForgeArgs()) return args @@ -298,7 +304,7 @@ class ProcessBuilder { val = this.authUser.accessToken break case 'user_type': - val = 'MOJANG' + val = 'mojang' break case 'version_type': val = this.versionData.type @@ -309,36 +315,41 @@ class ProcessBuilder { } } } - mcArgs.push('--modListFile') - mcArgs.push('absolute:' + this.fmlDir) - if(this.usingLiteLoader){ - mcArgs.push('--modRepo') - mcArgs.push(this.llDir) - - mcArgs.unshift('com.mumfrey.liteloader.launch.LiteLoaderTweaker') - mcArgs.unshift('--tweakClass') + // Autoconnect to the selected server. + if(ConfigManager.getAutoConnect() && this.server.isAutoConnect()){ + const serverURL = new URL('my://' + this.server.getAddress()) + mcArgs.push('--server') + mcArgs.push(serverURL.hostname) + if(serverURL.port){ + mcArgs.push('--port') + mcArgs.push(serverURL.port) + } } // Prepare game resolution if(ConfigManager.getFullscreen()){ - mcArgs.unshift('--fullscreen') + mcArgs.push('--fullscreen') + mcArgs.push(true) } else { - mcArgs.unshift(ConfigManager.getGameWidth()) - mcArgs.unshift('--width') - mcArgs.unshift(ConfigManager.getGameHeight()) - mcArgs.unshift('--height') + mcArgs.push('--width') + mcArgs.push(ConfigManager.getGameWidth()) + mcArgs.push('--height') + mcArgs.push(ConfigManager.getGameHeight()) } + + // Mod List File Argument + mcArgs.push('--modListFile') + mcArgs.push('absolute:' + this.fmlDir) - // Prepare autoconnect - if(ConfigManager.getAutoConnect() && this.server.isAutoConnect()){ - const serverURL = new URL('my://' + this.server.getAddress()) - mcArgs.unshift(serverURL.hostname) - mcArgs.unshift('--server') - if(serverURL.port){ - mcArgs.unshift(serverURL.port) - mcArgs.unshift('--port') - } + // LiteLoader + if(this.usingLiteLoader){ + mcArgs.push('--modRepo') + mcArgs.push(this.llDir) + + // Set first arg to liteloader tweak class + mcArgs.unshift('com.mumfrey.liteloader.launch.LiteLoaderTweaker') + mcArgs.unshift('--tweakClass') } return mcArgs