UNPKG

5.08 kBTypeScriptView Raw
1import { Installer } from "@xmcl/installer";
2import Task from "@xmcl/task";
3import { MinecraftFolder, MinecraftLocation, JavaExecutor } from "@xmcl/util";
4import { Version } from "@xmcl/version";
5/**
6 * The forge installer Module to install forge to the game
7 */
8export declare namespace ForgeInstaller {
9 /**
10 * The forge version metadata to download a forge
11 */
12 interface VersionMeta {
13 /**
14 * The installer info
15 */
16 installer: {
17 md5: string;
18 sha1: string;
19 /**
20 * The url path to concat with forge maven
21 */
22 path: string;
23 };
24 universal: {
25 md5: string;
26 sha1: string;
27 /**
28 * The url path to concat with forge maven
29 */
30 path: string;
31 };
32 /**
33 * The minecraft version
34 */
35 mcversion: string;
36 /**
37 * The forge version (without minecraft version)
38 */
39 version: string;
40 }
41 const DEFAULT_FORGE_MAVEN = "http://files.minecraftforge.net";
42 interface InstallProfile {
43 spec: number;
44 profile: string;
45 version: string;
46 json: string;
47 path: string;
48 minecraft: string;
49 data: {
50 [key: string]: {
51 client: string;
52 server: string;
53 };
54 };
55 processors: Array<{
56 jar: string;
57 classpath: string[];
58 args: string[];
59 outputs?: {
60 [key: string]: string;
61 };
62 }>;
63 libraries: Version.NormalLibrary[];
64 }
65 /**
66 * The forge diagnosis report. It may have some intersection with `Version.Diagnosis`.
67 */
68 interface Diagnosis {
69 /**
70 * When this flag is true, please reinstall totally
71 */
72 badInstall: boolean;
73 /**
74 * When only this is not empty
75 */
76 badProcessedFiles: Array<InstallProfile["processors"][number]>;
77 badVersionJson: boolean;
78 /**
79 * When this is not empty, please use `postProcessInstallProfile`
80 */
81 missingInstallDependencies: Version.NormalLibrary[];
82 missingBinpatch: boolean;
83 /**
84 * Alt for badProcessedFiles
85 */
86 missingSrgJar: boolean;
87 /**
88 * Alt for badProcessedFiles
89 */
90 missingMinecraftExtraJar: boolean;
91 /**
92 * Alt for badProcessedFiles
93 */
94 missingForgePatchesJar: boolean;
95 }
96 /**
97 * Diagnose for specific forge version. Majorly for the current installer forge. (mcversion >= 1.13)
98 *
99 * Don't use this with the version less than 1.13
100 * @param versionOrProfile If the version string present, it will try to find the installer profile under version folder. Otherwise it will use presented installer profile to diagnose
101 * @param minecraft The minecraft location.
102 */
103 function diagnoseForgeVersion(versionOrProfile: string | InstallProfile, minecraft: MinecraftLocation): Promise<Diagnosis>;
104 /**
105 * Post processing function for new forge installer (mcversion >= 1.13). You can use this with `ForgeInstaller.diagnose`.
106 *
107 * @param mc The minecraft location
108 * @param proc The processor
109 * @param java The java executor
110 */
111 function postProcess(mc: MinecraftFolder, proc: InstallProfile["processors"][number], java: JavaExecutor): Promise<void>;
112 /**
113 * Install for forge installer step 2 and 3.
114 * @param version The version string or installer profile
115 * @param minecraft The minecraft location
116 */
117 function installByInstallerPartialTask(version: string | InstallProfile, minecraft: MinecraftLocation, option?: {
118 java?: JavaExecutor;
119 } & Installer.LibraryOption): (context: Task.Context) => Promise<void>;
120 /**
121 * Install for forge installer step 2 and 3.
122 * @param version The version string or installer profile
123 * @param minecraft The minecraft location
124 */
125 function installByInstallerPartial(version: string | InstallProfile, minecraft: MinecraftLocation, option?: {
126 java?: JavaExecutor;
127 } & Installer.LibraryOption): Promise<void>;
128 /**
129 * Install forge to target location.
130 * Installation task for forge with mcversion >= 1.13 requires java installed on your pc.
131 * @param version The forge version meta
132 */
133 function install(version: VersionMeta, minecraft: MinecraftLocation, option?: {
134 maven?: string;
135 java?: JavaExecutor;
136 }): Promise<string>;
137 /**
138 * Install forge to target location.
139 * Installation task for forge with mcversion >= 1.13 requires java installed on your pc.
140 * @param version The forge version meta
141 */
142 function installTask(version: VersionMeta, minecraft: MinecraftLocation, option?: {
143 maven?: string;
144 java?: JavaExecutor;
145 } & Installer.LibraryOption): Task<string>;
146}
147export * from "./forgeweb";
148export default ForgeInstaller;