minerender 2.1.0-alpha.140 → 2.1.0-alpha.141
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/esm/assets/BlockEntities.mjs +2 -0
- package/dist/browser/esm/assets/BlockEntities.mjs.map +1 -1
- package/dist/browser/esm/assets/Entities.mjs +29 -3
- package/dist/browser/esm/assets/Entities.mjs.map +1 -1
- package/dist/browser/esm/assets/MineRenderData.mjs +8 -17
- package/dist/browser/esm/assets/MineRenderData.mjs.map +1 -1
- package/dist/browser/esm/assets/_versions/DatasetVersions.mjs +22 -0
- package/dist/browser/esm/assets/_versions/DatasetVersions.mjs.map +1 -0
- package/dist/browser/esm/cache/Caching.mjs +2 -0
- package/dist/browser/esm/cache/Caching.mjs.map +1 -1
- package/dist/browser/esm/index.browser.d.mts +7 -0
- package/dist/browser/index.d.ts +7 -0
- package/dist/browser/index.js +176 -132
- package/dist/browser/index.js.map +1 -1
- package/dist/bundle.js +185 -138
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +7 -0
- package/dist/node/index.d.ts +7 -0
- package/dist/node/index.js +178 -132
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +178 -132
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -35699,6 +35699,7 @@ void main() {
|
|
|
35699
35699
|
this.entityTextureCache,
|
|
35700
35700
|
this.entityAnimationCache,
|
|
35701
35701
|
this.blockEntityIndexCache,
|
|
35702
|
+
this.entityDatasetVersionCache,
|
|
35702
35703
|
this.fontCache,
|
|
35703
35704
|
this.unihexCache,
|
|
35704
35705
|
this.bannerPatternCache,
|
|
@@ -35754,6 +35755,7 @@ void main() {
|
|
|
35754
35755
|
_Caching.entityTextureCache = _Caching.createAssetCache();
|
|
35755
35756
|
_Caching.entityAnimationCache = _Caching.createAssetCache();
|
|
35756
35757
|
_Caching.blockEntityIndexCache = _Caching.createAssetCache();
|
|
35758
|
+
_Caching.entityDatasetVersionCache = _Caching.createAssetCache();
|
|
35757
35759
|
_Caching.unihexCache = _Caching.createAssetCache();
|
|
35758
35760
|
_Caching.fontCache = _Caching.createAssetCache();
|
|
35759
35761
|
_Caching.bannerPatternCache = _Caching.createAssetCache();
|
|
@@ -82360,26 +82362,45 @@ ${key}` : key;
|
|
|
82360
82362
|
}
|
|
82361
82363
|
});
|
|
82362
82364
|
|
|
82365
|
+
// src/assets/_versions/DatasetVersions.ts
|
|
82366
|
+
var parseRelease, compare2, nearestRelease;
|
|
82367
|
+
var init_DatasetVersions = __esm({
|
|
82368
|
+
"src/assets/_versions/DatasetVersions.ts"() {
|
|
82369
|
+
init_dirname();
|
|
82370
|
+
init_buffer2();
|
|
82371
|
+
init_process2();
|
|
82372
|
+
parseRelease = (value) => /^\d+\.\d+(?:\.\d+)?$/.test(value) ? value.split(".").map(Number) : void 0;
|
|
82373
|
+
compare2 = (left, right) => {
|
|
82374
|
+
for (let i4 = 0; i4 < 3; i4++) {
|
|
82375
|
+
const difference = (left[i4] ?? 0) - (right[i4] ?? 0);
|
|
82376
|
+
if (difference) return difference;
|
|
82377
|
+
}
|
|
82378
|
+
return 0;
|
|
82379
|
+
};
|
|
82380
|
+
nearestRelease = (requestedVersion, published) => {
|
|
82381
|
+
const requested = parseRelease(requestedVersion);
|
|
82382
|
+
if (!requested) return void 0;
|
|
82383
|
+
const versions2 = published.map((name2) => ({ name: name2, number: parseRelease(name2) })).filter((entry) => !!entry.number).sort((left, right) => compare2(left.number, right.number));
|
|
82384
|
+
const sameLine = versions2.filter((entry) => entry.number[0] === requested[0] && entry.number[1] === requested[1]);
|
|
82385
|
+
const selected = sameLine.sort((left, right) => Math.abs((left.number[2] ?? 0) - (requested[2] ?? 0)) - Math.abs((right.number[2] ?? 0) - (requested[2] ?? 0)) || compare2(left.number, right.number))[0] ?? versions2.filter((entry) => compare2(entry.number, requested) <= 0).pop() ?? versions2[0];
|
|
82386
|
+
return selected?.name;
|
|
82387
|
+
};
|
|
82388
|
+
}
|
|
82389
|
+
});
|
|
82390
|
+
|
|
82363
82391
|
// src/assets/MineRenderData.ts
|
|
82364
|
-
var object2,
|
|
82392
|
+
var object2, MineRenderData;
|
|
82365
82393
|
var init_MineRenderData = __esm({
|
|
82366
82394
|
"src/assets/MineRenderData.ts"() {
|
|
82367
82395
|
init_dirname();
|
|
82368
82396
|
init_buffer2();
|
|
82369
82397
|
init_process2();
|
|
82398
|
+
init_DatasetVersions();
|
|
82370
82399
|
init_AssetKey();
|
|
82371
82400
|
init_AssetLoader();
|
|
82372
82401
|
init_AssetParsers();
|
|
82373
82402
|
init_Caching();
|
|
82374
82403
|
object2 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
82375
|
-
release2 = (value) => /^\d+\.\d+(?:\.\d+)?$/.test(value) ? value.split(".").map(Number) : void 0;
|
|
82376
|
-
compare2 = (left, right) => {
|
|
82377
|
-
for (let i4 = 0; i4 < 3; i4++) {
|
|
82378
|
-
const difference = (left[i4] ?? 0) - (right[i4] ?? 0);
|
|
82379
|
-
if (difference) return difference;
|
|
82380
|
-
}
|
|
82381
|
-
return 0;
|
|
82382
|
-
};
|
|
82383
82404
|
MineRenderData = class {
|
|
82384
82405
|
/** Loads one registry. Missing files and invalid data reject the request. */
|
|
82385
82406
|
static async get(dataset, root) {
|
|
@@ -82409,9 +82430,9 @@ ${key}` : key;
|
|
|
82409
82430
|
const scope = AssetLoader.persistentScope;
|
|
82410
82431
|
return this.cached(`resolve:${requestRoot === void 0 ? "sources" : "explicit"}:${root}`, scope, defaultRoot, async () => {
|
|
82411
82432
|
const requestedVersion = root.slice(root.lastIndexOf("/") + 1);
|
|
82412
|
-
let manifest = await this.manifest(root, requestRoot !== void 0 &&
|
|
82433
|
+
let manifest = await this.manifest(root, requestRoot !== void 0 && parseRelease(requestedVersion) ? requestedVersion : void 0, requestRoot);
|
|
82413
82434
|
if (manifest) return { requestedVersion, version: manifest.minecraftVersion, root, manifest };
|
|
82414
|
-
const requested =
|
|
82435
|
+
const requested = parseRelease(requestedVersion);
|
|
82415
82436
|
if (!requested) {
|
|
82416
82437
|
throw new Error(`No MineRender data is published for ${requestedVersion}; automatic fallback requires a release`);
|
|
82417
82438
|
}
|
|
@@ -82423,14 +82444,12 @@ ${key}` : key;
|
|
|
82423
82444
|
}
|
|
82424
82445
|
return value.versions;
|
|
82425
82446
|
});
|
|
82426
|
-
const
|
|
82427
|
-
const sameLine = versions2.filter((entry) => entry.number[0] === requested[0] && entry.number[1] === requested[1]);
|
|
82428
|
-
const selected = sameLine.sort((left, right) => Math.abs((left.number[2] ?? 0) - (requested[2] ?? 0)) - Math.abs((right.number[2] ?? 0) - (requested[2] ?? 0)) || compare2(left.number, right.number))[0] ?? versions2.filter((entry) => compare2(entry.number, requested) <= 0).pop() ?? versions2[0];
|
|
82447
|
+
const selected = nearestRelease(requestedVersion, index.map((entry) => entry.name));
|
|
82429
82448
|
if (!selected) throw new Error(`No compatible MineRender data is published for ${requestedVersion}`);
|
|
82430
|
-
const resolvedRoot = `${base}/${selected
|
|
82431
|
-
manifest = await this.manifest(resolvedRoot, selected
|
|
82432
|
-
if (!manifest) throw new Error(`Missing MineRender manifest for published version ${selected
|
|
82433
|
-
return { requestedVersion, version: selected
|
|
82449
|
+
const resolvedRoot = `${base}/${selected}`;
|
|
82450
|
+
manifest = await this.manifest(resolvedRoot, selected, resolvedRoot);
|
|
82451
|
+
if (!manifest) throw new Error(`Missing MineRender manifest for published version ${selected}`);
|
|
82452
|
+
return { requestedVersion, version: selected, root: resolvedRoot, manifest };
|
|
82434
82453
|
});
|
|
82435
82454
|
}
|
|
82436
82455
|
static async manifest(root, expectedVersion, requestRoot) {
|
|
@@ -83592,119 +83611,6 @@ ${key}` : key, async () => {
|
|
|
83592
83611
|
}
|
|
83593
83612
|
});
|
|
83594
83613
|
|
|
83595
|
-
// src/assets/BlockEntities.ts
|
|
83596
|
-
var log12, BlockEntities;
|
|
83597
|
-
var init_BlockEntities = __esm({
|
|
83598
|
-
"src/assets/BlockEntities.ts"() {
|
|
83599
|
-
init_dirname();
|
|
83600
|
-
init_buffer2();
|
|
83601
|
-
init_process2();
|
|
83602
|
-
init_three_module();
|
|
83603
|
-
init_AssetKey();
|
|
83604
|
-
init_AssetLoader();
|
|
83605
|
-
init_source();
|
|
83606
|
-
init_Caching();
|
|
83607
|
-
init_log();
|
|
83608
|
-
log12 = logger("BlockEntities");
|
|
83609
|
-
BlockEntities = class {
|
|
83610
|
-
/**
|
|
83611
|
-
* Loads the block index of a version. Versions and sources without one yield an empty index, and so does
|
|
83612
|
-
* a failed load: the index is optional, and blocks must not retry or fail with it one by one. The empty
|
|
83613
|
-
* result is cached like any other; `Caching.clear()` or `AssetLoader.setVersion()` forces a new attempt.
|
|
83614
|
-
*/
|
|
83615
|
-
static async getIndex(root) {
|
|
83616
|
-
const key = new AssetKey("entity-models", "blocks", void 0, void 0, void 0, ".json", root);
|
|
83617
|
-
key.rootType = void 0;
|
|
83618
|
-
const index = await Caching.blockEntityIndexCache.get(key.serialize(), async () => {
|
|
83619
|
-
try {
|
|
83620
|
-
return await AssetLoader.get(key, "json" /* JSON */) ?? {};
|
|
83621
|
-
} catch (error2) {
|
|
83622
|
-
log12.warn("Could not load the block entity index; block entities are drawn as plain block models", error2);
|
|
83623
|
-
return {};
|
|
83624
|
-
}
|
|
83625
|
-
});
|
|
83626
|
-
return index ?? {};
|
|
83627
|
-
}
|
|
83628
|
-
/** The index entry of a block ID such as `minecraft:chest`. */
|
|
83629
|
-
static entry(index, block) {
|
|
83630
|
-
const entry = Object.prototype.hasOwnProperty.call(index, block) ? index[block] : void 0;
|
|
83631
|
-
return Array.isArray(entry?.parts) ? entry : void 0;
|
|
83632
|
-
}
|
|
83633
|
-
/** Selects the parts and placement for a block ID such as `minecraft:chest`; undefined when nothing is drawn. */
|
|
83634
|
-
static resolve(index, block, state = {}) {
|
|
83635
|
-
const entry = this.entry(index, block);
|
|
83636
|
-
if (!entry) return void 0;
|
|
83637
|
-
const value = (property) => String(state[property]).toLowerCase();
|
|
83638
|
-
const parts = entry.parts.filter((part) => Object.entries(part.when ?? {}).every(([property, values]) => String(values).split("|").includes(value(property))));
|
|
83639
|
-
if (!parts.length) return void 0;
|
|
83640
|
-
let rotation = 0;
|
|
83641
|
-
if (entry.rotation) {
|
|
83642
|
-
const selected = value(entry.rotation.property);
|
|
83643
|
-
rotation = "degrees" in entry.rotation ? entry.rotation.degrees[selected] : Number(selected) * entry.rotation.step;
|
|
83644
|
-
if (!Number.isFinite(rotation)) rotation = 0;
|
|
83645
|
-
}
|
|
83646
|
-
return { parts, rotation, translation: entry.translation ?? [0, 0, 0] };
|
|
83647
|
-
}
|
|
83648
|
-
/** Placement in block space (0..16 per axis), applied on top of the model's own transform. */
|
|
83649
|
-
static matrix(resolved, matrix = new Matrix4()) {
|
|
83650
|
-
return matrix.makeTranslation(8, 0, 8).multiply(new Matrix4().makeRotationY(resolved.rotation * Math.PI / 180)).multiply(new Matrix4().makeTranslation(resolved.translation[0] - 8, resolved.translation[1], resolved.translation[2] - 8));
|
|
83651
|
-
}
|
|
83652
|
-
};
|
|
83653
|
-
}
|
|
83654
|
-
});
|
|
83655
|
-
|
|
83656
|
-
// src/assets/DecoratedPots.ts
|
|
83657
|
-
var POTTERY_SHERDS, DecoratedPots;
|
|
83658
|
-
var init_DecoratedPots = __esm({
|
|
83659
|
-
"src/assets/DecoratedPots.ts"() {
|
|
83660
|
-
init_dirname();
|
|
83661
|
-
init_buffer2();
|
|
83662
|
-
init_process2();
|
|
83663
|
-
init_AssetKey();
|
|
83664
|
-
POTTERY_SHERDS = Object.freeze([
|
|
83665
|
-
"angler",
|
|
83666
|
-
"archer",
|
|
83667
|
-
"arms_up",
|
|
83668
|
-
"blade",
|
|
83669
|
-
"brewer",
|
|
83670
|
-
"burn",
|
|
83671
|
-
"danger",
|
|
83672
|
-
"explorer",
|
|
83673
|
-
"flow",
|
|
83674
|
-
"friend",
|
|
83675
|
-
"guster",
|
|
83676
|
-
"heart",
|
|
83677
|
-
"heartbreak",
|
|
83678
|
-
"howl",
|
|
83679
|
-
"miner",
|
|
83680
|
-
"mourner",
|
|
83681
|
-
"plenty",
|
|
83682
|
-
"prize",
|
|
83683
|
-
"scrape",
|
|
83684
|
-
"sheaf",
|
|
83685
|
-
"shelter",
|
|
83686
|
-
"skull",
|
|
83687
|
-
"snort"
|
|
83688
|
-
].map((pattern2) => `minecraft:${pattern2}_pottery_sherd`));
|
|
83689
|
-
DecoratedPots = class {
|
|
83690
|
-
/** Reads up to four item IDs in back, left, right, front order; missing and unmapped items use plain sides. */
|
|
83691
|
-
static getSideTextures(value, root) {
|
|
83692
|
-
const items = value === void 0 ? [] : value;
|
|
83693
|
-
if (!Array.isArray(items) || items.length > 4) throw new Error("pot_decorations must be an array of at most four item IDs");
|
|
83694
|
-
const textures = items.map((item) => {
|
|
83695
|
-
if (!isResourceLocation(item)) throw new Error("Pot decorations must be item identifiers");
|
|
83696
|
-
const id = item.includes(":") ? item : `minecraft:${item}`;
|
|
83697
|
-
return POTTERY_SHERDS.includes(id) ? id.slice("minecraft:".length).replace(/_sherd$/, "_pattern") : "decorated_pot_side";
|
|
83698
|
-
});
|
|
83699
|
-
return Object.fromEntries(["back", "left", "right", "front"].map((side, index) => [
|
|
83700
|
-
side,
|
|
83701
|
-
new AssetKey("minecraft", `decorated_pot/${textures[index] ?? "decorated_pot_side"}`, "textures", "entity", "assets", ".png", root)
|
|
83702
|
-
]));
|
|
83703
|
-
}
|
|
83704
|
-
};
|
|
83705
|
-
}
|
|
83706
|
-
});
|
|
83707
|
-
|
|
83708
83614
|
// src/assets/Entities.ts
|
|
83709
83615
|
var Entities;
|
|
83710
83616
|
var init_Entities = __esm({
|
|
@@ -83713,6 +83619,7 @@ ${key}` : key, async () => {
|
|
|
83713
83619
|
init_buffer2();
|
|
83714
83620
|
init_process2();
|
|
83715
83621
|
init_AssetKey();
|
|
83622
|
+
init_DatasetVersions();
|
|
83716
83623
|
init_AssetLoader();
|
|
83717
83624
|
init_source();
|
|
83718
83625
|
init_Caching();
|
|
@@ -83720,11 +83627,36 @@ ${key}` : key, async () => {
|
|
|
83720
83627
|
init_MineRenderError();
|
|
83721
83628
|
init_ModelTextures();
|
|
83722
83629
|
Entities = class {
|
|
83630
|
+
/**
|
|
83631
|
+
* Resolves `root` (default: the active version). Uses the exact dataset when published or when the
|
|
83632
|
+
* version is not a release; otherwise selects the nearest published release, like {@link MineRenderData.resolve}.
|
|
83633
|
+
* Textures keep the requested root.
|
|
83634
|
+
*/
|
|
83635
|
+
static async getDatasetRoot(root) {
|
|
83636
|
+
const requestRoot = (root ?? AssetLoader.ROOT).replace(/\/+$/, "");
|
|
83637
|
+
const requestedVersion = requestRoot.slice(requestRoot.lastIndexOf("/") + 1);
|
|
83638
|
+
const base = requestRoot.slice(0, requestRoot.lastIndexOf("/"));
|
|
83639
|
+
const selected = await Caching.entityDatasetVersionCache.get(root ?? `sources:${AssetLoader.ROOT}`, async () => {
|
|
83640
|
+
const key = new AssetKey("entity-models", "version", void 0, void 0, void 0, ".json", root);
|
|
83641
|
+
key.rootType = void 0;
|
|
83642
|
+
if (!parseRelease(requestedVersion) || await AssetLoader.get(key, "json" /* JSON */) !== void 0) return requestedVersion;
|
|
83643
|
+
const indexKey = new AssetKey("entity-models", "versions", void 0, void 0, void 0, ".json", base);
|
|
83644
|
+
indexKey.rootType = void 0;
|
|
83645
|
+
const index = await AssetLoader.get(indexKey, "json" /* JSON */);
|
|
83646
|
+
if (index === void 0) return requestedVersion;
|
|
83647
|
+
if (!index || typeof index !== "object" || Array.isArray(index) || !Array.isArray(index.versions) || !index.versions.every((entry) => entry && typeof entry === "object" && !Array.isArray(entry) && typeof entry.name === "string")) {
|
|
83648
|
+
throw new MineRenderError(`Invalid entity model version index at ${base}/entity-models/versions.json`);
|
|
83649
|
+
}
|
|
83650
|
+
return nearestRelease(requestedVersion, index.versions.map((entry) => entry.name)) ?? requestedVersion;
|
|
83651
|
+
});
|
|
83652
|
+
return selected === requestedVersion ? root : `${base}/${selected}`;
|
|
83653
|
+
}
|
|
83723
83654
|
/** Lists model paths in the `minecraft` namespace, including subdirectories and excluding `.json`. */
|
|
83724
83655
|
static async getEntityList() {
|
|
83656
|
+
const root = await this.getDatasetRoot();
|
|
83725
83657
|
const collect = async (path) => {
|
|
83726
83658
|
const prefix2 = path ? `${path}/` : "";
|
|
83727
|
-
const key = new AssetKey(DEFAULT_NAMESPACE, `${prefix2}_list`, void 0, void 0, "entity-models", ".json");
|
|
83659
|
+
const key = new AssetKey(DEFAULT_NAMESPACE, `${prefix2}_list`, void 0, void 0, "entity-models", ".json", root);
|
|
83728
83660
|
const list2 = await Caching.listAssetCache.get(key.serialize(), () => AssetLoader.get(key, "list" /* LIST */));
|
|
83729
83661
|
if (!list2) return [];
|
|
83730
83662
|
const files = list2.files.filter((file) => file.endsWith(".json") && file !== "_list.json").map((file) => `${prefix2}${file.slice(0, -5)}`);
|
|
@@ -83735,7 +83667,7 @@ ${key}` : key, async () => {
|
|
|
83735
83667
|
}
|
|
83736
83668
|
static async getModelFile(modelKey) {
|
|
83737
83669
|
const path = isAssetKey(modelKey) ? modelKey.getFullPath() : modelKey.path;
|
|
83738
|
-
const key = new AssetKey(modelKey.namespace, path, void 0, void 0, "entity-models", ".json", isAssetKey(modelKey) ? modelKey.root : void 0);
|
|
83670
|
+
const key = new AssetKey(modelKey.namespace, path, void 0, void 0, "entity-models", ".json", await this.getDatasetRoot(isAssetKey(modelKey) ? modelKey.root : void 0));
|
|
83739
83671
|
return Caching.entityModelCache.get(key.serialize(), () => AssetLoader.get(key, "json" /* JSON */));
|
|
83740
83672
|
}
|
|
83741
83673
|
/** Returns selectable geometry-layer names, or an empty list when the model is missing. */
|
|
@@ -83796,7 +83728,7 @@ ${key}` : key, async () => {
|
|
|
83796
83728
|
*/
|
|
83797
83729
|
static async getAnimations(modelKey) {
|
|
83798
83730
|
const path = isAssetKey(modelKey) ? modelKey.getFullPath() : modelKey.path;
|
|
83799
|
-
const key = new AssetKey(modelKey.namespace, path, void 0, void 0, "entity-models/animations", ".json", isAssetKey(modelKey) ? modelKey.root : void 0);
|
|
83731
|
+
const key = new AssetKey(modelKey.namespace, path, void 0, void 0, "entity-models/animations", ".json", await this.getDatasetRoot(isAssetKey(modelKey) ? modelKey.root : void 0));
|
|
83800
83732
|
const file = await Caching.entityAnimationCache.get(key.serialize(), () => AssetLoader.get(key, "json" /* JSON */));
|
|
83801
83733
|
return file?.animations;
|
|
83802
83734
|
}
|
|
@@ -83838,6 +83770,121 @@ ${key}` : key, async () => {
|
|
|
83838
83770
|
}
|
|
83839
83771
|
});
|
|
83840
83772
|
|
|
83773
|
+
// src/assets/BlockEntities.ts
|
|
83774
|
+
var log12, BlockEntities;
|
|
83775
|
+
var init_BlockEntities = __esm({
|
|
83776
|
+
"src/assets/BlockEntities.ts"() {
|
|
83777
|
+
init_dirname();
|
|
83778
|
+
init_buffer2();
|
|
83779
|
+
init_process2();
|
|
83780
|
+
init_three_module();
|
|
83781
|
+
init_AssetKey();
|
|
83782
|
+
init_Entities();
|
|
83783
|
+
init_AssetLoader();
|
|
83784
|
+
init_source();
|
|
83785
|
+
init_Caching();
|
|
83786
|
+
init_log();
|
|
83787
|
+
log12 = logger("BlockEntities");
|
|
83788
|
+
BlockEntities = class {
|
|
83789
|
+
/**
|
|
83790
|
+
* Loads the block index of a version. Versions and sources without one yield an empty index, and so does
|
|
83791
|
+
* a failed load: the index is optional, and blocks must not retry or fail with it one by one. The empty
|
|
83792
|
+
* result is cached like any other; `Caching.clear()` or `AssetLoader.setVersion()` forces a new attempt.
|
|
83793
|
+
*/
|
|
83794
|
+
static async getIndex(root) {
|
|
83795
|
+
const key = new AssetKey("entity-models", "blocks", void 0, void 0, void 0, ".json", root);
|
|
83796
|
+
key.rootType = void 0;
|
|
83797
|
+
const index = await Caching.blockEntityIndexCache.get(key.serialize(), async () => {
|
|
83798
|
+
try {
|
|
83799
|
+
key.root = await Entities.getDatasetRoot(root);
|
|
83800
|
+
return await AssetLoader.get(key, "json" /* JSON */) ?? {};
|
|
83801
|
+
} catch (error2) {
|
|
83802
|
+
log12.warn("Could not load the block entity index; block entities are drawn as plain block models", error2);
|
|
83803
|
+
return {};
|
|
83804
|
+
}
|
|
83805
|
+
});
|
|
83806
|
+
return index ?? {};
|
|
83807
|
+
}
|
|
83808
|
+
/** The index entry of a block ID such as `minecraft:chest`. */
|
|
83809
|
+
static entry(index, block) {
|
|
83810
|
+
const entry = Object.prototype.hasOwnProperty.call(index, block) ? index[block] : void 0;
|
|
83811
|
+
return Array.isArray(entry?.parts) ? entry : void 0;
|
|
83812
|
+
}
|
|
83813
|
+
/** Selects the parts and placement for a block ID such as `minecraft:chest`; undefined when nothing is drawn. */
|
|
83814
|
+
static resolve(index, block, state = {}) {
|
|
83815
|
+
const entry = this.entry(index, block);
|
|
83816
|
+
if (!entry) return void 0;
|
|
83817
|
+
const value = (property) => String(state[property]).toLowerCase();
|
|
83818
|
+
const parts = entry.parts.filter((part) => Object.entries(part.when ?? {}).every(([property, values]) => String(values).split("|").includes(value(property))));
|
|
83819
|
+
if (!parts.length) return void 0;
|
|
83820
|
+
let rotation = 0;
|
|
83821
|
+
if (entry.rotation) {
|
|
83822
|
+
const selected = value(entry.rotation.property);
|
|
83823
|
+
rotation = "degrees" in entry.rotation ? entry.rotation.degrees[selected] : Number(selected) * entry.rotation.step;
|
|
83824
|
+
if (!Number.isFinite(rotation)) rotation = 0;
|
|
83825
|
+
}
|
|
83826
|
+
return { parts, rotation, translation: entry.translation ?? [0, 0, 0] };
|
|
83827
|
+
}
|
|
83828
|
+
/** Placement in block space (0..16 per axis), applied on top of the model's own transform. */
|
|
83829
|
+
static matrix(resolved, matrix = new Matrix4()) {
|
|
83830
|
+
return matrix.makeTranslation(8, 0, 8).multiply(new Matrix4().makeRotationY(resolved.rotation * Math.PI / 180)).multiply(new Matrix4().makeTranslation(resolved.translation[0] - 8, resolved.translation[1], resolved.translation[2] - 8));
|
|
83831
|
+
}
|
|
83832
|
+
};
|
|
83833
|
+
}
|
|
83834
|
+
});
|
|
83835
|
+
|
|
83836
|
+
// src/assets/DecoratedPots.ts
|
|
83837
|
+
var POTTERY_SHERDS, DecoratedPots;
|
|
83838
|
+
var init_DecoratedPots = __esm({
|
|
83839
|
+
"src/assets/DecoratedPots.ts"() {
|
|
83840
|
+
init_dirname();
|
|
83841
|
+
init_buffer2();
|
|
83842
|
+
init_process2();
|
|
83843
|
+
init_AssetKey();
|
|
83844
|
+
POTTERY_SHERDS = Object.freeze([
|
|
83845
|
+
"angler",
|
|
83846
|
+
"archer",
|
|
83847
|
+
"arms_up",
|
|
83848
|
+
"blade",
|
|
83849
|
+
"brewer",
|
|
83850
|
+
"burn",
|
|
83851
|
+
"danger",
|
|
83852
|
+
"explorer",
|
|
83853
|
+
"flow",
|
|
83854
|
+
"friend",
|
|
83855
|
+
"guster",
|
|
83856
|
+
"heart",
|
|
83857
|
+
"heartbreak",
|
|
83858
|
+
"howl",
|
|
83859
|
+
"miner",
|
|
83860
|
+
"mourner",
|
|
83861
|
+
"plenty",
|
|
83862
|
+
"prize",
|
|
83863
|
+
"scrape",
|
|
83864
|
+
"sheaf",
|
|
83865
|
+
"shelter",
|
|
83866
|
+
"skull",
|
|
83867
|
+
"snort"
|
|
83868
|
+
].map((pattern2) => `minecraft:${pattern2}_pottery_sherd`));
|
|
83869
|
+
DecoratedPots = class {
|
|
83870
|
+
/** Reads up to four item IDs in back, left, right, front order; missing and unmapped items use plain sides. */
|
|
83871
|
+
static getSideTextures(value, root) {
|
|
83872
|
+
const items = value === void 0 ? [] : value;
|
|
83873
|
+
if (!Array.isArray(items) || items.length > 4) throw new Error("pot_decorations must be an array of at most four item IDs");
|
|
83874
|
+
const textures = items.map((item) => {
|
|
83875
|
+
if (!isResourceLocation(item)) throw new Error("Pot decorations must be item identifiers");
|
|
83876
|
+
const id = item.includes(":") ? item : `minecraft:${item}`;
|
|
83877
|
+
return POTTERY_SHERDS.includes(id) ? id.slice("minecraft:".length).replace(/_sherd$/, "_pattern") : "decorated_pot_side";
|
|
83878
|
+
});
|
|
83879
|
+
return Object.fromEntries(["back", "left", "right", "front"].map((side, index) => [
|
|
83880
|
+
side,
|
|
83881
|
+
new AssetKey("minecraft", `decorated_pot/${textures[index] ?? "decorated_pot_side"}`, "textures", "entity", "assets", ".png", root)
|
|
83882
|
+
]));
|
|
83883
|
+
}
|
|
83884
|
+
};
|
|
83885
|
+
}
|
|
83886
|
+
});
|
|
83887
|
+
|
|
83841
83888
|
// src/assets/_fonts/Unihex.ts
|
|
83842
83889
|
var Unihex_exports = {};
|
|
83843
83890
|
__export(Unihex_exports, {
|
|
@@ -103140,7 +103187,7 @@ gl_FragDepth=readDepth(vUv);
|
|
|
103140
103187
|
read.waiters++;
|
|
103141
103188
|
return new Promise((resolve, reject) => {
|
|
103142
103189
|
let finished = false;
|
|
103143
|
-
const
|
|
103190
|
+
const release2 = () => {
|
|
103144
103191
|
if (finished) return false;
|
|
103145
103192
|
finished = true;
|
|
103146
103193
|
signal?.removeEventListener("abort", abort2);
|
|
@@ -103148,7 +103195,7 @@ gl_FragDepth=readDepth(vUv);
|
|
|
103148
103195
|
return true;
|
|
103149
103196
|
};
|
|
103150
103197
|
const abort2 = () => {
|
|
103151
|
-
if (!
|
|
103198
|
+
if (!release2()) return;
|
|
103152
103199
|
if (!read.waiters && !read.settled) {
|
|
103153
103200
|
if (this.pending.get(key) === read) this.pending.delete(key);
|
|
103154
103201
|
read.controller.abort(signal.reason);
|
|
@@ -103158,10 +103205,10 @@ gl_FragDepth=readDepth(vUv);
|
|
|
103158
103205
|
signal?.addEventListener("abort", abort2, { once: true });
|
|
103159
103206
|
read.promise.then(
|
|
103160
103207
|
(data) => {
|
|
103161
|
-
if (
|
|
103208
|
+
if (release2()) resolve(data);
|
|
103162
103209
|
},
|
|
103163
103210
|
(error2) => {
|
|
103164
|
-
if (
|
|
103211
|
+
if (release2()) reject(error2);
|
|
103165
103212
|
}
|
|
103166
103213
|
);
|
|
103167
103214
|
if (signal?.aborted) abort2();
|