UNPKG

minecraft-java-core

Version:

A library starting minecraft game NW.js and Electron.js

55 lines (54 loc) 1.83 kB
/** * @author Luuxis * Luuxis License v1.0 (voir fichier LICENSE pour les détails en FR/EN) */ import { EventEmitter } from 'events'; import type { FabricLoaderData } from '../../../types.js'; interface QuiltOptions { path: string; loader: { version: string; build: string; }; downloadFileMultiple?: number; } interface QuiltLibrary { name: string; url: string; rules?: Array<unknown>; } interface QuiltJSON { libraries: QuiltLibrary[]; [key: string]: unknown; } /** * This class handles fetching the Quilt loader metadata, * identifying the appropriate build for a given Minecraft version, * and downloading required libraries. */ export default class Quilt extends EventEmitter { private readonly options; private versionMinecraft; constructor(options?: QuiltOptions); /** * Fetches the Quilt loader metadata to identify the correct build for the specified * Minecraft version. If "latest" or "recommended" is requested, picks the most * recent or stable build accordingly. * * @param Loader An object describing where to fetch Quilt metadata and JSON. * @returns A QuiltJSON object on success, or an error object if something fails. */ downloadJson(Loader: FabricLoaderData): Promise<QuiltJSON | { error: string; }>; /** * Parses the Quilt JSON to determine which libraries need downloading, skipping * any that already exist or that are disqualified by "rules". Downloads them * in bulk using the Downloader utility. * * @param quiltJson A QuiltJSON object containing a list of libraries. * @returns The final list of libraries, or an error if something fails. */ downloadLibraries(quiltJson: QuiltJSON): Promise<QuiltLibrary[]>; } export {};