Updated documentation.

This commit is contained in:
Pierce 2019-02-08 14:02:42 -05:00
parent f9fc29ee67
commit c3c864df50

View file

@ -1,7 +1,8 @@
# Minecraft Launcher Core # Minecraft Launcher Core
### Currently only supports MC 1.7.3 and up. ### Currently only supports MC 1.7.3 and up.
A script that launches Minecraft using NodeJS. A script that launches Minecraft using NodeJS.
Supports Vanilla and Forge.
### Installing ### Installing
@ -12,15 +13,15 @@ A script that launches Minecraft using NodeJS.
##### launcher.core Options ##### launcher.core Options
| Parameter | Type | Description | Required | | Parameter | Type | Description | Required |
|------------------|----------|-------------------------------------------------------------------------------------------|----------| |--------------------------|--------|-------------------------------------------------------------------------------------------|----------|
| `options.authorization` | Object | The result from `getAuth` function, allows the client to login in online or offline mode. | True | | `options.authorization` | Object | The result from `getAuth` function, allows the client to login in online or offline mode. | True |
| `options.clientPackage` | String | Path to the client package zip file. | False | | `options.clientPackage` | String | Path to the client package zip file. | False |
| `options.root` | String | Path where you want the launcher to work in. like `C:/Users/user/AppData/Roaming/.mc` | True | | `options.root` | String | Path where you want the launcher to work in. like `C:/Users/user/AppData/Roaming/.mc` | True |
| `options.os` | String | windows, osx or linux | True | | `options.os` | String | windows, osx or linux | True |
| `options.version.number` | String | Minecraft version that is going to be launched. | True | | `options.version.number` | String | Minecraft version that is going to be launched. | True |
| `options.version.type` | String | Any string. The actual Minecraft launcher uses `release` and `snapshot`. | True | | `options.version.type` | String | Any string. The actual Minecraft launcher uses `release` and `snapshot`. | True |
| `options.memory.max` | String | Max amount of memory being used by Minectaft | True | | `options.memory.max` | String | Max amount of memory being used by Minectaft | True |
#### launcher.authenticator Functions #### launcher.authenticator Functions
@ -45,6 +46,16 @@ A script that launches Minecraft using NodeJS.
| `client_token` | String | Token being checked if it's the same client that the access_token was created from. | True | | `client_token` | String | Token being checked if it's the same client that the access_token was created from. | True |
| `selected_profile` | Object | Json Object that was returned from Mojangs auth api. | True | | `selected_profile` | Object | Json Object that was returned from Mojangs auth api. | True |
#### Events
| Event Name | Type | Description |
|-------------------|---------|-------------------------------------------------------------------------------------|
| `data` | Buffer | Emitted when information is returned from 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 |
| `start` | null | Emitted after `launchOptions` are set. THIS WILL BE DEPRECATED AS ITS NOT ACCURATE |
#### Client Package Function #### Client Package Function
Client Packages allow the client to run offline on setup. This function should be used outside the actual launcher. Client Packages allow the client to run offline on setup. This function should be used outside the actual launcher.
@ -67,6 +78,7 @@ launcher.authenticator.getAuth("email", "password").then(auth => {
launcher.core({ launcher.core({
authorization: auth, authorization: auth,
clientPackage: null, clientPackage: null,
forge: null,
root: "C:/Users/user/AppData/Roaming/.mc", root: "C:/Users/user/AppData/Roaming/.mc",
os: "windows", os: "windows",
version: { version: {
@ -104,6 +116,29 @@ launcher.core({
}); });
``` ```
##### Using With Forge
```js
launcher.authenticator.getAuth("email", "password").then(auth => {
launcher.core({
authorization: auth,
clientPackage: null,
root: "C:/Users/user/AppData/Roaming/.mc",
forge: {
path: "C:/Users/user/Desktop/forge.jar"
},
os: "windows",
version: {
number: "1.12.2", // needs to be the same as the Forge version
type: "MCC-Launcher"
},
memory: {
max: "500"
}
});
});
```
#### What should it look like running from console? #### What should it look like running from console?