UNPKG

2.75 kBMarkdownView Raw
1# Forge-installer Module
2
3[![npm version](https://img.shields.io/npm/v/@xmcl/forge-installer.svg)](https://www.npmjs.com/package/@xmcl/forge-installer)
4[![npm](https://img.shields.io/npm/l/@xmcl/minecraft-launcher-core.svg)](https://github.com/voxelum/minecraft-launcher-core-node/blob/master/LICENSE)
5[![Build Status](https://github.com/voxelum/minecraft-launcher-core-node/workflows/Release%20Pre-Check/badge.svg)](https://github.com/voxelum/minecraft-launcher-core-node/workflows/Release%20Pre-Check/badge.svg)
6
7This is a sub-module belong to [minecraft-launcher-core](https://www.npmjs.com/package/@xmcl/minecraft-launcher-core) module. You can still use this individually.
8
9## New Forge Installing process
10
11The module have three stage for installing new forge *(mcversion >= 1.13)*
12
131. Deploy forge installer jar
14 1. Download installer jar
15 2. Extract forge universal jar files in installer jar into `.minecraft/libraries`
16 3. Extract `version.json` into target version folder, `.minecraft/versions/<ver>/<ver>.json`
17 4. Extract `installer_profile.json` into target version folder, `.minecraft/versions/<ver>/installer_profile.json`
182. Download Dependencies
19 1. Merge libraires in `installer_profile.json` and `<ver>.json`
20 2. Download them
213. Post processing forge jar
22 1. Parse `installer_profile.json`
23 2. Get the processors info and execute all of them.
24
25The `ForgeInstaller.install` will do all of them.
26
27The `ForgeInstaller.installByInstallerPartial` will do 2 and 3.
28
29If you want to just do step 3, you can use `ForgeInstaller.diagnose` and find which libraries is break and use `ForgeInstaller.postProcess` to handle it.
30
31## Usage
32
33### Forge Installation
34
35Get the forge version info and install forge from it.
36
37```ts
38 import { ForgeInstaller, ForgeWebPage } from "@xmcl/forge-installer";
39 import { MinecraftLocation } from "@xmcl/util";
40 const page: ForgeWebPage = await ForgeWebPage.getWebPage();
41 const minecraftLocation: MinecraftLocation;
42 const mcversion = page.mcversion; // mc version
43 const firstVersionOnPage: ForgeWebPage.Version = page.versions[0];
44 await ForgeInstaller.install(firstVersionOnPage, minecraftLocation);
45```
46
47Notice that this installation doesn't ensure full libraries installation.
48Please run `Installer.installDependencies` afther that.
49
50The new 1.13 forge installation process requires java to run.
51Either you have `java` executable in your environment variable PATH,
52or you can assign java location by `ForgeInstaller.install(forgeVersionMeta, minecraftLocation, { java: yourJavaExecutablePath });`.
53
54If you use this auto installation process to install forge, please checkout [Lex's Patreon](https://www.patreon.com/LexManos).
55Consider support him to maintains forge.
56