minerender 2.1.0-alpha.24 → 2.1.0-alpha.25
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 +3 -0
- package/dist/browser/index.d.ts +3 -0
- package/dist/browser/index.js +33 -2
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +33 -2
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +33 -2
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +3 -0
- package/dist/node/index.d.ts +3 -0
- package/dist/node/index.js +35 -2
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +35 -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,35 @@ 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 {
|
|
78306
|
+
texture = await this.resolveTexture(modelKey);
|
|
78307
|
+
}
|
|
78308
|
+
return { key: textureKey ?? modelKey, texture, layer, id: model.id };
|
|
78309
|
+
}
|
|
78310
|
+
static async resolveTexture(modelKey) {
|
|
78311
|
+
const path = isAssetKey(modelKey) ? modelKey.getFullPath() : modelKey.path;
|
|
78312
|
+
const key = new AssetKey(modelKey.namespace, path, void 0, void 0, "entity-models", ".json");
|
|
78313
|
+
return Caching.entityTextureCache.get(key.serialize(), async () => {
|
|
78314
|
+
const name2 = path.split("/").pop();
|
|
78315
|
+
for (const candidate of [path, `${path}/${name2}`]) {
|
|
78316
|
+
const texture = new AssetKey(modelKey.namespace, candidate, "textures", "entity", "assets", ".png");
|
|
78317
|
+
if (await ModelTextures.get(texture)) return texture;
|
|
78318
|
+
}
|
|
78319
|
+
const listKey = new AssetKey(modelKey.namespace, "_list", `${name2}_variant`, void 0, "data", ".json");
|
|
78320
|
+
const list = await AssetLoader.get(listKey, "list" /* LIST */);
|
|
78321
|
+
const files = list?.files.filter((file2) => file2.endsWith(".json") && file2 !== "_list.json");
|
|
78322
|
+
const file = files?.find((file2) => file2 === "temperate.json") ?? files?.[0];
|
|
78323
|
+
if (!file) return void 0;
|
|
78324
|
+
const variantKey = new AssetKey(modelKey.namespace, file.slice(0, -5), `${name2}_variant`, void 0, "data", ".json");
|
|
78325
|
+
const variant = await AssetLoader.get(variantKey, "json" /* JSON */);
|
|
78326
|
+
const assets = variant?.assets;
|
|
78327
|
+
const textureId = variant?.asset_id ?? (typeof assets?.wild === "string" ? assets.wild : Object.values(assets ?? {}).find((value) => typeof value === "string"));
|
|
78328
|
+
return typeof textureId === "string" ? AssetKey.parse("textures", textureId) : void 0;
|
|
78329
|
+
});
|
|
78300
78330
|
}
|
|
78301
78331
|
/** @deprecated Use getEntityList(); block entities share the entity dataset. */
|
|
78302
78332
|
static getBlockList() {
|
|
@@ -78800,6 +78830,7 @@ return ${compiler2.callType("value", tagType)}
|
|
|
78800
78830
|
super.dispose();
|
|
78801
78831
|
}
|
|
78802
78832
|
get textureKey() {
|
|
78833
|
+
if (this.entity.texture) return this.entity.texture;
|
|
78803
78834
|
const key = this.entity.key;
|
|
78804
78835
|
return new AssetKey(
|
|
78805
78836
|
key.namespace,
|