minerender 2.1.0-alpha.76 → 2.1.0-alpha.78

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.
@@ -863,8 +863,8 @@ var init_Textures = __esm({
863
863
  for (let y = 0; y < size; y++) {
864
864
  for (let x = 0; x < size; x++) {
865
865
  const offset = (y * size + x) * 4;
866
- const color = (x + y) % 2 === 0 ? 255 : 0;
867
- data[offset] = data[offset + 2] = color;
866
+ const color2 = (x + y) % 2 === 0 ? 255 : 0;
867
+ data[offset] = data[offset + 2] = color2;
868
868
  data[offset + 3] = 255;
869
869
  }
870
870
  }
@@ -1449,17 +1449,17 @@ var init_AssetKey = __esm({
1449
1449
  var DisplayPosition, DISPLAY_POSITIONS;
1450
1450
  var init_DisplayPosition = __esm({
1451
1451
  "src/model/DisplayPosition.ts"() {
1452
- DisplayPosition = /* @__PURE__ */ ((DisplayPosition2) => {
1453
- DisplayPosition2["THIRDPERSON_RIGHTHAND"] = "thirdperson_righthand";
1454
- DisplayPosition2["THIRDPERSON_LEFTHAND"] = "thirdperson_lefthand";
1455
- DisplayPosition2["FIRSTPERSON_RIGHTHAND"] = "firstperson_righthand";
1456
- DisplayPosition2["FIRSTPERSON_LEFTHAND"] = "firstperson_lefthand";
1457
- DisplayPosition2["GUI"] = "gui";
1458
- DisplayPosition2["HEAD"] = "head";
1459
- DisplayPosition2["GROUND"] = "ground";
1460
- DisplayPosition2["FIXED"] = "fixed";
1461
- DisplayPosition2["ON_SHELF"] = "on_shelf";
1462
- return DisplayPosition2;
1452
+ DisplayPosition = /* @__PURE__ */ ((DisplayPosition3) => {
1453
+ DisplayPosition3["THIRDPERSON_RIGHTHAND"] = "thirdperson_righthand";
1454
+ DisplayPosition3["THIRDPERSON_LEFTHAND"] = "thirdperson_lefthand";
1455
+ DisplayPosition3["FIRSTPERSON_RIGHTHAND"] = "firstperson_righthand";
1456
+ DisplayPosition3["FIRSTPERSON_LEFTHAND"] = "firstperson_lefthand";
1457
+ DisplayPosition3["GUI"] = "gui";
1458
+ DisplayPosition3["HEAD"] = "head";
1459
+ DisplayPosition3["GROUND"] = "ground";
1460
+ DisplayPosition3["FIXED"] = "fixed";
1461
+ DisplayPosition3["ON_SHELF"] = "on_shelf";
1462
+ return DisplayPosition3;
1463
1463
  })(DisplayPosition || {});
1464
1464
  DISPLAY_POSITIONS = Object.values(DisplayPosition);
1465
1465
  }
@@ -1677,11 +1677,11 @@ var init_Models = __esm({
1677
1677
  return this.PERSISTENT_CACHE.getOrLoad(AssetLoader.persistentKey(keyStr), (k1) => {
1678
1678
  return AssetLoader.get(key, "model" /* MODEL */);
1679
1679
  });
1680
- }).then((asset) => {
1681
- if (asset) {
1682
- asset.key = key;
1680
+ }).then((asset2) => {
1681
+ if (asset2) {
1682
+ asset2.key = key;
1683
1683
  }
1684
- return asset;
1684
+ return asset2;
1685
1685
  });
1686
1686
  }
1687
1687
  /**
@@ -1771,11 +1771,11 @@ var init_BlockStates = __esm({
1771
1771
  return this.PERSISTENT_CACHE.getOrLoad(AssetLoader.persistentKey(keyStr), (k1) => {
1772
1772
  return AssetLoader.get(key, "blockstate" /* BLOCKSTATE */);
1773
1773
  });
1774
- }).then((asset) => {
1775
- if (asset) {
1776
- asset.key = key;
1774
+ }).then((asset2) => {
1775
+ if (asset2) {
1776
+ asset2.key = key;
1777
1777
  }
1778
- return asset;
1778
+ return asset2;
1779
1779
  });
1780
1780
  }
1781
1781
  static getAll(keys) {
@@ -1925,29 +1925,29 @@ function applyGenericRotation(axis, rotation, obj) {
1925
1925
  break;
1926
1926
  }
1927
1927
  }
1928
- function addBox3WireframeToObject(box, obj, color = 16777215, w = 2) {
1928
+ function addBox3WireframeToObject(box, obj, color2 = 16777215, w = 2) {
1929
1929
  let size = new Vector33();
1930
1930
  box.getSize(size);
1931
1931
  let boxGeo = new BoxGeometry2(size.x, size.y, size.z, 1, 1, 1);
1932
1932
  let wireGeo = new EdgesGeometry(boxGeo);
1933
- let wireMat = new LineBasicMaterial({ color, linewidth: w });
1933
+ let wireMat = new LineBasicMaterial({ color: color2, linewidth: w });
1934
1934
  let wireframe = new LineSegments(wireGeo, wireMat);
1935
1935
  obj.add(wireframe);
1936
1936
  let axes = new AxesHelper(1);
1937
1937
  obj.add(axes);
1938
1938
  }
1939
- function addWireframeToObject(obj, color = 16777215, w = 2) {
1939
+ function addWireframeToObject(obj, color2 = 16777215, w = 2) {
1940
1940
  let boxGeo = new BoxGeometry2(16, 16, 16, 1, 1, 1);
1941
1941
  let wireGeo = new EdgesGeometry(boxGeo);
1942
- let wireMat = new LineBasicMaterial({ color, linewidth: w });
1942
+ let wireMat = new LineBasicMaterial({ color: color2, linewidth: w });
1943
1943
  let wireframe = new LineSegments(wireGeo, wireMat);
1944
1944
  obj.add(wireframe);
1945
1945
  let axes = new AxesHelper(1);
1946
1946
  obj.add(axes);
1947
1947
  }
1948
- function addWireframeToMesh(geo, mesh, color = 16777215, w = 2) {
1948
+ function addWireframeToMesh(geo, mesh, color2 = 16777215, w = 2) {
1949
1949
  let wireGeo = new EdgesGeometry(geo);
1950
- let wireMat = new LineBasicMaterial({ color, linewidth: w });
1950
+ let wireMat = new LineBasicMaterial({ color: color2, linewidth: w });
1951
1951
  let wireframe = new LineSegments(wireGeo, wireMat);
1952
1952
  mesh.add(wireframe);
1953
1953
  let axes = new AxesHelper(1);
@@ -2394,27 +2394,27 @@ var init_PackFormats = __esm({
2394
2394
  this.versions = /* @__PURE__ */ new Map();
2395
2395
  }
2396
2396
  /** Resolves pack formats from Mojang's client metadata hosted on assets.mcasset.cloud. */
2397
- static async get(version, type) {
2398
- let pending = this.versions.get(version);
2397
+ static async get(version2, type) {
2398
+ let pending = this.versions.get(version2);
2399
2399
  if (!pending || pending.expires <= Date.now()) {
2400
2400
  pending = {
2401
- formats: this.load(version),
2402
- expires: ["latest", "release", "snapshot"].includes(version) ? Date.now() + 3e5 : Infinity
2401
+ formats: this.load(version2),
2402
+ expires: ["latest", "release", "snapshot"].includes(version2) ? Date.now() + 3e5 : Infinity
2403
2403
  };
2404
- this.versions.set(version, pending);
2404
+ this.versions.set(version2, pending);
2405
2405
  }
2406
2406
  try {
2407
2407
  return (await pending.formats)[type];
2408
2408
  } catch (cause) {
2409
- if (this.versions.get(version) === pending) this.versions.delete(version);
2409
+ if (this.versions.get(version2) === pending) this.versions.delete(version2);
2410
2410
  const option = type === "assets" ? "resourcePackFormat" : "dataPackFormat";
2411
2411
  const reason = cause instanceof Error ? cause.message : String(cause);
2412
- throw new Error(`Could not resolve the pack format for Minecraft ${version}. Set ArchiveAssetSource ${option} explicitly. ${reason}`);
2412
+ throw new Error(`Could not resolve the pack format for Minecraft ${version2}. Set ArchiveAssetSource ${option} explicitly. ${reason}`);
2413
2413
  }
2414
2414
  }
2415
- static async load(version) {
2415
+ static async load(version2) {
2416
2416
  const response = await Requests.genericRequest({
2417
- url: `https://assets.mcasset.cloud/${encodeURIComponent(version)}/game-version.json`,
2417
+ url: `https://assets.mcasset.cloud/${encodeURIComponent(version2)}/game-version.json`,
2418
2418
  responseType: "json"
2419
2419
  });
2420
2420
  const data = response.data;
@@ -2502,7 +2502,7 @@ var init_ArchiveAssetSource = __esm({
2502
2502
  }
2503
2503
  async load(key, parser) {
2504
2504
  const path = `${this.assetBasePath(key)}${key.type !== void 0 ? key.type + "/" : ""}${key.path}${key.extension}`;
2505
- const version = AssetLoader.version;
2505
+ const version2 = AssetLoader.version;
2506
2506
  let selectedPath = path;
2507
2507
  let url;
2508
2508
  try {
@@ -2510,7 +2510,7 @@ var init_ArchiveAssetSource = __esm({
2510
2510
  if (key.rootType === "assets" || key.rootType === "data") {
2511
2511
  const metadata = await this.getMetadata(key);
2512
2512
  if (metadata.hasOverlays) {
2513
- const format2 = (key.rootType === "assets" ? this.options.resourcePackFormat : this.options.dataPackFormat) ?? await PackFormats.get(version, key.rootType);
2513
+ const format2 = (key.rootType === "assets" ? this.options.resourcePackFormat : this.options.dataPackFormat) ?? await PackFormats.get(version2, key.rootType);
2514
2514
  directories = metadata.overlayDirectories(format2);
2515
2515
  }
2516
2516
  }
@@ -2608,8 +2608,8 @@ var init_AssetLoader = __esm({
2608
2608
  return this.ROOT.substring(this.ROOT.lastIndexOf("/") + 1);
2609
2609
  }
2610
2610
  /** Selects an mcasset.cloud version, updates the vanilla source, and clears in-memory caches. */
2611
- static setVersion(version) {
2612
- this.ROOT = `https://assets.mcasset.cloud/${version}`;
2611
+ static setVersion(version2) {
2612
+ this.ROOT = `https://assets.mcasset.cloud/${version2}`;
2613
2613
  const source = new HostedAssetSource(this.ROOT, { retryDefaults: false });
2614
2614
  const index = this._SOURCES.findIndex((s) => s.key === "mcassets");
2615
2615
  if (index !== -1) {
@@ -2678,8 +2678,8 @@ ${key}` : key;
2678
2678
  const sources = [...this._SOURCES];
2679
2679
  const results = [];
2680
2680
  for (const { source } of sources) {
2681
- const asset = await source.get(key, parser);
2682
- if (asset != void 0) results.push(asset);
2681
+ const asset2 = await source.get(key, parser);
2682
+ if (asset2 != void 0) results.push(asset2);
2683
2683
  if (await source.blocks(key)) break;
2684
2684
  }
2685
2685
  return results;
@@ -2741,9 +2741,9 @@ var init_ModelTextures = __esm({
2741
2741
  const pending = this.preload(key);
2742
2742
  const cached2 = Caching.textureAssetCache.getIfPresent(keyStr);
2743
2743
  try {
2744
- const asset = await pending;
2745
- if (asset) {
2746
- return await ImageLoader.infoToCanvasData(asset);
2744
+ const asset2 = await pending;
2745
+ if (asset2) {
2746
+ return await ImageLoader.infoToCanvasData(asset2);
2747
2747
  }
2748
2748
  return void 0;
2749
2749
  } catch (err) {
@@ -2757,10 +2757,10 @@ var init_ModelTextures = __esm({
2757
2757
  static async preload(key) {
2758
2758
  const keyStr = key.serialize();
2759
2759
  return Caching.textureAssetCache.get(keyStr, (k) => {
2760
- return AssetLoader.get(key, "image" /* IMAGE */).then((asset) => {
2761
- if (asset)
2762
- asset.key = key;
2763
- return asset;
2760
+ return AssetLoader.get(key, "image" /* IMAGE */).then((asset2) => {
2761
+ if (asset2)
2762
+ asset2.key = key;
2763
+ return asset2;
2764
2764
  });
2765
2765
  });
2766
2766
  }
@@ -2773,10 +2773,10 @@ var init_ModelTextures = __esm({
2773
2773
  const keyStr = key.serialize();
2774
2774
  return Caching.textureMetaCache.get(keyStr, (k) => {
2775
2775
  return this.PERSISTENT_META_CACHE.getOrLoad(AssetLoader.persistentKey(keyStr), (k1) => {
2776
- return AssetLoader.get(key, "meta" /* META */).then((asset) => {
2777
- if (asset)
2778
- asset.key = key;
2779
- return asset;
2776
+ return AssetLoader.get(key, "meta" /* META */).then((asset2) => {
2777
+ if (asset2)
2778
+ asset2.key = key;
2779
+ return asset2;
2780
2780
  });
2781
2781
  });
2782
2782
  });
@@ -3345,12 +3345,12 @@ var init_UVMapper = __esm({
3345
3345
  } else {
3346
3346
  uniqueTextureNames.push(textureKey);
3347
3347
  const assetKey = AssetKey.parse("textures", textureValue, model.key);
3348
- promises.push(ModelTextures.get(assetKey).then((asset) => {
3349
- if (!asset) {
3348
+ promises.push(ModelTextures.get(assetKey).then((asset2) => {
3349
+ if (!asset2) {
3350
3350
  console.warn(p5, "Missing texture", assetKey);
3351
3351
  return;
3352
3352
  }
3353
- textureMap[textureKey] = new WrappedImage(asset);
3353
+ textureMap[textureKey] = new WrappedImage(asset2);
3354
3354
  }));
3355
3355
  promises.push(ModelTextures.getMeta(assetKey).then((meta) => {
3356
3356
  metaMap[textureKey] = meta;
@@ -3694,10 +3694,10 @@ var init_Entities = __esm({
3694
3694
  const collect = async (path) => {
3695
3695
  const prefix2 = path ? `${path}/` : "";
3696
3696
  const key = new AssetKey(DEFAULT_NAMESPACE, `${prefix2}_list`, void 0, void 0, "entity-models", ".json");
3697
- const list = await Caching.listAssetCache.get(key.serialize(), () => AssetLoader.get(key, "list" /* LIST */));
3698
- if (!list) return [];
3699
- const files = list.files.filter((file) => file.endsWith(".json") && file !== "_list.json").map((file) => `${prefix2}${file.slice(0, -5)}`);
3700
- const children = await Promise.all(list.directories.map((directory) => collect(`${prefix2}${directory}`)));
3697
+ const list2 = await Caching.listAssetCache.get(key.serialize(), () => AssetLoader.get(key, "list" /* LIST */));
3698
+ if (!list2) return [];
3699
+ const files = list2.files.filter((file) => file.endsWith(".json") && file !== "_list.json").map((file) => `${prefix2}${file.slice(0, -5)}`);
3700
+ const children = await Promise.all(list2.directories.map((directory) => collect(`${prefix2}${directory}`)));
3701
3701
  return [...files, ...children.flat()];
3702
3702
  };
3703
3703
  return collect("");
@@ -3781,8 +3781,8 @@ var init_Entities = __esm({
3781
3781
  if (await ModelTextures.get(texture2)) return texture2;
3782
3782
  }
3783
3783
  const listKey = new AssetKey(modelKey.namespace, "_list", `${name}_variant`, void 0, "data", ".json", root);
3784
- const list = await AssetLoader.get(listKey, "list" /* LIST */);
3785
- const files = list?.files.filter((file2) => file2.endsWith(".json") && file2 !== "_list.json");
3784
+ const list2 = await AssetLoader.get(listKey, "list" /* LIST */);
3785
+ const files = list2?.files.filter((file2) => file2.endsWith(".json") && file2 !== "_list.json");
3786
3786
  const file = files?.find((file2) => file2 === "temperate.json") ?? files?.[0];
3787
3787
  if (!file) return void 0;
3788
3788
  const variantKey = new AssetKey(modelKey.namespace, file.slice(0, -5), `${name}_variant`, void 0, "data", ".json", root);
@@ -3887,27 +3887,27 @@ var init_EntityAnimationPlayer = __esm({
3887
3887
  for (const layer of layers) {
3888
3888
  const objects = [];
3889
3889
  if (poses) {
3890
- layer.traverse((object2) => {
3891
- if (poses.has(object2)) objects.push(object2);
3890
+ layer.traverse((object3) => {
3891
+ if (poses.has(object3)) objects.push(object3);
3892
3892
  });
3893
3893
  } else {
3894
3894
  for (const bone of Object.keys(animation.bones)) {
3895
- const object2 = layer.getObjectByName(`group:${bone}`);
3896
- if (object2) objects.push(object2);
3895
+ const object3 = layer.getObjectByName(`group:${bone}`);
3896
+ if (object3) objects.push(object3);
3897
3897
  }
3898
3898
  }
3899
- for (const object2 of objects) {
3900
- const bone = object2.name.slice("group:".length);
3901
- const pose = poses?.get(object2);
3899
+ for (const object3 of objects) {
3900
+ const bone = object3.name.slice("group:".length);
3901
+ const pose = poses?.get(object3);
3902
3902
  this.parts.push({
3903
3903
  bone,
3904
- object: object2,
3905
- position: object2.position.clone(),
3906
- rotation: object2.rotation.clone(),
3907
- scale: object2.scale.clone(),
3908
- basePosition: pose ? new Vector35(...pose.offset) : object2.position.clone(),
3909
- baseRotation: pose ? new Euler3(...pose.rotation, "ZYX") : object2.rotation.clone(),
3910
- baseScale: pose ? new Vector35(...pose.scale ?? [1, 1, 1]) : object2.scale.clone()
3904
+ object: object3,
3905
+ position: object3.position.clone(),
3906
+ rotation: object3.rotation.clone(),
3907
+ scale: object3.scale.clone(),
3908
+ basePosition: pose ? new Vector35(...pose.offset) : object3.position.clone(),
3909
+ baseRotation: pose ? new Euler3(...pose.rotation, "ZYX") : object3.rotation.clone(),
3910
+ baseScale: pose ? new Vector35(...pose.scale ?? [1, 1, 1]) : object3.scale.clone()
3911
3911
  });
3912
3912
  }
3913
3913
  }
@@ -4273,10 +4273,10 @@ var init_SceneObject = __esm({
4273
4273
  return new InstancedBufferAttribute(array, attribute.itemSize, attribute.normalized, attribute.meshPerAttribute).setUsage(attribute.usage);
4274
4274
  };
4275
4275
  const matrix = grow(mesh.instanceMatrix, 0);
4276
- const color = mesh.instanceColor ? grow(mesh.instanceColor, 1) : null;
4276
+ const color2 = mesh.instanceColor ? grow(mesh.instanceColor, 1) : null;
4277
4277
  mesh.dispose();
4278
4278
  mesh.instanceMatrix = matrix;
4279
- mesh.instanceColor = color;
4279
+ mesh.instanceColor = color2;
4280
4280
  }
4281
4281
  *activeInstanceIndices() {
4282
4282
  if (this.instanceMesh) {
@@ -4449,15 +4449,15 @@ var init_SceneObject = __esm({
4449
4449
  }
4450
4450
  }
4451
4451
  //</editor-fold>
4452
- toggleObjectVisibility(object2, visible) {
4453
- if (object2) {
4452
+ toggleObjectVisibility(object3, visible) {
4453
+ if (object3) {
4454
4454
  if (typeof visible !== "undefined") {
4455
- object2.visible = visible;
4455
+ object3.visible = visible;
4456
4456
  } else {
4457
- object2.visible = !object2.visible;
4457
+ object3.visible = !object3.visible;
4458
4458
  }
4459
4459
  this.notifyDirty();
4460
- return object2.visible;
4460
+ return object3.visible;
4461
4461
  }
4462
4462
  this.notifyDirty();
4463
4463
  return false;
@@ -4753,8 +4753,8 @@ var init_EntityObject = __esm({
4753
4753
  this.scrollMaterials.push({ material: mat, offset: mat.map.offset, speed: scroll });
4754
4754
  }
4755
4755
  }
4756
- this.getLayerGroup(name)?.traverse((object2) => {
4757
- if (isMesh(object2)) object2.material = mat;
4756
+ this.getLayerGroup(name)?.traverse((object3) => {
4757
+ if (isMesh(object3)) object3.material = mat;
4758
4758
  });
4759
4759
  }));
4760
4760
  if (!this.children.length) {
@@ -5093,8 +5093,8 @@ function toTrianglesDrawMode(geometry, drawMode) {
5093
5093
  return geometry;
5094
5094
  }
5095
5095
  }
5096
- function computeMorphedAttributes(object2) {
5097
- if (object2.geometry.isBufferGeometry !== true) {
5096
+ function computeMorphedAttributes(object3) {
5097
+ if (object3.geometry.isBufferGeometry !== true) {
5098
5098
  console.error("THREE.BufferGeometryUtils: Geometry is not of type BufferGeometry.");
5099
5099
  return null;
5100
5100
  }
@@ -5107,11 +5107,11 @@ function computeMorphedAttributes(object2) {
5107
5107
  const _morphA = new Vector310();
5108
5108
  const _morphB = new Vector310();
5109
5109
  const _morphC = new Vector310();
5110
- function _calculateMorphedAttributeData(object3, material2, attribute, morphAttribute, morphTargetsRelative2, a2, b2, c2, modifiedAttributeArray) {
5110
+ function _calculateMorphedAttributeData(object4, material2, attribute, morphAttribute, morphTargetsRelative2, a2, b2, c2, modifiedAttributeArray) {
5111
5111
  _vA.fromBufferAttribute(attribute, a2);
5112
5112
  _vB.fromBufferAttribute(attribute, b2);
5113
5113
  _vC.fromBufferAttribute(attribute, c2);
5114
- const morphInfluences = object3.morphTargetInfluences;
5114
+ const morphInfluences = object4.morphTargetInfluences;
5115
5115
  if (material2.morphTargets && morphAttribute && morphInfluences) {
5116
5116
  _morphA.set(0, 0, 0);
5117
5117
  _morphB.set(0, 0, 0);
@@ -5137,10 +5137,10 @@ function computeMorphedAttributes(object2) {
5137
5137
  _vB.add(_morphB);
5138
5138
  _vC.add(_morphC);
5139
5139
  }
5140
- if (object3.isSkinnedMesh) {
5141
- object3.boneTransform(a2, _vA);
5142
- object3.boneTransform(b2, _vB);
5143
- object3.boneTransform(c2, _vC);
5140
+ if (object4.isSkinnedMesh) {
5141
+ object4.boneTransform(a2, _vA);
5142
+ object4.boneTransform(b2, _vB);
5143
+ object4.boneTransform(c2, _vC);
5144
5144
  }
5145
5145
  modifiedAttributeArray[a2 * 3 + 0] = _vA.x;
5146
5146
  modifiedAttributeArray[a2 * 3 + 1] = _vA.y;
@@ -5152,8 +5152,8 @@ function computeMorphedAttributes(object2) {
5152
5152
  modifiedAttributeArray[c2 * 3 + 1] = _vC.y;
5153
5153
  modifiedAttributeArray[c2 * 3 + 2] = _vC.z;
5154
5154
  }
5155
- const geometry = object2.geometry;
5156
- const material = object2.material;
5155
+ const geometry = object3.geometry;
5156
+ const material = object3.material;
5157
5157
  let a, b, c;
5158
5158
  const index = geometry.index;
5159
5159
  const positionAttribute = geometry.attributes.position;
@@ -5180,7 +5180,7 @@ function computeMorphedAttributes(object2) {
5180
5180
  b = index.getX(j + 1);
5181
5181
  c = index.getX(j + 2);
5182
5182
  _calculateMorphedAttributeData(
5183
- object2,
5183
+ object3,
5184
5184
  groupMaterial,
5185
5185
  positionAttribute,
5186
5186
  morphPosition,
@@ -5191,7 +5191,7 @@ function computeMorphedAttributes(object2) {
5191
5191
  modifiedPosition
5192
5192
  );
5193
5193
  _calculateMorphedAttributeData(
5194
- object2,
5194
+ object3,
5195
5195
  groupMaterial,
5196
5196
  normalAttribute,
5197
5197
  morphNormal,
@@ -5211,7 +5211,7 @@ function computeMorphedAttributes(object2) {
5211
5211
  b = index.getX(i + 1);
5212
5212
  c = index.getX(i + 2);
5213
5213
  _calculateMorphedAttributeData(
5214
- object2,
5214
+ object3,
5215
5215
  material,
5216
5216
  positionAttribute,
5217
5217
  morphPosition,
@@ -5222,7 +5222,7 @@ function computeMorphedAttributes(object2) {
5222
5222
  modifiedPosition
5223
5223
  );
5224
5224
  _calculateMorphedAttributeData(
5225
- object2,
5225
+ object3,
5226
5226
  material,
5227
5227
  normalAttribute,
5228
5228
  morphNormal,
@@ -5246,7 +5246,7 @@ function computeMorphedAttributes(object2) {
5246
5246
  b = j + 1;
5247
5247
  c = j + 2;
5248
5248
  _calculateMorphedAttributeData(
5249
- object2,
5249
+ object3,
5250
5250
  groupMaterial,
5251
5251
  positionAttribute,
5252
5252
  morphPosition,
@@ -5257,7 +5257,7 @@ function computeMorphedAttributes(object2) {
5257
5257
  modifiedPosition
5258
5258
  );
5259
5259
  _calculateMorphedAttributeData(
5260
- object2,
5260
+ object3,
5261
5261
  groupMaterial,
5262
5262
  normalAttribute,
5263
5263
  morphNormal,
@@ -5277,7 +5277,7 @@ function computeMorphedAttributes(object2) {
5277
5277
  b = i + 1;
5278
5278
  c = i + 2;
5279
5279
  _calculateMorphedAttributeData(
5280
- object2,
5280
+ object3,
5281
5281
  material,
5282
5282
  positionAttribute,
5283
5283
  morphPosition,
@@ -5288,7 +5288,7 @@ function computeMorphedAttributes(object2) {
5288
5288
  modifiedPosition
5289
5289
  );
5290
5290
  _calculateMorphedAttributeData(
5291
- object2,
5291
+ object3,
5292
5292
  material,
5293
5293
  normalAttribute,
5294
5294
  morphNormal,
@@ -5544,9 +5544,9 @@ var init_ItemTints = __esm({
5544
5544
  }));
5545
5545
  return colors;
5546
5546
  }
5547
- static rgb(color) {
5548
- if (!Array.isArray(color)) return color & 16777215;
5549
- const [red, green, blue] = color.map((channel) => Math.floor(Math.fround(Math.fround(channel) * 255)));
5547
+ static rgb(color2) {
5548
+ if (!Array.isArray(color2)) return color2 & 16777215;
5549
+ const [red, green, blue] = color2.map((channel) => Math.floor(Math.fround(Math.fround(channel) * 255)));
5550
5550
  return red << 16 | green << 8 | blue;
5551
5551
  }
5552
5552
  };
@@ -5602,13 +5602,13 @@ var init_ModelObject = __esm({
5602
5602
  transform.multiply(new Matrix49().makeTranslation(-8, -8, -8));
5603
5603
  try {
5604
5604
  for (const part of parts) {
5605
- const object2 = new EntityObject(part.model, { flip: false, wireframe: this.options.wireframe });
5606
- object2.matrix.copy(transform).multiply(part.transform);
5607
- object2.matrixWorldNeedsUpdate = true;
5608
- object2.matrixAutoUpdate = false;
5609
- this.add(object2);
5610
- await object2.init();
5611
- object2.iterateAllMeshes((mesh) => {
5605
+ const object3 = new EntityObject(part.model, { flip: false, wireframe: this.options.wireframe });
5606
+ object3.matrix.copy(transform).multiply(part.transform);
5607
+ object3.matrixWorldNeedsUpdate = true;
5608
+ object3.matrixAutoUpdate = false;
5609
+ this.add(object3);
5610
+ await object3.init();
5611
+ object3.iterateAllMeshes((mesh) => {
5612
5612
  const source = mesh.material;
5613
5613
  let material = this.specialMaterials.get(source);
5614
5614
  if (!material) {
@@ -5619,7 +5619,7 @@ var init_ModelObject = __esm({
5619
5619
  mesh.material = material;
5620
5620
  });
5621
5621
  for (const [name, rotation] of Object.entries(part.rotations)) {
5622
- object2.getGroupByName(name)?.rotation.set(...rotation, "ZYX");
5622
+ object3.getGroupByName(name)?.rotation.set(...rotation, "ZYX");
5623
5623
  }
5624
5624
  }
5625
5625
  } catch (error) {
@@ -5672,9 +5672,9 @@ var init_ModelObject = __esm({
5672
5672
  if (tintIndex === void 0 || tintIndex < 0) continue;
5673
5673
  const tint = this.options.tints[tintIndex];
5674
5674
  if (tint === void 0) continue;
5675
- const color = new Color9(tint);
5675
+ const color2 = new Color9(tint);
5676
5676
  for (let vertex = 0; vertex < 4; vertex++) {
5677
- color.toArray(colors, (faceIndex * 4 + vertex) * 3);
5677
+ color2.toArray(colors, (faceIndex * 4 + vertex) * 3);
5678
5678
  }
5679
5679
  }
5680
5680
  elGeo.setAttribute("color", new BufferAttribute5(colors, 3));
@@ -5989,9 +5989,9 @@ var init_FluidModelObject = __esm({
5989
5989
  }
5990
5990
  }
5991
5991
  geometry.clearGroups();
5992
- const color = new Color10(this.options.tints?.[0] ?? (this.kind === "water" ? 4159204 : 16777215));
5992
+ const color2 = new Color10(this.options.tints?.[0] ?? (this.kind === "water" ? 4159204 : 16777215));
5993
5993
  const colors = new Float32Array(geometry.getAttribute("position").count * 3);
5994
- for (let i = 0; i < colors.length; i += 3) color.toArray(colors, i);
5994
+ for (let i = 0; i < colors.length; i += 3) color2.toArray(colors, i);
5995
5995
  geometry.setAttribute("color", new BufferAttribute6(colors, 3));
5996
5996
  geometry.computeBoundingBox();
5997
5997
  geometry.computeBoundingSphere();
@@ -6084,9 +6084,9 @@ var NodeEnv = class {
6084
6084
  imageSize(data) {
6085
6085
  return imageSize(Buffer.isBuffer(data) ? data : Buffer.from(data));
6086
6086
  }
6087
- openCache(name, version) {
6087
+ openCache(name, version2) {
6088
6088
  return new NodeCache(NodePersist.create({
6089
- dir: name + version,
6089
+ dir: name + version2,
6090
6090
  encoding: "utf8"
6091
6091
  }));
6092
6092
  }
@@ -6247,8 +6247,8 @@ var Fonts = class {
6247
6247
  const stack = await AssetLoader.getAll(key, "json" /* JSON */);
6248
6248
  if (stack.length === 0) throw new Error(`Could not load font ${key.toNamespacedString()}`);
6249
6249
  const glyphs = /* @__PURE__ */ new Map();
6250
- for (const asset of stack) {
6251
- for (const provider of asset.providers) {
6250
+ for (const asset2 of stack) {
6251
+ for (const provider of asset2.providers) {
6252
6252
  if (provider.filter?.uniform || provider.filter?.jp) continue;
6253
6253
  let provided;
6254
6254
  switch (provider.type) {
@@ -6394,13 +6394,13 @@ var OBJExporter = class {
6394
6394
  * @param {Object3D} object - The 3D object to export.
6395
6395
  * @return {string} The exported OBJ.
6396
6396
  */
6397
- parse(object2) {
6397
+ parse(object3) {
6398
6398
  let output = "";
6399
6399
  let indexVertex = 0;
6400
6400
  let indexVertexUvs = 0;
6401
6401
  let indexNormals = 0;
6402
6402
  const vertex = new Vector37();
6403
- const color = new Color4();
6403
+ const color2 = new Color4();
6404
6404
  const normal = new Vector37();
6405
6405
  const uv = new Vector22();
6406
6406
  const face = [];
@@ -6499,9 +6499,9 @@ var OBJExporter = class {
6499
6499
  vertex.applyMatrix4(points.matrixWorld);
6500
6500
  output += "v " + vertex.x + " " + vertex.y + " " + vertex.z;
6501
6501
  if (colors !== void 0) {
6502
- color.fromBufferAttribute(colors, i);
6503
- ColorManagement.workingToColorSpace(color, SRGBColorSpace3);
6504
- output += " " + color.r + " " + color.g + " " + color.b;
6502
+ color2.fromBufferAttribute(colors, i);
6503
+ ColorManagement.workingToColorSpace(color2, SRGBColorSpace3);
6504
+ output += " " + color2.r + " " + color2.g + " " + color2.b;
6505
6505
  }
6506
6506
  output += "\n";
6507
6507
  }
@@ -6513,7 +6513,7 @@ var OBJExporter = class {
6513
6513
  }
6514
6514
  indexVertex += nbVertex;
6515
6515
  }
6516
- object2.traverse(function(child) {
6516
+ object3.traverse(function(child) {
6517
6517
  if (child.isMesh === true) {
6518
6518
  parseMesh(child);
6519
6519
  }
@@ -6547,9 +6547,9 @@ var PLYExporter = class {
6547
6547
  * @param {PLYExporter~Options} options - The export options.
6548
6548
  * @return {?(string|ArrayBuffer)} The exported PLY.
6549
6549
  */
6550
- parse(object2, onDone, options = {}) {
6550
+ parse(object3, onDone, options = {}) {
6551
6551
  function traverseMeshes(cb) {
6552
- object2.traverse(function(child) {
6552
+ object3.traverse(function(child) {
6553
6553
  if (child.isMesh === true || child.isPoints) {
6554
6554
  const mesh = child;
6555
6555
  const geometry = mesh.geometry;
@@ -6582,7 +6582,7 @@ var PLYExporter = class {
6582
6582
  for (const name of customAttributeNames) customTypes[name] = "float";
6583
6583
  let vertexCount = 0;
6584
6584
  let faceCount = 0;
6585
- object2.traverse(function(child) {
6585
+ object3.traverse(function(child) {
6586
6586
  if (child.isMesh === true) {
6587
6587
  const mesh = child;
6588
6588
  const geometry = mesh.geometry;
@@ -7204,8 +7204,8 @@ function equalArray(array1, array2) {
7204
7204
  return element === array2[index];
7205
7205
  });
7206
7206
  }
7207
- function stringToArrayBuffer(text) {
7208
- return new TextEncoder().encode(text).buffer;
7207
+ function stringToArrayBuffer(text2) {
7208
+ return new TextEncoder().encode(text2).buffer;
7209
7209
  }
7210
7210
  function isIdentityMatrix(matrix) {
7211
7211
  return equalArray(matrix.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
@@ -7398,12 +7398,12 @@ var GLTFWriter = class {
7398
7398
  * @param {THREE.Object3D|THREE.Material|THREE.BufferGeometry|THREE.AnimationClip} object
7399
7399
  * @param {Object} objectDef
7400
7400
  */
7401
- serializeUserData(object2, objectDef) {
7402
- if (Object.keys(object2.userData).length === 0) return;
7401
+ serializeUserData(object3, objectDef) {
7402
+ if (Object.keys(object3.userData).length === 0) return;
7403
7403
  const options = this.options;
7404
7404
  const extensionsUsed = this.extensionsUsed;
7405
7405
  try {
7406
- const json = JSON.parse(JSON.stringify(object2.userData));
7406
+ const json = JSON.parse(JSON.stringify(object3.userData));
7407
7407
  if (options.includeCustomExtensions && json.gltfExtensions) {
7408
7408
  if (objectDef.extensions === void 0) objectDef.extensions = {};
7409
7409
  for (const extensionName in json.gltfExtensions) {
@@ -7414,7 +7414,7 @@ var GLTFWriter = class {
7414
7414
  }
7415
7415
  if (Object.keys(json).length > 0) objectDef.extras = json;
7416
7416
  } catch (error) {
7417
- console.warn("THREE.GLTFExporter: userData of '" + object2.name + "' won't be serialized because of JSON.stringify error - " + error.message);
7417
+ console.warn("THREE.GLTFExporter: userData of '" + object3.name + "' won't be serialized because of JSON.stringify error - " + error.message);
7418
7418
  }
7419
7419
  }
7420
7420
  /**
@@ -7923,9 +7923,9 @@ var GLTFWriter = class {
7923
7923
  if (material.isMeshStandardMaterial !== true && material.isMeshBasicMaterial !== true) {
7924
7924
  console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");
7925
7925
  }
7926
- const color = material.color.toArray().concat([material.opacity]);
7927
- if (!equalArray(color, [1, 1, 1, 1])) {
7928
- materialDef.pbrMetallicRoughness.baseColorFactor = color;
7926
+ const color2 = material.color.toArray().concat([material.opacity]);
7927
+ if (!equalArray(color2, [1, 1, 1, 1])) {
7928
+ materialDef.pbrMetallicRoughness.baseColorFactor = color2;
7929
7929
  }
7930
7930
  if (material.isMeshStandardMaterial) {
7931
7931
  materialDef.pbrMetallicRoughness.metallicFactor = material.metalness;
@@ -8340,13 +8340,13 @@ var GLTFWriter = class {
8340
8340
  * @param {THREE.Object3D} object
8341
8341
  * @return {?number}
8342
8342
  */
8343
- processSkin(object2) {
8343
+ processSkin(object3) {
8344
8344
  const json = this.json;
8345
8345
  const nodeMap = this.nodeMap;
8346
- const node = json.nodes[nodeMap.get(object2)];
8347
- const skeleton = object2.skeleton;
8346
+ const node = json.nodes[nodeMap.get(object3)];
8347
+ const skeleton = object3.skeleton;
8348
8348
  if (skeleton === void 0) return null;
8349
- const rootJoint = object2.skeleton.bones[0];
8349
+ const rootJoint = object3.skeleton.bones[0];
8350
8350
  if (rootJoint === void 0) return null;
8351
8351
  const joints = [];
8352
8352
  const inverseBindMatrices = new Float32Array(skeleton.bones.length * 16);
@@ -8354,7 +8354,7 @@ var GLTFWriter = class {
8354
8354
  for (let i = 0; i < skeleton.bones.length; ++i) {
8355
8355
  joints.push(nodeMap.get(skeleton.bones[i]));
8356
8356
  temporaryBoneInverse.copy(skeleton.boneInverses[i]);
8357
- temporaryBoneInverse.multiply(object2.bindMatrix).toArray(inverseBindMatrices, i * 16);
8357
+ temporaryBoneInverse.multiply(object3.bindMatrix).toArray(inverseBindMatrices, i * 16);
8358
8358
  }
8359
8359
  if (json.skins === void 0) json.skins = [];
8360
8360
  json.skins.push({
@@ -8370,19 +8370,19 @@ var GLTFWriter = class {
8370
8370
  * @param {THREE.Object3D} object Object3D to processNodeAsync
8371
8371
  * @return {Promise<number>} Index of the node in the nodes list
8372
8372
  */
8373
- async processNodeAsync(object2) {
8373
+ async processNodeAsync(object3) {
8374
8374
  const json = this.json;
8375
8375
  const options = this.options;
8376
8376
  const nodeMap = this.nodeMap;
8377
8377
  if (!json.nodes) json.nodes = [];
8378
- if (object2.pivot !== null) {
8379
- return await this._processNodeWithPivotAsync(object2);
8378
+ if (object3.pivot !== null) {
8379
+ return await this._processNodeWithPivotAsync(object3);
8380
8380
  }
8381
8381
  const nodeDef = {};
8382
8382
  if (options.trs) {
8383
- const rotation = object2.quaternion.toArray();
8384
- const position = object2.position.toArray();
8385
- const scale = object2.scale.toArray();
8383
+ const rotation = object3.quaternion.toArray();
8384
+ const position = object3.position.toArray();
8385
+ const scale = object3.scale.toArray();
8386
8386
  if (!equalArray(rotation, [0, 0, 0, 1])) {
8387
8387
  nodeDef.rotation = rotation;
8388
8388
  }
@@ -8393,28 +8393,28 @@ var GLTFWriter = class {
8393
8393
  nodeDef.scale = scale;
8394
8394
  }
8395
8395
  } else {
8396
- if (object2.matrixAutoUpdate) {
8397
- object2.updateMatrix();
8396
+ if (object3.matrixAutoUpdate) {
8397
+ object3.updateMatrix();
8398
8398
  }
8399
- if (isIdentityMatrix(object2.matrix) === false) {
8400
- nodeDef.matrix = object2.matrix.elements;
8399
+ if (isIdentityMatrix(object3.matrix) === false) {
8400
+ nodeDef.matrix = object3.matrix.elements;
8401
8401
  }
8402
8402
  }
8403
- if (object2.name !== "") nodeDef.name = String(object2.name);
8404
- this.serializeUserData(object2, nodeDef);
8405
- if (object2.isMesh || object2.isLine || object2.isPoints) {
8406
- const meshIndex = await this.processMeshAsync(object2);
8403
+ if (object3.name !== "") nodeDef.name = String(object3.name);
8404
+ this.serializeUserData(object3, nodeDef);
8405
+ if (object3.isMesh || object3.isLine || object3.isPoints) {
8406
+ const meshIndex = await this.processMeshAsync(object3);
8407
8407
  if (meshIndex !== null) nodeDef.mesh = meshIndex;
8408
- } else if (object2.isCamera) {
8409
- nodeDef.camera = this.processCamera(object2);
8408
+ } else if (object3.isCamera) {
8409
+ nodeDef.camera = this.processCamera(object3);
8410
8410
  }
8411
- if (object2.isSkinnedMesh) this.skins.push(object2);
8411
+ if (object3.isSkinnedMesh) this.skins.push(object3);
8412
8412
  const nodeIndex = json.nodes.push(nodeDef) - 1;
8413
- nodeMap.set(object2, nodeIndex);
8414
- if (object2.children.length > 0) {
8413
+ nodeMap.set(object3, nodeIndex);
8414
+ if (object3.children.length > 0) {
8415
8415
  const children = [];
8416
- for (let i = 0, l = object2.children.length; i < l; i++) {
8417
- const child = object2.children[i];
8416
+ for (let i = 0, l = object3.children.length; i < l; i++) {
8417
+ const child = object3.children[i];
8418
8418
  if (child.visible || options.onlyVisible === false) {
8419
8419
  const childNodeIndex = await this.processNodeAsync(child);
8420
8420
  if (childNodeIndex !== null) children.push(childNodeIndex);
@@ -8423,7 +8423,7 @@ var GLTFWriter = class {
8423
8423
  if (children.length > 0) nodeDef.children = children;
8424
8424
  }
8425
8425
  await this._invokeAllAsync(function(ext) {
8426
- ext.writeNode && ext.writeNode(object2, nodeDef);
8426
+ ext.writeNode && ext.writeNode(object3, nodeDef);
8427
8427
  });
8428
8428
  return nodeIndex;
8429
8429
  }
@@ -8432,19 +8432,19 @@ var GLTFWriter = class {
8432
8432
  * @param {THREE.Object3D} object Object3D with pivot
8433
8433
  * @return {Promise<number>} Index of the container node
8434
8434
  */
8435
- async _processNodeWithPivotAsync(object2) {
8435
+ async _processNodeWithPivotAsync(object3) {
8436
8436
  const json = this.json;
8437
8437
  const options = this.options;
8438
8438
  const nodeMap = this.nodeMap;
8439
- const pivot = object2.pivot;
8439
+ const pivot = object3.pivot;
8440
8440
  const containerDef = {};
8441
- const rotation = object2.quaternion.toArray();
8441
+ const rotation = object3.quaternion.toArray();
8442
8442
  const position = [
8443
- object2.position.x + pivot.x,
8444
- object2.position.y + pivot.y,
8445
- object2.position.z + pivot.z
8443
+ object3.position.x + pivot.x,
8444
+ object3.position.y + pivot.y,
8445
+ object3.position.z + pivot.z
8446
8446
  ];
8447
- const scale = object2.scale.toArray();
8447
+ const scale = object3.scale.toArray();
8448
8448
  if (!equalArray(rotation, [0, 0, 0, 1])) {
8449
8449
  containerDef.rotation = rotation;
8450
8450
  }
@@ -8455,28 +8455,28 @@ var GLTFWriter = class {
8455
8455
  containerDef.scale = scale;
8456
8456
  }
8457
8457
  containerDef.extras = { pivot: pivot.toArray() };
8458
- if (object2.name !== "") containerDef.name = String(object2.name);
8459
- this.serializeUserData(object2, containerDef);
8458
+ if (object3.name !== "") containerDef.name = String(object3.name);
8459
+ this.serializeUserData(object3, containerDef);
8460
8460
  const containerIndex = json.nodes.push(containerDef) - 1;
8461
- nodeMap.set(object2, containerIndex);
8461
+ nodeMap.set(object3, containerIndex);
8462
8462
  const childDef = {};
8463
8463
  const childPosition = [-pivot.x, -pivot.y, -pivot.z];
8464
8464
  if (!equalArray(childPosition, [0, 0, 0])) {
8465
8465
  childDef.translation = childPosition;
8466
8466
  }
8467
- if (object2.isMesh || object2.isLine || object2.isPoints) {
8468
- const meshIndex = await this.processMeshAsync(object2);
8467
+ if (object3.isMesh || object3.isLine || object3.isPoints) {
8468
+ const meshIndex = await this.processMeshAsync(object3);
8469
8469
  if (meshIndex !== null) childDef.mesh = meshIndex;
8470
- } else if (object2.isCamera) {
8471
- childDef.camera = this.processCamera(object2);
8470
+ } else if (object3.isCamera) {
8471
+ childDef.camera = this.processCamera(object3);
8472
8472
  }
8473
- if (object2.isSkinnedMesh) this.skins.push(object2);
8473
+ if (object3.isSkinnedMesh) this.skins.push(object3);
8474
8474
  const childIndex = json.nodes.push(childDef) - 1;
8475
8475
  const containerChildren = [childIndex];
8476
- if (object2.children.length > 0) {
8476
+ if (object3.children.length > 0) {
8477
8477
  const grandchildren = [];
8478
- for (let i = 0, l = object2.children.length; i < l; i++) {
8479
- const child = object2.children[i];
8478
+ for (let i = 0, l = object3.children.length; i < l; i++) {
8479
+ const child = object3.children[i];
8480
8480
  if (child.visible || options.onlyVisible === false) {
8481
8481
  const childNodeIndex = await this.processNodeAsync(child);
8482
8482
  if (childNodeIndex !== null) grandchildren.push(childNodeIndex);
@@ -8486,7 +8486,7 @@ var GLTFWriter = class {
8486
8486
  }
8487
8487
  containerDef.children = containerChildren;
8488
8488
  await this._invokeAllAsync(function(ext) {
8489
- ext.writeNode && ext.writeNode(object2, containerDef);
8489
+ ext.writeNode && ext.writeNode(object3, containerDef);
8490
8490
  });
8491
8491
  return containerIndex;
8492
8492
  }
@@ -8929,10 +8929,10 @@ var GLTFMeshGpuInstancing = class {
8929
8929
  this.writer = writer;
8930
8930
  this.name = "EXT_mesh_gpu_instancing";
8931
8931
  }
8932
- writeNode(object2, nodeDef) {
8933
- if (!object2.isInstancedMesh) return;
8932
+ writeNode(object3, nodeDef) {
8933
+ if (!object3.isInstancedMesh) return;
8934
8934
  const writer = this.writer;
8935
- const mesh = object2;
8935
+ const mesh = object3;
8936
8936
  const translationAttr = new Float32Array(mesh.count * 3);
8937
8937
  const rotationAttr = new Float32Array(mesh.count * 4);
8938
8938
  const scaleAttr = new Float32Array(mesh.count * 3);
@@ -9122,8 +9122,8 @@ var SceneExporter = class {
9122
9122
  }
9123
9123
  }
9124
9124
  };
9125
- function localMatrix(object2) {
9126
- return object2.matrixAutoUpdate ? new Matrix47().compose(object2.position, object2.quaternion, object2.scale) : object2.matrix.clone();
9125
+ function localMatrix(object3) {
9126
+ return object3.matrixAutoUpdate ? new Matrix47().compose(object3.position, object3.quaternion, object3.scale) : object3.matrix.clone();
9127
9127
  }
9128
9128
  function createSnapshot(root, gltf, bakeColors = false) {
9129
9129
  const scene = new Scene3();
@@ -9227,24 +9227,24 @@ function createSnapshot(root, gltf, bakeColors = false) {
9227
9227
  scene.add(copy);
9228
9228
  }
9229
9229
  };
9230
- const visit = (object2, parentWorld) => {
9231
- if (!object2.visible) return;
9232
- const world = parentWorld.clone().multiply(localMatrix(object2));
9233
- const mesh = object2;
9230
+ const visit = (object3, parentWorld) => {
9231
+ if (!object3.visible) return;
9232
+ const world = parentWorld.clone().multiply(localMatrix(object3));
9233
+ const mesh = object3;
9234
9234
  if (mesh.isMesh) {
9235
9235
  const instanced = mesh;
9236
9236
  if (instanced.isInstancedMesh) {
9237
9237
  for (let i = 0; i < instanced.count; i++) {
9238
9238
  const matrix = new Matrix47();
9239
9239
  instanced.getMatrixAt(i, matrix);
9240
- const color = instanced.instanceColor ? new Color7().fromBufferAttribute(instanced.instanceColor, i) : void 0;
9241
- addMesh(mesh, world.clone().multiply(matrix), color);
9240
+ const color2 = instanced.instanceColor ? new Color7().fromBufferAttribute(instanced.instanceColor, i) : void 0;
9241
+ addMesh(mesh, world.clone().multiply(matrix), color2);
9242
9242
  }
9243
9243
  } else {
9244
9244
  addMesh(mesh, world);
9245
9245
  }
9246
9246
  }
9247
- for (const child of object2.children) visit(child, world);
9247
+ for (const child of object3.children) visit(child, world);
9248
9248
  };
9249
9249
  try {
9250
9250
  const ancestors = [];
@@ -9317,16 +9317,17 @@ function copyDataTexture(source) {
9317
9317
 
9318
9318
  // src/gui/GuiHelper.ts
9319
9319
  init_AssetKey();
9320
+ init_ModelTextures();
9320
9321
 
9321
9322
  // src/gui/GuiText.ts
9322
9323
  import { BufferGeometry as BufferGeometry2, Color as Color8, Float32BufferAttribute as Float32BufferAttribute4 } from "three";
9323
- async function layoutGuiText(text, options = {}) {
9324
+ async function layoutGuiText(text2, options = {}) {
9324
9325
  const maxWidth = options.maxWidth ?? Infinity, lineHeight = options.lineHeight ?? 9;
9325
9326
  if (!(maxWidth > 0) || !Number.isFinite(lineHeight) || lineHeight <= 0) {
9326
9327
  throw new Error("Text wrap width and line height must be positive");
9327
9328
  }
9328
9329
  const font = await Fonts.get(options.font);
9329
- const runs = typeof text === "string" ? [{ text }] : text;
9330
+ const runs = typeof text2 === "string" ? [{ text: text2 }] : text2;
9330
9331
  const glyphs = [], lineWidths = [];
9331
9332
  let line = [], width = 0;
9332
9333
  let trailingNewline = false;
@@ -9380,7 +9381,7 @@ function createGuiTextGeometry(layout, shadow = true) {
9380
9381
  batch = { image: glyph?.image, positions: [], uvs: [], colors: [], indices: [] };
9381
9382
  batches.push(batch);
9382
9383
  }
9383
- const color = new Color8(isShadow ? (style.color & 16579836) >> 2 : style.color);
9384
+ const color2 = new Color8(isShadow ? (style.color & 16579836) >> 2 : style.color);
9384
9385
  const offset = isShadow ? 1 : 0;
9385
9386
  const top = glyph ? 7 - glyph.ascent : 0;
9386
9387
  const height = glyph ? glyph.height * glyph.scale : 8;
@@ -9408,7 +9409,7 @@ function createGuiTextGeometry(layout, shadow = true) {
9408
9409
  const v0 = glyph ? 1 - glyph.y / glyph.image.height : 1;
9409
9410
  const v1 = glyph ? 1 - (glyph.y + glyph.height) / glyph.image.height : 0;
9410
9411
  batch.uvs.push(u0, v0, u1, v0, u0, v1, u1, v1);
9411
- for (let i = 0; i < 4; i++) batch.colors.push(color.r, color.g, color.b);
9412
+ for (let i = 0; i < 4; i++) batch.colors.push(color2.r, color2.g, color2.b);
9412
9413
  batch.indices.push(base, base + 2, base + 1, base + 2, base + 3, base + 1);
9413
9414
  };
9414
9415
  for (const boldOffset of style.bold ? [0, 1] : [0]) {
@@ -9426,7 +9427,128 @@ function createGuiTextGeometry(layout, shadow = true) {
9426
9427
  }
9427
9428
 
9428
9429
  // src/gui/GuiHelper.ts
9430
+ var GUI_CONTAINER_LAYOUTS = {
9431
+ generic_54: {
9432
+ texture: "minecraft:gui/container/generic_54",
9433
+ crop: [0, 0, 176, 222],
9434
+ slotOrigin: [8, 18],
9435
+ slotOffset: [18, 18],
9436
+ rowSize: 9,
9437
+ slotCount: 54
9438
+ },
9439
+ crafting_table: {
9440
+ texture: "minecraft:gui/container/crafting_table",
9441
+ crop: [0, 0, 176, 166],
9442
+ slotOrigin: [30, 17],
9443
+ slotOffset: [18, 18],
9444
+ rowSize: 3,
9445
+ slotCount: 9,
9446
+ resultPosition: [124, 35]
9447
+ }
9448
+ };
9429
9449
  var GuiHelper = class {
9450
+ /**
9451
+ * Creates a 182×5 boss bar using the active resource pack. Finite progress is clamped to 0–1.
9452
+ * The fill crops the source image; explicit crops do not apply `.mcmeta` sprite scaling.
9453
+ */
9454
+ static async bossBar(options = {}) {
9455
+ const { color: color2 = "pink", progress = 1, position = [0, 0] } = options;
9456
+ this.validatePosition(position);
9457
+ if (!["pink", "blue", "red", "green", "yellow", "purple", "white"].includes(color2)) {
9458
+ throw new Error(`Unsupported boss bar color: ${color2}`);
9459
+ }
9460
+ if (!Number.isFinite(progress)) throw new Error("Boss bar progress must be finite");
9461
+ const value = Math.max(0, Math.min(1, progress));
9462
+ const width = value > 0 ? Math.floor(value * 181) + 1 : 0;
9463
+ const texture = `minecraft:gui/sprites/boss_bar/${color2}`;
9464
+ const layers = [{
9465
+ name: "boss-bar-background",
9466
+ texture: `${texture}_background`,
9467
+ position: [...position],
9468
+ size: [182, 5]
9469
+ }];
9470
+ if (width > 0) {
9471
+ layers.push({
9472
+ ...await this.cropTexture(`${texture}_progress`, [0, 0, width, 5], [182, 5], position),
9473
+ name: "boss-bar-progress"
9474
+ });
9475
+ }
9476
+ return layers;
9477
+ }
9478
+ /**
9479
+ * Creates a 192×192 book page with optional arrows and supplied text. Buttons are hidden by default.
9480
+ * Callers choose the page content and button states; this helper does not paginate or handle clicks.
9481
+ */
9482
+ static async book(options = {}) {
9483
+ const {
9484
+ position = [0, 0],
9485
+ previous = "hidden",
9486
+ next = "hidden",
9487
+ text: text2,
9488
+ color: color2 = 0,
9489
+ shadow = false,
9490
+ maxWidth = 114,
9491
+ lineHeight = 9,
9492
+ ...style
9493
+ } = options;
9494
+ this.validatePosition(position);
9495
+ for (const state of [previous, next]) {
9496
+ if (!["hidden", "normal", "hover"].includes(state)) throw new Error(`Unsupported book button state: ${state}`);
9497
+ }
9498
+ const layers = [{
9499
+ ...await this.cropTexture("minecraft:gui/book", [0, 0, 192, 192], [256, 256], position),
9500
+ name: "book-background"
9501
+ }];
9502
+ for (const [name, direction, state, x] of [
9503
+ ["previous", "backward", previous, 43],
9504
+ ["next", "forward", next, 116]
9505
+ ]) {
9506
+ if (state === "hidden") continue;
9507
+ layers.push({
9508
+ name: `book-${name}`,
9509
+ texture: `minecraft:gui/sprites/widget/page_${direction}${state === "hover" ? "_highlighted" : ""}`,
9510
+ position: [position[0] + x, position[1] + 157],
9511
+ size: [23, 13]
9512
+ });
9513
+ }
9514
+ if (text2 !== void 0) {
9515
+ layers.push({
9516
+ name: "book-text",
9517
+ text: text2,
9518
+ position: [position[0] + 36, position[1] + 30],
9519
+ color: color2,
9520
+ shadow,
9521
+ maxWidth,
9522
+ lineHeight,
9523
+ ...style
9524
+ });
9525
+ }
9526
+ return layers;
9527
+ }
9528
+ /** Creates a container background. Use {@link GUI_CONTAINER_LAYOUTS} with {@link inventorySlot} to place its items. */
9529
+ static async container(type, position = [0, 0]) {
9530
+ this.validatePosition(position);
9531
+ if (type !== "generic_54" && type !== "crafting_table") throw new Error(`Unsupported GUI container: ${type}`);
9532
+ const layout = GUI_CONTAINER_LAYOUTS[type];
9533
+ return [{ ...await this.cropTexture(layout.texture, layout.crop, [256, 256], position), name: "background" }];
9534
+ }
9535
+ static validatePosition(position) {
9536
+ if (!Array.isArray(position) || position.length !== 2 || !position.every(Number.isFinite)) {
9537
+ throw new Error("GUI position must contain two finite coordinates");
9538
+ }
9539
+ }
9540
+ static async cropTexture(texture, crop, referenceSize, position) {
9541
+ const image = await ModelTextures.preload(AssetKey.parse("textures", texture));
9542
+ if (!image) throw new Error(`Could not load GUI texture ${texture}`);
9543
+ const [x, y, width, height] = crop;
9544
+ const scaleX = image.width / referenceSize[0], scaleY = image.height / referenceSize[1];
9545
+ return {
9546
+ texture,
9547
+ crop: [x * scaleX, y * scaleY, width * scaleX, height * scaleY],
9548
+ position: [...position],
9549
+ size: [width, height]
9550
+ };
9551
+ }
9430
9552
  /** Sizes a tooltip around supplied text; the first entry is its title. */
9431
9553
  static async tooltip(lines, options = {}) {
9432
9554
  if (!lines.length) return [];
@@ -9442,8 +9564,8 @@ var GuiHelper = class {
9442
9564
  size: [width + 24, height + 24]
9443
9565
  }));
9444
9566
  let y = position[1];
9445
- lines.forEach((text, index) => {
9446
- layers.push({ ...textOptions, name: `tooltip-line-${index}`, text, position: [position[0], y] });
9567
+ lines.forEach((text2, index) => {
9568
+ layers.push({ ...textOptions, name: `tooltip-line-${index}`, text: text2, position: [position[0], y] });
9447
9569
  y += layouts[index].height + (index === 0 ? titleGap : 0);
9448
9570
  });
9449
9571
  return layers;
@@ -9461,8 +9583,9 @@ var GuiHelper = class {
9461
9583
  }
9462
9584
  /** Creates crafting-table layers for ingredients and the result; stack counts are not drawn. */
9463
9585
  static recipe(recipe, options = {}) {
9586
+ const layout = GUI_CONTAINER_LAYOUTS.crafting_table;
9464
9587
  const layers = [
9465
- { name: "background", texture: "minecraft:gui/container/crafting_table", crop: [0, 0, 176, 166] }
9588
+ { name: "background", texture: layout.texture, crop: [...layout.crop] }
9466
9589
  ];
9467
9590
  const itemKey = (ingredient) => {
9468
9591
  const item = typeof ingredient === "string" && !ingredient.startsWith("#") ? ingredient : typeof ingredient === "object" && "item" in ingredient ? ingredient.item : options.resolveIngredient?.(ingredient);
@@ -9477,7 +9600,7 @@ var GuiHelper = class {
9477
9600
  layers.push({
9478
9601
  name: `ingredient-${slot}`,
9479
9602
  item: itemKey(ingredient),
9480
- position: this.inventorySlot(slot, [30, 17], [18, 18], 3)
9603
+ position: this.inventorySlot(slot, layout.slotOrigin, layout.slotOffset, layout.rowSize)
9481
9604
  });
9482
9605
  };
9483
9606
  switch (recipe.type) {
@@ -9512,7 +9635,7 @@ var GuiHelper = class {
9512
9635
  layers.push({
9513
9636
  name: "result",
9514
9637
  item: itemKey("id" in recipe.result ? recipe.result.id : recipe.result.item),
9515
- position: [124, 35]
9638
+ position: [...layout.resultPosition]
9516
9639
  });
9517
9640
  return layers;
9518
9641
  }
@@ -9899,29 +10022,29 @@ var SceneInspector = class {
9899
10022
  this.objectControlsContainer.innerHTML = "";
9900
10023
  this.addControls(targetObject, targetIntersection, instance);
9901
10024
  }
9902
- addControls(object2, intersection, instance) {
10025
+ addControls(object3, intersection, instance) {
9903
10026
  const container = document.createElement("div");
9904
10027
  container.append(this.separator("Select Parent/Child"));
9905
- if (object2.parent) {
9906
- container.append(this.buttonControl("Select Parent " + object2.parent.constructor.name + " " + object2.parent.name, "P", () => {
9907
- this.selectObject(object2.parent, intersection, instance);
10028
+ if (object3.parent) {
10029
+ container.append(this.buttonControl("Select Parent " + object3.parent.constructor.name + " " + object3.parent.name, "P", () => {
10030
+ this.selectObject(object3.parent, intersection, instance);
9908
10031
  }));
9909
10032
  }
9910
- if (object2.children.length > 0) {
10033
+ if (object3.children.length > 0) {
9911
10034
  let i = 1;
9912
- for (let child of object2.children) {
10035
+ for (let child of object3.children) {
9913
10036
  container.append(this.buttonControl("Select Child " + child.constructor.name + " " + child.name, "C" + i++, () => {
9914
10037
  this.selectObject(child, intersection, instance);
9915
10038
  }));
9916
10039
  }
9917
10040
  }
9918
10041
  container.append(this.separator());
9919
- const selectedInstance = instance && (object2 === instance.instanceable || object2 === intersection?.object) ? instance : void 0;
10042
+ const selectedInstance = instance && (object3 === instance.instanceable || object3 === intersection?.object) ? instance : void 0;
9920
10043
  if (!selectedInstance) {
9921
- container.append(this.toggleControl("Visibility", "V", object2.visible, (v) => object2.visible = v));
10044
+ container.append(this.toggleControl("Visibility", "V", object3.visible, (v) => object3.visible = v));
9922
10045
  }
9923
10046
  container.append(this.separator("Mesh"));
9924
- this.addObjectControls(object2, intersection, container, selectedInstance);
10047
+ this.addObjectControls(object3, intersection, container, selectedInstance);
9925
10048
  container.append(this.separator());
9926
10049
  this.objectControlsContainer.append(container);
9927
10050
  }
@@ -10337,29 +10460,29 @@ var BlockTints = class {
10337
10460
  }
10338
10461
  }
10339
10462
  if (!indices.size) return tints;
10340
- let color;
10463
+ let color2;
10341
10464
  switch (rule.source) {
10342
10465
  case "constant":
10343
- color = rule.color;
10466
+ color2 = rule.color;
10344
10467
  break;
10345
10468
  case "grass":
10346
- color = await Colormaps.grassColor(key);
10469
+ color2 = await Colormaps.grassColor(key);
10347
10470
  break;
10348
10471
  case "redstone": {
10349
10472
  const power = Number(state.power ?? 0) / 15;
10350
10473
  const red = power * 0.6 + (power > 0 ? 0.4 : 0.3);
10351
10474
  const green = Math.max(0, power * power * 0.7 - 0.5);
10352
10475
  const blue = Math.max(0, power * power * 0.6 - 0.7);
10353
- color = Math.floor(red * 255) << 16 | Math.floor(green * 255) << 8 | Math.floor(blue * 255);
10476
+ color2 = Math.floor(red * 255) << 16 | Math.floor(green * 255) << 8 | Math.floor(blue * 255);
10354
10477
  break;
10355
10478
  }
10356
10479
  case "stem": {
10357
10480
  const age = Number(state.age ?? 0);
10358
- color = age * 32 << 16 | 255 - age * 8 << 8 | age * 4;
10481
+ color2 = age * 32 << 16 | 255 - age * 8 << 8 | age * 4;
10359
10482
  break;
10360
10483
  }
10361
10484
  }
10362
- return { ...Object.fromEntries([...indices].map((index) => [index, color])), ...tints };
10485
+ return { ...Object.fromEntries([...indices].map((index) => [index, color2])), ...tints };
10363
10486
  }
10364
10487
  };
10365
10488
 
@@ -10501,8 +10624,8 @@ var BlockObject = class _BlockObject extends SceneObject {
10501
10624
  return false;
10502
10625
  }
10503
10626
  return this._models.some((model) => {
10504
- const object2 = isInstanceReference(model) ? model.instanceable : model;
10505
- return object2.isOpaqueFullCube && this.getModelCullMask(model, 63) === 63;
10627
+ const object3 = isInstanceReference(model) ? model.instanceable : model;
10628
+ return object3.isOpaqueFullCube && this.getModelCullMask(model, 63) === 63;
10506
10629
  });
10507
10630
  }
10508
10631
  getModelMatrix(model) {
@@ -10511,8 +10634,8 @@ var BlockObject = class _BlockObject extends SceneObject {
10511
10634
  return model.matrix.clone();
10512
10635
  }
10513
10636
  getModelCullMask(model, worldMask) {
10514
- const object2 = isInstanceReference(model) ? model.instanceable : model;
10515
- if (object2.options.displayPosition) return 0;
10637
+ const object3 = isInstanceReference(model) ? model.instanceable : model;
10638
+ if (object3.options.displayPosition) return 0;
10516
10639
  const position = new Vector312();
10517
10640
  const rotation = new Quaternion5();
10518
10641
  const scale = new Vector312();
@@ -10529,14 +10652,14 @@ var BlockObject = class _BlockObject extends SceneObject {
10529
10652
  replacements.push(model);
10530
10653
  continue;
10531
10654
  }
10532
- const object2 = isInstanceReference(model) ? model.instanceable : model;
10655
+ const object3 = isInstanceReference(model) ? model.instanceable : model;
10533
10656
  const cullMask = this.getModelCullMask(model, worldMask);
10534
- if (cullMask === (object2.options.cullMask ?? 0)) {
10657
+ if (cullMask === (object3.options.cullMask ?? 0)) {
10535
10658
  replacements.push(model);
10536
10659
  continue;
10537
10660
  }
10538
10661
  const matrix = this.getModelMatrix(model);
10539
- const replacement = await this.scene.addModel(object2.originalModel, { ...object2.options, cullMask });
10662
+ const replacement = await this.scene.addModel(object3.originalModel, { ...object3.options, cullMask });
10540
10663
  replacements.push(replacement);
10541
10664
  if (isInstanceReference(replacement)) {
10542
10665
  replacement.setMatrix(matrix);
@@ -10544,8 +10667,8 @@ var BlockObject = class _BlockObject extends SceneObject {
10544
10667
  replacement.matrix.copy(matrix);
10545
10668
  replacement.matrixWorldNeedsUpdate = true;
10546
10669
  matrix.decompose(replacement.position, replacement.quaternion, replacement.scale);
10547
- replacement.matrixAutoUpdate = object2.matrixAutoUpdate;
10548
- replacement.visible = object2.visible;
10670
+ replacement.matrixAutoUpdate = object3.matrixAutoUpdate;
10671
+ replacement.visible = object3.visible;
10549
10672
  }
10550
10673
  }
10551
10674
  } catch (error) {
@@ -13692,60 +13815,60 @@ var MineRenderScene = class _MineRenderScene extends Scene4 {
13692
13815
  this.DEFAULT_OPTIONS = (0, import_ts_deepmerge8.default)({}, {});
13693
13816
  }
13694
13817
  add(...objects) {
13695
- for (const object2 of objects) {
13818
+ for (const object3 of objects) {
13696
13819
  this.dirty = true;
13697
13820
  try {
13698
- super.add(object2);
13821
+ super.add(object3);
13699
13822
  } finally {
13700
- if (object2?.isObject3D && object2 !== this) {
13701
- this.updateObjectRegistration(object2, object2.parent === this);
13823
+ if (object3?.isObject3D && object3 !== this) {
13824
+ this.updateObjectRegistration(object3, object3.parent === this);
13702
13825
  }
13703
13826
  }
13704
13827
  }
13705
13828
  return this;
13706
13829
  }
13707
13830
  remove(...objects) {
13708
- for (const object2 of objects) {
13709
- if (!this.children.includes(object2)) continue;
13831
+ for (const object3 of objects) {
13832
+ if (!this.children.includes(object3)) continue;
13710
13833
  this.dirty = true;
13711
- this.updateObjectRegistration(object2, false);
13834
+ this.updateObjectRegistration(object3, false);
13712
13835
  try {
13713
- super.remove(object2);
13836
+ super.remove(object3);
13714
13837
  } finally {
13715
- this.updateObjectRegistration(object2, object2.parent === this);
13838
+ this.updateObjectRegistration(object3, object3.parent === this);
13716
13839
  }
13717
13840
  }
13718
13841
  return this;
13719
13842
  }
13720
- updateObjectRegistration(object2, attached) {
13721
- if (this.observedObjects.has(object2) === attached) return;
13722
- const observable = object2;
13843
+ updateObjectRegistration(object3, attached) {
13844
+ if (this.observedObjects.has(object3) === attached) return;
13845
+ const observable = object3;
13723
13846
  if (attached) {
13724
- this.observedObjects.add(object2);
13847
+ this.observedObjects.add(object3);
13725
13848
  observable.addEventListener("change", this.onObjectChange);
13726
13849
  } else {
13727
- this.observedObjects.delete(object2);
13850
+ this.observedObjects.delete(object3);
13728
13851
  observable.removeEventListener("change", this.onObjectChange);
13729
13852
  }
13730
13853
  const change = attached ? 1 : -1;
13731
13854
  this.stats.objectCount += change;
13732
- if (isSceneObject(object2)) {
13855
+ if (isSceneObject(object3)) {
13733
13856
  this.stats.sceneObjectCount += change;
13734
13857
  }
13735
13858
  }
13736
13859
  /** Initializes each object before attaching it to the scene. */
13737
- async initAndAdd(...object2) {
13860
+ async initAndAdd(...object3) {
13738
13861
  this.dirty = true;
13739
- for (let obj of object2) {
13862
+ for (let obj of object3) {
13740
13863
  await obj.init();
13741
13864
  }
13742
- return this.add(...object2);
13865
+ return this.add(...object3);
13743
13866
  }
13744
- async addSceneObject(asset, objectSupplier, _options, parent = this) {
13867
+ async addSceneObject(asset2, objectSupplier, _options, parent = this) {
13745
13868
  this.dirty = true;
13746
13869
  const obj = await objectSupplier();
13747
- if (obj?.options?.instanceMeshes && asset.key && asset.key?.assetType === "models") {
13748
- let key = asset.key.serialize();
13870
+ if (obj?.options?.instanceMeshes && asset2.key && asset2.key?.assetType === "models") {
13871
+ let key = asset2.key.serialize();
13749
13872
  if (isModelObject(obj)) {
13750
13873
  const { displayPosition, uvLockRotation, tints, cullMask } = obj.options;
13751
13874
  if (displayPosition) key += `|display:${displayPosition}`;
@@ -13851,11 +13974,11 @@ var _changeEvent = { type: "change" };
13851
13974
  var _startEvent = { type: "start" };
13852
13975
  var _endEvent = { type: "end" };
13853
13976
  var OrbitControls = class extends EventDispatcher {
13854
- constructor(object2, domElement) {
13977
+ constructor(object3, domElement) {
13855
13978
  super();
13856
13979
  if (domElement === void 0) console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.');
13857
13980
  if (domElement === document) console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.');
13858
- this.object = object2;
13981
+ this.object = object3;
13859
13982
  this.domElement = domElement;
13860
13983
  this.domElement.style.touchAction = "none";
13861
13984
  this.enabled = true;
@@ -13912,7 +14035,7 @@ var OrbitControls = class extends EventDispatcher {
13912
14035
  };
13913
14036
  this.update = function() {
13914
14037
  const offset = new Vector313();
13915
- const quat = new Quaternion6().setFromUnitVectors(object2.up, new Vector313(0, 1, 0));
14038
+ const quat = new Quaternion6().setFromUnitVectors(object3.up, new Vector313(0, 1, 0));
13916
14039
  const quatInverse = quat.clone().invert();
13917
14040
  const lastPosition = new Vector313();
13918
14041
  const lastQuaternion = new Quaternion6();
@@ -14477,8 +14600,8 @@ var OrbitControls = class extends EventDispatcher {
14477
14600
  }
14478
14601
  };
14479
14602
  var MapControls = class extends OrbitControls {
14480
- constructor(object2, domElement) {
14481
- super(object2, domElement);
14603
+ constructor(object3, domElement) {
14604
+ super(object3, domElement);
14482
14605
  this.screenSpacePanning = false;
14483
14606
  this.mouseButtons.LEFT = MOUSE.PAN;
14484
14607
  this.mouseButtons.RIGHT = MOUSE.ROTATE;
@@ -14907,6 +15030,232 @@ init_SceneObject();
14907
15030
  // src/index.ts
14908
15031
  init_request();
14909
15032
 
15033
+ // src/scene/SceneDocument.ts
15034
+ init_DisplayPosition();
15035
+ function fail(path, message) {
15036
+ throw new Error(`${path}: ${message}`);
15037
+ }
15038
+ function object2(value, path) {
15039
+ if (!value || typeof value !== "object" || Array.isArray(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value))) fail(path, "expected a JSON object");
15040
+ for (const key of Object.keys(value)) {
15041
+ if (["__proto__", "prototype", "constructor"].includes(key)) fail(`${path}.${key}`, "unsupported property");
15042
+ }
15043
+ return value;
15044
+ }
15045
+ function fields(value, path, allowed, required = []) {
15046
+ const input = object2(value, path);
15047
+ for (const key of required) if (input[key] === void 0) fail(`${path}.${key}`, "required");
15048
+ for (const [key, entry] of Object.entries(input)) {
15049
+ if (!Object.prototype.hasOwnProperty.call(allowed, key)) fail(`${path}.${key}`, "unsupported property");
15050
+ if (entry !== void 0) allowed[key](entry, `${path}.${key}`);
15051
+ }
15052
+ return input;
15053
+ }
15054
+ var text = (value, path) => {
15055
+ if (typeof value !== "string" || !value.trim()) fail(path, "expected a nonempty string");
15056
+ };
15057
+ var literalText = (value, path) => {
15058
+ if (typeof value !== "string") fail(path, "expected a string");
15059
+ };
15060
+ var boolean = (value, path) => {
15061
+ if (typeof value !== "boolean") fail(path, "expected a boolean");
15062
+ };
15063
+ var number = (value, path) => {
15064
+ if (typeof value !== "number" || !Number.isFinite(value)) fail(path, "expected a finite number");
15065
+ };
15066
+ var positive = (value, path) => {
15067
+ number(value, path);
15068
+ if (value <= 0) fail(path, "expected a positive number");
15069
+ };
15070
+ var nonnegative = (value, path) => {
15071
+ number(value, path);
15072
+ if (value < 0) fail(path, "expected a nonnegative number");
15073
+ };
15074
+ var color = (value, path) => {
15075
+ number(value, path);
15076
+ if (!Number.isInteger(value) || value < 0 || value > 16777215) {
15077
+ fail(path, "expected an RGB integer from 0 to 16777215");
15078
+ }
15079
+ };
15080
+ var asset = (value, path) => {
15081
+ text(value, path);
15082
+ if (!/^(?:[a-z0-9_.-]+:)?[a-z0-9_./-]+$/.test(value) || value.split(/[:/]/).some((part) => !part || part === "." || part === "..")) {
15083
+ fail(path, "expected a resource ID such as minecraft:stone");
15084
+ }
15085
+ };
15086
+ var version = (value, path) => {
15087
+ text(value, path);
15088
+ if (!/^[a-zA-Z0-9._-]+$/.test(value)) fail(path, "expected a Minecraft version without slashes");
15089
+ };
15090
+ var tuple = (size, item = number) => (value, path) => {
15091
+ if (!Array.isArray(value) || value.length !== size) fail(path, `expected ${size} numbers`);
15092
+ for (let index = 0; index < size; index++) item(value[index], `${path}[${index}]`);
15093
+ };
15094
+ var list = (item) => (value, path) => {
15095
+ if (!Array.isArray(value)) fail(path, "expected an array");
15096
+ for (let index = 0; index < value.length; index++) item(value[index], `${path}[${index}]`);
15097
+ };
15098
+ var dictionary = (item, numericKeys = false) => (value, path) => {
15099
+ for (const [key, entry] of Object.entries(object2(value, path))) {
15100
+ if (numericKeys && !/^\d+$/.test(key)) fail(`${path}.${key}`, "expected a nonnegative tint index");
15101
+ item(entry, `${path}.${key}`);
15102
+ }
15103
+ };
15104
+ var enumeration = (values) => (value, path) => {
15105
+ if (!values.includes(value)) fail(path, `expected one of: ${values.join(", ")}`);
15106
+ };
15107
+ var textStyle = { color, bold: boolean, italic: boolean };
15108
+ function guiLayer(value, path) {
15109
+ const layer = object2(value, path);
15110
+ if (["texture", "item", "text"].filter((key) => layer[key] !== void 0).length !== 1) {
15111
+ fail(path, "expected exactly one of texture, item, or text");
15112
+ }
15113
+ const layout = { name: text, position: tuple(2), size: tuple(2, positive) };
15114
+ if (layer.texture !== void 0) {
15115
+ fields(value, path, { ...layout, texture: asset, crop: (value2, path2) => {
15116
+ tuple(4)(value2, path2);
15117
+ const [x, y, width, height] = value2;
15118
+ nonnegative(x, `${path2}[0]`);
15119
+ nonnegative(y, `${path2}[1]`);
15120
+ positive(width, `${path2}[2]`);
15121
+ positive(height, `${path2}[3]`);
15122
+ } });
15123
+ } else if (layer.item !== void 0) {
15124
+ fields(value, path, { ...layout, item: asset, tints: dictionary(color, true) });
15125
+ } else {
15126
+ fields(value, path, {
15127
+ ...layout,
15128
+ ...textStyle,
15129
+ font: asset,
15130
+ shadow: boolean,
15131
+ maxWidth: positive,
15132
+ lineHeight: positive,
15133
+ text: (value2, path2) => {
15134
+ if (typeof value2 === "string") return;
15135
+ list((run, path3) => {
15136
+ fields(run, path3, { text: literalText, ...textStyle }, ["text"]);
15137
+ })(value2, path2);
15138
+ }
15139
+ });
15140
+ }
15141
+ }
15142
+ function validateObject(value, path) {
15143
+ const input = object2(value, path);
15144
+ const common = { id: text, name: text, type: text, position: tuple(3), rotation: tuple(3), scale: tuple(3), visible: boolean };
15145
+ const required = ["id", "type"];
15146
+ const renderOptions = { wireframe: boolean };
15147
+ switch (input.type) {
15148
+ case "skin":
15149
+ fields(value, path, {
15150
+ ...common,
15151
+ skin: text,
15152
+ cape: (value2, path2) => {
15153
+ fields(value2, path2, { texture: text, layout: enumeration(["minecraft", "optifine", "labymod"]) }, ["texture"]);
15154
+ },
15155
+ hiddenParts: list(enumeration(SKIN_PARTS)),
15156
+ pose: (value2, path2) => {
15157
+ fields(value2, path2, {
15158
+ head: tuple(3),
15159
+ body: tuple(3),
15160
+ rightArm: tuple(3),
15161
+ leftArm: tuple(3),
15162
+ rightLeg: tuple(3),
15163
+ leftLeg: tuple(3),
15164
+ cape: tuple(3)
15165
+ });
15166
+ },
15167
+ options: (value2, path2) => {
15168
+ fields(value2, path2, { slim: boolean, legacy: boolean });
15169
+ }
15170
+ }, required);
15171
+ break;
15172
+ case "block":
15173
+ fields(value, path, {
15174
+ ...common,
15175
+ asset,
15176
+ state: dictionary(text),
15177
+ options: (value2, path2) => {
15178
+ fields(value2, path2, { ...renderOptions, tints: dictionary(color, true) });
15179
+ }
15180
+ }, [...required, "asset"]);
15181
+ break;
15182
+ case "item":
15183
+ case "model":
15184
+ fields(value, path, {
15185
+ ...common,
15186
+ asset,
15187
+ options: (value2, path2) => {
15188
+ fields(value2, path2, { ...renderOptions, displayPosition: enumeration(DISPLAY_POSITIONS), tints: dictionary(color, true) });
15189
+ }
15190
+ }, [...required, "asset"]);
15191
+ break;
15192
+ case "entity":
15193
+ fields(value, path, {
15194
+ ...common,
15195
+ asset,
15196
+ texture: asset,
15197
+ layers: list(text),
15198
+ when: list(text),
15199
+ textures: dictionary(asset),
15200
+ options: (value2, path2) => {
15201
+ fields(value2, path2, {
15202
+ ...renderOptions,
15203
+ flip: boolean,
15204
+ tints: dictionary((value3, path3) => {
15205
+ typeof value3 === "string" ? text(value3, path3) : color(value3, path3);
15206
+ })
15207
+ });
15208
+ },
15209
+ animation: (value2, path2) => {
15210
+ fields(value2, path2, { name: text, loop: boolean, speed: nonnegative, time: nonnegative, paused: boolean }, ["name"]);
15211
+ }
15212
+ }, [...required, "asset"]);
15213
+ if (Array.isArray(input.layers) && !input.layers.length) fail(`${path}.layers`, "expected at least one layer");
15214
+ break;
15215
+ case "gui":
15216
+ fields(value, path, { ...common, layers: list(guiLayer) }, [...required, "layers"]);
15217
+ break;
15218
+ default:
15219
+ fail(`${path}.type`, "expected skin, block, item, entity, model, or gui");
15220
+ }
15221
+ }
15222
+ function parseSceneDocument(value) {
15223
+ if (typeof value === "string") {
15224
+ try {
15225
+ value = JSON.parse(value);
15226
+ } catch {
15227
+ fail("scene", "invalid JSON");
15228
+ }
15229
+ }
15230
+ const input = fields(value, "scene", {
15231
+ format: enumeration(["minerender-scene"]),
15232
+ version: (value2, path) => {
15233
+ if (value2 !== 1) fail(path, "only scene document version 1 is supported");
15234
+ },
15235
+ minecraftVersion: version,
15236
+ camera: (value2, path) => {
15237
+ fields(value2, path, { position: tuple(3), target: tuple(3) }, ["position", "target"]);
15238
+ },
15239
+ objects: list(validateObject)
15240
+ }, ["format", "version", "objects"]);
15241
+ const ids = /* @__PURE__ */ new Set();
15242
+ for (const [index, entry] of input.objects.entries()) {
15243
+ if (ids.has(entry.id)) fail(`scene.objects[${index}].id`, `duplicate object ID "${entry.id}"`);
15244
+ ids.add(entry.id);
15245
+ }
15246
+ return JSON.parse(JSON.stringify(input));
15247
+ }
15248
+
15249
+ // src/scene/SceneDocumentLoader.ts
15250
+ init_AssetKey();
15251
+ init_AssetLoader();
15252
+ init_BlockStates();
15253
+ init_Entities();
15254
+ init_Models();
15255
+ init_DisplayPosition();
15256
+ import { Group as Group2 } from "three";
15257
+ init_SceneObject();
15258
+
14910
15259
  // src/skin/Skins.ts
14911
15260
  init_Requests();
14912
15261
  var Skins = class {
@@ -15077,6 +15426,195 @@ var Skins = class {
15077
15426
  //</editor-fold>
15078
15427
  };
15079
15428
 
15429
+ // src/scene/SceneDocumentLoader.ts
15430
+ var DocumentObjectScene = class extends MineRenderScene {
15431
+ async addSceneObject(_asset, supplier, _options, parent = this) {
15432
+ const object3 = await supplier();
15433
+ return this.initialize(object3, parent);
15434
+ }
15435
+ async initialize(object3, parent = this) {
15436
+ object3.scene = this;
15437
+ try {
15438
+ await object3.init();
15439
+ parent.add(object3);
15440
+ return object3;
15441
+ } catch (error) {
15442
+ object3.dispose();
15443
+ object3.removeFromParent();
15444
+ throw error;
15445
+ }
15446
+ }
15447
+ dispose() {
15448
+ for (const child of [...this.children]) {
15449
+ if (child.parent !== this) continue;
15450
+ if (isSceneObject(child)) child.dispose();
15451
+ child.removeFromParent();
15452
+ }
15453
+ }
15454
+ };
15455
+ async function skinTexture(value, cape = false) {
15456
+ if (!/^[a-zA-Z0-9_-]{1,36}$/.test(value)) return value;
15457
+ const texture = await (cape ? Skins.capeFromUuidOrUsername(value) : Skins.fromUuidOrUsername(value));
15458
+ if (!texture) throw new Error(`Could not find ${cape ? "cape" : "skin"} for "${value}"`);
15459
+ return texture;
15460
+ }
15461
+ var SceneDocumentLoader = class {
15462
+ static parse(value) {
15463
+ return parseSceneDocument(value);
15464
+ }
15465
+ /**
15466
+ * Loads objects concurrently and attaches them in document order after every load succeeds.
15467
+ * A failure waits for all loads, disposes staged objects, and reports the first error in document order.
15468
+ */
15469
+ static async load(scene, value, parent = scene) {
15470
+ const definition = this.parse(value);
15471
+ if (definition.minecraftVersion !== void 0 && definition.minecraftVersion !== AssetLoader.version) {
15472
+ throw new Error(`Scene requires Minecraft ${definition.minecraftVersion}; call AssetLoader.setVersion("${definition.minecraftVersion}") before loading it`);
15473
+ }
15474
+ const root = new Group2();
15475
+ root.name = "MineRender scene document";
15476
+ const objects = [];
15477
+ let disposed = false;
15478
+ const loaded = {
15479
+ root,
15480
+ objects,
15481
+ definition,
15482
+ advanceAnimations: (delta) => {
15483
+ if (!disposed) for (const object3 of objects) object3.advanceAnimation(delta);
15484
+ },
15485
+ dispose: () => {
15486
+ if (disposed) return;
15487
+ disposed = true;
15488
+ root.removeFromParent();
15489
+ for (const object3 of objects) object3.dispose();
15490
+ root.clear();
15491
+ scene.dirty = true;
15492
+ }
15493
+ };
15494
+ try {
15495
+ const results = await Promise.allSettled(definition.objects.map((object3) => this.loadValidatedObject(scene, object3)));
15496
+ for (const result of results) if (result.status === "fulfilled") objects.push(result.value);
15497
+ const failure = results.find((result) => result.status === "rejected");
15498
+ if (failure) throw failure.reason;
15499
+ for (const object3 of objects) root.add(object3.root);
15500
+ parent.add(root);
15501
+ scene.dirty = true;
15502
+ return loaded;
15503
+ } catch (error) {
15504
+ loaded.dispose();
15505
+ throw error;
15506
+ }
15507
+ }
15508
+ /** Loads an independently editable object. Its root owns the document's position, rotation, and scale. */
15509
+ static async loadObject(scene, value, parent = scene) {
15510
+ const definition = this.parse({ format: "minerender-scene", version: 1, objects: [value] }).objects[0];
15511
+ return this.loadValidatedObject(scene, definition, parent);
15512
+ }
15513
+ static async loadValidatedObject(scene, definition, parent) {
15514
+ const root = new Group2();
15515
+ root.name = definition.name ?? definition.id;
15516
+ root.userData.sceneObjectId = definition.id;
15517
+ root.position.fromArray(definition.position ?? [0, 0, 0]);
15518
+ root.rotation.set(...definition.rotation ?? [0, 0, 0]);
15519
+ root.scale.fromArray(definition.scale ?? [1, 1, 1]);
15520
+ root.visible = definition.visible ?? true;
15521
+ const content = new DocumentObjectScene();
15522
+ root.add(content);
15523
+ let object3;
15524
+ try {
15525
+ switch (definition.type) {
15526
+ case "skin": {
15527
+ const skin = new SkinObject({ ...definition.options, instanceMeshes: false });
15528
+ object3 = skin;
15529
+ const texture = definition.skin ? await skinTexture(definition.skin) : `${AssetLoader.ROOT}/assets/minecraft/textures/entity/player/${definition.options?.slim ? "slim/alex" : "wide/steve"}.png`;
15530
+ await skin.setSkinTexture(texture);
15531
+ await content.initialize(skin);
15532
+ if (definition.cape) await skin.setCapeTexture(await skinTexture(definition.cape.texture, true), definition.cape.layout);
15533
+ for (const [part, rotation] of Object.entries(definition.pose ?? {})) {
15534
+ skin.getGroupByName(part)?.rotation.set(...rotation, "XYZ");
15535
+ }
15536
+ for (const part of definition.hiddenParts ?? []) {
15537
+ const mesh = skin.getMeshByName(part);
15538
+ if (mesh) mesh.visible = false;
15539
+ }
15540
+ break;
15541
+ }
15542
+ case "block": {
15543
+ const state = await BlockStates.get(AssetKey.parse("blockstates", definition.asset));
15544
+ if (!state) throw new Error(`Could not load block ${definition.asset}`);
15545
+ object3 = await content.addBlock(state, { ...definition.options, initialState: definition.state, instanceMeshes: false });
15546
+ break;
15547
+ }
15548
+ case "item":
15549
+ case "model": {
15550
+ let key = AssetKey.parse("models", definition.asset);
15551
+ if (definition.type === "item" && key.type !== "item") {
15552
+ key = new AssetKey(key.namespace, key.getFullPath(), "models", "item");
15553
+ }
15554
+ const model = await Models.getMerged(key);
15555
+ if (!model) throw new Error(`Could not load ${definition.type} ${definition.asset}`);
15556
+ object3 = await content.addModel(model, {
15557
+ ...definition.type === "item" ? { displayPosition: "gui" /* GUI */ } : {},
15558
+ ...definition.options,
15559
+ instanceMeshes: false
15560
+ });
15561
+ break;
15562
+ }
15563
+ case "entity": {
15564
+ const key = AssetKey.parse("entity-models", definition.asset);
15565
+ const model = await Entities.getEntity(key, definition.texture ? AssetKey.parse("textures", definition.texture) : void 0, {
15566
+ layers: definition.layers,
15567
+ when: definition.when,
15568
+ textures: definition.textures && Object.fromEntries(Object.entries(definition.textures).map(([name, texture]) => [name, AssetKey.parse("textures", texture)]))
15569
+ });
15570
+ if (!model) throw new Error(`Could not load entity ${definition.asset}`);
15571
+ const entity = await content.addEntity(model, { ...definition.options, instanceMeshes: false });
15572
+ object3 = entity;
15573
+ if (definition.animation) {
15574
+ const animations = await Entities.getAnimations(key);
15575
+ const clip = animations?.[definition.animation.name];
15576
+ if (!clip) throw new Error(`Entity ${definition.asset} has no animation "${definition.animation.name}"`);
15577
+ entity.playAnimation(clip, definition.animation);
15578
+ }
15579
+ break;
15580
+ }
15581
+ case "gui":
15582
+ object3 = await content.initialize(new GuiObject(definition.layers));
15583
+ break;
15584
+ }
15585
+ let disposed = false;
15586
+ const loaded = {
15587
+ root,
15588
+ object: object3,
15589
+ definition,
15590
+ advanceAnimation: (delta) => {
15591
+ if (!disposed && definition.type === "entity" && !definition.animation?.paused) object3.advanceAnimation(delta);
15592
+ },
15593
+ dispose: () => {
15594
+ if (disposed) return;
15595
+ disposed = true;
15596
+ root.removeFromParent();
15597
+ object3.dispose();
15598
+ object3.removeFromParent();
15599
+ content.dispose();
15600
+ root.clear();
15601
+ scene.dirty = true;
15602
+ }
15603
+ };
15604
+ parent?.add(root);
15605
+ scene.dirty = true;
15606
+ return loaded;
15607
+ } catch (error) {
15608
+ object3?.dispose();
15609
+ object3?.removeFromParent();
15610
+ content.dispose();
15611
+ root.removeFromParent();
15612
+ root.clear();
15613
+ throw new Error(`Scene object "${definition.name ?? definition.id}": ${error instanceof Error ? error.message : String(error)}`);
15614
+ }
15615
+ }
15616
+ };
15617
+
15080
15618
  // src/texture/index.ts
15081
15619
  init_Colormaps();
15082
15620
  init_TextureAtlas();
@@ -15430,16 +15968,16 @@ var SectionModels = class {
15430
15968
  if (!models) this.models.set(model, models = /* @__PURE__ */ new Map());
15431
15969
  const key = JSON.stringify([rotation.x, rotation.y, rotation.z, variant.uvlock, tints]);
15432
15970
  const template = await cached(models, key, async () => {
15433
- const object2 = new SectionModel(model, {
15971
+ const object3 = new SectionModel(model, {
15434
15972
  instanceMeshes: false,
15435
15973
  mergeMeshes: false,
15436
15974
  tints,
15437
15975
  uvLockRotation: variant.uvlock && (rotation.x !== 0 || rotation.y !== 0) ? [rotation.x, rotation.y, rotation.z] : void 0
15438
15976
  });
15439
- await object2.init();
15440
- const geometry = object2.children[0].geometry;
15977
+ await object3.init();
15978
+ const geometry = object3.children[0].geometry;
15441
15979
  geometry.applyMatrix4(new Matrix412().makeRotationFromEuler(rotation));
15442
- object2.clear();
15980
+ object3.clear();
15443
15981
  const cullFaces = CUBE_FACES.map((face) => {
15444
15982
  const local = CUBE_FACES.findIndex((name) => name === atlas.model.elements[0].faces[face]?.cullface);
15445
15983
  if (local < 0) return 0;
@@ -15655,10 +16193,10 @@ var MineRenderWorld = class {
15655
16193
  await block.object.updateFluid((x, y, z) => {
15656
16194
  const neighbor = pos.clone().add(new Vector316(x, y, z));
15657
16195
  const section = this.getChunkAt(neighbor);
15658
- const object2 = section?.isBlockVisibleAt(neighbor) ? section.getBlockAt(neighbor)?.object : void 0;
16196
+ const object3 = section?.isBlockVisibleAt(neighbor) ? section.getBlockAt(neighbor)?.object : void 0;
15659
16197
  return {
15660
- fluid: object2?.fluidKind,
15661
- level: object2?.fluidLevel,
16198
+ fluid: object3?.fluidKind,
16199
+ level: object3?.fluidLevel,
15662
16200
  solid: section?.isOccludingAt(neighbor) ?? false
15663
16201
  };
15664
16202
  });
@@ -15734,8 +16272,8 @@ init_Model();
15734
16272
  // src/world/SectionMesh.ts
15735
16273
  init_CanvasCompat();
15736
16274
  init_Materials();
15737
- import { BufferGeometry as BufferGeometry8, Float32BufferAttribute as Float32BufferAttribute8, Group as Group2, Mesh as Mesh9 } from "three";
15738
- var SectionMesh = class _SectionMesh extends Group2 {
16275
+ import { BufferGeometry as BufferGeometry8, Float32BufferAttribute as Float32BufferAttribute8, Group as Group3, Mesh as Mesh9 } from "three";
16276
+ var SectionMesh = class _SectionMesh extends Group3 {
15739
16277
  constructor() {
15740
16278
  super(...arguments);
15741
16279
  this.ownedMeshes = [];
@@ -15788,7 +16326,7 @@ var SectionMesh = class _SectionMesh extends Group2 {
15788
16326
  const normal = template.geometry.getAttribute("normal");
15789
16327
  const uv = template.geometry.getAttribute("uv");
15790
16328
  const bounds = template.geometry.getAttribute("uvBounds");
15791
- const color = template.geometry.getAttribute("color");
16329
+ const color2 = template.geometry.getAttribute("color");
15792
16330
  const sourceIndices = template.geometry.getIndex();
15793
16331
  const placement = locations.get(template.atlas).placement;
15794
16332
  const mapU = (u) => (placement.x + u * template.atlas.image.width) / page.width;
@@ -15810,7 +16348,7 @@ var SectionMesh = class _SectionMesh extends Group2 {
15810
16348
  mapU(bounds?.getZ(vertex) ?? 1),
15811
16349
  mapV(bounds?.getW(vertex) ?? 1)
15812
16350
  );
15813
- colors.push(color?.getX(vertex) ?? 1, color?.getY(vertex) ?? 1, color?.getZ(vertex) ?? 1);
16351
+ colors.push(color2?.getX(vertex) ?? 1, color2?.getY(vertex) ?? 1, color2?.getZ(vertex) ?? 1);
15814
16352
  }
15815
16353
  for (let corner = 0; corner < 6; corner++) indices.push(start + sourceIndices.getX(face * 6 + corner) - face * 4);
15816
16354
  }
@@ -15898,7 +16436,7 @@ var Chunk = class _Chunk {
15898
16436
  this.renderedBlocks.get(index)?.object?.removeFromScene();
15899
16437
  if (this.sectionBlocks.delete(index)) this.meshDirty = true;
15900
16438
  this.renderedBlocks.delete(index);
15901
- let object2;
16439
+ let object3;
15902
16440
  try {
15903
16441
  if (!readBlock) return void 0;
15904
16442
  const stored = readBlock();
@@ -15913,22 +16451,22 @@ var Chunk = class _Chunk {
15913
16451
  this.sectionBlocks.set(index, { index, template, cullMask: 0 });
15914
16452
  this.meshDirty = true;
15915
16453
  } else {
15916
- object2 = await this.scene.addBlock(blockState, {
16454
+ object3 = await this.scene.addBlock(blockState, {
15917
16455
  mergeMeshes: true,
15918
16456
  instanceMeshes: true,
15919
16457
  maxInstanceCount: 2e3,
15920
16458
  initialState: stored.properties
15921
16459
  });
15922
- object2.setPosition(MineRenderWorld.worldToScenePosition(worldPos));
16460
+ object3.setPosition(MineRenderWorld.worldToScenePosition(worldPos));
15923
16461
  }
15924
16462
  const info = { get block() {
15925
16463
  return readBlock();
15926
- }, object: object2 };
16464
+ }, object: object3 };
15927
16465
  this.renderedBlocks.set(index, info);
15928
16466
  return info;
15929
16467
  } catch (error) {
15930
16468
  this.data.set(index, void 0);
15931
- object2?.removeFromScene();
16469
+ object3?.removeFromScene();
15932
16470
  throw error;
15933
16471
  } finally {
15934
16472
  await onBlocksChanged?.([worldPos]);
@@ -16076,6 +16614,7 @@ export {
16076
16614
  Env,
16077
16615
  FluidModelObject,
16078
16616
  Fonts,
16617
+ GUI_CONTAINER_LAYOUTS,
16079
16618
  Geometries,
16080
16619
  GuiHelper,
16081
16620
  GuiLight,
@@ -16111,6 +16650,7 @@ export {
16111
16650
  RequestError,
16112
16651
  Requests,
16113
16652
  SKIN_PARTS,
16653
+ SceneDocumentLoader,
16114
16654
  SceneExporter,
16115
16655
  SceneInspector,
16116
16656
  SceneObject,
@@ -16186,6 +16726,7 @@ export {
16186
16726
  mergeBufferAttributes,
16187
16727
  mergeBufferGeometries,
16188
16728
  mergeVertices,
16729
+ parseSceneDocument,
16189
16730
  prefix,
16190
16731
  registerNodeEnv,
16191
16732
  sampleEntityAnimation,