mirror of
https://github.com/artegoser/pimi-launcher-core.git
synced 2024-12-23 10:23:47 +03:00
clean up classpaths, deprecating options.forge.path to options.forge
This commit is contained in:
parent
ebefa405a0
commit
5748b386e3
5 changed files with 26 additions and 11 deletions
|
@ -50,7 +50,7 @@ launcher.authenticator.getAuth("email", "password").then(auth => {
|
|||
| `options.version.custom` | String | Name of the jar, json, and folder of the custom client you are launching with. (Optifine) | False |
|
||||
| `options.memory.max` | String | Max amount of memory being used by Minectaft | True |
|
||||
| `options.memory.min` | String | Min amount of memory being used by Minectaft | True |
|
||||
| `options.forge.path` | String | Path to Universal Forge Jar | False |
|
||||
| `options.forge` | String | Path to Universal Forge Jar | False |
|
||||
| `options.customArgs` | String | Array of custom JVM options | False |
|
||||
| `options.server.host` | String | Host url to the server, don't include the port | False |
|
||||
| `options.server.port` | String | Port of the host url, will default to `25565` if not entered. | False |
|
||||
|
@ -144,9 +144,7 @@ launcher.authenticator.getAuth("email", "password").then(auth => {
|
|||
authorization: auth,
|
||||
clientPackage: null,
|
||||
root: "C:/Users/user/AppData/Roaming/.mc",
|
||||
forge: {
|
||||
path: "C:/Users/user/Desktop/forge.jar"
|
||||
},
|
||||
forge: "C:/Users/user/Desktop/forge.jar",
|
||||
os: "windows",
|
||||
version: {
|
||||
number: "1.12.2", // needs to be the same as the Forge version
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
const event = require('events');
|
||||
|
||||
module.exports = new event.EventEmitter();
|
||||
const event = new (require('events')).EventEmitter();
|
||||
event.on('newListener', event => {
|
||||
if(event === 'start') {
|
||||
process.emitWarning('The \'start\' event is deprecated. Use \'data\' instead.', 'DeprecationWarning');
|
||||
}
|
||||
});
|
||||
module.exports = event;
|
|
@ -266,6 +266,17 @@ module.exports.getClasses = function (options, version) {
|
|||
});
|
||||
};
|
||||
|
||||
module.exports.cleanUp = async function(array) {
|
||||
const newArray = [];
|
||||
|
||||
for(let argument in array) {
|
||||
if(newArray.includes(array[argument])) continue;
|
||||
newArray.push(array[argument]);
|
||||
}
|
||||
|
||||
return newArray;
|
||||
};
|
||||
|
||||
module.exports.getLaunchOptions = function (version, modification, options) {
|
||||
return new Promise(resolve => {
|
||||
let type = modification || version;
|
||||
|
|
|
@ -32,8 +32,9 @@ module.exports = async function (options) {
|
|||
let forge = null;
|
||||
let custom = null;
|
||||
if(options.forge) {
|
||||
if(options.forge.path) process.emitWarning('\'options.forge.path\' will be deprecated. Use \'options.forge\' instead');
|
||||
event.emit('debug', '[MCLC]: Detected Forge in options, getting dependencies');
|
||||
forge = await handler.getForgeDependencies(options.root, versionFile, options.forge.path);
|
||||
forge = await handler.getForgeDependencies(options.root, versionFile, options.forge.path || options.forge);
|
||||
}
|
||||
if(options.version.custom) {
|
||||
event.emit('debug', '[MCLC]: Detected custom in options, setting custom version file');
|
||||
|
@ -56,17 +57,18 @@ module.exports = async function (options) {
|
|||
if(options.customArgs) jvm = jvm.concat(options.customArgs);
|
||||
|
||||
const classes = await handler.getClasses(options, versionFile);
|
||||
const classPaths = ['-cp'];
|
||||
let classPaths = ['-cp'];
|
||||
const separator = options.os === "windows" ? ";" : ":";
|
||||
event.emit('debug', `[MCLC]: Using ${separator} to separate class paths`);
|
||||
if(forge) {
|
||||
event.emit('debug', '[MCLC]: Setting Forge class paths');
|
||||
classPaths.push(`${options.forge.path}${separator}${forge.paths.join(separator)}${separator}${classes.join(separator)};${mcPath}`);
|
||||
classPaths.push(`${options.forge.path || options.forge}${separator}${forge.paths.join(separator)}${separator}${classes.join(separator)};${mcPath}`);
|
||||
classPaths.push(forge.forge.mainClass)
|
||||
} else {
|
||||
classPaths.push(`${mcPath}${separator}${classes.join(separator)}`);
|
||||
classPaths.push(versionFile.mainClass || custom.mainClass);
|
||||
}
|
||||
classPaths = await handler.cleanUp(classPaths);
|
||||
|
||||
// Download version's assets
|
||||
event.emit('debug', '[MCLC]: Attempting to download assets');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "minecraft-launcher-core",
|
||||
"version": "2.6.1",
|
||||
"version": "2.6.2",
|
||||
"description": "Module that downloads Minecraft assets and runs Minecraft. Also Supports Forge",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
|
|
Loading…
Add table
Reference in a new issue