Skip to content

Installer Module ​

npm versionDownloadsInstall sizenpmBuild Status

Provide functions to install Minecraft client, libraries, and assets.

Usage ​

Install Minecraft ​

Fully install vanilla minecraft client including assets and libs.

ts
import { getVersionList, MinecraftVersion, install } from "@xmcl/installer";
import { MinecraftLocation } from "@xmcl/core";

const minecraft: MinecraftLocation;
const list: MinecraftVersion[] = (await getVersionList()).versions;
const aVersion: MinecraftVersion = list[0]; // i just pick the first version in list here
await install(aVersion, minecraft);

Just install libraries:

ts
import { installLibraries } from "@xmcl/installer";
import { ResolvedVersion, MinecraftLocation, Version } from "@xmcl/core";

const minecraft: MinecraftLocation;
const version: string; // version string like 1.13
const resolvedVersion: ResolvedVersion = await Version.parse(minecraft, version);
await installLibraries(resolvedVersion);

Just install assets:

ts
import { installAssets } from "@xmcl/installer";
import { MinecraftLocation, ResolvedVersion, Version } from "@xmcl/core";

const minecraft: MinecraftLocation;
const version: string; // version string like 1.13
const resolvedVersion: ResolvedVersion = await Version.parse(minecraft, version);
await installAssets(resolvedVersion);

Just ensure all assets and libraries are installed:

ts
import { installDependencies } from "@xmcl/installer";
import { MinecraftLocation, ResolvedVersion, Version } from "@xmcl/core";

const minecraft: MinecraftLocation;
const version: string; // version string like 1.13
const resolvedVersion: ResolvedVersion = await Version.parse(minecraft, version);
await installDependencies(resolvedVersion);

Limit the concurrency of installation ​

The library is using undici as the backbone of http request. It's a very fast http client. But it's also very aggressive. It will create a lot of connections to the server. If you want to limit the concurrency of the installation, you want to create your own undici Dispatcher to handle the request.

ts
import { Dispatcher, Agent } from "undici";

const agent = new Agent({
    connection: 16 // only 16 connection (socket) we should create at most
    // you can have other control here.
});

await installAssets(resolvedVersion, { 
  agent: { // notice this is the DownloadAgent from `@xmcl/file-transfer`
    dispatcher: agent // this is the undici Dispatcher option
  }
});

There are other type of Dispatcher, like Pool, Client, ProxyAgent. You can read undici document for more information.

Progress Moniting on Installation ​

Most install function has a corresponding task function. For example, install function has the function name installTask which is the task version monitor the progress of install.

Here is the example of just moniting the install task overall progress:

ts
// suppose you have define such functions to update UI
declare function updateTaskProgress(task: Task<any>, progress: number, total: number): void;
declare function setTaskToFail(task: Task<any>): void;
declare function setTaskToSuccess(task: Task<any>): void;
declare function trackTask(task: Task<any>): void;

const installAllTask: Task<ResolvedVersion> = installTask(versionMetadata, mcLocation);
await installAllTask.startAndWait({
    onStart(task: Task<any>) {
        // a task start
        // task.path show the path
        // task.name is the name
        trackTask(task)
    },
    onUpdate(task: Task<any>, chunkSize: number) {
        // a task update
        // the chunk size usually the buffer size
        // you can use this to track download speed

        // you can track this specific task progress
        updateTaskProgress(task, task.progress, task.total);

        // or you can update the root task by
        updateTaskProgress(task, installAllTask.progress, installAllTask.total);
    },
    onFailed(task: Task<any>, error: any) {
        // on a task fail
        setTaskToFail(task);
    },
    onSucceed(task: Task<any>, result: any) {
        // on task success
        setTaskToSuccess(task);
    },
    // on task is paused/resumed/cancelled
    onPaused(task: Task<any>) {
    },
    onResumed(task: Task<any>) {
    },
    onCancelled(task: Task<any>) {
    },
});

The task is designed to organize the all the works in a tree like structure.

The installTask has such parent/child structure

  • install
    • version
      • json
      • jar
    • dependencies
      • assets
        • assetsJson
        • asset
      • libraries
        • library

To generally display this tree in UI. You can identify the task by its path.

ts
function updateTaskUI(task: Task<any>, progress: number, total: number) {
    // you can use task.path as identifier
    // and update the task on UI
    const path = task.path;
    // the path can be something like `install.version.json`
}

Or you can use your own identifier like uuid:

ts
// you customize function to make task to a user reacable string to display in UI
declare function getTaskName(task: Task<any>): string;

