Class: AssetKey
Defined in: packages/minerender/src/assets/AssetKey.ts:40
Locates an asset by namespace, directory, extension, and optional asset root.
Extends
Constructors
Constructor
new AssetKey(
namespace,
path,
assetType?,
type?,
rootType?,
extension?,
root?
): AssetKey;Defined in: packages/minerender/src/assets/AssetKey.ts:52
Creates a key from separate path components. Use parse for a combined reference.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
namespace | string | undefined | - |
path | string | undefined | - |
assetType? | string | undefined | Asset directory, such as models, textures, or blockstates. |
type? | string | undefined | Subdirectory, such as block or item. |
rootType? | string | "assets" | Top-level directory, usually assets or data. |
extension? | string | ".json" | - |
root? | string | undefined | Base URL override for hosted asset sources. |
Returns
AssetKey
Overrides
Properties
| Property | Modifier | Type | Default value | Description | Inherited from | Defined in |
|---|---|---|---|---|---|---|
assetType? | public | string | undefined | Asset directory, such as models, textures, or blockstates. | - | packages/minerender/src/assets/AssetKey.ts:54 |
extension | public | string | ".json" | - | - | packages/minerender/src/assets/AssetKey.ts:57 |
isAssetKey | readonly | true | true | - | - | packages/minerender/src/assets/AssetKey.ts:42 |
namespace | readonly | string | undefined | - | BasicAssetKey.namespace | packages/minerender/src/assets/AssetKey.ts:53 |
path | readonly | string | undefined | - | BasicAssetKey.path | packages/minerender/src/assets/AssetKey.ts:53 |
root? | public | string | undefined | Base URL override for hosted asset sources. | - | packages/minerender/src/assets/AssetKey.ts:58 |
rootType | public | string | "assets" | Top-level directory, usually assets or data. | - | packages/minerender/src/assets/AssetKey.ts:56 |
type? | public | string | undefined | Subdirectory, such as block or item. | - | packages/minerender/src/assets/AssetKey.ts:55 |
Methods
getFullPath()
getFullPath(): string;Defined in: packages/minerender/src/assets/AssetKey.ts:112
Joins the type subdirectory and path without adding a namespace or file extension.
Returns
string
serialize()
serialize(): string;Defined in: packages/minerender/src/assets/AssetKey.ts:126
Returns a cache identifier that includes the explicit root or AssetLoader.ROOT.
Returns
string
Overrides
toNamespacedString()
toNamespacedString(): string;Defined in: packages/minerender/src/assets/AssetKey.ts:121
Returns
string
Overrides
BasicAssetKey.toNamespacedString
toString()
toString(): string;Defined in: packages/minerender/src/assets/AssetKey.ts:99
Returns a string representation of an object.
Returns
string
Overrides
parse()
static parse(
assetType,
str,
origin?
): AssetKey;Defined in: packages/minerender/src/assets/AssetKey.ts:74
Parses an asset reference such as minecraft:block/stone. A missing namespace defaults to the origin's namespace or minecraft.
Parameters
| Parameter | Type | Description |
|---|---|---|
assetType | string | Asset category, such as models or textures. |
str | string | Path with an optional namespace and file extension. |
origin? | AssetKey | Supplies the asset root, default namespace, and non-texture extension. |
Returns
AssetKey
A key with the matching extension removed from its path. Textures use .png; other assets use the origin's extension or .json.