UNPKG

mc-piston-api

Version:

A library to assist with Minecraft's piston-meta API.

38 lines (37 loc) 1.22 kB
import { AssetIndex } from "./schema/AssetIndex"; import { GameVersionManifest } from "./schema/VersionInfo"; /** * Grabs an asset index from version metadata. * Requires usage of {@link getVersion | the getVersion method} to get the value for the version argument * * @example * Here's an example * ```ts * // Fetch the version metadata * const version = await getVersion("1.19.3"); * * // Fetch the asset index * const assetIndex = await getAssetIndex(version); * ``` * * @param version - The version metadata to grab the asset index from. * @returns The asset index for the version provided. */ export declare const getAssetIndex: (version: GameVersionManifest) => Promise<AssetIndex>; /** * Resolves a full asset download URL from an asset hash. * * @example * An example of getting this. * ```ts * // Fetch the asset index * const assetIndex = await getAssetIndex(version); * * // Get the asset URL * const assetUrl = resolveAssetURL(assetIndex.objects[Object.keys(assetIndex.objects)[0]].hash); * ``` * * @param hash The asset's hash, found in it's object metadata in the asset index. * @returns The full asset URL. */ export declare const resolveAssetURL: (hash: string) => string;