function runTask(rootTask: Task<any>) {
    // your own id for this root task
    const uid = uuid();
    await rootTask.startAndWait({
        onStart(task: Task<any>) {
            // tell ui that a task with such name started
            // the task id is a number id from 0
            trackTask(`${uid}.${task.id}`, getTaskName(task));
        },
        onUpdate(task: Task<any>, chunkSize: number) {
            // update the total progress 
            updateTaskProgress(`${uid}.${task.id}`, installAllTask.progress, installAllTask.total);
        },
        onStart(task: Task<any>) {
            // tell ui this task ended
            endTask(`${uid}.${task.id}`);
        },
    });
}

Install Library/Assets with Customized Host ​

To swap the library to your self-host or other customized host, you can assign the libraryHost field in options.

For example, if you want to download the library commons-io:commons-io:2.5 from your self hosted server, you can have

ts
// the example for call `installLibraries`
// this option will also work for other functions involving libraries like `install`, `installDependencies`.
await installLibraries(resolvedVersion, {
    libraryHost(library: ResolvedLibrary) {
        if (library.name === "commons-io:commons-io:2.5") {
            // the downloader will first try the first url in the array
            // if this failed, it will try the 2nd.
            // if it's still failed, it will try original url
            return ["https://your-host.org/the/path/to/the/jar", "your-sencodary-url"];
            // if you just have one url
            // just return a string here...
        }
        // return undefined if you don't want to change lib url
        return undefined;
    },
    mavenHost: ['https://www.your-other-maven.org'], // you still can use this to add other maven
});

// it will first try you libraryHost url and then try mavenHost url.

To swap the assets host, you can just assign the assets host url to the options

ts
await installAssets(resolvedVersion, {
    assetsHost: "https://www.your-url/assets"
});

The assets host should accept the get asset request like GET https://www.your-url/assets/<hash-head>/<hash>, where hash-head is the first two char in <hash>. The <hash> is the sha1 of the asset.

Install Forge ​

Get the forge version info and install forge from it.

ts
import { installForge, getForgeVersionList, ForgeVersionList, ForgeVersion } from "@xmcl/installer";
import { MinecraftLocation } from "@xmcl/core";

const list: ForgeVersionList = await getForgeVersionList();
const minecraftLocation: MinecraftLocation;
const mcversion = page.mcversion; // mc version
const firstVersionOnPage: ForgeVersion = page.versions[0];
await installForge(firstVersionOnPage, minecraftLocation);

If you know forge version and minecraft version. You can directly do such:

ts
import { installForge } from "@xmcl/installer";

const forgeVersion = 'a-forge-version'; // like 31.1.27
await installForge({ version: forgeVersion, mcversion: '1.15.2' }, minecraftLocation);

Notice that this installation doesn't ensure full libraries installation. Please run installDependencies afther that.

The new 1.13 forge installation process requires java to run. Either you have java executable in your environment variable PATH, or you can assign java location by installForge(forgeVersionMeta, minecraftLocation, { java: yourJavaExecutablePath });.

If you use this auto installation process to install forge, please checkout Lex's Patreon. Consider support him to maintains forge.

Install Fabric ​

Fetch the new fabric version list.

ts
import { installFabric, FabricArtifactVersion } from "@xmcl/installer";

const versionList: FabricArtifactVersion[] = await getFabricArtifactList();

Install fabric to the client. This installation process doesn't ensure the minecraft libraries.

ts
const minecraftLocation: MinecraftLocation;
await installFabric(versionList[0], minecraftLocation);

Please run Installer.installDependencies after that to install fully.

New Forge Installing process ​

The module have three stage for installing new forge (mcversion >= 1.13)

  1. Deploy forge installer jar
    1. Download installer jar
    2. Extract forge universal jar files in installer jar into .minecraft/libraries
    3. Extract version.json into target version folder, .minecraft/versions/<ver>/<ver>.json
    4. Extract installer_profile.json into target version folder, .minecraft/versions/<ver>/installer_profile.json
  2. Download Dependencies
    1. Merge libraires in installer_profile.json and <ver>.json
    2. Download them
  3. Post processing forge jar
    1. Parse installer_profile.json
    2. Get the processors info and execute all of them.

The installForge will do all of them.

The installByProfile will do 2 and 3.

Install Java 8 From Mojang Source ​

Scan java installation path from the disk. (Require a lzma unpacker, like 7zip-bin or lzma-native)

ts
import { installJreFromMojang } from "@xmcl/installer";

// this require a unpackLZMA util to work
// you can use `7zip-bin`
// or `lzma-native` for this
const unpackLZMA: (src: string, dest: string) => Promise<void>;

await installJreFromMojang({
    destination: "your/java/home",
    unpackLZMA,
});

🧾 Classes ​

🤝 Interfaces ​

🗃️ Namespaces ​

🏳️ Enums ​

🏭 Functions ​

diagnoseInstall ​

