UNPKG

dmclc

Version:

Dolphin Minecraft Launcher Core

99 lines (98 loc) 4.2 kB
/// <reference types="node" resolution-mode="require"/> /// <reference types="node" resolution-mode="require"/> import fs from "fs"; import * as i18next from "i18next"; import { Account } from "./auth/account.js"; import { Installer } from "./install.js"; import { Loader } from "./loaders/loader.js"; import { ContentService } from "./mods/download/ContentService.js"; import { ModpackFormat } from "./mods/modpack/Modpack.js"; import { Library } from "./schemas.js"; import { MinecraftVersion } from "./version.js"; export interface Progress { update(msg: string): void; close(): void; } export interface LauncherInterface { askUser<T extends string>(questions: Record<T, string>, message?: string): Promise<Record<T, string>>; askUserOne(localized: string, message?: string): Promise<string>; info(message: string, title: string): Promise<void>; warn(message: string, title: string): Promise<void>; error(message: string, title: string): Promise<void>; createProgress(steps: number, title: string, msg: string): Progress; } /** * The core of DMCLC. * @public */ export declare class Launcher { name: string; clientId: string; private launcherInterface; downloader?: ((url: string, filename: fs.PathLike, oldURL: string) => Promise<void>) | undefined; copy?: ((arg: string) => void) | undefined; /** @see os.platform */ systemType: NodeJS.Platform; natives: "linux" | "osx" | "windows"; /** BMCLAPI */ mirror: string | undefined; installer: Installer; /** All loaders. */ loaders: Map<string, Loader<unknown>>; /** All account types. */ accountTypes: Map<string, (data: Record<string, unknown>) => Account<any>>; contentServices: Map<string, ContentService<unknown>>; modpackFormats: Map<string, ModpackFormat>; /** Using Java executable */ usingJava: string; /** All installed versions. */ installedVersions: Map<string, MinecraftVersion>; i18n: i18next.TFunction; archInfo?: { specialArch: string; specialNatives: Record<string, Library>; }; envPaths: import("env-paths").Paths; private realRootPath; static readonly version = "4.4.0-beta.2"; /** * Create a new Launcher object. * @throws {@link FormattedError} * @param rootPath - path to .minecraft * @param name - Launcher name. * @param javaExec - {@link Launcher.usingJava} */ protected constructor(rootPath: string, name: string, javaExec: string, clientId: string, launcherInterface: LauncherInterface, downloader?: ((url: string, filename: fs.PathLike, oldURL: string) => Promise<void>) | undefined, copy?: ((arg: string) => void) | undefined); /** * Create a new Launcher object. * @throws {@link FormattedError} * @throws RequestError * @param rootPath - path to .minecraft * @param name - Launcher name. * @param javaExec - {@link Launcher.usingJava} * @param clientId - Microsoft identify platform APP id. * @param downloader - Custom downloading function. * @param copy - Custom clipboard function. * @returns Launcher. */ static create(rootPath: string, name: string, javaExec: string, clientId: string, launcherInterface: LauncherInterface, lang?: string, downloader?: (url: string, filename: fs.PathLike, oldURL: string) => Promise<void>, copy?: (arg: string) => void): Promise<Launcher>; private init; /** * Refresh installed versions. */ refreshInstalledVersion(): void; /** * The path to the ".minecraft" directory. */ get rootPath(): string; set rootPath(path: string); private getArchString; removeVersion(version: MinecraftVersion): Promise<void>; askUser<T extends string>(questions: Record<T, string>, message?: string): Promise<Record<T, string>>; askUserOne(localizeKey: string, message?: string): Promise<string>; info(message: string, title?: string): Promise<void>; warn(message: string, title?: string): Promise<void>; error(message: string, title?: string): Promise<void>; createProgress(steps: number, title: string, msg: string): Progress; setDownloadImages(): void; }