@bauxite/launcher-api-forge
v0.5.0
Published
> Provides high-level API for managing Forge Minecraft client instances. > Works as a plugin for `launcher-api`. > Designed to be consumed by `launcher-ui` and `launcher-cli`.
Downloads
9
Readme
launcher-api-forge
Provides high-level API for managing Forge Minecraft client instances. Works as a plugin for
launcher-api
. Designed to be consumed bylauncher-ui
andlauncher-cli
.
Table of Contents
Installation
$ yarn add @bauxite/launcher-api-forge
or
$ npm install --save @bauxite/launcher-api-forge
API Overview
All methods described below return a Promise unless otherwise specified. "Return" implies the Promise having been resolved, and "throw" implies the Promise having been rejected.
Forge Versions
getForgeVersions
(async)
Fetch a list of all available versions of Forge.
Return value
Returns an array of objects, each representing a version of Forge, comprising:
ID
: The version number, i.e.14.23.1.2555
build
: The build numberminecraftVersionID
: The supported version of Minecraftbranch
: Usuallynull
─ the branch on which this version was releasedreleasedAt
: ADate
object representing the time this version was releseddownloads
: An array of objects, each representing a build artefact for this version. Each object contains:ID
: A unique identifier for this build, comprising the versionID
, and the downloadname
name
: The type of build artefact, i.e.universal
,installer
ormdk
path
: The filename of the build artefactsha1
: A SHA1 hash of the build artefacturl
: The remote URL from which the artefact can be downloaded
latest
: If true, this is the latest unstable available buildrecommended
: If true, this is the latest recommended available build
The versions are in descending order of released date (releasedAt
).
getForgeVersionsByID
(async)
Finds a version of Forge by its ID.
Parameters
ID
: The version ID to fetch details for
Return value
Returns an element of the array returned by getForgeVersions
, or null
if the supplied ID
does not match any versions.
getForgeVersionsForMinecraftVersion
(async)
Finds all versions of Forge that are compatible with the supplied Minecraft version.
Parameters
versionID
: The Minecraft version ID
Return value
Returns a subset of the array returned by getForgeVersions
, or an empty array if no compatible versions exist.
Installing Forge
installForge
(async)
Installs (or updates) Forge to a Bauxite-managed Minecraft instance.
Parameters
directory
: The directory of the Minecraft instance to install Forge toforgeVersionID
: The version ID of Forge to install
Return value
Returns an object identical to that of getInstance
from launcher-api
, with
the addition of a forgeVersionID
field. For example:
{
"ID": "twitchy-creeper-23",
"directory": "/home/<user>/.bauxite/instances/twitchy-creeper-23",
"versionID": "1.12.2",
"forgeVersionID": "14.23.1.2555"
}
Launching Forge
Launching Forge instances is handled by startInstance
in launcher-api
─ only
the method for generating launch arguments is augmented to allow this.
generateForgeLaunchArguments
(async)
An override for generateLaunchArguments
, automatically called when launching
Forge-enabled instances.
Parameters
Accepts a single parameter of an object with the 3 following fields:
instance
: An object representing the instance to launch, as returned bygetInstance
fromlauncher-api
.profile
: An object representing the user profile to launch with, as returned by thegetProfile
methods fromlauncher-api
.version
: An object representing the version manifest of the instance, as returned bygetVersionManifest
fromlauncher-api
.
Return value
An array of command-line arguments to pass to the Java executable installed on the system, such that the Forge instance will be launched.