ts
diagnoseInstall(installProfile: InstallProfile, minecraftLocation: MinecraftLocation, side: "server" | "client"= 'client'): Promise<InstallProfileIssueReport>

Diagnose a install profile status. Check if it processor output correctly processed.

This can be used for check if forge correctly installed when minecraft >= 1.13

Parameters ​

  • installProfile: InstallProfile The install profile.
  • minecraftLocation: MinecraftLocation The minecraft location
  • side: "server" | "client"

Return Type ​

  • Promise<InstallProfileIssueReport>

Defined in: packages/installer/diagnose.ts:33

fetchJavaRuntimeManifest ​

ts
fetchJavaRuntimeManifest(options: FetchJavaRuntimeManifestOptions= {}): Promise<JavaRuntimeManifest>

Fetch java runtime manifest. It should be able to resolve to your platform, or you can assign the platform.

Also, you should assign the target to download, or it will use the latest java 16.

Parameters ​

  • options: FetchJavaRuntimeManifestOptions The options of fetch runtime manifest

Return Type ​

  • Promise<JavaRuntimeManifest>

Defined in: packages/installer/java-runtime.ts:196

generateOptifineVersion ​

ts
generateOptifineVersion(editionRelease: string, minecraftVersion: string, launchWrapperVersion: string, options: InstallOptifineOptions= {}): Version

Generate the optifine version json from provided info.

Parameters ​

  • editionRelease: string The edition + release with _
  • minecraftVersion: string The minecraft version
  • launchWrapperVersion: string The launch wrapper version
  • options: InstallOptifineOptions The install options Might be changed and don't break the major version

Return Type ​

  • Version

Defined in: packages/installer/optifine.ts:25

getDefaultEntryResolver ​

ts
getDefaultEntryResolver(): EntryResolver

Return Type ​

  • EntryResolver

Defined in: packages/installer/unzip.ts:14

getFabricArtifacts ​

ts
getFabricArtifacts(options: FabricOptions): Promise<FabricArtifacts>

Get all the artifacts provided by fabric

Parameters ​

  • options: FabricOptions

Return Type ​

  • Promise<FabricArtifacts>

Defined in: packages/installer/fabric.ts:49

getFabricLoaderArtifact ​

ts
getFabricLoaderArtifact(minecraft: string, loader: string, options: FabricOptions): Promise<FabricLoaderArtifact>

Get fabric-loader artifact list by Minecraft version

Parameters ​

  • minecraft: string The minecraft version
  • loader: string The yarn-loader version
  • options: FabricOptions

Return Type ​

  • Promise<FabricLoaderArtifact>

Defined in: packages/installer/fabric.ts:103

getForgeVersionList ​

ts
getForgeVersionList(options: Object= {}): Promise<ForgeVersionList>

Query the webpage content from files.minecraftforge.net.

You can put the last query result to the fallback option. It will check if your old result is up-to-date. It will request a new page only when the fallback option is outdated.

Parameters ​

  • options: Object

Return Type ​

  • Promise<ForgeVersionList>

Defined in: packages/installer/forge.ts:555

getLabyModManifest ​

ts
getLabyModManifest(env: string= 'production', options: Object): Promise<LabyModManifest>

Parameters ​

  • env: string
  • options: Object

Return Type ​

  • Promise<LabyModManifest>

Defined in: packages/installer/labymod.ts:41

getLiteloaderVersionList ​

ts
getLiteloaderVersionList(options: Object= {}): Promise<LiteloaderVersionList>

Get or update the LiteLoader version list.

This will request liteloader offical json by default. You can replace the request by assigning the remote option.

Parameters ​

  • options: Object

Return Type ​

  • Promise<LiteloaderVersionList>

Defined in: packages/installer/liteloader.ts:112

getLoaderArtifactList ​

ts
getLoaderArtifactList(options: FabricOptions): Promise<FabricArtifactVersion[]>

Get fabric-loader artifact list

Parameters ​

  • options: FabricOptions

Return Type ​

  • Promise<FabricArtifactVersion[]>

Defined in: packages/installer/fabric.ts:80

getLoaderArtifactListFor ​

ts
getLoaderArtifactListFor(minecraft: string, options: FabricOptions): Promise<FabricLoaderArtifact[]>

Get fabric-loader artifact list by Minecraft version

Parameters ​

  • minecraft: string The minecraft version
  • options: FabricOptions

Return Type ​

  • Promise<FabricLoaderArtifact[]>

Defined in: packages/installer/fabric.ts:91

getPotentialJavaLocations ​

ts
getPotentialJavaLocations(): Promise<string[]>

Get all potential java locations for Minecraft.

On mac/linux, it will perform which java. On win32, it will perform where java

Return Type ​

  • Promise<string[]>

Defined in: packages/installer/java.ts:199

getQuiltVersionsList ​

