Skip to content

Class ModelLoader

The model loader load the resource

🏭 Constructors

constructor

ts
new ModelLoader(loader: ResourceLoader): ModelLoader

Parameters

  • loader: ResourceLoader The resource loader

Return Type

  • ModelLoader

Defined in: packages/resourcepack/modelLoader.ts:31

🏷️ Properties

loader

ts
loader: ResourceLoader

The resource loader

Defined in: packages/resourcepack/modelLoader.ts:31

models

ts
models: Record<string, Resolved> = {}

All the resolved model

Defined in: packages/resourcepack/modelLoader.ts:26

textures

ts
textures: Record<string, Resource> = {}

All required texture raw resources

Defined in: packages/resourcepack/modelLoader.ts:22

🔧 Methods

loadModel

ts
loadModel(modelPath: string, folder: string= 'block'): Promise<Resolved>

Load a model by search its parent. It will throw an error if the model is not found.

Parameters

  • modelPath: string
  • folder: string

Return Type

  • Promise<Resolved>

Defined in: packages/resourcepack/modelLoader.ts:36

findRealTexturePath

ts
findRealTexturePath(model: Resolved, variantKey: string): undefined | string

Parameters

  • model: Resolved
  • variantKey: string

Return Type

  • undefined | string

Defined in: packages/resourcepack/modelLoader.ts:9

Released under the MIT License.