minerender 2.1.0-alpha.24 → 2.1.0-alpha.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.d.mts +4 -0
- package/dist/browser/index.d.ts +4 -0
- package/dist/browser/index.js +35 -2
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +35 -2
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +35 -2
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +4 -0
- package/dist/node/index.d.ts +4 -0
- package/dist/node/index.js +37 -2
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +37 -2
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -66380,7 +66380,8 @@ return ${compiler2.callType("value", tagType)}
|
|
|
66380
66380
|
this.listAssetCache,
|
|
66381
66381
|
this.defaultBlockStatesCache,
|
|
66382
66382
|
this.blockTintCache,
|
|
66383
|
-
this.entityModelCache
|
|
66383
|
+
this.entityModelCache,
|
|
66384
|
+
this.entityTextureCache
|
|
66384
66385
|
];
|
|
66385
66386
|
}
|
|
66386
66387
|
static clear() {
|
|
@@ -66424,6 +66425,7 @@ return ${compiler2.callType("value", tagType)}
|
|
|
66424
66425
|
_Caching.defaultBlockStatesCache = _Caching.createAssetCache();
|
|
66425
66426
|
_Caching.blockTintCache = _Caching.createAssetCache();
|
|
66426
66427
|
_Caching.entityModelCache = _Caching.createAssetCache();
|
|
66428
|
+
_Caching.entityTextureCache = _Caching.createAssetCache();
|
|
66427
66429
|
var Caching = _Caching;
|
|
66428
66430
|
|
|
66429
66431
|
// src/Geometries.ts
|
|
@@ -78296,7 +78298,37 @@ return ${compiler2.callType("value", tagType)}
|
|
|
78296
78298
|
if (!layer) {
|
|
78297
78299
|
throw new MineRenderError(`Entity ${model.id} has no layer "${layerName}". Available layers: ${Object.keys(model.layers).join(", ")}`);
|
|
78298
78300
|
}
|
|
78299
|
-
|
|
78301
|
+
let texture;
|
|
78302
|
+
if (textureKey) {
|
|
78303
|
+
const path2 = isAssetKey(textureKey) ? textureKey.getFullPath() : textureKey.path;
|
|
78304
|
+
texture = isAssetKey(textureKey) && textureKey.assetType === "textures" && path2.startsWith("entity/") ? textureKey : new AssetKey(textureKey.namespace, path2, "textures", "entity", "assets", ".png", isAssetKey(textureKey) ? textureKey.root : void 0);
|
|
78305
|
+
} else if (layer.textureLocation !== void 0) {
|
|
78306
|
+
texture = AssetKey.parse("textures", layer.textureLocation.replace(/^([^:]+:)?textures\//, "$1"));
|
|
78307
|
+
} else {
|
|
78308
|
+
texture = await this.resolveTexture(modelKey);
|
|
78309
|
+
}
|
|
78310
|
+
return { key: textureKey ?? modelKey, texture, layer, id: model.id };
|
|
78311
|
+
}
|
|
78312
|
+
static async resolveTexture(modelKey) {
|
|
78313
|
+
const path = isAssetKey(modelKey) ? modelKey.getFullPath() : modelKey.path;
|
|
78314
|
+
const key = new AssetKey(modelKey.namespace, path, void 0, void 0, "entity-models", ".json");
|
|
78315
|
+
return Caching.entityTextureCache.get(key.serialize(), async () => {
|
|
78316
|
+
const name2 = path.split("/").pop();
|
|
78317
|
+
for (const candidate of [path, `${path}/${name2}`]) {
|
|
78318
|
+
const texture = new AssetKey(modelKey.namespace, candidate, "textures", "entity", "assets", ".png");
|
|
78319
|
+
if (await ModelTextures.get(texture)) return texture;
|
|
78320
|
+
}
|
|
78321
|
+
const listKey = new AssetKey(modelKey.namespace, "_list", `${name2}_variant`, void 0, "data", ".json");
|
|
78322
|
+
const list = await AssetLoader.get(listKey, "list" /* LIST */);
|
|
78323
|
+
const files = list?.files.filter((file2) => file2.endsWith(".json") && file2 !== "_list.json");
|
|
78324
|
+
const file = files?.find((file2) => file2 === "temperate.json") ?? files?.[0];
|
|
78325
|
+
if (!file) return void 0;
|
|
78326
|
+
const variantKey = new AssetKey(modelKey.namespace, file.slice(0, -5), `${name2}_variant`, void 0, "data", ".json");
|
|
78327
|
+
const variant = await AssetLoader.get(variantKey, "json" /* JSON */);
|
|
78328
|
+
const assets = variant?.assets;
|
|
78329
|
+
const textureId = variant?.asset_id ?? (typeof assets?.wild === "string" ? assets.wild : Object.values(assets ?? {}).find((value) => typeof value === "string"));
|
|
78330
|
+
return typeof textureId === "string" ? AssetKey.parse("textures", textureId) : void 0;
|
|
78331
|
+
});
|
|
78300
78332
|
}
|
|
78301
78333
|
/** @deprecated Use getEntityList(); block entities share the entity dataset. */
|
|
78302
78334
|
static getBlockList() {
|
|
@@ -78800,6 +78832,7 @@ return ${compiler2.callType("value", tagType)}
|
|
|
78800
78832
|
super.dispose();
|
|
78801
78833
|
}
|
|
78802
78834
|
get textureKey() {
|
|
78835
|
+
if (this.entity.texture) return this.entity.texture;
|
|
78803
78836
|
const key = this.entity.key;
|
|
78804
78837
|
return new AssetKey(
|
|
78805
78838
|
key.namespace,
|