ts
getQuiltVersionsList(options: GetQuiltOptions): Promise<QuiltArtifactVersion[]>

Parameters ​

  • options: GetQuiltOptions

Return Type ​

  • Promise<QuiltArtifactVersion[]>

Defined in: packages/installer/quilt.ts:54

getVersionList ​

ts
getVersionList(options: Object= {}): Promise<MinecraftVersionList>

Get and update the version list. This try to send http GET request to offical Minecraft metadata endpoint by default. You can swap the endpoint by passing url on remote in option.

Parameters ​

  • options: Object

Return Type ​

  • Promise<MinecraftVersionList>

Defined in: packages/installer/minecraft.ts:86

getYarnArtifactList ​

ts
getYarnArtifactList(options: FabricOptions): Promise<FabricArtifactVersion[]>

Get fabric-yarn artifact list

Parameters ​

  • options: FabricOptions

Return Type ​

  • Promise<FabricArtifactVersion[]>

Defined in: packages/installer/fabric.ts:59

getYarnArtifactListFor ​

ts
getYarnArtifactListFor(minecraft: string, options: FabricOptions): Promise<FabricArtifactVersion[]>

Get fabric-yarn artifact list by Minecraft version

Parameters ​

  • minecraft: string The Minecraft version
  • options: FabricOptions

Return Type ​

  • Promise<FabricArtifactVersion[]>

Defined in: packages/installer/fabric.ts:70

install ​

ts
install(versionMeta: MinecraftVersionBaseInfo, minecraft: MinecraftLocation, option: Options= {}): Promise<ResolvedVersion>

Install the Minecraft game to a location by version metadata.

This will install version json, version jar, and all dependencies (assets, libraries)

Parameters ​

  • versionMeta: MinecraftVersionBaseInfo The version metadata
  • minecraft: MinecraftLocation The Minecraft location
  • option: Options

Return Type ​

  • Promise<ResolvedVersion>

Defined in: packages/installer/minecraft.ts:199

installAssets ​

ts
installAssets(version: ResolvedVersion, options: AssetsOptions= {}): Promise<ResolvedVersion>

Install or check the assets to resolved version

Parameters ​

  • version: ResolvedVersion The target version
  • options: AssetsOptions The option to replace assets host url

Return Type ​

  • Promise<ResolvedVersion>

Defined in: packages/installer/minecraft.ts:229

installAssetsTask ​

ts
installAssetsTask(version: ResolvedVersion, options: AssetsOptions= {}): Task<ResolvedVersion>

Install or check the assets to resolved version

Parameters ​

  • version: ResolvedVersion The target version
  • options: AssetsOptions The option to replace assets host url

Return Type ​

  • Task<ResolvedVersion>

Defined in: packages/installer/minecraft.ts:311

installByInstallerTask ​

ts
installByInstallerTask(version: RequiredVersion, minecraft: MinecraftLocation, options: InstallForgeOptions): TaskRoutine<string>

Parameters ​

  • version: RequiredVersion
  • minecraft: MinecraftLocation
  • options: InstallForgeOptions

Return Type ​

  • TaskRoutine<string>

Defined in: packages/installer/forge.ts:478

installByProfile ​

ts
installByProfile(installProfile: InstallProfile, minecraft: MinecraftLocation, options: InstallProfileOption= {}): Promise<void>

Install by install profile. The install profile usually contains some preprocess should run before installing dependencies.

Parameters ​

  • installProfile: InstallProfile The install profile
  • minecraft: MinecraftLocation The minecraft location
  • options: InstallProfileOption The options to install

Return Type ​

  • Promise<void>

Defined in: packages/installer/profile.ts:174

installByProfileTask ​

ts
installByProfileTask(installProfile: InstallProfile, minecraft: MinecraftLocation, options: InstallProfileOption= {}): TaskRoutine<void>

Install by install profile. The install profile usually contains some preprocess should run before installing dependencies.

Parameters ​

  • installProfile: InstallProfile The install profile
  • minecraft: MinecraftLocation The minecraft location
  • options: InstallProfileOption The options to install

Return Type ​

  • TaskRoutine<void>

Defined in: packages/installer/profile.ts:185

installDependencies ​

ts
installDependencies(version: ResolvedVersion, options: Options): Promise<ResolvedVersion>

Install the completeness of the Minecraft game assets and libraries on a existed version.

Parameters ​

  • version: ResolvedVersion The resolved version produced by Version.parse
  • options: Options

Return Type ​

  • Promise<ResolvedVersion>

Defined in: packages/installer/minecraft.ts:219

installDependenciesTask ​

ts
installDependenciesTask(version: ResolvedVersion, options: Options= {}): Task<ResolvedVersion>

Install the completeness of the Minecraft game assets and libraries on a existed version.

Parameters ​

  • version: ResolvedVersion The resolved version produced by Version.parse
  • options: Options

Return Type ​

  • Task<ResolvedVersion>

Defined in: packages/installer/minecraft.ts:295

installFabric ​

ts
installFabric(loader: FabricLoaderArtifact, minecraft: MinecraftLocation, options: FabricInstallOptions= {}): Promise<string>

Generate fabric version json to the disk according to yarn and loader

Parameters ​

  • loader: FabricLoaderArtifact The loader artifact
  • minecraft: MinecraftLocation The Minecraft Location
  • options: FabricInstallOptions The options

Return Type ​

  • Promise<string>

Defined in: packages/installer/fabric.ts:151

installForge ​

ts
installForge(version: RequiredVersion, minecraft: MinecraftLocation, options: InstallForgeOptions): Promise<string>

Install forge to target location. Installation task for forge with mcversion >= 1.13 requires java installed on your pc.

Parameters ​

  • version: RequiredVersion The forge version meta
  • minecraft: MinecraftLocation
  • options: InstallForgeOptions

Return Type ​

  • Promise<string>

Defined in: packages/installer/forge.ts:532

installForgeTask ​

ts
installForgeTask(version: RequiredVersion, minecraft: MinecraftLocation, options: InstallForgeOptions= {}): Task<string>

Install forge to target location. Installation task for forge with mcversion >= 1.13 requires java installed on your pc.

Parameters ​

  • version: RequiredVersion The forge version meta
  • minecraft: MinecraftLocation
  • options: InstallForgeOptions

Return Type ​

  • Task<string>

Defined in: packages/installer/forge.ts:543

installJavaRuntimeTask ​

ts
installJavaRuntimeTask(options: InstallJavaRuntimeOptions): Task<void>

Install java runtime from java runtime manifest

Parameters ​

  • options: InstallJavaRuntimeOptions The options to install java runtime

Return Type ​

  • Task<void>

Defined in: packages/installer/java-runtime.ts:271

installJreFromMojang ​

ts
installJreFromMojang(options: InstallJavaOptions): Promise<void>

Install JRE from Mojang offical resource. It should install jdk 8.

Parameters ​

  • options: InstallJavaOptions The install options

Return Type ​

  • Promise<void>

Defined in: packages/installer/java.ts:127

installJreFromMojangTask ​

ts
installJreFromMojangTask(options: InstallJavaOptions): TaskRoutine<void>

Install JRE from Mojang offical resource. It should install jdk 8.

Parameters ​

  • options: InstallJavaOptions The install options

Return Type ​

  • TaskRoutine<void>

Defined in: packages/installer/java.ts:84

installLaby4Mod ​

ts
installLaby4Mod(manifest: LabyModManifest, tag: string, minecraft: MinecraftLocation, options: InstallLabyModOptions): Promise<string>

Parameters ​

  • manifest: LabyModManifest
  • tag: string
  • minecraft: MinecraftLocation
  • options: InstallLabyModOptions

Return Type ​

  • Promise<string>

Defined in: packages/installer/labymod.ts:146

installLabyMod4Task ​

ts
installLabyMod4Task(manifest: LabyModManifest, tag: string, minecraft: MinecraftLocation, options: InstallLabyModOptions): Task<string>

Parameters ​

  • manifest: LabyModManifest
  • tag: string
  • minecraft: MinecraftLocation
  • options: InstallLabyModOptions

Return Type ​

  • Task<string>

Defined in: packages/installer/labymod.ts:122

installLibraries ​

ts
installLibraries(version: ResolvedVersion, options: LibraryOptions= {}): Promise<void>

Install all the libraries of providing version

Parameters ​

  • version: ResolvedVersion The target version
  • options: LibraryOptions The library host swap option

Return Type ​

  • Promise<void>

Defined in: packages/installer/minecraft.ts:238

installLibrariesTask ​

ts
installLibrariesTask(version: InstallLibraryVersion, options: LibraryOptions= {}): Task<void>

Install all the libraries of providing version

Parameters ​

  • version: InstallLibraryVersion The target version
  • options: LibraryOptions The library host swap option

Return Type ​

  • Task<void>

Defined in: packages/installer/minecraft.ts:383

installLiteloader ​

ts
installLiteloader(versionMeta: LiteloaderVersion, location: MinecraftLocation, options: InstallOptions): Promise<string>

Install the liteloader to specific minecraft location.

This will install the liteloader amount on the corresponded Minecraft version by default. If you want to install over the forge. You should first install forge and pass the installed forge version id to the third param, like 1.12-forge-xxxx

Parameters ​

  • versionMeta: LiteloaderVersion The liteloader version metadata.
  • location: MinecraftLocation The minecraft location you want to install
  • options: InstallOptions

