Clean up launchArguments

This commit is contained in:
Pierce 2019-02-08 18:37:05 -05:00
parent a1652d2398
commit 9574095696
2 changed files with 4 additions and 8 deletions

View file

@ -42,14 +42,12 @@ module.exports = async function (options) {
jvm.push(await handler.getJVM(versionFile, options)); jvm.push(await handler.getJVM(versionFile, options));
if(options.customArgs) jvm = jvm.concat(options.customArgs); if(options.customArgs) jvm = jvm.concat(options.customArgs);
let mainClass;
const classes = await handler.getClasses(options.root, versionFile); const classes = await handler.getClasses(options.root, versionFile);
const classPaths = []; const classPaths = ['-cp'];
if(forge) { if(forge) {
classPaths.push(`${options.forge.path};${forge.paths.join(';')};${classes.join(';')};${mcPath}`); classPaths.push(`${options.forge.path};${forge.paths.join(';')};${classes.join(';')};${mcPath}`);
mainClass = forge.forge.mainClass classPaths.push(forge.forge.mainClass)
} else { } else {
classPaths.push('-cp');
classPaths.push(`${mcPath};${classes.join(";")}`); classPaths.push(`${mcPath};${classes.join(";")}`);
classPaths.push(versionFile.mainClass); classPaths.push(versionFile.mainClass);
} }
@ -65,9 +63,7 @@ module.exports = async function (options) {
launchOptions = await handler.getLaunchOptions(versionFile, null, options); launchOptions = await handler.getLaunchOptions(versionFile, null, options);
} }
// NOTE: Hacky way of setting up launch options, will rework this next update. const launchArguments = args.concat(jvm, classPaths, launchOptions);
let launchArguments = args.concat(jvm, classPaths, launchOptions);
if(forge) launchArguments = `${jvm.join(' ')} -cp ${classPaths} ${mainClass} ${launchOptions.join(' ')}`.split(' ');
const minecraft = child.spawn(`java`, launchArguments); const minecraft = child.spawn(`java`, launchArguments);
event.emit('start', null); event.emit('start', null);

View file

@ -1,6 +1,6 @@
{ {
"name": "minecraft-launcher-core", "name": "minecraft-launcher-core",
"version": "2.1.2", "version": "2.1.3",
"description": "Module that downloads Minecraft assets and runs Minecraft. Also Supports Forge", "description": "Module that downloads Minecraft assets and runs Minecraft. Also Supports Forge",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {