This module aims to convert the excellent work by mindstorm38 into an NPM module in order to be used in many NodeJS based projects.
The package is compatible with Windows and Linux Clients
Install the package using npm
npm install portablemc
This package also requires that portablemc is installed on the system. The package will search in its default installation locations.
This function tells the package some key pieces of information:
EXE_LOCATION : Path to the PortableMC Application
LOG_LOCATION : Path to logs location
MAIN_DIR : Path where minecraft will be installed
All values have defaults however the package will error if portablemc is not found. In this case manual declaration may be needed.
portablemc.config({
EXE_LOCATION: PATH_TO_EXE
LOG_LOCATION: PATH_TO_LOG,
MAIN_DIR:PATH_TO_MC_INSTALLATION
});
This function determines which user is used to boot into the minecraft instance. It can be used both standalone and asynchronously which will return a result
portablemc.authenticate(EMAIL);
or
const authenticatedUser = await portablemc.authenticate(EMAIL);
{
"username": "USERNAME",
"uuid": "UUID",
"email": "EMAIL (Obsfucated)"
}
Once this function is run it stores the user and will use it to launch later sessions.
This functions boots an instance of minecraft with the following conditions:
{
"version":"MC VERSION",
"loader": "LOADER"
}
Version : accepts any version. Also accepts release and snapshot
Loader : accepts the following
- Standard (Vanilla)
- Forge
- Fabric
- NeoForge
- Quilt
- LegacyFabric
Currently there is no check to ensure that the version selected supports the loader. This will be addressed in a future version.
Setting this to true will stop the launch of the game and only install it.
This function can be called normaly and asynchronously
portablemc.launchGame(options,false);
or
const launchGameVersion = await portablemc.launchGame(options,false);
const authenticatedUsers = portablemc.getAuthedUsers()
Returns an array of authenticated users
const logoutUser = await portablemc.logout(email)
Logs the user out