Return Type ​

  • Promise<string>

Defined in: packages/installer/liteloader.ts:135

installLiteloaderTask ​

ts
installLiteloaderTask(versionMeta: LiteloaderVersion, location: MinecraftLocation, options: InstallOptions= {}): Task<string>

Install the liteloader to specific minecraft location.

This will install the liteloader amount on the corresponded Minecraft version by default. If you want to install over the forge. You should first install forge and pass the installed forge version id to the third param, like 1.12-forge-xxxx

Parameters ​

  • versionMeta: LiteloaderVersion The liteloader version metadata.
  • location: MinecraftLocation The minecraft location you want to install
  • options: InstallOptions

Return Type ​

  • Task<string>

Defined in: packages/installer/liteloader.ts:183

installNeoForged ​

ts
installNeoForged(project: "forge" | "neoforge", version: string, minecraft: MinecraftLocation, options: InstallForgeOptions): Promise<string>

Parameters ​

  • project: "forge" | "neoforge"
  • version: string
  • minecraft: MinecraftLocation
  • options: InstallForgeOptions

Return Type ​

  • Promise<string>

Defined in: packages/installer/neoForged.ts:49

installNeoForgedTask ​

ts
installNeoForgedTask(project: "forge" | "neoforge", version: string, minecraft: MinecraftLocation, options: InstallForgeOptions): Task<string>

Parameters ​

  • project: "forge" | "neoforge"
  • version: string
  • minecraft: MinecraftLocation
  • options: InstallForgeOptions

Return Type ​

  • Task<string>

Defined in: packages/installer/neoForged.ts:53

installOptifine ​

ts
installOptifine(installer: string, minecraft: MinecraftLocation, options: InstallOptifineOptions): Promise<string>

Install optifine by optifine installer

Parameters ​

  • installer: string The installer jar file path
  • minecraft: MinecraftLocation The minecraft location
  • options: InstallOptifineOptions The option to install Might be changed and don't break the major version

Return Type ​

  • Promise<string>

Defined in: packages/installer/optifine.ts:60

installOptifineTask ​

ts
installOptifineTask(installer: string, minecraft: MinecraftLocation, options: InstallOptifineOptions= {}): TaskRoutine<string>

Install optifine by optifine installer task

Parameters ​

  • installer: string The installer jar file path
  • minecraft: MinecraftLocation The minecraft location
  • options: InstallOptifineOptions The option to install Might be changed and don't break the major version

Return Type ​

  • TaskRoutine<string>

Defined in: packages/installer/optifine.ts:87

installQuiltVersion ​

ts
installQuiltVersion(options: InstallQuiltVersionOptions): Promise<string>

Parameters ​

  • options: InstallQuiltVersionOptions

Return Type ​

  • Promise<string>

Defined in: packages/installer/quilt.ts:16

installResolvedAssetsTask ​

ts
installResolvedAssetsTask(assets: AssetInfo[], folder: MinecraftFolder, options: AssetsOptions= {}): TaskRoutine<void>

Only install several resolved assets.

Parameters ​

  • assets: AssetInfo[] The assets to install
  • folder: MinecraftFolder The minecraft folder
  • options: AssetsOptions The asset option

Return Type ​

  • TaskRoutine<void>

Defined in: packages/installer/minecraft.ts:409

installResolvedLibraries ​

ts
installResolvedLibraries(libraries: ResolvedLibrary[], minecraft: MinecraftLocation, option: LibraryOptions): Promise<void>

Only install several resolved libraries

Parameters ​

  • libraries: ResolvedLibrary[] The resolved libraries
  • minecraft: MinecraftLocation The minecraft location
  • option: LibraryOptions The install option

Return Type ​

  • Promise<void>

Defined in: packages/installer/minecraft.ts:248

installResolvedLibrariesTask ​

ts
installResolvedLibrariesTask(libraries: ResolvedLibrary[], minecraft: MinecraftLocation, option: LibraryOptions): Task<void>

Only install several resolved libraries

Parameters ​

  • libraries: ResolvedLibrary[] The resolved libraries
  • minecraft: MinecraftLocation The minecraft location
  • option: LibraryOptions The install option

Return Type ​

  • Task<void>

Defined in: packages/installer/minecraft.ts:399

installTask ​

ts
installTask(versionMeta: MinecraftVersionBaseInfo, minecraft: MinecraftLocation, options: Options= {}): Task<ResolvedVersion>

Install the Minecraft game to a location by version metadata.

This will install version json, version jar, and all dependencies (assets, libraries)

Parameters ​

  • versionMeta: MinecraftVersionBaseInfo The version metadata
  • minecraft: MinecraftLocation The Minecraft location
  • options: Options

Return Type ​

  • Task<ResolvedVersion>

