GithubHelp home page GithubHelp logo

portablemc_npm's Introduction

PortableMC_NPM

This module aims to convert the excellent work by mindstorm38 into an NPM module in order to be used in many NodeJS based projects.

Compatability

The package is compatible with Windows and Linux Clients

Installation

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.

Getting Started

.config(options)

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
});

.authenticate(email)

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.

.launchGame(options,installOnly)

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.

installOnly

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);

Other Functions

.getAuthedUsers()

const authenticatedUsers = portablemc.getAuthedUsers()

Returns an array of authenticated users

.logout(email)

const logoutUser = await portablemc.logout(email)

Logs the user out

portablemc_npm's People

Contributors

jackcooper04 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.