/** * The resource pack module to read Minecraft resource pack just like Minecraft in-game. * * You can open the ResourcePack by {@link ResourcePack.open} and get resource by {@link ResourcePack.get}. * * Or you can just load resource pack metadata by {@link readPackMetaAndIcon}. * * @packageDocumentation */ import { FileSystem } from '@xmcl/system'; import { PackMeta } from './format'; /** * The Minecraft used object to map the game resource location. */ export declare class ResourceLocation { readonly domain: string; readonly path: string; static deconstruct(path: string, appendPath?: string): ResourceLocation; /** * build from texture path */ static ofTexturePath(location: string | ResourceLocation): ResourceLocation; /** * build from model path */ static ofBlockModelPath(location: string | ResourceLocation): ResourceLocation; static ofItemModelPath(location: string | ResourceLocation): ResourceLocation; static ofModelPath(location: string | ResourceLocation): ResourceLocation; /** * build from block state path */ static ofBlockStatePath(location: string | ResourceLocation): ResourceLocation; /** * from absoluted path */ static fromPath(location: string | ResourceLocation): ResourceLocation; static getAssetsPath(location: string | ResourceLocation): string; constructor(domain: string, path: string); toString(): string; } /** * The resource in the resource pack on a `ResourceLocation` * @see {@link ResourceLocation} */ export interface Resource { /** * The absolute location of the resource */ readonly location: ResourceLocation; /** * The real resource url which is used for reading the content of it. */ readonly url: string; /** * Read the resource content */ read(): Promise; read(encoding: undefined): Promise; read(encoding: 'utf-8' | 'base64'): Promise; read(encoding?: 'utf-8' | 'base64'): Promise; /** * Read the metadata of the resource */ readMetadata(): Promise; } /** * The Minecraft resource pack. Providing the loading resource from `ResourceLocation` function. * It's a wrap of `FileSystem` which provides cross node/browser accssing. * * @see {@link ResourceLocation} * @see {@link FileSystem} */ export declare class ResourcePack { readonly fs: FileSystem; constructor(fs: FileSystem); /** * Load the resource content * @param location The resource location * @param type The output type of the resource */ load(location: ResourceLocation, type?: 'utf-8' | 'base64'): Promise; /** * Load the resource metadata which is localted at .mcmeta */ loadMetadata(location: ResourceLocation): Promise; /** * Get the url of the resource location. * Please notice that this is depended on `FileSystem` implementation of the `getUrl`. * * @returns The absolute url like `file://` or `http://` depending on underlaying `FileSystem`. * @see {@link FileSystem} */ getUrl(location: ResourceLocation): string; /** * Get the resource on the resource location. * * It can be undefined if there is no resource at that location. * @param location THe resource location */ get(location: ResourceLocation): Promise; /** * Does the resource pack has the resource */ has(location: ResourceLocation): Promise; /** * The owned domain. You can think about the modids. */ domains(): Promise; /** * The pack info, just like resource pack */ info(): Promise; /** * The icon of the resource pack */ icon(): Promise; private getPath; static open(resourcePack: string | Uint8Array | FileSystem): Promise; } //# sourceMappingURL=resourcePack.d.ts.map