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