pimi-launcher-core/README.md

75 lines
2.1 KiB
Markdown
Raw Normal View History

2018-10-30 01:13:58 +03:00
# Minecraft Launcher Core
### Currently only supports MC 1.7.3 and up.
A script that launches Minecraft using NodeJS.
2018-12-10 02:17:20 +03:00
#### Installing
`npm i minecraft-launcher-core`
2018-10-30 01:13:58 +03:00
#### Usage
##### Basic Login
2018-10-30 01:13:58 +03:00
```javascript
2018-11-30 05:44:40 +03:00
const launcher = require('./pathtomodule');
2018-10-30 01:13:58 +03:00
2018-12-01 03:33:50 +03:00
launcher.authenticator.getAuth("email", "password").then(auth => {
// Save the auth to a file so it can be used later on!
2018-11-30 05:44:40 +03:00
launcher.core({
authorization: auth,
2018-12-01 22:30:58 +03:00
clientPackage: null,
// All of the following is required
root: "directory", // C:/Users/user/AppData/Roaming/.mc
os: "windows", // windows, osx, linux
version: {
number: "1.13.2", // Minecraft version you want to launch
type: "MCC-Launcher" // Type. Can be anything
},
memory: {
max: "500"
}
});
});
```
##### Using Validate and Refresh
```javascript
let auth = require("pathToUserAuthJson.json");
const validateCheck = await launcher.authenticator.validate(auth.access_token); // required arguments.
if(!validateCheck) {
auth = await launcher.authenticator.refreshAuth(auth.access_token, auth.client_token, auth.selected_profile); // required arguments.
}
launcher.core({
authorization: auth,
2018-12-01 22:30:58 +03:00
clientPackage: null,
// All of the following is required
2018-11-30 05:44:40 +03:00
root: "directory", // C:/Users/user/AppData/Roaming/.mc
os: "windows", // windows, osx, linux
version: {
number: "1.13.2", // Minecraft version you want to launch
type: "MCC-Launcher" // Type. Can be anything
},
memory: {
max: "500"
}
});
});
```
2018-10-30 01:40:52 +03:00
2018-12-01 22:30:58 +03:00
#### Client Packages
Client Packages allow the client to run offline on setup.
* makePackage - `launcher.handler.makePackage(["arrayOfVersions"], "os");`
* extractPackage - `launcher.handler.extractPackage("directory", "packageDirectory")`
If you're using a clientPackage, change `null` for `clientPackage` to the zip directory in the example.
2018-10-30 01:40:52 +03:00
#### What should it look like running from console?
![gif](https://pierce.is-serious.business/7d91a7.gif)