mirror of
https://github.com/artegoser/pimi-launcher-core.git
synced 2024-11-22 04:06:21 +03:00
changes to getLaunchOptions so tweaks arent hard coded
This commit is contained in:
parent
1c097c6ae3
commit
edaf35dcd8
3 changed files with 19 additions and 9 deletions
|
@ -177,7 +177,7 @@ module.exports.getForgeDependencies = async function(root, version, forgeJarPath
|
|||
await downloadAsync(downloadLink, jarPath, name);
|
||||
|
||||
paths.push(`${jarPath}\\${name}`);
|
||||
})
|
||||
});
|
||||
|
||||
await Promise.all(download);
|
||||
|
||||
|
@ -212,9 +212,14 @@ module.exports.getClasses = function (root, version) {
|
|||
});
|
||||
};
|
||||
|
||||
module.exports.getLaunchOptions = function (version, options) {
|
||||
module.exports.getLaunchOptions = function (version, forge, options) {
|
||||
return new Promise(resolve => {
|
||||
let arguments = version.minecraftArguments ? version.minecraftArguments.split(' ') : version.arguments.game;
|
||||
let arguments;
|
||||
if(forge) {
|
||||
arguments = forge.minecraftArguments ? forge.minecraftArguments.split(' ') : forge.arguments.game;
|
||||
} else {
|
||||
arguments = version.minecraftArguments ? version.minecraftArguments.split(' ') : version.arguments.game;
|
||||
}
|
||||
const fields = {
|
||||
'${auth_access_token}': options.authorization.access_token,
|
||||
'${auth_session}': options.authorization.access_token,
|
||||
|
|
|
@ -27,7 +27,7 @@ module.exports = async function (options) {
|
|||
forge = await handler.getForgeDependencies(options.root, versionFile, options.forge.path);
|
||||
}
|
||||
|
||||
const args = []
|
||||
const args = [];
|
||||
|
||||
// Jvm
|
||||
let jvm = [
|
||||
|
@ -40,9 +40,10 @@ module.exports = async function (options) {
|
|||
'-Xincgc'
|
||||
];
|
||||
jvm.push(await handler.getJVM(versionFile, options));
|
||||
if(options.customArgs) jvm = jvm.concat(options.customArgs);
|
||||
|
||||
const classes = await handler.getClasses(options.root, versionFile);
|
||||
let mainClass;
|
||||
const classes = await handler.getClasses(options.root, versionFile);
|
||||
const classPaths = [];
|
||||
if(forge) {
|
||||
classPaths.push(`${options.forge.path};${forge.paths.join(';')};${classes.join(';')};${mcPath}`);
|
||||
|
@ -57,14 +58,18 @@ module.exports = async function (options) {
|
|||
await handler.getAssets(options.root, versionFile);
|
||||
|
||||
// Launch options
|
||||
const launchOptions = await handler.getLaunchOptions(versionFile, options);
|
||||
if(forge) launchOptions.push('--tweakClass net.minecraftforge.fml.common.launcher.FMLTweaker');
|
||||
let launchOptions;
|
||||
if(forge) {
|
||||
launchOptions = await handler.getLaunchOptions(versionFile, forge.forge, options);
|
||||
} else {
|
||||
launchOptions = await handler.getLaunchOptions(versionFile, null, options);
|
||||
}
|
||||
|
||||
// NOTE: Hacky way of setting up launch options, will rework this next update.
|
||||
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);
|
||||
minecraft.stdout.on('data', (data) => event.emit('data', data));
|
||||
minecraft.stderr.on('data', (data) => event.emit('error', data));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "minecraft-launcher-core",
|
||||
"version": "2.0.1",
|
||||
"version": "2.1.0",
|
||||
"description": "Module that downloads Minecraft assets and runs Minecraft. Also Supports Forge",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
|
|
Loading…
Add table
Reference in a new issue