mirror of
https://github.com/artegoser/pimi-launcher-core.git
synced 2024-11-25 13:36:21 +03:00
moved error to data. Read DESC
before you go "wait what the f*ck", in older versions, the minecraft process emits data to `error` instead of normal `data`. In newer versions, errors and data are all processed through `data`, making `error` pointless.
This commit is contained in:
parent
001f52e150
commit
22baef8735
4 changed files with 11 additions and 7 deletions
|
@ -73,16 +73,20 @@ launcher.on('error', (e) => console.log(e.toString('utf-8')));
|
||||||
| `options.window.width` | String | Width of the Minecraft Client | False |
|
| `options.window.width` | String | Width of the Minecraft Client | False |
|
||||||
| `options.window.height` | String | Height of the Minecraft Client. | False |
|
| `options.window.height` | String | Height of the Minecraft Client. | False |
|
||||||
| `options.overrides` | Object | Json object redefining paths for better customization. Example below. | False |
|
| `options.overrides` | Object | Json object redefining paths for better customization. Example below. | False |
|
||||||
|
| `options.overrides` | Object | Json object redefining paths for better customization. Example below. | False |
|
||||||
|
| `options.overrides.minArgs`| Integer| The amount of launch arguments specified in the version file before it adds the default again| False |
|
||||||
```js
|
```js
|
||||||
let opts = {
|
let opts = {
|
||||||
otherOps...,
|
otherOps...,
|
||||||
overrides: {
|
overrides: {
|
||||||
minecraftJar: "",
|
minecraftJar: "",
|
||||||
versionJson: "",
|
versionJson: "",
|
||||||
directory: "",
|
directory: "", // where the minecraft jar and version json are located.
|
||||||
libraries: "",
|
libraries: "",
|
||||||
natives: "",
|
natives: "",
|
||||||
assetRoot: ""
|
assetRoot: "",
|
||||||
|
classes: [], // all class paths are required if you use this.
|
||||||
|
minArgs: 11,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -147,7 +151,6 @@ You'll need to provide the folder created in the versions if you're running the
|
||||||
| `arguments` | Object | Emitted when launch arguments are set for the Minecraft Jar. |
|
| `arguments` | Object | Emitted when launch arguments are set for the Minecraft Jar. |
|
||||||
| `data` | Buffer | Emitted when information is returned from the Minecraft Process |
|
| `data` | Buffer | Emitted when information is returned from the Minecraft Process |
|
||||||
| `close` | Integer | Code number that is returned by the Minecraft Process |
|
| `close` | Integer | Code number that is returned by the Minecraft Process |
|
||||||
| `error` | String | Emitted when the Minecraft Process errors |
|
|
||||||
| `package-extract` | null | Emitted when `clientPackage` finishes being extracted |
|
| `package-extract` | null | Emitted when `clientPackage` finishes being extracted |
|
||||||
| `download` | String | Emitted when a file successfully downloads |
|
| `download` | String | Emitted when a file successfully downloads |
|
||||||
| `download-status` | Object | Emitted when data is received while downloading |
|
| `download-status` | Object | Emitted when data is received while downloading |
|
||||||
|
|
|
@ -323,7 +323,8 @@ class Handler {
|
||||||
const assetRoot = this.options.overrides.assetRoot || path.join(this.options.root, 'assets');
|
const assetRoot = this.options.overrides.assetRoot || path.join(this.options.root, 'assets');
|
||||||
const assetPath = this.version.assets === "legacy" || this.version.assets === "pre-1.6" ? path.join(assetRoot, 'legacy') : path.join(assetRoot);
|
const assetPath = this.version.assets === "legacy" || this.version.assets === "pre-1.6" ? path.join(assetRoot, 'legacy') : path.join(assetRoot);
|
||||||
|
|
||||||
if(args.length < 11) args = args.concat(this.version.minecraftArguments ? this.version.minecraftArguments.split(' ') : this.version.arguments.game);
|
const minArgs = this.options.overrides.minArgs || 5;
|
||||||
|
if(args.length < minArgs) args = args.concat(this.version.minecraftArguments ? this.version.minecraftArguments.split(' ') : this.version.arguments.game);
|
||||||
|
|
||||||
if({}.toString.call(this.options.authorization) === "[object Promise]") {
|
if({}.toString.call(this.options.authorization) === "[object Promise]") {
|
||||||
this.options.authorization = await this.options.authorization;
|
this.options.authorization = await this.options.authorization;
|
||||||
|
|
|
@ -86,7 +86,7 @@ class MCLCore extends EventEmitter {
|
||||||
|
|
||||||
if(this.options.customArgs) jvm = jvm.concat(this.options.customArgs);
|
if(this.options.customArgs) jvm = jvm.concat(this.options.customArgs);
|
||||||
|
|
||||||
const classes = await handler.cleanUp(await this.handler.getClasses());
|
const classes = this.options.overrides.classes || await handler.cleanUp(await this.handler.getClasses());
|
||||||
let classPaths = ['-cp'];
|
let classPaths = ['-cp'];
|
||||||
const separator = this.handler.getOS() === "windows" ? ";" : ":";
|
const separator = this.handler.getOS() === "windows" ? ";" : ":";
|
||||||
this.emit('debug', `[MCLC]: Using ${separator} to separate class paths`);
|
this.emit('debug', `[MCLC]: Using ${separator} to separate class paths`);
|
||||||
|
@ -115,7 +115,7 @@ class MCLCore extends EventEmitter {
|
||||||
|
|
||||||
const minecraft = child.spawn(this.options.javaPath ? this.options.javaPath : 'java', launchArguments);
|
const minecraft = child.spawn(this.options.javaPath ? this.options.javaPath : 'java', launchArguments);
|
||||||
minecraft.stdout.on('data', (data) => this.emit('data', data));
|
minecraft.stdout.on('data', (data) => this.emit('data', data));
|
||||||
minecraft.stderr.on('data', (data) => this.emit('error', data));
|
minecraft.stderr.on('data', (data) => this.emit('data', data));
|
||||||
minecraft.on('close', (code) => this.emit('close', code));
|
minecraft.on('close', (code) => this.emit('close', code));
|
||||||
|
|
||||||
return minecraft;
|
return minecraft;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "minecraft-launcher-core",
|
"name": "minecraft-launcher-core",
|
||||||
"version": "3.7.2",
|
"version": "3.7.3",
|
||||||
"description": "Lightweight module that downloads and runs Minecraft using javascript / NodeJS",
|
"description": "Lightweight module that downloads and runs Minecraft using javascript / NodeJS",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
Loading…
Add table
Reference in a new issue