-
-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathindex.d.ts
308 lines (295 loc) · 7.82 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
/// <reference types="node" />
declare module "minecraft-launcher-core" {
type OS = "windows" | "osx" | "linux";
interface IOverrides {
/**
* The amount of launch arguments specified in the version file before it adds the default again
*/
minArgs?: number;
minecraftJar?: string;
versionJson?: string;
versionName?: string;
/**
* Folder, where the game process generates folders like saves and resource packs.
*/
gameDirectory?: string;
/**
* Folder, where the Minecraft jar and version json are located.
*/
directory?: string;
natives?: string;
assetRoot?: string;
assetIndex?: string;
libraryRoot?: string;
/**
* Working directory of the java process.
*/
cwd?: string;
/**
* Whether or not the client is detached from the parent / launcher.
*/
detached?: boolean;
/**
* List of classes.
* All class paths are required if you use this.
*/
classes?: Array<string>;
/**
* Max sockets for downloadAsync.
*/
maxSockets?: number;
/**
* Urls to the Minecraft and Forge resource servers
*
* This is for launcher developers located in countries that have the Minecraft and Forge resource servers
* blocked for what ever reason. They obviously need to mirror the formatting of the original JSONs / file structures.
*/
url?: {
/**
* List of versions.
*/
meta?: string;
/**
* Minecraft resources.
*/
resource?: string;
/**
* Forge resources.
*/
mavenForge?: string;
/**
* for Forge only, you need to redefine the library url in the version json.
*/
defaultRepoForge?: string;
/**
*
*/
fallbackMaven?: string;
};
/**
* Version of the ForgeWrapper which MCLC uses. This allows us to launch modern Forge.
*/
fw?: {
baseUrl?: string;
version?: string;
sh1?: string;
size?: number;
};
logj4ConfigurationFile?: string;
}
interface ILauncherOptions {
/**
* Path or URL to the client package zip file.
*/
clientPackage?: string;
/**
* if true MCLC will remove the client package zip file after its finished extracting.
*/
removePackage?: boolean;
/**
* Path where you want the launcher to work in.
* This will usually be your .minecraft folder
*/
root: string;
/**
* OS override for minecraft natives
*
* @default will autodetect
*/
os?: OS;
/**
* Array of custom Minecraft arguments.
*/
customLaunchArgs?: Array<string>;
/**
* Array of custom Java arguments
*/
customArgs?: Array<string>;
/**
* Array of game argument feature flags
*/
features?: Array<string>;
/**
* minecraft version info
*/
version: {
/**
* Actual version.
*
* @example '1.16.4'
*/
number: string;
/**
* type of release, usually `release` or `snapshot`
*/
type: 'release' | 'snapshot' | string;
/**
* The name of the folder, jar file, and version json in the version folder.
*
* ` MCLC will look in the `versions` folder for this name
* @example '1.16.4-fabric'
*/
custom?: string;
};
memory: {
/**
* Min amount of memory being used by Minecraft.
*/
max: string | number;
/**
* Max amount of memory being used by Minecraft.
*/
min: string | number;
};
/**
* Path to Forge Jar.
*
* Versions below 1.13 should be the "universal" jar while versions above 1.13+ should be the "installer" jar
*/
forge?: string;
/**
* Path to the JRE executable file, will default to java if not entered.
*/
javaPath?: string;
proxy?: {
/**
* Host url to the proxy, don't include the port.
*/
host: string;
/**
* Username for the proxy.
*
* @default 8080
*/
port?: string;
/**
* Username for the proxy.
*/
username?: string;
/**
* Password for the proxy.
*/
password?: string;
};
/**
* Timeout on download requests.
*/
timeout?: number;
window?: {
/**
* Width of the Minecraft Client
*/
width?: number;
/**
* Height of the Minecraft Client
*/
height?: number;
/**
* Fullscreen the Minecraft Client.
*/
fullscreen?: boolean;
};
/**
* Allows the game to be launched directly into a world
*/
quickPlay?: {
/**
* The type of world you want to join.
* Note, that versions prior to 1.20 only support "legacy"
*/
type: 'singleplayer' | 'multiplayer' | 'realms' | 'legacy';
/**
* Represents the world you want to join
*
* For singleplayer this should be the folder name of the world
* For multiplayer this should be the IP address of the server
* For realms this should be the Realms ID
* legacy follows multiplayer format
*/
identifier: string;
/**
* The specified path for logging (relative to the run directory)
*/
path?: string;
};
/**
* Json object redefining paths for better customization
*/
overrides?: IOverrides;
authorization: Promise<IUser> | IUser;
/**
* Path of json cache.
*/
cache?: string;
}
interface IUser {
access_token: string;
client_token: string;
uuid: string;
name: string;
user_properties: Partial<any>;
meta?: {
type: "mojang" | "msa",
demo?: boolean
};
}
interface IProfile {
id: number;
name: string;
}
interface IAuthenticator {
/**
* @param username email if using a password, else the username
* @param password password for mojang account
*/
getAuth(username: string, password?: string): Promise<IUser>;
/**
*
* @param access_token Token being checked if it can be used to login with (online mode)
* @param client_token Client token being checked to see if there was a change of client (online mode)
*/
validate(
access_token: string,
client_token: string
): Promise<boolean | Partial<any>>;
/**
*
* @param access_token Token being checked if it can be used to login with (online mode)
* @param client_token Client token being checked to see if there was a change of client (online mode)
*/
refreshAuth(
access_token: string,
client_token: string,
): Promise<IUser>;
/**
*
* @param access_token Token being checked if it can be used to login with (online mode)
* @param client_token Client token being checked to see if there was a change of client (online mode)
*/
invalidate(
access_token: string,
client_token: string
): Promise<boolean | Partial<any>>;
/**
* @param username email if using a password, else the username
* @param password password for mojang account
*/
signOut(
username: string,
password: string
): Promise<boolean | Partial<any>>;
changeApiUrl(url: string): void;
}
import { EventEmitter } from 'events'
import { ChildProcessWithoutNullStreams } from 'child_process'
export class Client extends EventEmitter {
launch(options: ILauncherOptions): Promise<ChildProcessWithoutNullStreams | null>;
protected printVersion(): void;
protected createRootDirectory(): void;
protected createGameDirectory(): void;
protected extractPackage(): Promise<void>;
protected getModifyJson(): Promise<any>;
protected startMinecraft(launchArguments: string[]): ChildProcessWithoutNullStreams;
}
export const Authenticator: IAuthenticator;
}