Defined in: packages/installer/minecraft.ts:262

installVersion ​

ts
installVersion(versionMeta: MinecraftVersionBaseInfo, minecraft: MinecraftLocation, options: JarOption= {}): Promise<ResolvedVersion>

Only install the json/jar. Do not install dependencies.

Parameters ​

  • versionMeta: MinecraftVersionBaseInfo the version metadata; get from updateVersionMeta
  • minecraft: MinecraftLocation minecraft location
  • options: JarOption

Return Type ​

  • Promise<ResolvedVersion>

Defined in: packages/installer/minecraft.ts:209

installVersionTask ​

ts
installVersionTask(versionMeta: MinecraftVersionBaseInfo, minecraft: MinecraftLocation, options: JarOption= {}): Task<ResolvedVersion>

Only install the json/jar. Do not install dependencies.

Parameters ​

  • versionMeta: MinecraftVersionBaseInfo the version metadata; get from updateVersionMeta
  • minecraft: MinecraftLocation minecraft location
  • options: JarOption

Return Type ​

  • Task<ResolvedVersion>

Defined in: packages/installer/minecraft.ts:278

isForgeInstallerEntries ​

ts
isForgeInstallerEntries(entries: ForgeInstallerEntries): entries is ForgeInstallerEntriesPattern

Parameters ​

  • entries: ForgeInstallerEntries

Return Type ​

  • entries is ForgeInstallerEntriesPattern

Defined in: packages/installer/forge.ts:425

isLegacyForgeInstallerEntries ​

ts
isLegacyForgeInstallerEntries(entries: ForgeInstallerEntries): entries is Required<Pick<ForgeInstallerEntries, "installProfileJson" | "legacyUniversalJar">>

Parameters ​

  • entries: ForgeInstallerEntries

Return Type ​

  • entries is Required<Pick<ForgeInstallerEntries, "installProfileJson" | "legacyUniversalJar">>

Defined in: packages/installer/forge.ts:421

parseJavaVersion ​

ts
parseJavaVersion(versionText: string): Object | undefined

Parse version string and major version number from stderr of java process.

Parameters ​

  • versionText: string The stderr for java -version

Return Type ​

  • Object | undefined

Defined in: packages/installer/java.ts:165

postProcess ​

ts
postProcess(processors: PostProcessor[], minecraft: MinecraftFolder, javaOptions: SpawnJavaOptions): Promise<void>

Post process the post processors from InstallProfile.

Parameters ​

  • processors: PostProcessor[] The processor info
  • minecraft: MinecraftFolder The minecraft location
  • javaOptions: SpawnJavaOptions

Return Type ​

  • Promise<void>

Defined in: packages/installer/profile.ts:162

resolveJava ​

ts
resolveJava(path: string): Promise<JavaInfo | undefined>

Try to resolve a java info at this path. This will call java -version

Parameters ​

  • path: string The java exectuable path.

Return Type ​

  • Promise<JavaInfo | undefined>

Defined in: packages/installer/java.ts:135

resolveLibraryDownloadUrls ​

ts
resolveLibraryDownloadUrls(library: ResolvedLibrary, libraryOptions: LibraryOptions): string[]

Resolve a library download urls with fallback.

Parameters ​

  • library: ResolvedLibrary The resolved library
  • libraryOptions: LibraryOptions The library install options

Return Type ​

  • string[]

Defined in: packages/installer/minecraft.ts:565

resolveProcessors ​

ts
resolveProcessors(side: "server" | "client", installProfile: InstallProfile, minecraft: MinecraftFolder): Object[]

Resolve processors in install profile

Parameters ​

  • side: "server" | "client"
  • installProfile: InstallProfile
  • minecraft: MinecraftFolder

Return Type ​

  • Object[]

Defined in: packages/installer/profile.ts:77

scanLocalJava ​

ts
scanLocalJava(locations: string[]): Promise<JavaInfo[]>

Scan local java version on the disk.

It will check if the passed locations are the home of java. Notice that the locations should not be the executable, but the path of java installation, like JAVA_HOME.

This will call getPotentialJavaLocations and then resolveJava

Parameters ​

  • locations: string[] The location (like java_home) want to check.

Return Type ​

  • Promise<JavaInfo[]>

Defined in: packages/installer/java.ts:260

unpackForgeInstaller ​

ts
unpackForgeInstaller(zip: ZipFile, entries: ForgeInstallerEntriesPattern, forgeVersion: string, profile: InstallProfile, mc: MinecraftFolder, jarPath: string, options: InstallForgeOptions): Promise<string>

Unpack forge installer jar file content to the version library artifact directory.

