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 readonly

ts
loader: ResourceLoader

The resource loader

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

models readonly

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

All the resolved model

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

textures readonly

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 static

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

Parameters

  • model: Resolved
  • variantKey: string

Return Type

  • undefined | string

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