minerender 2.1.0-alpha.116 → 2.1.0-alpha.118
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 +14 -5
- package/dist/browser/index.d.ts +14 -5
- package/dist/browser/index.js +50 -69
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +50 -69
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +50 -69
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +14 -5
- package/dist/node/index.d.ts +14 -5
- package/dist/node/index.js +50 -69
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +50 -69
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -43235,7 +43235,8 @@ void main() {
|
|
|
43235
43235
|
}
|
|
43236
43236
|
/**
|
|
43237
43237
|
* Uses the exact version when published. Otherwise, selects the nearest patch in the same
|
|
43238
|
-
* release line (older on ties), then the latest earlier release
|
|
43238
|
+
* release line (older on ties), then the latest earlier release or the oldest published release.
|
|
43239
|
+
* Unpublished snapshots reject.
|
|
43239
43240
|
*/
|
|
43240
43241
|
static async resolve(root) {
|
|
43241
43242
|
const requestRoot = root?.replace(/\/+$/, "");
|
|
@@ -43244,11 +43245,11 @@ void main() {
|
|
|
43244
43245
|
const scope = AssetLoader.persistentScope;
|
|
43245
43246
|
return this.cached(`resolve:${requestRoot === void 0 ? "sources" : "explicit"}:${root}`, scope, defaultRoot, async () => {
|
|
43246
43247
|
const requestedVersion = root.slice(root.lastIndexOf("/") + 1);
|
|
43247
|
-
let manifest = await this.manifest(root, release(requestedVersion) ? requestedVersion : void 0, requestRoot);
|
|
43248
|
+
let manifest = await this.manifest(root, requestRoot !== void 0 && release(requestedVersion) ? requestedVersion : void 0, requestRoot);
|
|
43248
43249
|
if (manifest) return { requestedVersion, version: manifest.minecraftVersion, root, manifest };
|
|
43249
43250
|
const requested = release(requestedVersion);
|
|
43250
|
-
if (!requested
|
|
43251
|
-
throw new Error(`No MineRender data is published for ${requestedVersion}; automatic fallback requires a release
|
|
43251
|
+
if (!requested) {
|
|
43252
|
+
throw new Error(`No MineRender data is published for ${requestedVersion}; automatic fallback requires a release`);
|
|
43252
43253
|
}
|
|
43253
43254
|
const base = root.slice(0, root.lastIndexOf("/"));
|
|
43254
43255
|
const index = await this.cached(`versions:${base}`, scope, defaultRoot, async () => {
|
|
@@ -43258,9 +43259,9 @@ void main() {
|
|
|
43258
43259
|
}
|
|
43259
43260
|
return value.versions;
|
|
43260
43261
|
});
|
|
43261
|
-
const versions2 = index.map((entry) => ({ name: entry.name, number: release(entry.name) })).filter((entry) => !!entry.number
|
|
43262
|
+
const versions2 = index.map((entry) => ({ name: entry.name, number: release(entry.name) })).filter((entry) => !!entry.number).sort((left, right) => compare(left.number, right.number));
|
|
43262
43263
|
const sameLine = versions2.filter((entry) => entry.number[0] === requested[0] && entry.number[1] === requested[1]);
|
|
43263
|
-
const selected = sameLine.sort((left, right) => Math.abs((left.number[2] ?? 0) - (requested[2] ?? 0)) - Math.abs((right.number[2] ?? 0) - (requested[2] ?? 0)) || compare(left.number, right.number))[0] ?? versions2.filter((entry) => compare(entry.number, requested) <= 0).pop();
|
|
43264
|
+
const selected = sameLine.sort((left, right) => Math.abs((left.number[2] ?? 0) - (requested[2] ?? 0)) - Math.abs((right.number[2] ?? 0) - (requested[2] ?? 0)) || compare(left.number, right.number))[0] ?? versions2.filter((entry) => compare(entry.number, requested) <= 0).pop() ?? versions2[0];
|
|
43264
43265
|
if (!selected) throw new Error(`No compatible MineRender data is published for ${requestedVersion}`);
|
|
43265
43266
|
const resolvedRoot = `${base}/${selected.name}`;
|
|
43266
43267
|
manifest = await this.manifest(resolvedRoot, selected.name, resolvedRoot);
|
|
@@ -43379,12 +43380,7 @@ ${key}` : key, async () => {
|
|
|
43379
43380
|
static async getLayers(value, target, root) {
|
|
43380
43381
|
if (value === void 0) return [];
|
|
43381
43382
|
if (!Array.isArray(value)) throw new Error("banner_patterns must be an array");
|
|
43382
|
-
const activeRoot = AssetLoader.ROOT, scope = AssetLoader.persistentScope;
|
|
43383
|
-
const checkSources = () => {
|
|
43384
|
-
if (activeRoot !== AssetLoader.ROOT || scope !== AssetLoader.persistentScope) throw new Error("Asset sources changed while loading banner patterns; retry the request");
|
|
43385
|
-
};
|
|
43386
43383
|
const colors = value.length ? await this.getColors(root) : void 0;
|
|
43387
|
-
checkSources();
|
|
43388
43384
|
return Promise.all(value.slice(0, 16).map(async (layer) => {
|
|
43389
43385
|
if (!layer || typeof layer !== "object" || Array.isArray(layer)) throw new Error("Each banner pattern requires a pattern and dye color");
|
|
43390
43386
|
if (typeof layer.color !== "string" || !Object.prototype.hasOwnProperty.call(colors, layer.color)) throw new Error(`Unsupported dye color ${layer.color}`);
|
|
@@ -43394,7 +43390,6 @@ ${key}` : key, async () => {
|
|
|
43394
43390
|
const id = this.identifier(pattern2);
|
|
43395
43391
|
const key = new AssetKey(id.namespace, id.getFullPath(), "banner_pattern", void 0, "data", ".json", root);
|
|
43396
43392
|
pattern2 = await Caching.bannerPatternCache.get(key.serialize(), () => AssetLoader.get(key, "json" /* JSON */));
|
|
43397
|
-
checkSources();
|
|
43398
43393
|
if (!pattern2) throw new Error(`Missing banner pattern ${layer.pattern}`);
|
|
43399
43394
|
}
|
|
43400
43395
|
if (!pattern2 || typeof pattern2 !== "object" || Array.isArray(pattern2) || typeof pattern2.translation_key !== "string") throw new Error("Banner patterns require asset_id and translation_key");
|
|
@@ -43694,30 +43689,24 @@ ${key}` : key, async () => {
|
|
|
43694
43689
|
}).then((r5) => r5?.files ?? []);
|
|
43695
43690
|
}
|
|
43696
43691
|
static async loadAndMerge(key, context = {}) {
|
|
43697
|
-
const checkSources = this.sourceCheck();
|
|
43698
43692
|
const model = key.type === "item" ? await this.getItemModel(key, context) : await this.getRaw(key);
|
|
43699
43693
|
if (!model) {
|
|
43700
43694
|
return void 0;
|
|
43701
43695
|
}
|
|
43702
43696
|
const merged = await ModelMerger.mergeWithParents(model);
|
|
43703
|
-
checkSources();
|
|
43704
43697
|
return merged;
|
|
43705
43698
|
}
|
|
43706
43699
|
static async getItemModel(key, context = {}) {
|
|
43707
|
-
const checkSources = this.sourceCheck();
|
|
43708
43700
|
const preview = this.snapshotContext(key, context);
|
|
43709
43701
|
const dataKey = await this.applyDefaults(key, preview);
|
|
43710
|
-
checkSources();
|
|
43711
43702
|
return this.getPreparedItemModel(key, preview, dataKey);
|
|
43712
43703
|
}
|
|
43713
43704
|
static async getPreparedItemModel(key, preview, dataKey) {
|
|
43714
|
-
const checkSources = this.sourceCheck();
|
|
43715
43705
|
const itemId = `${key.namespace}:${key.path}`;
|
|
43716
43706
|
const itemKey2 = new AssetKey(key.namespace, key.path, "items", void 0, key.rootType, ".json", key.root);
|
|
43717
43707
|
const cacheKey = itemKey2.serialize() + this.contextKey(preview) + dataKey;
|
|
43718
43708
|
const model = await this.PERSISTENT_CACHE.getOrLoad(`${this.ITEM_CACHE_VERSION}:${AssetLoader.persistentKey(cacheKey)}`, async () => {
|
|
43719
43709
|
const result = await AssetLoader.getFirst([itemKey2, key], "json" /* JSON */);
|
|
43720
|
-
checkSources();
|
|
43721
43710
|
if (!result) return void 0;
|
|
43722
43711
|
if (result.key.assetType !== "items") return { ...result.asset, key, itemId, components: preview.components };
|
|
43723
43712
|
const load = async (selected) => {
|
|
@@ -43736,10 +43725,8 @@ ${key}` : key, async () => {
|
|
|
43736
43725
|
return { ...model3, itemId, components: preview.components, ...selected.special && { special: selected.special }, ...selected.tints && { tints: selected.tints } };
|
|
43737
43726
|
};
|
|
43738
43727
|
const model2 = await load(this.selectItemModel(result.asset.model, key, preview));
|
|
43739
|
-
checkSources();
|
|
43740
43728
|
return model2;
|
|
43741
43729
|
});
|
|
43742
|
-
checkSources();
|
|
43743
43730
|
const restore = (model2) => ({
|
|
43744
43731
|
...model2,
|
|
43745
43732
|
key: Object.assign(new AssetKey("", ""), model2.key),
|
|
@@ -43803,22 +43790,14 @@ ${key}` : key, async () => {
|
|
|
43803
43790
|
}
|
|
43804
43791
|
static async applyDefaults(key, preview) {
|
|
43805
43792
|
if (key.type !== "item") return "";
|
|
43806
|
-
const root = AssetLoader.ROOT, scope = AssetLoader.persistentScope;
|
|
43807
43793
|
const resolved = await MineRenderData.resolve(key.root);
|
|
43808
43794
|
const defaults = await ItemDefaults.get(`${key.namespace}:${key.path}`, key.root);
|
|
43809
43795
|
preview.components = { ...defaults, ...preview.components };
|
|
43810
43796
|
if (resolved.manifest.dataVersion < 3337 && key.namespace === DEFAULT_NAMESPACE && ["potion", "splash_potion", "lingering_potion"].includes(key.path) && !Object.prototype.hasOwnProperty.call(preview.components, "minecraft:enchantment_glint_override") && await ItemTints.hasPotionEffects(preview.components["minecraft:potion_contents"], key.root)) {
|
|
43811
43797
|
preview.components["minecraft:enchantment_glint_override"] = true;
|
|
43812
43798
|
}
|
|
43813
|
-
if (AssetLoader.ROOT !== root || AssetLoader.persistentScope !== scope) throw new Error("Asset sources changed while loading item defaults; retry the request");
|
|
43814
43799
|
return `|data:${resolved.root}:${resolved.manifest.datasets.itemDefaults?.sha256}:${resolved.manifest.datasets.potionColors?.sha256}`;
|
|
43815
43800
|
}
|
|
43816
|
-
static sourceCheck() {
|
|
43817
|
-
const root = AssetLoader.ROOT, scope = AssetLoader.persistentScope;
|
|
43818
|
-
return () => {
|
|
43819
|
-
if (AssetLoader.ROOT !== root || AssetLoader.persistentScope !== scope) throw new Error("Asset sources changed while loading item models; retry the request");
|
|
43820
|
-
};
|
|
43821
|
-
}
|
|
43822
43801
|
static contextKey(context) {
|
|
43823
43802
|
const itemReferences = Object.fromEntries(Object.entries(context.itemReferences).map(([id, key]) => [id, key.serialize()]));
|
|
43824
43803
|
return `|${this.ITEM_CACHE_VERSION}:${JSON.stringify(this.snapshotJson({ ...context, itemReferences }))}`;
|
|
@@ -44005,7 +43984,6 @@ ${key}` : key, async () => {
|
|
|
44005
43984
|
* @param key - Model key, for example `AssetKey.parse("models", "minecraft:item/diamond_sword")`.
|
|
44006
43985
|
*/
|
|
44007
43986
|
static async getMerged(key, context = {}) {
|
|
44008
|
-
const checkSources = this.sourceCheck();
|
|
44009
43987
|
if (!key.assetType) {
|
|
44010
43988
|
key.assetType = "models";
|
|
44011
43989
|
}
|
|
@@ -44014,15 +43992,12 @@ ${key}` : key, async () => {
|
|
|
44014
43992
|
}
|
|
44015
43993
|
const preview = this.snapshotContext(key, context);
|
|
44016
43994
|
const dataKey = await this.applyDefaults(key, preview);
|
|
44017
|
-
checkSources();
|
|
44018
43995
|
const keyStr = AssetLoader.persistentKey(key.serialize() + (key.type === "item" ? this.contextKey(preview) + dataKey : ""));
|
|
44019
43996
|
const model = await Caching.mergedModelCache.get(keyStr, async () => {
|
|
44020
43997
|
const raw = key.type === "item" ? await this.getPreparedItemModel(key, preview, dataKey) : await this.getRaw(key);
|
|
44021
43998
|
const merged = raw ? await ModelMerger.mergeWithParents(raw) : void 0;
|
|
44022
|
-
checkSources();
|
|
44023
43999
|
return merged;
|
|
44024
44000
|
});
|
|
44025
|
-
checkSources();
|
|
44026
44001
|
return model;
|
|
44027
44002
|
}
|
|
44028
44003
|
/** Alias for {@link getMerged}. */
|
|
@@ -100647,7 +100622,6 @@ property list uchar int vertex_index
|
|
|
100647
100622
|
init_ModelCulling();
|
|
100648
100623
|
init_FluidGeometry();
|
|
100649
100624
|
init_MineRenderData();
|
|
100650
|
-
init_AssetLoader();
|
|
100651
100625
|
init_Entities();
|
|
100652
100626
|
var _BlockObject = class _BlockObject extends SceneObject {
|
|
100653
100627
|
constructor(blockState3, options) {
|
|
@@ -100672,19 +100646,12 @@ property list uchar int vertex_index
|
|
|
100672
100646
|
this.biomePosition = options?.biomePosition ? [...options.biomePosition] : void 0;
|
|
100673
100647
|
}
|
|
100674
100648
|
async init() {
|
|
100675
|
-
const root = AssetLoader.ROOT, scope = AssetLoader.persistentScope;
|
|
100676
|
-
const checkSources = () => {
|
|
100677
|
-
if (root !== AssetLoader.ROOT || scope !== AssetLoader.persistentScope) throw new Error("Asset sources changed while loading a block; retry the request");
|
|
100678
|
-
};
|
|
100679
100649
|
this._fluidRules = await MineRenderData.get("fluids", this.blockState.key?.root);
|
|
100680
|
-
checkSources();
|
|
100681
100650
|
if (this.options.applyDefaultState) {
|
|
100682
100651
|
this._setState(await BlockStateResolver.defaults(this.blockState));
|
|
100683
|
-
checkSources();
|
|
100684
100652
|
}
|
|
100685
100653
|
if (this.options.initialState !== void 0) this._setState(this.options.initialState);
|
|
100686
100654
|
await this.recreateModels();
|
|
100687
|
-
checkSources();
|
|
100688
100655
|
}
|
|
100689
100656
|
dispose() {
|
|
100690
100657
|
this.clearModels();
|
|
@@ -101575,6 +101542,8 @@ property list uchar int vertex_index
|
|
|
101575
101542
|
var VANILLA_FLY_SPEED = 10.89;
|
|
101576
101543
|
var PITCH_LIMIT = Math.PI / 2;
|
|
101577
101544
|
var MOVE_EPSILON = 1e-6;
|
|
101545
|
+
var MAX_STEP_SECONDS = 0.1;
|
|
101546
|
+
var CLICK_SLOP_PIXELS = 4;
|
|
101578
101547
|
var _euler = new Euler(0, 0, 0, "YXZ");
|
|
101579
101548
|
var _forward = new Vector3();
|
|
101580
101549
|
var _right = new Vector3();
|
|
@@ -101609,7 +101578,8 @@ property list uchar int vertex_index
|
|
|
101609
101578
|
right: ["KeyD", "ArrowRight"],
|
|
101610
101579
|
up: ["Space"],
|
|
101611
101580
|
down: ["ShiftLeft", "ShiftRight"],
|
|
101612
|
-
|
|
101581
|
+
// Not Control: Ctrl+W closes the browser tab on Windows and Linux, and a page cannot block it.
|
|
101582
|
+
sprint: ["KeyR"]
|
|
101613
101583
|
};
|
|
101614
101584
|
this._pressed = /* @__PURE__ */ new Set();
|
|
101615
101585
|
this._velocity = new Vector3();
|
|
@@ -101617,8 +101587,12 @@ property list uchar int vertex_index
|
|
|
101617
101587
|
this._lastQuaternion = new Quaternion();
|
|
101618
101588
|
this._position0 = new Vector3();
|
|
101619
101589
|
this._quaternion0 = new Quaternion();
|
|
101590
|
+
this._dragX = 0;
|
|
101591
|
+
this._dragY = 0;
|
|
101620
101592
|
this._dragMoved = false;
|
|
101593
|
+
this._dragTravel = 0;
|
|
101621
101594
|
this._locked = false;
|
|
101595
|
+
this._madeFocusable = false;
|
|
101622
101596
|
this._onKeyDown = (event) => this.handleKey(event, true);
|
|
101623
101597
|
this._onKeyUp = (event) => this.handleKey(event, false);
|
|
101624
101598
|
this._onPointerDown = (event) => this.handlePointerDown(event);
|
|
@@ -101648,7 +101622,10 @@ property list uchar int vertex_index
|
|
|
101648
101622
|
element.addEventListener("wheel", this._onWheel, { passive: false });
|
|
101649
101623
|
element.addEventListener("blur", this._onBlur);
|
|
101650
101624
|
element.style.touchAction = "none";
|
|
101651
|
-
if (element.tabIndex < 0)
|
|
101625
|
+
if (element.tabIndex < 0) {
|
|
101626
|
+
element.tabIndex = 0;
|
|
101627
|
+
this._madeFocusable = true;
|
|
101628
|
+
}
|
|
101652
101629
|
}
|
|
101653
101630
|
disconnect() {
|
|
101654
101631
|
const element = this.domElement;
|
|
@@ -101666,6 +101643,10 @@ property list uchar int vertex_index
|
|
|
101666
101643
|
element.removeEventListener("wheel", this._onWheel);
|
|
101667
101644
|
element.removeEventListener("blur", this._onBlur);
|
|
101668
101645
|
element.style.touchAction = "auto";
|
|
101646
|
+
if (this._madeFocusable) {
|
|
101647
|
+
element.removeAttribute("tabindex");
|
|
101648
|
+
this._madeFocusable = false;
|
|
101649
|
+
}
|
|
101669
101650
|
this.unlock();
|
|
101670
101651
|
this._locked = false;
|
|
101671
101652
|
this.releaseKeys();
|
|
@@ -101736,6 +101717,7 @@ property list uchar int vertex_index
|
|
|
101736
101717
|
/**
|
|
101737
101718
|
* Advances movement by `delta` seconds (measured since the previous call when omitted)
|
|
101738
101719
|
* and dispatches `change` when the camera moved.
|
|
101720
|
+
* A step longer than 0.1 s is applied as 0.1 s.
|
|
101739
101721
|
*/
|
|
101740
101722
|
update(delta) {
|
|
101741
101723
|
if (delta === void 0) {
|
|
@@ -101747,7 +101729,7 @@ property list uchar int vertex_index
|
|
|
101747
101729
|
this._velocity.set(0, 0, 0);
|
|
101748
101730
|
return;
|
|
101749
101731
|
}
|
|
101750
|
-
if (delta > 0) this.move(delta);
|
|
101732
|
+
if (delta > 0) this.move(Math.min(delta, MAX_STEP_SECONDS));
|
|
101751
101733
|
this.notifyChange();
|
|
101752
101734
|
}
|
|
101753
101735
|
move(delta) {
|
|
@@ -101794,15 +101776,21 @@ property list uchar int vertex_index
|
|
|
101794
101776
|
this._pressed.clear();
|
|
101795
101777
|
}
|
|
101796
101778
|
handleKey(event, down) {
|
|
101779
|
+
if (event.code === "MetaLeft" || event.code === "MetaRight") this.releaseKeys();
|
|
101797
101780
|
const action = this.actionFor(event.code);
|
|
101798
101781
|
if (!action) return;
|
|
101799
101782
|
const ownsInput = this.enabled && (this._locked || event.target === this.domElement);
|
|
101800
|
-
if (down && !ownsInput) return;
|
|
101783
|
+
if (down && (!ownsInput || this.isBrowserShortcut(event))) return;
|
|
101801
101784
|
const pressed = this._pressed.has(action);
|
|
101802
101785
|
if (down) this._pressed.add(action);
|
|
101803
101786
|
else this._pressed.delete(action);
|
|
101804
101787
|
if (ownsInput || this.enabled && pressed) event.preventDefault();
|
|
101805
101788
|
}
|
|
101789
|
+
/** A key pressed with Control, Alt, or Command stays a browser shortcut unless that modifier is bound to an action. */
|
|
101790
|
+
isBrowserShortcut(event) {
|
|
101791
|
+
const bound = (modifier) => Object.values(this.keys).some((codes2) => codes2.some((code2) => code2.startsWith(modifier)));
|
|
101792
|
+
return event.ctrlKey && !bound("Control") || event.altKey && !bound("Alt") || event.metaKey && !bound("Meta");
|
|
101793
|
+
}
|
|
101806
101794
|
actionFor(code2) {
|
|
101807
101795
|
for (const action in this.keys) {
|
|
101808
101796
|
if (this.keys[action].includes(code2)) return action;
|
|
@@ -101822,7 +101810,10 @@ property list uchar int vertex_index
|
|
|
101822
101810
|
if (this._dragPointer !== void 0) return;
|
|
101823
101811
|
if (event.pointerType === "mouse" && event.button !== 0 && event.button !== 2) return;
|
|
101824
101812
|
this._dragPointer = event.pointerId;
|
|
101813
|
+
this._dragX = event.clientX;
|
|
101814
|
+
this._dragY = event.clientY;
|
|
101825
101815
|
this._dragMoved = false;
|
|
101816
|
+
this._dragTravel = 0;
|
|
101826
101817
|
element.setPointerCapture?.(event.pointerId);
|
|
101827
101818
|
}
|
|
101828
101819
|
onJoystickSide(event) {
|
|
@@ -101838,8 +101829,20 @@ property list uchar int vertex_index
|
|
|
101838
101829
|
return;
|
|
101839
101830
|
}
|
|
101840
101831
|
if (!this._locked && event.pointerId !== this._dragPointer) return;
|
|
101841
|
-
|
|
101842
|
-
|
|
101832
|
+
let dx, dy;
|
|
101833
|
+
if (this._locked) {
|
|
101834
|
+
dx = event.movementX ?? 0;
|
|
101835
|
+
dy = event.movementY ?? 0;
|
|
101836
|
+
} else {
|
|
101837
|
+
dx = event.clientX - this._dragX;
|
|
101838
|
+
dy = event.clientY - this._dragY;
|
|
101839
|
+
this._dragX = event.clientX;
|
|
101840
|
+
this._dragY = event.clientY;
|
|
101841
|
+
if (!this._dragMoved) {
|
|
101842
|
+
this._dragTravel += Math.hypot(dx, dy);
|
|
101843
|
+
if (this._dragTravel <= CLICK_SLOP_PIXELS) return;
|
|
101844
|
+
}
|
|
101845
|
+
}
|
|
101843
101846
|
if (!dx && !dy) return;
|
|
101844
101847
|
this._dragMoved = true;
|
|
101845
101848
|
this.turn(dx, dy);
|
|
@@ -105752,6 +105755,7 @@ gl_FragDepth=readDepth(vUv);
|
|
|
105752
105755
|
/**
|
|
105753
105756
|
* Replaces renderer-owned controls with the selected mode, keeping the camera where it is.
|
|
105754
105757
|
* Switching to orbit controls targets the point the camera looks at, at the previous orbit distance.
|
|
105758
|
+
* The previous controls object is disposed, so its listeners and settings do not carry over.
|
|
105755
105759
|
* Returns the new controls, or undefined when controls were disabled at construction or after disposal.
|
|
105756
105760
|
*/
|
|
105757
105761
|
setControlsMode(mode2) {
|
|
@@ -106679,7 +106683,6 @@ gl_FragDepth=readDepth(vUv);
|
|
|
106679
106683
|
init_process2();
|
|
106680
106684
|
init_MineRenderError();
|
|
106681
106685
|
init_MineRenderData();
|
|
106682
|
-
init_AssetLoader();
|
|
106683
106686
|
init_NBTHelper();
|
|
106684
106687
|
|
|
106685
106688
|
// src/world/ChunkData.ts
|
|
@@ -106956,14 +106959,12 @@ gl_FragDepth=readDepth(vUv);
|
|
|
106956
106959
|
/** Decodes all stored chunks. Gzip, zlib, LZ4, and uncompressed payloads are supported. */
|
|
106957
106960
|
static async parse(data, options = {}) {
|
|
106958
106961
|
options = { ...options };
|
|
106959
|
-
const checkSources = this.assetGuard();
|
|
106960
106962
|
options.signal?.throwIfAborted();
|
|
106961
106963
|
const bytes = this.bytes(data);
|
|
106962
106964
|
const chunks = [];
|
|
106963
106965
|
for (const location of this.locations(bytes)) {
|
|
106964
106966
|
chunks.push(await this.abortable(this.readChunk(bytes, location, options), options.signal));
|
|
106965
106967
|
}
|
|
106966
|
-
checkSources();
|
|
106967
106968
|
return { chunks };
|
|
106968
106969
|
}
|
|
106969
106970
|
/**
|
|
@@ -106974,22 +106975,12 @@ gl_FragDepth=readDepth(vUv);
|
|
|
106974
106975
|
*/
|
|
106975
106976
|
static async parseChunk(data, localX, localZ, options = {}) {
|
|
106976
106977
|
options = { ...options };
|
|
106977
|
-
const checkSources = this.assetGuard();
|
|
106978
106978
|
options.signal?.throwIfAborted();
|
|
106979
106979
|
const bytes = this.bytes(data);
|
|
106980
106980
|
const location = this.location(bytes, localX, localZ);
|
|
106981
106981
|
const chunk = location ? await this.abortable(this.readChunk(bytes, location, options), options.signal) : void 0;
|
|
106982
|
-
checkSources();
|
|
106983
106982
|
return chunk;
|
|
106984
106983
|
}
|
|
106985
|
-
static assetGuard() {
|
|
106986
|
-
const root = AssetLoader.ROOT, scope = AssetLoader.persistentScope;
|
|
106987
|
-
return () => {
|
|
106988
|
-
if (AssetLoader.ROOT !== root || AssetLoader.persistentScope !== scope) {
|
|
106989
|
-
throw new MineRenderError("Asset sources changed while parsing Anvil data; retry the request");
|
|
106990
|
-
}
|
|
106991
|
-
};
|
|
106992
|
-
}
|
|
106993
106984
|
/**
|
|
106994
106985
|
* Decodes one chunk from an `entities/r.x.z.mca` file without migrating its NBT.
|
|
106995
106986
|
* @param localX - Chunk x within the region, from 0 to 31.
|
|
@@ -107733,7 +107724,6 @@ gl_FragDepth=readDepth(vUv);
|
|
|
107733
107724
|
|
|
107734
107725
|
// src/world/_entities/WorldEntities.ts
|
|
107735
107726
|
init_BannerPatterns();
|
|
107736
|
-
init_AssetLoader();
|
|
107737
107727
|
var WorldEntities = class {
|
|
107738
107728
|
constructor(scene) {
|
|
107739
107729
|
this.scene = scene;
|
|
@@ -107741,10 +107731,6 @@ gl_FragDepth=readDepth(vUv);
|
|
|
107741
107731
|
}
|
|
107742
107732
|
/** Captures column ownership before asynchronous block or asset loading starts. */
|
|
107743
107733
|
prepare(entities = [], column) {
|
|
107744
|
-
const root = AssetLoader.ROOT, scope = AssetLoader.persistentScope;
|
|
107745
|
-
const checkSources = () => {
|
|
107746
|
-
if (root !== AssetLoader.ROOT || scope !== AssetLoader.persistentScope) throw new Error("Asset sources changed while loading saved entities; retry the request");
|
|
107747
|
-
};
|
|
107748
107734
|
const placements = entities.flatMap((entity) => {
|
|
107749
107735
|
const resolved = resolveSavedEntity(entity);
|
|
107750
107736
|
if (!resolved) return [];
|
|
@@ -107760,17 +107746,13 @@ gl_FragDepth=readDepth(vUv);
|
|
|
107760
107746
|
let object4;
|
|
107761
107747
|
try {
|
|
107762
107748
|
if (!current()) return;
|
|
107763
|
-
checkSources();
|
|
107764
107749
|
const models = await Entities.getEntityList();
|
|
107765
|
-
checkSources();
|
|
107766
107750
|
if (!models.includes(placement.key.path) || !current()) return;
|
|
107767
107751
|
const model = await Entities.getEntity(placement.key, placement.texture, { when: placement.when });
|
|
107768
|
-
checkSources();
|
|
107769
107752
|
if (!model || !current()) return;
|
|
107770
107753
|
let tints = placement.tints;
|
|
107771
107754
|
if (placement.woolDye) {
|
|
107772
107755
|
const dye = (await BannerPatterns.getColors(placement.key.root))[placement.woolDye];
|
|
107773
|
-
checkSources();
|
|
107774
107756
|
const tint = placement.woolDye === "white" ? 15132390 : Math.floor((dye >> 16 & 255) * 0.75) << 16 | Math.floor((dye >> 8 & 255) * 0.75) << 8 | Math.floor((dye & 255) * 0.75);
|
|
107775
107757
|
tints = { ...tints, wool_color: tint };
|
|
107776
107758
|
}
|
|
@@ -107780,7 +107762,6 @@ gl_FragDepth=readDepth(vUv);
|
|
|
107780
107762
|
object4.position.fromArray(placement.position).multiplyScalar(16).addScalar(-8);
|
|
107781
107763
|
object4.rotation.y = placement.yaw;
|
|
107782
107764
|
await object4.init();
|
|
107783
|
-
checkSources();
|
|
107784
107765
|
if (!current()) return;
|
|
107785
107766
|
placement.owner.add(object4);
|
|
107786
107767
|
this.scene.add(object4);
|