Class ResourcePack
The Minecraft resource pack. Providing the loading resource from ResourceLocation
function. It's a wrap of FileSystem
which provides cross node/browser accssing.
🏭 Constructors
constructor
new ResourcePack(fs: FileSystem): ResourcePack
Parameters
- fs:
FileSystem
Return Type
ResourcePack
Defined in: packages/resourcepack/resourcePack.ts:123
🏷️ Properties
fs readonly
fs: FileSystem
Defined in: packages/resourcepack/resourcePack.ts:123
🔧 Methods
domains
domains(): Promise<string[]>
The owned domain. You can think about the modids.
Return Type
Promise<string[]>
Defined in: packages/resourcepack/resourcePack.ts:186
get
get(location: ResourceLocation): Promise<undefined | Resource>
Get the resource on the resource location.
It can be undefined if there is no resource at that location.
Parameters
- location:
ResourceLocation
THe resource location
Return Type
Promise<undefined | Resource>
Defined in: packages/resourcepack/resourcePack.ts:165
getPath private
getPath(location: ResourceLocation): string
Parameters
- location:
ResourceLocation
Return Type
string
Defined in: packages/resourcepack/resourcePack.ts:217
getUrl
getUrl(location: ResourceLocation): string
Get the url of the resource location. Please notice that this is depended on FileSystem
implementation of the getUrl
.
Parameters
- location:
ResourceLocation
Return Type
string
Defined in: packages/resourcepack/resourcePack.ts:154
has
has(location: ResourceLocation): Promise<boolean>
Does the resource pack has the resource
Parameters
- location:
ResourceLocation
Return Type
Promise<boolean>
Defined in: packages/resourcepack/resourcePack.ts:179
icon
icon(): Promise<Uint8Array>
The icon of the resource pack
Return Type
Promise<Uint8Array>
Defined in: packages/resourcepack/resourcePack.ts:213
info
info(): Promise<Pack>
The pack info, just like resource pack
Return Type
Promise<Pack>
Defined in: packages/resourcepack/resourcePack.ts:200
load
load(location: ResourceLocation, type: "utf-8" | "base64"): Promise<undefined | string | Uint8Array>
Load the resource content
Parameters
- location:
ResourceLocation
The resource location - type:
"utf-8" | "base64"
The output type of the resource
Return Type
Promise<undefined | string | Uint8Array>
Defined in: packages/resourcepack/resourcePack.ts:129
loadMetadata
loadMetadata(location: ResourceLocation): Promise<any>
Load the resource metadata which is localted at <resource-path>.mcmeta
Parameters
- location:
ResourceLocation
Return Type
Promise<any>
Defined in: packages/resourcepack/resourcePack.ts:140
open static
open(resourcePack: string | Uint8Array | FileSystem): Promise<ResourcePack>
Parameters
- resourcePack:
string | Uint8Array | FileSystem
Return Type
Promise<ResourcePack>
Defined in: packages/resourcepack/resourcePack.ts:221