Skip to content

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

ts
new ResourcePack(fs: FileSystem): ResourcePack

Parameters

  • fs: FileSystem

Return Type

  • ResourcePack

Defined in: packages/resourcepack/resourcePack.ts:123

🏷️ Properties

fs

ts
fs: FileSystem

Defined in: packages/resourcepack/resourcePack.ts:123

🔧 Methods

domains

ts
domains(): Promise<string[]>

The owned domain. You can think about the modids.

Return Type

  • Promise<string[]>

Defined in: packages/resourcepack/resourcePack.ts:186

get

ts
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

ts
getPath(location: ResourceLocation): string

Parameters

  • location: ResourceLocation

Return Type

  • string

Defined in: packages/resourcepack/resourcePack.ts:217

getUrl

ts
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

ts
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

ts
icon(): Promise<Uint8Array>

The icon of the resource pack

Return Type

  • Promise<Uint8Array>

Defined in: packages/resourcepack/resourcePack.ts:213

info

ts
info(): Promise<Pack>

The pack info, just like resource pack

Return Type

  • Promise<Pack>

Defined in: packages/resourcepack/resourcePack.ts:200

load

ts
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

ts
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

ts
open(resourcePack: string | Uint8Array | FileSystem): Promise<ResourcePack>

Parameters

  • resourcePack: string | Uint8Array | FileSystem

Return Type

  • Promise<ResourcePack>

Defined in: packages/resourcepack/resourcePack.ts:221

Released under the MIT License.