Parameters ​

  • zip: ZipFile The forge jar file
  • entries: ForgeInstallerEntriesPattern The entries
  • forgeVersion: string The expected version of forge
  • profile: InstallProfile The forge install profile
  • mc: MinecraftFolder The minecraft location
  • jarPath: string
  • options: InstallForgeOptions

Return Type ​

  • Promise<string>

Defined in: packages/installer/forge.ts:344

walkForgeInstallerEntries ​

ts
walkForgeInstallerEntries(zip: ZipFile, forgeVersion: string): Promise<ForgeInstallerEntries>

Walk the forge installer file to find key entries

Parameters ​

  • zip: ZipFile THe forge instal
  • forgeVersion: string Forge version to install

Return Type ​

  • Promise<ForgeInstallerEntries>

Defined in: packages/installer/forge.ts:434

🏷️ Variables ​

DEFAULT_FORGE_MAVEN const ​

ts
DEFAULT_FORGE_MAVEN: "http://files.minecraftforge.net/maven" = 'http://files.minecraftforge.net/maven'

Defined in: packages/installer/forge.ts:137

DEFAULT_META_URL const ​

ts
DEFAULT_META_URL: "https://meta.quiltmc.org" = 'https://meta.quiltmc.org'

Defined in: packages/installer/quilt.ts:6

DEFAULT_RESOURCE_ROOT_URL const ​

ts
DEFAULT_RESOURCE_ROOT_URL: "https://resources.download.minecraft.net" = 'https://resources.download.minecraft.net'

Default resource/assets url root

Defined in: packages/installer/minecraft.ts:77

DEFAULT_RUNTIME_ALL_URL const ​

ts
DEFAULT_RUNTIME_ALL_URL: "https://launchermeta.mojang.com/v1/products/java-runtime/2ec0cc96c44e5a76b9c8b7c39df7210883d12871/all.json" = 'https://launchermeta.mojang.com/v1/products/java-runtime/2ec0cc96c44e5a76b9c8b7c39df7210883d12871/all.json'

Defined in: packages/installer/java-runtime.ts:133

DEFAULT_VERSION_MANIFEST const ​

ts
DEFAULT_VERSION_MANIFEST: "http://dl.liteloader.com/versions/versions.json" = 'http://dl.liteloader.com/versions/versions.json'

Defined in: packages/installer/liteloader.ts:8

DEFAULT_VERSION_MANIFEST_URL const ​

ts
DEFAULT_VERSION_MANIFEST_URL: "https://launchermeta.mojang.com/mc/game/version_manifest.json" = 'https://launchermeta.mojang.com/mc/game/version_manifest.json'

Default minecraft version manifest url.

Defined in: packages/installer/minecraft.ts:73

LOADER_MAVEN_URL const ​

ts
LOADER_MAVEN_URL: "https://maven.fabricmc.net/net/fabricmc/fabric-loader/maven-metadata.xml" = 'https://maven.fabricmc.net/net/fabricmc/fabric-loader/maven-metadata.xml'

Defined in: packages/installer/fabric.ts:7

YARN_MAVEN_URL const ​

ts
YARN_MAVEN_URL: "https://maven.fabricmc.net/net/fabricmc/yarn/maven-metadata.xml" = 'https://maven.fabricmc.net/net/fabricmc/yarn/maven-metadata.xml'

Defined in: packages/installer/fabric.ts:6

⏩ Type Aliases ​

AnyEntry ​

ts
AnyEntry: FileEntry | DirectoryEntry | LinkEntry

Defined in: packages/installer/java-runtime.ts:118

ForgeInstallerEntriesPattern ​

ts
ForgeInstallerEntriesPattern: ForgeInstallerEntries & Required<Pick<ForgeInstallerEntries, "versionJson" | "installProfileJson">>

Defined in: packages/installer/forge.ts:111

ForgeLegacyInstallerEntriesPattern ​

ts
ForgeLegacyInstallerEntriesPattern: Required<Pick<ForgeInstallerEntries, "installProfileJson" | "legacyUniversalJar">>

Defined in: packages/installer/forge.ts:112

InstallIssues ​

ts
InstallIssues: ProcessorIssue | LibraryIssue

Defined in: packages/installer/diagnose.ts:4

InstallLibraryVersion ​

ts
InstallLibraryVersion: Pick<ResolvedVersion, "libraries" | "minecraftDirectory">

Defined in: packages/installer/minecraft.ts:147

LibraryHost ​

ts
LibraryHost: Function

Defined in: packages/installer/minecraft.ts:14

Options ​

ts
Options: DownloadBaseOptions & ParallelTaskOptions & AssetsOptions & JarOption & LibraryOptions & InstallSideOption

Defined in: packages/installer/minecraft.ts:188

UnpackLZMAFunction ​

ts
UnpackLZMAFunction: Function | Function

Defined in: packages/installer/java.ts:52