mirror of
https://github.com/artegoser/pimi-launcher-core.git
synced 2025-02-23 20:51:30 +03:00
Added Proxy and Server launch options. Reformted stuff
This commit is contained in:
parent
2652654c18
commit
a2e166dfe1
5 changed files with 84 additions and 38 deletions
|
@ -43,7 +43,7 @@ function getAuth(username, password) {
|
|||
uuid: body.selectedProfile.id,
|
||||
name: body.selectedProfile.name,
|
||||
selected_profile: body.selectedProfile,
|
||||
user_properties: JSON.stringify((body.user || {}).properties || {})
|
||||
user_properties: JSON.stringify(body.user.properties || {})
|
||||
};
|
||||
|
||||
resolve(userProfile);
|
||||
|
|
|
@ -217,12 +217,9 @@ module.exports.getClasses = function (root, version) {
|
|||
|
||||
module.exports.getLaunchOptions = function (version, forge, options) {
|
||||
return new Promise(resolve => {
|
||||
let arguments;
|
||||
if(forge) {
|
||||
arguments = forge.minecraftArguments ? forge.minecraftArguments.split(' ') : forge.arguments.game;
|
||||
} else {
|
||||
arguments = version.minecraftArguments ? version.minecraftArguments.split(' ') : version.arguments.game;
|
||||
}
|
||||
let type = forge || version;
|
||||
let arguments = type.minecraftArguments ? type.minecraftArguments.split(' ') : type.arguments.game;
|
||||
|
||||
const fields = {
|
||||
'${auth_access_token}': options.authorization.access_token,
|
||||
'${auth_session}': options.authorization.access_token,
|
||||
|
@ -243,6 +240,18 @@ module.exports.getLaunchOptions = function (version, forge, options) {
|
|||
}
|
||||
}
|
||||
|
||||
if(options.server) arguments.push('--server', options.server.host, '--port', options.server.port || "25565");
|
||||
if(options.proxy) arguments.push(
|
||||
'--proxyHost',
|
||||
options.proxy.host,
|
||||
'--proxyPort',
|
||||
options.proxy.port || "8080",
|
||||
'--proxyUser',
|
||||
options.proxy.username,
|
||||
'--proxyPass',
|
||||
options.proxy.password
|
||||
);
|
||||
|
||||
resolve(arguments);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -37,6 +37,7 @@ module.exports = async function (options) {
|
|||
'-Dfml.ignoreInvalidMinecraftCertificates=true',
|
||||
`-Djava.library.path=${nativePath}`,
|
||||
`-Xmx${options.memory.max}M`,
|
||||
`-Xms${options.memory.min}M`,
|
||||
'-Xincgc'
|
||||
];
|
||||
jvm.push(await handler.getJVM(versionFile, options));
|
||||
|
@ -55,13 +56,9 @@ module.exports = async function (options) {
|
|||
// Download version's assets
|
||||
await handler.getAssets(options.root, versionFile);
|
||||
|
||||
// Launch options
|
||||
// Launch options. Thank you Lyrus for the reformat <3
|
||||
let launchOptions;
|
||||
if(forge) {
|
||||
launchOptions = await handler.getLaunchOptions(versionFile, forge.forge, options);
|
||||
} else {
|
||||
launchOptions = await handler.getLaunchOptions(versionFile, null, options);
|
||||
}
|
||||
launchOptions = await handler.getLaunchOptions(versionFile, forge ? forge.forge : null, options);
|
||||
|
||||
const launchArguments = args.concat(jvm, classPaths, launchOptions);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue