Installer Module
Provide functions to install Minecraft client, libraries, and assets.
Usage
Install Minecraft
Fully install vanilla minecraft client including assets and libs.
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:
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:
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:
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.
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:
// 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
- assets
- version
To generally display this tree in UI. You can identify the task by its path
.
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:
// 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
// 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
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.
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:
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.
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.
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)
- Deploy forge installer jar
- Download installer jar
- Extract forge universal jar files in installer jar into
.minecraft/libraries
- Extract
version.json
into target version folder,.minecraft/versions/<ver>/<ver>.json
- Extract
installer_profile.json
into target version folder,.minecraft/versions/<ver>/installer_profile.json
- Download Dependencies
- Merge libraires in
installer_profile.json
and<ver>.json
- Download them
- Merge libraires in
- Post processing forge jar
- Parse
installer_profile.json
- Get the processors info and execute all of them.
- Parse
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)
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
diagnoseInstall(installProfile: InstallProfile, minecraftLocation: MinecraftLocation): 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
Return Type
Promise<InstallProfileIssueReport>
Defined in: packages/installer/diagnose.ts:33
fetchJavaRuntimeManifest
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
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
getDefaultEntryResolver(): EntryResolver
Return Type
EntryResolver
Defined in: packages/installer/unzip.ts:14
getFabricArtifacts
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
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
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:452
getLabyModManifest
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
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
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
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
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
getQuiltVersionsList(options: GetQuiltOptions): Promise<QuiltArtifactVersion[]>
Parameters
- options:
GetQuiltOptions
Return Type
Promise<QuiltArtifactVersion[]>
Defined in: packages/installer/quilt.ts:54
getVersionList
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
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
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
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
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
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
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:382
installByProfile
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:164
installByProfileTask
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:175
installDependencies
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
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
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
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:429
installForgeTask
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:440
installJavaRuntimeTask
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
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
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
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
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
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
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
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
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
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
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
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
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
installQuiltVersion(options: InstallQuiltVersionOptions): Promise<string>
Parameters
- options:
InstallQuiltVersionOptions
Return Type
Promise<string>
Defined in: packages/installer/quilt.ts:16
installResolvedAssetsTask
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
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
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
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
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
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
isForgeInstallerEntries(entries: ForgeInstallerEntries): entries is ForgeInstallerEntriesPattern
Parameters
- entries:
ForgeInstallerEntries
Return Type
entries is ForgeInstallerEntriesPattern
Defined in: packages/installer/forge.ts:329
isLegacyForgeInstallerEntries
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:325
parseJavaVersion
parseJavaVersion(versionText: string): Object | undefined
Parse version string and major version number from stderr of java process.
Parameters
- versionText:
string
The stderr forjava -version
Return Type
Object | undefined
Defined in: packages/installer/java.ts:165
postProcess
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:152
resolveJava
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
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
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
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
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:248
walkForgeInstallerEntries
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:338
🏷️ Variables
DEFAULT_FORGE_MAVEN
DEFAULT_FORGE_MAVEN: "http://files.minecraftforge.net/maven" = 'http://files.minecraftforge.net/maven'
Defined in: packages/installer/forge.ts:136
DEFAULT_META_URL
DEFAULT_META_URL: "https://meta.quiltmc.org" = 'https://meta.quiltmc.org'
Defined in: packages/installer/quilt.ts:6
DEFAULT_RESOURCE_ROOT_URL
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
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
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
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
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
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
AnyEntry: FileEntry | DirectoryEntry | LinkEntry
Defined in: packages/installer/java-runtime.ts:118
ForgeInstallerEntriesPattern
ForgeInstallerEntriesPattern: ForgeInstallerEntries & Required<Pick<ForgeInstallerEntries, "versionJson" | "installProfileJson">>
Defined in: packages/installer/forge.ts:110
ForgeLegacyInstallerEntriesPattern
ForgeLegacyInstallerEntriesPattern: Required<Pick<ForgeInstallerEntries, "installProfileJson" | "legacyUniversalJar">>
Defined in: packages/installer/forge.ts:111
InstallIssues
InstallIssues: ProcessorIssue | LibraryIssue
Defined in: packages/installer/diagnose.ts:4
InstallLibraryVersion
InstallLibraryVersion: Pick<ResolvedVersion, "libraries" | "minecraftDirectory">
Defined in: packages/installer/minecraft.ts:147
LibraryHost
LibraryHost: Function
Defined in: packages/installer/minecraft.ts:14
Options
Options: DownloadBaseOptions & ParallelTaskOptions & AssetsOptions & JarOption & LibraryOptions & InstallSideOption
Defined in: packages/installer/minecraft.ts:188
UnpackLZMAFunction
UnpackLZMAFunction: Function | Function
Defined in: packages/installer/java.ts:52