1 | # Forge-installer Module
|
2 |
|
3 | [![npm version](https://img.shields.io/npm/v/@xmcl/forge-installer.svg)](https://www.npmjs.com/package/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://travis-ci.org/voxelum/minecraft-launcher-core-node.svg)](https://travis-ci.org/voxelum/minecraft-launcher-core-node)
|
6 |
|
7 | This 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 |
|
11 | The module have three stage for installing new forge *(mcversion >= 1.13)*
|
12 |
|
13 | 1. 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`
|
18 | 2. Download Dependencies
|
19 | 1. Merge libraires in `installer_profile.json` and `<ver>.json`
|
20 | 2. Download them
|
21 | 3. Post processing forge jar
|
22 | 1. Parse `installer_profile.json`
|
23 | 2. Get the processors info and execute all of them.
|
24 |
|
25 | The `ForgeInstaller.install` will do all of them.
|
26 |
|
27 | The `ForgeInstaller.installByInstallerPartial` will do 2 and 3.
|
28 |
|
29 | If 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 | ### Forge Installation
|
32 |
|
33 | ```ts
|
34 | import { ForgeInstaller, ForgeWebPage } from "@xmcl/forge-installer";
|
35 | import { MinecraftLocation } from "@xmcl/util";
|
36 | const page: ForgeWebPage = await ForgeWebPage.getWebPage();
|
37 | const minecraftLocation: MinecraftLocation;
|
38 | const mcversion = page.mcversion; // mc version
|
39 | const firstVersionOnPage: ForgeWebPage.Version = page.versions[0];
|
40 | await ForgeInstaller.install(firstVersionOnPage, minecraftLocation);
|
41 | ```
|
42 |
|
43 | Get the forge version info and install forge from it.
|
44 |
|
45 | Notice that this installation doesn't ensure full libraries installation.
|
46 | Please run `Installer.installDependencies` afther that.
|
47 |
|
48 | The new 1.13 forge installation process requires java to run.
|
49 | Either you have `java` executable in your environment variable PATH,
|
50 | or you can assign java location by `ForgeInstaller.install(forgeVersionMeta, minecraftLocation, { java: yourJavaExecutablePath });`.
|
51 |
|
52 | If you use this auto installation process to install forge, please checkout [Lex's Patreon](https://www.patreon.com/LexManos).
|
53 | Consider support him to maintains forge.
|
54 |
|