2020-07-30 03:47:30 +03:00
|
|
|
/// <reference types="node" />
|
|
|
|
|
|
|
|
declare module "minecraft-launcher-core" {
|
2021-01-18 17:13:47 +03:00
|
|
|
type OS = "windows" | "osx" | "linux";
|
|
|
|
|
|
|
|
interface IOverrides {
|
|
|
|
minArgs?: number;
|
|
|
|
minecraftJar?: string;
|
|
|
|
versionJson?: string;
|
2023-01-30 04:15:16 +03:00
|
|
|
gameDirectory?: string;
|
2021-01-18 17:13:47 +03:00
|
|
|
directory?: string;
|
|
|
|
natives?: string;
|
|
|
|
assetRoot?: string;
|
|
|
|
libraryRoot?: string;
|
|
|
|
cwd?: string;
|
|
|
|
detached?: boolean;
|
|
|
|
classes?: Array<string>;
|
|
|
|
maxSockets?: number;
|
|
|
|
url?: {
|
|
|
|
meta?: string;
|
|
|
|
resources?: string;
|
|
|
|
mavenForge?: string;
|
|
|
|
defaultRepoForge?: string;
|
|
|
|
fallbackMaven?: string;
|
|
|
|
};
|
2021-08-08 23:05:50 +03:00
|
|
|
fw?: {
|
|
|
|
baseUrl?: string;
|
|
|
|
version?: string;
|
|
|
|
sh1?: string;
|
|
|
|
size?: number;
|
|
|
|
};
|
2021-01-18 17:13:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
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 to installer being executed.
|
|
|
|
*/
|
|
|
|
installer?: string;
|
|
|
|
/**
|
|
|
|
* 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>;
|
2022-08-29 07:59:32 +03:00
|
|
|
/**
|
|
|
|
* Array of game argument feature flags
|
|
|
|
*/
|
|
|
|
features?: Array<string>;
|
2021-01-18 17:13:47 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*
|
2021-01-18 22:03:07 +03:00
|
|
|
* ` MCLC will look in the `versions` folder for this name
|
2021-01-18 17:13:47 +03:00
|
|
|
* @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;
|
|
|
|
server?: {
|
|
|
|
/**
|
|
|
|
* Host url to the server, don't include the port.
|
|
|
|
*/
|
|
|
|
host: string;
|
|
|
|
/**
|
|
|
|
* Port of the host url
|
|
|
|
*
|
|
|
|
* @default 25565
|
|
|
|
*/
|
|
|
|
port?: 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?: number;
|
|
|
|
height?: number;
|
|
|
|
fullscreen?: boolean;
|
|
|
|
};
|
|
|
|
overrides?: IOverrides;
|
|
|
|
authorization: Promise<IUser>;
|
2023-03-11 00:36:33 +03:00
|
|
|
/**
|
|
|
|
* Path of json cache.
|
|
|
|
*/
|
|
|
|
cache?: string;
|
2021-01-18 17:13:47 +03:00
|
|
|
}
|
|
|
|
|
2021-07-15 01:37:30 +03:00
|
|
|
|
|
|
|
|
2021-01-18 17:13:47 +03:00
|
|
|
interface IUser {
|
|
|
|
access_token: string;
|
|
|
|
client_token: string;
|
|
|
|
uuid: string;
|
|
|
|
name: string;
|
|
|
|
user_properties: Partial<any>;
|
2021-07-15 01:37:30 +03:00
|
|
|
meta?: {
|
|
|
|
type: "mojang" | "msa",
|
|
|
|
demo?: boolean
|
|
|
|
};
|
2021-01-18 17:13:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
interface IProfile {
|
|
|
|
id: number;
|
|
|
|
name: string;
|
2020-07-30 03:47:30 +03:00
|
|
|
}
|
2021-01-18 17:13:47 +03:00
|
|
|
|
|
|
|
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 {
|
2021-01-19 13:59:04 +03:00
|
|
|
launch(options: ILauncherOptions): Promise<ChildProcessWithoutNullStreams | null>;
|
2021-02-10 17:04:25 +03:00
|
|
|
protected printVersion(): void;
|
|
|
|
protected createRootDirectory(): void;
|
|
|
|
protected createGameDirectory(): void;
|
2021-03-30 20:45:33 +03:00
|
|
|
protected extractPackage(): Promise<void>;
|
|
|
|
protected getModifyJson(): Promise<any>;
|
2021-02-11 04:00:34 +03:00
|
|
|
protected startMinecraft(launchArguments: string[]): ChildProcessWithoutNullStreams;
|
2021-01-18 17:13:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
export const Authenticator: IAuthenticator;
|
|
|
|
}
|