minerender 2.1.0-alpha.70 → 2.1.0-alpha.73

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.
@@ -800,7 +800,7 @@ var init_TextureLoader = __esm({
800
800
  static createTexture() {
801
801
  return new Texture();
802
802
  }
803
- static loadInBackground(src, format = RGBAFormat, rotation = 0) {
803
+ static loadInBackground(src, format2 = RGBAFormat, rotation = 0) {
804
804
  const texture = this.createTexture();
805
805
  texture.colorSpace = THREE.SRGBColorSpace;
806
806
  const image = ImageLoader.loadElement(src, () => {
@@ -810,11 +810,11 @@ var init_TextureLoader = __esm({
810
810
  console.warn("Failed to load texture", src, error);
811
811
  });
812
812
  texture.image = image;
813
- texture.format = format;
813
+ texture.format = format2;
814
814
  texture.rotation = rotation;
815
815
  return Textures.initTextureProps(texture);
816
816
  }
817
- static load(src, format = RGBAFormat, rotation = 0) {
817
+ static load(src, format2 = RGBAFormat, rotation = 0) {
818
818
  const texture = new Texture();
819
819
  texture.colorSpace = THREE.SRGBColorSpace;
820
820
  ImageLoader.getData(src).then((image) => {
@@ -824,7 +824,7 @@ var init_TextureLoader = __esm({
824
824
  this.failedTextures.add(texture);
825
825
  console.warn("Failed to load texture", src, error);
826
826
  });
827
- texture.format = format;
827
+ texture.format = format2;
828
828
  texture.rotation = rotation;
829
829
  return Textures.initTextureProps(texture);
830
830
  }
@@ -1753,6 +1753,10 @@ var init_AssetSource = __esm({
1753
1753
  AssetSource = class {
1754
1754
  constructor() {
1755
1755
  }
1756
+ /** Whether this source prevents lower-priority sources from supplying the key. Its own assets remain available. */
1757
+ blocks(key) {
1758
+ return false;
1759
+ }
1756
1760
  /**
1757
1761
  * Identifies this source's content across sessions for persistent caching. Sources that
1758
1762
  * cannot tell whether their content changed (an unnamed archive, for example) return
@@ -1932,10 +1936,10 @@ var NBTHelper;
1932
1936
  var init_NBTHelper = __esm({
1933
1937
  "src/nbt/NBTHelper.ts"() {
1934
1938
  NBTHelper = class {
1935
- static async fromBuffer(data, format) {
1939
+ static async fromBuffer(data, format2) {
1936
1940
  const buffer = Buffer3.from(data instanceof Uint8Array ? data : new Uint8Array(data));
1937
1941
  const prismarineNbt = await import("prismarine-nbt");
1938
- const { parsed, type, metadata } = await prismarineNbt.parse(buffer, format);
1942
+ const { parsed, type, metadata } = await prismarineNbt.parse(buffer, format2);
1939
1943
  return Object.assign(parsed, {
1940
1944
  format: type,
1941
1945
  metadata,
@@ -2184,6 +2188,164 @@ var init_BrowserArchiveProxy = __esm({
2184
2188
  }
2185
2189
  });
2186
2190
 
2191
+ // src/assets/source/archive/PackMetadata.ts
2192
+ function object(value, field) {
2193
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
2194
+ throw new Error(`Invalid ${field}: expected an object`);
2195
+ }
2196
+ return value;
2197
+ }
2198
+ function integer(value, field) {
2199
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) {
2200
+ throw new Error(`Invalid ${field}: expected a nonnegative integer`);
2201
+ }
2202
+ return value;
2203
+ }
2204
+ function format(value, field, upper = false) {
2205
+ const parts = Array.isArray(value) ? value : [value];
2206
+ if (parts.length < 1 || parts.length > 2) {
2207
+ throw new Error(`Invalid ${field}: expected a major version or [major, minor]`);
2208
+ }
2209
+ return [integer(parts[0], field), parts.length === 2 ? integer(parts[1], field) : upper ? Infinity : 0];
2210
+ }
2211
+ function compare(a, b) {
2212
+ return a[0] === b[0] ? a[1] - b[1] : a[0] - b[0];
2213
+ }
2214
+ function overlay(value, field) {
2215
+ const entry = object(value, field);
2216
+ const directory = entry.directory;
2217
+ if (typeof directory !== "string" || !directory || /[^-_a-zA-Z0-9.]/.test(directory) || directory === "." || directory === "..") {
2218
+ throw new Error(`Invalid ${field}.directory: expected a directory name without path separators`);
2219
+ }
2220
+ let min, max;
2221
+ if ("min_format" in entry || "max_format" in entry) {
2222
+ min = format(entry.min_format, `${field}.min_format`);
2223
+ max = format(entry.max_format, `${field}.max_format`, true);
2224
+ } else {
2225
+ const range = entry.formats;
2226
+ let lower, upper;
2227
+ if (typeof range === "number") {
2228
+ lower = upper = range;
2229
+ } else if (Array.isArray(range)) {
2230
+ if (range.length !== 2) throw new Error(`Invalid ${field}.formats: expected [min, max]`);
2231
+ [lower, upper] = range;
2232
+ } else {
2233
+ const bounds = object(range, `${field}.formats`);
2234
+ lower = bounds.min_inclusive;
2235
+ upper = bounds.max_inclusive;
2236
+ }
2237
+ min = [integer(lower, `${field}.formats.min_inclusive`), 0];
2238
+ max = [integer(upper, `${field}.formats.max_inclusive`), Infinity];
2239
+ }
2240
+ if (compare(min, max) > 0) throw new Error(`Invalid ${field}: minimum format exceeds maximum format`);
2241
+ return { directory, min, max };
2242
+ }
2243
+ function pattern(value, field) {
2244
+ if (value === void 0) return void 0;
2245
+ if (typeof value !== "string") throw new Error(`Invalid ${field}: expected a regular expression string`);
2246
+ try {
2247
+ return new RegExp(value);
2248
+ } catch (cause) {
2249
+ throw new Error(`Invalid ${field}: ${String(cause)}`);
2250
+ }
2251
+ }
2252
+ var PackMetadata;
2253
+ var init_PackMetadata = __esm({
2254
+ "src/assets/source/archive/PackMetadata.ts"() {
2255
+ PackMetadata = class _PackMetadata {
2256
+ constructor(overlays, filters) {
2257
+ this.overlays = overlays;
2258
+ this.filters = filters;
2259
+ this.hasOverlays = overlays.length > 0;
2260
+ }
2261
+ static parse(value) {
2262
+ const metadata = object(value, "pack.mcmeta");
2263
+ let overlays = [];
2264
+ if ("overlays" in metadata) {
2265
+ const entries = object(metadata.overlays, "overlays").entries;
2266
+ if (!Array.isArray(entries)) throw new Error("Invalid overlays.entries: expected an array");
2267
+ overlays = entries.map((entry, index) => overlay(entry, `overlays.entries[${index}]`));
2268
+ }
2269
+ let filters = [];
2270
+ if ("filter" in metadata) {
2271
+ const entries = object(metadata.filter, "filter").block;
2272
+ if (!Array.isArray(entries)) throw new Error("Invalid filter.block: expected an array");
2273
+ filters = entries.map((value2, index) => {
2274
+ const field = `filter.block[${index}]`;
2275
+ const entry = object(value2, field);
2276
+ return { namespace: pattern(entry.namespace, `${field}.namespace`), path: pattern(entry.path, `${field}.path`) };
2277
+ });
2278
+ }
2279
+ return new _PackMetadata(overlays, filters);
2280
+ }
2281
+ /** Returns applicable directories in lookup order, with the last declared overlay first. */
2282
+ overlayDirectories(target) {
2283
+ const selected = format(target, "target format");
2284
+ return this.overlays.filter((entry) => compare(selected, entry.min) >= 0 && compare(selected, entry.max) <= 0).map((entry) => entry.directory).reverse();
2285
+ }
2286
+ blocks(namespace, path) {
2287
+ return this.filters.some((entry) => entry.namespace?.test(namespace) ?? true) && this.filters.some((entry) => entry.path?.test(path) ?? true);
2288
+ }
2289
+ };
2290
+ }
2291
+ });
2292
+
2293
+ // src/assets/source/archive/PackFormats.ts
2294
+ var PackFormats;
2295
+ var init_PackFormats = __esm({
2296
+ "src/assets/source/archive/PackFormats.ts"() {
2297
+ init_Requests();
2298
+ PackFormats = class {
2299
+ static {
2300
+ this.versions = /* @__PURE__ */ new Map();
2301
+ }
2302
+ /** Resolves pack formats from Mojang's client metadata hosted on assets.mcasset.cloud. */
2303
+ static async get(version, type) {
2304
+ let pending = this.versions.get(version);
2305
+ if (!pending || pending.expires <= Date.now()) {
2306
+ pending = {
2307
+ formats: this.load(version),
2308
+ expires: ["latest", "release", "snapshot"].includes(version) ? Date.now() + 3e5 : Infinity
2309
+ };
2310
+ this.versions.set(version, pending);
2311
+ }
2312
+ try {
2313
+ return (await pending.formats)[type];
2314
+ } catch (cause) {
2315
+ if (this.versions.get(version) === pending) this.versions.delete(version);
2316
+ const option = type === "assets" ? "resourcePackFormat" : "dataPackFormat";
2317
+ const reason = cause instanceof Error ? cause.message : String(cause);
2318
+ throw new Error(`Could not resolve the pack format for Minecraft ${version}. Set ArchiveAssetSource ${option} explicitly. ${reason}`);
2319
+ }
2320
+ }
2321
+ static async load(version) {
2322
+ const response = await Requests.genericRequest({
2323
+ url: `https://assets.mcasset.cloud/${encodeURIComponent(version)}/game-version.json`,
2324
+ responseType: "json"
2325
+ });
2326
+ const data = response.data;
2327
+ if (!data || typeof data !== "object" || Array.isArray(data)) {
2328
+ throw new Error("Expected version metadata to be an object");
2329
+ }
2330
+ const packs = data.pack_version;
2331
+ if (typeof packs !== "number" && (!packs || typeof packs !== "object" || Array.isArray(packs))) {
2332
+ throw new Error("Expected pack_version to be a number or an object");
2333
+ }
2334
+ const format2 = (type) => {
2335
+ const modern = typeof packs === "object" && ["resource_major", "resource_minor", "data_major", "data_minor"].some((key) => key in packs);
2336
+ const major = typeof packs === "number" ? packs : packs[modern ? `${type}_major` : type];
2337
+ const minor = modern ? packs[`${type}_minor`] : 0;
2338
+ if (typeof major !== "number" || !Number.isSafeInteger(major) || major < 0 || typeof minor !== "number" || !Number.isSafeInteger(minor) || minor < 0) {
2339
+ throw new Error(`Invalid ${type} pack format in version metadata`);
2340
+ }
2341
+ return Object.freeze([major, minor]);
2342
+ };
2343
+ return { assets: format2("resource"), data: format2("data") };
2344
+ }
2345
+ };
2346
+ }
2347
+ });
2348
+
2187
2349
  // src/assets/source/archive/ArchiveAssetSource.ts
2188
2350
  var ArchiveAssetSource;
2189
2351
  var init_ArchiveAssetSource = __esm({
@@ -2192,35 +2354,77 @@ var init_ArchiveAssetSource = __esm({
2192
2354
  init_request();
2193
2355
  init_HostedAssetSource();
2194
2356
  init_BrowserArchiveProxy();
2357
+ init_AssetLoader();
2358
+ init_PackMetadata();
2359
+ init_PackFormats();
2195
2360
  ArchiveAssetSource = class _ArchiveAssetSource extends AssetSource {
2196
- constructor(archiveProxy) {
2361
+ constructor(archiveProxy, options = {}) {
2197
2362
  super();
2198
- console.log(archiveProxy);
2199
2363
  this._archiveProxy = archiveProxy;
2364
+ const copyFormat = (format2) => typeof format2 === "object" ? [format2[0], format2[1]] : format2;
2365
+ this.options = {
2366
+ resourcePackFormat: copyFormat(options.resourcePackFormat),
2367
+ dataPackFormat: copyFormat(options.dataPackFormat)
2368
+ };
2200
2369
  }
2201
- static blob(blob) {
2202
- return new _ArchiveAssetSource(new BrowserArchiveProxy(blob));
2370
+ static blob(blob, options) {
2371
+ return new _ArchiveAssetSource(new BrowserArchiveProxy(blob), options);
2203
2372
  }
2204
2373
  get cacheId() {
2205
2374
  const id = this._archiveProxy.id;
2206
- return id === void 0 ? void 0 : `archive:${id}`;
2375
+ const formats = [this.options.resourcePackFormat ?? AssetLoader.version, this.options.dataPackFormat ?? AssetLoader.version];
2376
+ return id === void 0 ? void 0 : `archive-metadata:1:${id}:${JSON.stringify(formats)}`;
2207
2377
  }
2208
2378
  async getEntries() {
2209
- return this._archiveProxy.getEntries();
2379
+ return this.entries ??= this._archiveProxy.getEntries().catch((error) => {
2380
+ this.entries = void 0;
2381
+ throw error;
2382
+ });
2210
2383
  }
2211
2384
  async getEntry(path) {
2212
2385
  const entries = await this.getEntries();
2213
2386
  return entries.find((e) => e.filename === path);
2214
2387
  }
2388
+ async getMetadata(key) {
2389
+ try {
2390
+ return await (this.metadata ??= this.getEntry("pack.mcmeta").then(async (entry) => PackMetadata.parse(entry ? JSON.parse(await (await entry.getData()).text()) : {})).catch((error) => {
2391
+ this.metadata = void 0;
2392
+ throw error;
2393
+ }));
2394
+ } catch (cause) {
2395
+ throw new AssetLoadError(this, key, "pack.mcmeta", cause);
2396
+ }
2397
+ }
2398
+ async blocks(key) {
2399
+ if (key.rootType !== "assets" && key.rootType !== "data") return false;
2400
+ const metadata = await this.getMetadata(key);
2401
+ const path = `${key.assetType !== void 0 ? key.assetType + "/" : ""}${key.getFullPath()}${key.extension}`;
2402
+ return metadata.blocks(key.namespace, path);
2403
+ }
2215
2404
  async get(key, parser) {
2216
2405
  const responseParser = HostedAssetSource.PARSER_MAP.get(parser);
2217
2406
  return this.load(key, responseParser);
2218
2407
  }
2219
2408
  async load(key, parser) {
2220
2409
  const path = `${this.assetBasePath(key)}${key.type !== void 0 ? key.type + "/" : ""}${key.path}${key.extension}`;
2410
+ const version = AssetLoader.version;
2411
+ let selectedPath = path;
2221
2412
  let url;
2222
2413
  try {
2223
- const entry = await this.getEntry(path);
2414
+ let directories = [];
2415
+ if (key.rootType === "assets" || key.rootType === "data") {
2416
+ const metadata = await this.getMetadata(key);
2417
+ if (metadata.hasOverlays) {
2418
+ const format2 = (key.rootType === "assets" ? this.options.resourcePackFormat : this.options.dataPackFormat) ?? await PackFormats.get(version, key.rootType);
2419
+ directories = metadata.overlayDirectories(format2);
2420
+ }
2421
+ }
2422
+ let entry;
2423
+ for (const directory of [...directories, ""]) {
2424
+ selectedPath = directory ? `${directory}/${path}` : path;
2425
+ entry = await this.getEntry(selectedPath);
2426
+ if (entry) break;
2427
+ }
2224
2428
  if (!entry) {
2225
2429
  return void 0;
2226
2430
  }
@@ -2233,7 +2437,8 @@ var init_ArchiveAssetSource = __esm({
2233
2437
  }
2234
2438
  return await parser.parse(response);
2235
2439
  } catch (cause) {
2236
- throw new AssetLoadError(this, key, path, cause);
2440
+ if (cause instanceof AssetLoadError) throw cause;
2441
+ throw new AssetLoadError(this, key, selectedPath, cause);
2237
2442
  } finally {
2238
2443
  if (url !== void 0) {
2239
2444
  URL.revokeObjectURL(url);
@@ -2266,6 +2471,8 @@ var init_archive = __esm({
2266
2471
  init_ArchiveEntry();
2267
2472
  init_ArchiveProxy();
2268
2473
  init_BrowserArchiveProxy();
2474
+ init_PackFormats();
2475
+ init_PackMetadata();
2269
2476
  }
2270
2477
  });
2271
2478
 
@@ -2362,13 +2569,14 @@ ${key}` : key;
2362
2569
  this.addSource("mcassets", new HostedAssetSource(this.ROOT, { retryDefaults: false }));
2363
2570
  }
2364
2571
  static async getAll(key, parser) {
2365
- let promises = [];
2366
- for (const source of this._SOURCES) {
2367
- promises.push(source.source.get(key, parser));
2572
+ const sources = [...this._SOURCES];
2573
+ const results = [];
2574
+ for (const { source } of sources) {
2575
+ const asset = await source.get(key, parser);
2576
+ if (asset != void 0) results.push(asset);
2577
+ if (await source.blocks(key)) break;
2368
2578
  }
2369
- return Promise.all(promises).then((results) => {
2370
- return results.filter((r) => r != void 0);
2371
- });
2579
+ return results;
2372
2580
  }
2373
2581
  /** Returns the first defined result in source-priority order, without merging assets. */
2374
2582
  static async get(key, parser) {
@@ -2389,13 +2597,17 @@ ${key}` : key;
2389
2597
  /** Tries each path within a source before considering lower-priority sources. */
2390
2598
  static async getFirst(keys, parser) {
2391
2599
  const sources = [...this._SOURCES];
2600
+ let remaining = [...keys];
2392
2601
  for (const source of sources) {
2393
- for (const key of keys) {
2602
+ for (const key of remaining) {
2394
2603
  const result = await source.source.get(key, parser);
2395
2604
  if (result !== void 0) {
2396
2605
  return { key, asset: result };
2397
2606
  }
2398
2607
  }
2608
+ const blocked = await Promise.all(remaining.map((key) => source.source.blocks(key)));
2609
+ remaining = remaining.filter((_, index) => !blocked[index]);
2610
+ if (!remaining.length) break;
2399
2611
  }
2400
2612
  return void 0;
2401
2613
  }
@@ -3510,27 +3722,27 @@ var init_EntityAnimationPlayer = __esm({
3510
3722
  for (const layer of layers) {
3511
3723
  const objects = [];
3512
3724
  if (poses) {
3513
- layer.traverse((object) => {
3514
- if (poses.has(object)) objects.push(object);
3725
+ layer.traverse((object2) => {
3726
+ if (poses.has(object2)) objects.push(object2);
3515
3727
  });
3516
3728
  } else {
3517
3729
  for (const bone of Object.keys(animation.bones)) {
3518
- const object = layer.getObjectByName(`group:${bone}`);
3519
- if (object) objects.push(object);
3730
+ const object2 = layer.getObjectByName(`group:${bone}`);
3731
+ if (object2) objects.push(object2);
3520
3732
  }
3521
3733
  }
3522
- for (const object of objects) {
3523
- const bone = object.name.slice("group:".length);
3524
- const pose = poses?.get(object);
3734
+ for (const object2 of objects) {
3735
+ const bone = object2.name.slice("group:".length);
3736
+ const pose = poses?.get(object2);
3525
3737
  this.parts.push({
3526
3738
  bone,
3527
- object,
3528
- position: object.position.clone(),
3529
- rotation: object.rotation.clone(),
3530
- scale: object.scale.clone(),
3531
- basePosition: pose ? new Vector35(...pose.offset) : object.position.clone(),
3532
- baseRotation: pose ? new Euler3(...pose.rotation, "ZYX") : object.rotation.clone(),
3533
- baseScale: pose ? new Vector35(...pose.scale ?? [1, 1, 1]) : object.scale.clone()
3739
+ object: object2,
3740
+ position: object2.position.clone(),
3741
+ rotation: object2.rotation.clone(),
3742
+ scale: object2.scale.clone(),
3743
+ basePosition: pose ? new Vector35(...pose.offset) : object2.position.clone(),
3744
+ baseRotation: pose ? new Euler3(...pose.rotation, "ZYX") : object2.rotation.clone(),
3745
+ baseScale: pose ? new Vector35(...pose.scale ?? [1, 1, 1]) : object2.scale.clone()
3534
3746
  });
3535
3747
  }
3536
3748
  }
@@ -4057,15 +4269,15 @@ var init_SceneObject = __esm({
4057
4269
  }
4058
4270
  }
4059
4271
  //</editor-fold>
4060
- toggleObjectVisibility(object, visible) {
4061
- if (object) {
4272
+ toggleObjectVisibility(object2, visible) {
4273
+ if (object2) {
4062
4274
  if (typeof visible !== "undefined") {
4063
- object.visible = visible;
4275
+ object2.visible = visible;
4064
4276
  } else {
4065
- object.visible = !object.visible;
4277
+ object2.visible = !object2.visible;
4066
4278
  }
4067
4279
  this.notifyDirty();
4068
- return object.visible;
4280
+ return object2.visible;
4069
4281
  }
4070
4282
  this.notifyDirty();
4071
4283
  return false;
@@ -4356,8 +4568,8 @@ var init_EntityObject = __esm({
4356
4568
  this.scrollMaterials.push({ material: mat, offset: mat.map.offset, speed: scroll });
4357
4569
  }
4358
4570
  }
4359
- this.getLayerGroup(name)?.traverse((object) => {
4360
- if (isMesh(object)) object.material = mat;
4571
+ this.getLayerGroup(name)?.traverse((object2) => {
4572
+ if (isMesh(object2)) object2.material = mat;
4361
4573
  });
4362
4574
  }));
4363
4575
  if (!this.children.length) {
@@ -4696,8 +4908,8 @@ function toTrianglesDrawMode(geometry, drawMode) {
4696
4908
  return geometry;
4697
4909
  }
4698
4910
  }
4699
- function computeMorphedAttributes(object) {
4700
- if (object.geometry.isBufferGeometry !== true) {
4911
+ function computeMorphedAttributes(object2) {
4912
+ if (object2.geometry.isBufferGeometry !== true) {
4701
4913
  console.error("THREE.BufferGeometryUtils: Geometry is not of type BufferGeometry.");
4702
4914
  return null;
4703
4915
  }
@@ -4710,11 +4922,11 @@ function computeMorphedAttributes(object) {
4710
4922
  const _morphA = new Vector310();
4711
4923
  const _morphB = new Vector310();
4712
4924
  const _morphC = new Vector310();
4713
- function _calculateMorphedAttributeData(object2, material2, attribute, morphAttribute, morphTargetsRelative2, a2, b2, c2, modifiedAttributeArray) {
4925
+ function _calculateMorphedAttributeData(object3, material2, attribute, morphAttribute, morphTargetsRelative2, a2, b2, c2, modifiedAttributeArray) {
4714
4926
  _vA.fromBufferAttribute(attribute, a2);
4715
4927
  _vB.fromBufferAttribute(attribute, b2);
4716
4928
  _vC.fromBufferAttribute(attribute, c2);
4717
- const morphInfluences = object2.morphTargetInfluences;
4929
+ const morphInfluences = object3.morphTargetInfluences;
4718
4930
  if (material2.morphTargets && morphAttribute && morphInfluences) {
4719
4931
  _morphA.set(0, 0, 0);
4720
4932
  _morphB.set(0, 0, 0);
@@ -4740,10 +4952,10 @@ function computeMorphedAttributes(object) {
4740
4952
  _vB.add(_morphB);
4741
4953
  _vC.add(_morphC);
4742
4954
  }
4743
- if (object2.isSkinnedMesh) {
4744
- object2.boneTransform(a2, _vA);
4745
- object2.boneTransform(b2, _vB);
4746
- object2.boneTransform(c2, _vC);
4955
+ if (object3.isSkinnedMesh) {
4956
+ object3.boneTransform(a2, _vA);
4957
+ object3.boneTransform(b2, _vB);
4958
+ object3.boneTransform(c2, _vC);
4747
4959
  }
4748
4960
  modifiedAttributeArray[a2 * 3 + 0] = _vA.x;
4749
4961
  modifiedAttributeArray[a2 * 3 + 1] = _vA.y;
@@ -4755,8 +4967,8 @@ function computeMorphedAttributes(object) {
4755
4967
  modifiedAttributeArray[c2 * 3 + 1] = _vC.y;
4756
4968
  modifiedAttributeArray[c2 * 3 + 2] = _vC.z;
4757
4969
  }
4758
- const geometry = object.geometry;
4759
- const material = object.material;
4970
+ const geometry = object2.geometry;
4971
+ const material = object2.material;
4760
4972
  let a, b, c;
4761
4973
  const index = geometry.index;
4762
4974
  const positionAttribute = geometry.attributes.position;
@@ -4783,7 +4995,7 @@ function computeMorphedAttributes(object) {
4783
4995
  b = index.getX(j + 1);
4784
4996
  c = index.getX(j + 2);
4785
4997
  _calculateMorphedAttributeData(
4786
- object,
4998
+ object2,
4787
4999
  groupMaterial,
4788
5000
  positionAttribute,
4789
5001
  morphPosition,
@@ -4794,7 +5006,7 @@ function computeMorphedAttributes(object) {
4794
5006
  modifiedPosition
4795
5007
  );
4796
5008
  _calculateMorphedAttributeData(
4797
- object,
5009
+ object2,
4798
5010
  groupMaterial,
4799
5011
  normalAttribute,
4800
5012
  morphNormal,
@@ -4814,7 +5026,7 @@ function computeMorphedAttributes(object) {
4814
5026
  b = index.getX(i + 1);
4815
5027
  c = index.getX(i + 2);
4816
5028
  _calculateMorphedAttributeData(
4817
- object,
5029
+ object2,
4818
5030
  material,
4819
5031
  positionAttribute,
4820
5032
  morphPosition,
@@ -4825,7 +5037,7 @@ function computeMorphedAttributes(object) {
4825
5037
  modifiedPosition
4826
5038
  );
4827
5039
  _calculateMorphedAttributeData(
4828
- object,
5040
+ object2,
4829
5041
  material,
4830
5042
  normalAttribute,
4831
5043
  morphNormal,
@@ -4849,7 +5061,7 @@ function computeMorphedAttributes(object) {
4849
5061
  b = j + 1;
4850
5062
  c = j + 2;
4851
5063
  _calculateMorphedAttributeData(
4852
- object,
5064
+ object2,
4853
5065
  groupMaterial,
4854
5066
  positionAttribute,
4855
5067
  morphPosition,
@@ -4860,7 +5072,7 @@ function computeMorphedAttributes(object) {
4860
5072
  modifiedPosition
4861
5073
  );
4862
5074
  _calculateMorphedAttributeData(
4863
- object,
5075
+ object2,
4864
5076
  groupMaterial,
4865
5077
  normalAttribute,
4866
5078
  morphNormal,
@@ -4880,7 +5092,7 @@ function computeMorphedAttributes(object) {
4880
5092
  b = i + 1;
4881
5093
  c = i + 2;
4882
5094
  _calculateMorphedAttributeData(
4883
- object,
5095
+ object2,
4884
5096
  material,
4885
5097
  positionAttribute,
4886
5098
  morphPosition,
@@ -4891,7 +5103,7 @@ function computeMorphedAttributes(object) {
4891
5103
  modifiedPosition
4892
5104
  );
4893
5105
  _calculateMorphedAttributeData(
4894
- object,
5106
+ object2,
4895
5107
  material,
4896
5108
  normalAttribute,
4897
5109
  morphNormal,
@@ -5203,13 +5415,13 @@ var init_ModelObject = __esm({
5203
5415
  transform.multiply(new Matrix49().makeTranslation(-8, -8, -8));
5204
5416
  try {
5205
5417
  for (const part of parts) {
5206
- const object = new EntityObject(part.model, { flip: false, wireframe: this.options.wireframe });
5207
- object.matrix.copy(transform).multiply(part.transform);
5208
- object.matrixWorldNeedsUpdate = true;
5209
- object.matrixAutoUpdate = false;
5210
- this.add(object);
5211
- await object.init();
5212
- object.iterateAllMeshes((mesh) => {
5418
+ const object2 = new EntityObject(part.model, { flip: false, wireframe: this.options.wireframe });
5419
+ object2.matrix.copy(transform).multiply(part.transform);
5420
+ object2.matrixWorldNeedsUpdate = true;
5421
+ object2.matrixAutoUpdate = false;
5422
+ this.add(object2);
5423
+ await object2.init();
5424
+ object2.iterateAllMeshes((mesh) => {
5213
5425
  const source = mesh.material;
5214
5426
  let material = this.specialMaterials.get(source);
5215
5427
  if (!material) {
@@ -5220,7 +5432,7 @@ var init_ModelObject = __esm({
5220
5432
  mesh.material = material;
5221
5433
  });
5222
5434
  for (const [name, rotation] of Object.entries(part.rotations)) {
5223
- object.getGroupByName(name)?.rotation.set(...rotation, "ZYX");
5435
+ object2.getGroupByName(name)?.rotation.set(...rotation, "ZYX");
5224
5436
  }
5225
5437
  }
5226
5438
  } catch (error) {
@@ -5992,7 +6204,7 @@ var OBJExporter = class {
5992
6204
  * @param {Object3D} object - The 3D object to export.
5993
6205
  * @return {string} The exported OBJ.
5994
6206
  */
5995
- parse(object) {
6207
+ parse(object2) {
5996
6208
  let output = "";
5997
6209
  let indexVertex = 0;
5998
6210
  let indexVertexUvs = 0;
@@ -6111,7 +6323,7 @@ var OBJExporter = class {
6111
6323
  }
6112
6324
  indexVertex += nbVertex;
6113
6325
  }
6114
- object.traverse(function(child) {
6326
+ object2.traverse(function(child) {
6115
6327
  if (child.isMesh === true) {
6116
6328
  parseMesh(child);
6117
6329
  }
@@ -6145,9 +6357,9 @@ var PLYExporter = class {
6145
6357
  * @param {PLYExporter~Options} options - The export options.
6146
6358
  * @return {?(string|ArrayBuffer)} The exported PLY.
6147
6359
  */
6148
- parse(object, onDone, options = {}) {
6360
+ parse(object2, onDone, options = {}) {
6149
6361
  function traverseMeshes(cb) {
6150
- object.traverse(function(child) {
6362
+ object2.traverse(function(child) {
6151
6363
  if (child.isMesh === true || child.isPoints) {
6152
6364
  const mesh = child;
6153
6365
  const geometry = mesh.geometry;
@@ -6180,7 +6392,7 @@ var PLYExporter = class {
6180
6392
  for (const name of customAttributeNames) customTypes[name] = "float";
6181
6393
  let vertexCount = 0;
6182
6394
  let faceCount = 0;
6183
- object.traverse(function(child) {
6395
+ object2.traverse(function(child) {
6184
6396
  if (child.isMesh === true) {
6185
6397
  const mesh = child;
6186
6398
  const geometry = mesh.geometry;
@@ -6996,12 +7208,12 @@ var GLTFWriter = class {
6996
7208
  * @param {THREE.Object3D|THREE.Material|THREE.BufferGeometry|THREE.AnimationClip} object
6997
7209
  * @param {Object} objectDef
6998
7210
  */
6999
- serializeUserData(object, objectDef) {
7000
- if (Object.keys(object.userData).length === 0) return;
7211
+ serializeUserData(object2, objectDef) {
7212
+ if (Object.keys(object2.userData).length === 0) return;
7001
7213
  const options = this.options;
7002
7214
  const extensionsUsed = this.extensionsUsed;
7003
7215
  try {
7004
- const json = JSON.parse(JSON.stringify(object.userData));
7216
+ const json = JSON.parse(JSON.stringify(object2.userData));
7005
7217
  if (options.includeCustomExtensions && json.gltfExtensions) {
7006
7218
  if (objectDef.extensions === void 0) objectDef.extensions = {};
7007
7219
  for (const extensionName in json.gltfExtensions) {
@@ -7012,7 +7224,7 @@ var GLTFWriter = class {
7012
7224
  }
7013
7225
  if (Object.keys(json).length > 0) objectDef.extras = json;
7014
7226
  } catch (error) {
7015
- console.warn("THREE.GLTFExporter: userData of '" + object.name + "' won't be serialized because of JSON.stringify error - " + error.message);
7227
+ console.warn("THREE.GLTFExporter: userData of '" + object2.name + "' won't be serialized because of JSON.stringify error - " + error.message);
7016
7228
  }
7017
7229
  }
7018
7230
  /**
@@ -7385,7 +7597,7 @@ var GLTFWriter = class {
7385
7597
  * @param {string} mimeType export format
7386
7598
  * @return {number} Index of the processed texture in the "images" array
7387
7599
  */
7388
- processImage(image, format, flipY, mimeType = "image/png") {
7600
+ processImage(image, format2, flipY, mimeType = "image/png") {
7389
7601
  if (image !== null) {
7390
7602
  const writer = this;
7391
7603
  const cache = writer.cache;
@@ -7409,8 +7621,8 @@ var GLTFWriter = class {
7409
7621
  ctx.scale(1, -1);
7410
7622
  }
7411
7623
  if (image.data !== void 0) {
7412
- if (format !== RGBAFormat2) {
7413
- console.error("GLTFExporter: Only RGBAFormat is supported.", format);
7624
+ if (format2 !== RGBAFormat2) {
7625
+ console.error("GLTFExporter: Only RGBAFormat is supported.", format2);
7414
7626
  }
7415
7627
  if (image.width > options.maxTextureSize || image.height > options.maxTextureSize) {
7416
7628
  console.warn("GLTFExporter: Image size is bigger than maxTextureSize", image);
@@ -7938,13 +8150,13 @@ var GLTFWriter = class {
7938
8150
  * @param {THREE.Object3D} object
7939
8151
  * @return {?number}
7940
8152
  */
7941
- processSkin(object) {
8153
+ processSkin(object2) {
7942
8154
  const json = this.json;
7943
8155
  const nodeMap = this.nodeMap;
7944
- const node = json.nodes[nodeMap.get(object)];
7945
- const skeleton = object.skeleton;
8156
+ const node = json.nodes[nodeMap.get(object2)];
8157
+ const skeleton = object2.skeleton;
7946
8158
  if (skeleton === void 0) return null;
7947
- const rootJoint = object.skeleton.bones[0];
8159
+ const rootJoint = object2.skeleton.bones[0];
7948
8160
  if (rootJoint === void 0) return null;
7949
8161
  const joints = [];
7950
8162
  const inverseBindMatrices = new Float32Array(skeleton.bones.length * 16);
@@ -7952,7 +8164,7 @@ var GLTFWriter = class {
7952
8164
  for (let i = 0; i < skeleton.bones.length; ++i) {
7953
8165
  joints.push(nodeMap.get(skeleton.bones[i]));
7954
8166
  temporaryBoneInverse.copy(skeleton.boneInverses[i]);
7955
- temporaryBoneInverse.multiply(object.bindMatrix).toArray(inverseBindMatrices, i * 16);
8167
+ temporaryBoneInverse.multiply(object2.bindMatrix).toArray(inverseBindMatrices, i * 16);
7956
8168
  }
7957
8169
  if (json.skins === void 0) json.skins = [];
7958
8170
  json.skins.push({
@@ -7968,19 +8180,19 @@ var GLTFWriter = class {
7968
8180
  * @param {THREE.Object3D} object Object3D to processNodeAsync
7969
8181
  * @return {Promise<number>} Index of the node in the nodes list
7970
8182
  */
7971
- async processNodeAsync(object) {
8183
+ async processNodeAsync(object2) {
7972
8184
  const json = this.json;
7973
8185
  const options = this.options;
7974
8186
  const nodeMap = this.nodeMap;
7975
8187
  if (!json.nodes) json.nodes = [];
7976
- if (object.pivot !== null) {
7977
- return await this._processNodeWithPivotAsync(object);
8188
+ if (object2.pivot !== null) {
8189
+ return await this._processNodeWithPivotAsync(object2);
7978
8190
  }
7979
8191
  const nodeDef = {};
7980
8192
  if (options.trs) {
7981
- const rotation = object.quaternion.toArray();
7982
- const position = object.position.toArray();
7983
- const scale = object.scale.toArray();
8193
+ const rotation = object2.quaternion.toArray();
8194
+ const position = object2.position.toArray();
8195
+ const scale = object2.scale.toArray();
7984
8196
  if (!equalArray(rotation, [0, 0, 0, 1])) {
7985
8197
  nodeDef.rotation = rotation;
7986
8198
  }
@@ -7991,28 +8203,28 @@ var GLTFWriter = class {
7991
8203
  nodeDef.scale = scale;
7992
8204
  }
7993
8205
  } else {
7994
- if (object.matrixAutoUpdate) {
7995
- object.updateMatrix();
8206
+ if (object2.matrixAutoUpdate) {
8207
+ object2.updateMatrix();
7996
8208
  }
7997
- if (isIdentityMatrix(object.matrix) === false) {
7998
- nodeDef.matrix = object.matrix.elements;
8209
+ if (isIdentityMatrix(object2.matrix) === false) {
8210
+ nodeDef.matrix = object2.matrix.elements;
7999
8211
  }
8000
8212
  }
8001
- if (object.name !== "") nodeDef.name = String(object.name);
8002
- this.serializeUserData(object, nodeDef);
8003
- if (object.isMesh || object.isLine || object.isPoints) {
8004
- const meshIndex = await this.processMeshAsync(object);
8213
+ if (object2.name !== "") nodeDef.name = String(object2.name);
8214
+ this.serializeUserData(object2, nodeDef);
8215
+ if (object2.isMesh || object2.isLine || object2.isPoints) {
8216
+ const meshIndex = await this.processMeshAsync(object2);
8005
8217
  if (meshIndex !== null) nodeDef.mesh = meshIndex;
8006
- } else if (object.isCamera) {
8007
- nodeDef.camera = this.processCamera(object);
8218
+ } else if (object2.isCamera) {
8219
+ nodeDef.camera = this.processCamera(object2);
8008
8220
  }
8009
- if (object.isSkinnedMesh) this.skins.push(object);
8221
+ if (object2.isSkinnedMesh) this.skins.push(object2);
8010
8222
  const nodeIndex = json.nodes.push(nodeDef) - 1;
8011
- nodeMap.set(object, nodeIndex);
8012
- if (object.children.length > 0) {
8223
+ nodeMap.set(object2, nodeIndex);
8224
+ if (object2.children.length > 0) {
8013
8225
  const children = [];
8014
- for (let i = 0, l = object.children.length; i < l; i++) {
8015
- const child = object.children[i];
8226
+ for (let i = 0, l = object2.children.length; i < l; i++) {
8227
+ const child = object2.children[i];
8016
8228
  if (child.visible || options.onlyVisible === false) {
8017
8229
  const childNodeIndex = await this.processNodeAsync(child);
8018
8230
  if (childNodeIndex !== null) children.push(childNodeIndex);
@@ -8021,7 +8233,7 @@ var GLTFWriter = class {
8021
8233
  if (children.length > 0) nodeDef.children = children;
8022
8234
  }
8023
8235
  await this._invokeAllAsync(function(ext) {
8024
- ext.writeNode && ext.writeNode(object, nodeDef);
8236
+ ext.writeNode && ext.writeNode(object2, nodeDef);
8025
8237
  });
8026
8238
  return nodeIndex;
8027
8239
  }
@@ -8030,19 +8242,19 @@ var GLTFWriter = class {
8030
8242
  * @param {THREE.Object3D} object Object3D with pivot
8031
8243
  * @return {Promise<number>} Index of the container node
8032
8244
  */
8033
- async _processNodeWithPivotAsync(object) {
8245
+ async _processNodeWithPivotAsync(object2) {
8034
8246
  const json = this.json;
8035
8247
  const options = this.options;
8036
8248
  const nodeMap = this.nodeMap;
8037
- const pivot = object.pivot;
8249
+ const pivot = object2.pivot;
8038
8250
  const containerDef = {};
8039
- const rotation = object.quaternion.toArray();
8251
+ const rotation = object2.quaternion.toArray();
8040
8252
  const position = [
8041
- object.position.x + pivot.x,
8042
- object.position.y + pivot.y,
8043
- object.position.z + pivot.z
8253
+ object2.position.x + pivot.x,
8254
+ object2.position.y + pivot.y,
8255
+ object2.position.z + pivot.z
8044
8256
  ];
8045
- const scale = object.scale.toArray();
8257
+ const scale = object2.scale.toArray();
8046
8258
  if (!equalArray(rotation, [0, 0, 0, 1])) {
8047
8259
  containerDef.rotation = rotation;
8048
8260
  }
@@ -8053,28 +8265,28 @@ var GLTFWriter = class {
8053
8265
  containerDef.scale = scale;
8054
8266
  }
8055
8267
  containerDef.extras = { pivot: pivot.toArray() };
8056
- if (object.name !== "") containerDef.name = String(object.name);
8057
- this.serializeUserData(object, containerDef);
8268
+ if (object2.name !== "") containerDef.name = String(object2.name);
8269
+ this.serializeUserData(object2, containerDef);
8058
8270
  const containerIndex = json.nodes.push(containerDef) - 1;
8059
- nodeMap.set(object, containerIndex);
8271
+ nodeMap.set(object2, containerIndex);
8060
8272
  const childDef = {};
8061
8273
  const childPosition = [-pivot.x, -pivot.y, -pivot.z];
8062
8274
  if (!equalArray(childPosition, [0, 0, 0])) {
8063
8275
  childDef.translation = childPosition;
8064
8276
  }
8065
- if (object.isMesh || object.isLine || object.isPoints) {
8066
- const meshIndex = await this.processMeshAsync(object);
8277
+ if (object2.isMesh || object2.isLine || object2.isPoints) {
8278
+ const meshIndex = await this.processMeshAsync(object2);
8067
8279
  if (meshIndex !== null) childDef.mesh = meshIndex;
8068
- } else if (object.isCamera) {
8069
- childDef.camera = this.processCamera(object);
8280
+ } else if (object2.isCamera) {
8281
+ childDef.camera = this.processCamera(object2);
8070
8282
  }
8071
- if (object.isSkinnedMesh) this.skins.push(object);
8283
+ if (object2.isSkinnedMesh) this.skins.push(object2);
8072
8284
  const childIndex = json.nodes.push(childDef) - 1;
8073
8285
  const containerChildren = [childIndex];
8074
- if (object.children.length > 0) {
8286
+ if (object2.children.length > 0) {
8075
8287
  const grandchildren = [];
8076
- for (let i = 0, l = object.children.length; i < l; i++) {
8077
- const child = object.children[i];
8288
+ for (let i = 0, l = object2.children.length; i < l; i++) {
8289
+ const child = object2.children[i];
8078
8290
  if (child.visible || options.onlyVisible === false) {
8079
8291
  const childNodeIndex = await this.processNodeAsync(child);
8080
8292
  if (childNodeIndex !== null) grandchildren.push(childNodeIndex);
@@ -8084,7 +8296,7 @@ var GLTFWriter = class {
8084
8296
  }
8085
8297
  containerDef.children = containerChildren;
8086
8298
  await this._invokeAllAsync(function(ext) {
8087
- ext.writeNode && ext.writeNode(object, containerDef);
8299
+ ext.writeNode && ext.writeNode(object2, containerDef);
8088
8300
  });
8089
8301
  return containerIndex;
8090
8302
  }
@@ -8527,10 +8739,10 @@ var GLTFMeshGpuInstancing = class {
8527
8739
  this.writer = writer;
8528
8740
  this.name = "EXT_mesh_gpu_instancing";
8529
8741
  }
8530
- writeNode(object, nodeDef) {
8531
- if (!object.isInstancedMesh) return;
8742
+ writeNode(object2, nodeDef) {
8743
+ if (!object2.isInstancedMesh) return;
8532
8744
  const writer = this.writer;
8533
- const mesh = object;
8745
+ const mesh = object2;
8534
8746
  const translationAttr = new Float32Array(mesh.count * 3);
8535
8747
  const rotationAttr = new Float32Array(mesh.count * 4);
8536
8748
  const scaleAttr = new Float32Array(mesh.count * 3);
@@ -8720,8 +8932,8 @@ var SceneExporter = class {
8720
8932
  }
8721
8933
  }
8722
8934
  };
8723
- function localMatrix(object) {
8724
- return object.matrixAutoUpdate ? new Matrix47().compose(object.position, object.quaternion, object.scale) : object.matrix.clone();
8935
+ function localMatrix(object2) {
8936
+ return object2.matrixAutoUpdate ? new Matrix47().compose(object2.position, object2.quaternion, object2.scale) : object2.matrix.clone();
8725
8937
  }
8726
8938
  function createSnapshot(root, gltf, bakeColors = false) {
8727
8939
  const scene = new Scene3();
@@ -8825,10 +9037,10 @@ function createSnapshot(root, gltf, bakeColors = false) {
8825
9037
  scene.add(copy);
8826
9038
  }
8827
9039
  };
8828
- const visit = (object, parentWorld) => {
8829
- if (!object.visible) return;
8830
- const world = parentWorld.clone().multiply(localMatrix(object));
8831
- const mesh = object;
9040
+ const visit = (object2, parentWorld) => {
9041
+ if (!object2.visible) return;
9042
+ const world = parentWorld.clone().multiply(localMatrix(object2));
9043
+ const mesh = object2;
8832
9044
  if (mesh.isMesh) {
8833
9045
  const instanced = mesh;
8834
9046
  if (instanced.isInstancedMesh) {
@@ -8842,7 +9054,7 @@ function createSnapshot(root, gltf, bakeColors = false) {
8842
9054
  addMesh(mesh, world);
8843
9055
  }
8844
9056
  }
8845
- for (const child of object.children) visit(child, world);
9057
+ for (const child of object2.children) visit(child, world);
8846
9058
  };
8847
9059
  try {
8848
9060
  const ancestors = [];
@@ -9074,11 +9286,11 @@ var GuiHelper = class {
9074
9286
  switch (recipe.type) {
9075
9287
  case "minecraft:crafting_shaped":
9076
9288
  case "crafting_shaped": {
9077
- const pattern = recipe.pattern;
9078
- if (!pattern.length || pattern.length > 3 || !pattern[0].length || pattern[0].length > 3 || pattern.some((row) => row.length !== pattern[0].length)) {
9289
+ const pattern2 = recipe.pattern;
9290
+ if (!pattern2.length || pattern2.length > 3 || !pattern2[0].length || pattern2[0].length > 3 || pattern2.some((row) => row.length !== pattern2[0].length)) {
9079
9291
  throw new Error("Crafting patterns must be rectangular, with 1\u20133 rows and columns");
9080
9292
  }
9081
- const cells = pattern.flatMap((row, y) => row.split("").map((symbol, x) => ({ symbol, x, y }))).filter((cell) => cell.symbol !== " ");
9293
+ const cells = pattern2.flatMap((row, y) => row.split("").map((symbol, x) => ({ symbol, x, y }))).filter((cell) => cell.symbol !== " ");
9082
9294
  if (!cells.length) throw new Error("Crafting patterns must contain an ingredient");
9083
9295
  const minX = Math.min(...cells.map((cell) => cell.x)), maxX = Math.max(...cells.map((cell) => cell.x));
9084
9296
  const minY = Math.min(...cells.map((cell) => cell.y)), maxY = Math.max(...cells.map((cell) => cell.y));
@@ -9490,29 +9702,29 @@ var SceneInspector = class {
9490
9702
  this.objectControlsContainer.innerHTML = "";
9491
9703
  this.addControls(targetObject, targetIntersection, instance);
9492
9704
  }
9493
- addControls(object, intersection, instance) {
9705
+ addControls(object2, intersection, instance) {
9494
9706
  const container = document.createElement("div");
9495
9707
  container.append(this.separator("Select Parent/Child"));
9496
- if (object.parent) {
9497
- container.append(this.buttonControl("Select Parent " + object.parent.constructor.name + " " + object.parent.name, "P", () => {
9498
- this.selectObject(object.parent, intersection, instance);
9708
+ if (object2.parent) {
9709
+ container.append(this.buttonControl("Select Parent " + object2.parent.constructor.name + " " + object2.parent.name, "P", () => {
9710
+ this.selectObject(object2.parent, intersection, instance);
9499
9711
  }));
9500
9712
  }
9501
- if (object.children.length > 0) {
9713
+ if (object2.children.length > 0) {
9502
9714
  let i = 1;
9503
- for (let child of object.children) {
9715
+ for (let child of object2.children) {
9504
9716
  container.append(this.buttonControl("Select Child " + child.constructor.name + " " + child.name, "C" + i++, () => {
9505
9717
  this.selectObject(child, intersection, instance);
9506
9718
  }));
9507
9719
  }
9508
9720
  }
9509
9721
  container.append(this.separator());
9510
- const selectedInstance = instance && (object === instance.instanceable || object === intersection?.object) ? instance : void 0;
9722
+ const selectedInstance = instance && (object2 === instance.instanceable || object2 === intersection?.object) ? instance : void 0;
9511
9723
  if (!selectedInstance) {
9512
- container.append(this.toggleControl("Visibility", "V", object.visible, (v) => object.visible = v));
9724
+ container.append(this.toggleControl("Visibility", "V", object2.visible, (v) => object2.visible = v));
9513
9725
  }
9514
9726
  container.append(this.separator("Mesh"));
9515
- this.addObjectControls(object, intersection, container, selectedInstance);
9727
+ this.addObjectControls(object2, intersection, container, selectedInstance);
9516
9728
  container.append(this.separator());
9517
9729
  this.objectControlsContainer.append(container);
9518
9730
  }
@@ -10083,8 +10295,8 @@ var BlockObject = class _BlockObject extends SceneObject {
10083
10295
  return false;
10084
10296
  }
10085
10297
  return this._models.some((model) => {
10086
- const object = isInstanceReference(model) ? model.instanceable : model;
10087
- return object.isOpaqueFullCube && this.getModelCullMask(model, 63) === 63;
10298
+ const object2 = isInstanceReference(model) ? model.instanceable : model;
10299
+ return object2.isOpaqueFullCube && this.getModelCullMask(model, 63) === 63;
10088
10300
  });
10089
10301
  }
10090
10302
  getModelMatrix(model) {
@@ -10093,8 +10305,8 @@ var BlockObject = class _BlockObject extends SceneObject {
10093
10305
  return model.matrix.clone();
10094
10306
  }
10095
10307
  getModelCullMask(model, worldMask) {
10096
- const object = isInstanceReference(model) ? model.instanceable : model;
10097
- if (object.options.displayPosition) return 0;
10308
+ const object2 = isInstanceReference(model) ? model.instanceable : model;
10309
+ if (object2.options.displayPosition) return 0;
10098
10310
  const position = new Vector312();
10099
10311
  const rotation = new Quaternion5();
10100
10312
  const scale = new Vector312();
@@ -10111,14 +10323,14 @@ var BlockObject = class _BlockObject extends SceneObject {
10111
10323
  replacements.push(model);
10112
10324
  continue;
10113
10325
  }
10114
- const object = isInstanceReference(model) ? model.instanceable : model;
10326
+ const object2 = isInstanceReference(model) ? model.instanceable : model;
10115
10327
  const cullMask = this.getModelCullMask(model, worldMask);
10116
- if (cullMask === (object.options.cullMask ?? 0)) {
10328
+ if (cullMask === (object2.options.cullMask ?? 0)) {
10117
10329
  replacements.push(model);
10118
10330
  continue;
10119
10331
  }
10120
10332
  const matrix = this.getModelMatrix(model);
10121
- const replacement = await this.scene.addModel(object.originalModel, { ...object.options, cullMask });
10333
+ const replacement = await this.scene.addModel(object2.originalModel, { ...object2.options, cullMask });
10122
10334
  replacements.push(replacement);
10123
10335
  if (isInstanceReference(replacement)) {
10124
10336
  replacement.setMatrix(matrix);
@@ -10126,8 +10338,8 @@ var BlockObject = class _BlockObject extends SceneObject {
10126
10338
  replacement.matrix.copy(matrix);
10127
10339
  replacement.matrixWorldNeedsUpdate = true;
10128
10340
  matrix.decompose(replacement.position, replacement.quaternion, replacement.scale);
10129
- replacement.matrixAutoUpdate = object.matrixAutoUpdate;
10130
- replacement.visible = object.visible;
10341
+ replacement.matrixAutoUpdate = object2.matrixAutoUpdate;
10342
+ replacement.visible = object2.visible;
10131
10343
  }
10132
10344
  }
10133
10345
  } catch (error) {
@@ -12045,9 +12257,9 @@ var SchematicParser = class {
12045
12257
  * Parses a legacy schematic using custom mappings before the bundled defaults.
12046
12258
  * Keys are `id:metadata`; values are block states such as `minecraft:oak_log[axis=x]`.
12047
12259
  */
12048
- static async parse(nbt, customMappings = {}) {
12260
+ static async parse(nbt, customMappings = {}, options = {}) {
12049
12261
  const tags = nbt.value;
12050
- if (tags.Materials?.type !== "string" || tags.Materials.value !== "Alpha") {
12262
+ if (!options.lenient && (tags.Materials?.type !== "string" || tags.Materials.value !== "Alpha")) {
12051
12263
  throw new MineRenderError("Schematic Materials must be Alpha");
12052
12264
  }
12053
12265
  const size = ["Width", "Height", "Length"].map((name) => {
@@ -12088,8 +12300,16 @@ var SchematicParser = class {
12088
12300
  const id = high << 8 | ids.value[index] & 255;
12089
12301
  const metadata = data.value[index] & 255;
12090
12302
  const key = `${id}:${metadata}`;
12091
- const mapped = customMappings[key] ?? mapping[key];
12092
- if (!mapped) throw new MineRenderError(`Unsupported legacy block ${id}:${metadata} at schematic index ${index}`);
12303
+ let mapped = customMappings[key] ?? mapping[key];
12304
+ if (!mapped && options.lenient) {
12305
+ mapped = customMappings[`${id}:0`] ?? mapping[`${id}:0`];
12306
+ }
12307
+ if (!mapped) {
12308
+ if (options.lenient) {
12309
+ continue;
12310
+ }
12311
+ throw new MineRenderError(`Unsupported legacy block ${id}:${metadata} at schematic index ${index}`);
12312
+ }
12093
12313
  const [type, state] = mapped.split("[");
12094
12314
  if (type === "minecraft:air") continue;
12095
12315
  const properties = {};
@@ -13250,53 +13470,53 @@ var MineRenderScene = class _MineRenderScene extends Scene4 {
13250
13470
  this.DEFAULT_OPTIONS = (0, import_ts_deepmerge8.default)({}, {});
13251
13471
  }
13252
13472
  add(...objects) {
13253
- for (const object of objects) {
13473
+ for (const object2 of objects) {
13254
13474
  this.dirty = true;
13255
13475
  try {
13256
- super.add(object);
13476
+ super.add(object2);
13257
13477
  } finally {
13258
- if (object?.isObject3D && object !== this) {
13259
- this.updateObjectRegistration(object, object.parent === this);
13478
+ if (object2?.isObject3D && object2 !== this) {
13479
+ this.updateObjectRegistration(object2, object2.parent === this);
13260
13480
  }
13261
13481
  }
13262
13482
  }
13263
13483
  return this;
13264
13484
  }
13265
13485
  remove(...objects) {
13266
- for (const object of objects) {
13267
- if (!this.children.includes(object)) continue;
13486
+ for (const object2 of objects) {
13487
+ if (!this.children.includes(object2)) continue;
13268
13488
  this.dirty = true;
13269
- this.updateObjectRegistration(object, false);
13489
+ this.updateObjectRegistration(object2, false);
13270
13490
  try {
13271
- super.remove(object);
13491
+ super.remove(object2);
13272
13492
  } finally {
13273
- this.updateObjectRegistration(object, object.parent === this);
13493
+ this.updateObjectRegistration(object2, object2.parent === this);
13274
13494
  }
13275
13495
  }
13276
13496
  return this;
13277
13497
  }
13278
- updateObjectRegistration(object, attached) {
13279
- if (this.observedObjects.has(object) === attached) return;
13280
- const observable = object;
13498
+ updateObjectRegistration(object2, attached) {
13499
+ if (this.observedObjects.has(object2) === attached) return;
13500
+ const observable = object2;
13281
13501
  if (attached) {
13282
- this.observedObjects.add(object);
13502
+ this.observedObjects.add(object2);
13283
13503
  observable.addEventListener("change", this.onObjectChange);
13284
13504
  } else {
13285
- this.observedObjects.delete(object);
13505
+ this.observedObjects.delete(object2);
13286
13506
  observable.removeEventListener("change", this.onObjectChange);
13287
13507
  }
13288
13508
  const change = attached ? 1 : -1;
13289
13509
  this.stats.objectCount += change;
13290
- if (isSceneObject(object)) {
13510
+ if (isSceneObject(object2)) {
13291
13511
  this.stats.sceneObjectCount += change;
13292
13512
  }
13293
13513
  }
13294
- async initAndAdd(...object) {
13514
+ async initAndAdd(...object2) {
13295
13515
  this.dirty = true;
13296
- for (let obj of object) {
13516
+ for (let obj of object2) {
13297
13517
  await obj.init();
13298
13518
  }
13299
- return this.add(...object);
13519
+ return this.add(...object2);
13300
13520
  }
13301
13521
  async addSceneObject(asset, objectSupplier, _options, parent = this) {
13302
13522
  this.dirty = true;
@@ -13383,11 +13603,11 @@ var _changeEvent = { type: "change" };
13383
13603
  var _startEvent = { type: "start" };
13384
13604
  var _endEvent = { type: "end" };
13385
13605
  var OrbitControls = class extends EventDispatcher {
13386
- constructor(object, domElement) {
13606
+ constructor(object2, domElement) {
13387
13607
  super();
13388
13608
  if (domElement === void 0) console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.');
13389
13609
  if (domElement === document) console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.');
13390
- this.object = object;
13610
+ this.object = object2;
13391
13611
  this.domElement = domElement;
13392
13612
  this.domElement.style.touchAction = "none";
13393
13613
  this.enabled = true;
@@ -13444,7 +13664,7 @@ var OrbitControls = class extends EventDispatcher {
13444
13664
  };
13445
13665
  this.update = function() {
13446
13666
  const offset = new Vector313();
13447
- const quat = new Quaternion6().setFromUnitVectors(object.up, new Vector313(0, 1, 0));
13667
+ const quat = new Quaternion6().setFromUnitVectors(object2.up, new Vector313(0, 1, 0));
13448
13668
  const quatInverse = quat.clone().invert();
13449
13669
  const lastPosition = new Vector313();
13450
13670
  const lastQuaternion = new Quaternion6();
@@ -14009,8 +14229,8 @@ var OrbitControls = class extends EventDispatcher {
14009
14229
  }
14010
14230
  };
14011
14231
  var MapControls = class extends OrbitControls {
14012
- constructor(object, domElement) {
14013
- super(object, domElement);
14232
+ constructor(object2, domElement) {
14233
+ super(object2, domElement);
14014
14234
  this.screenSpacePanning = false;
14015
14235
  this.mouseButtons.LEFT = MOUSE.PAN;
14016
14236
  this.mouseButtons.RIGHT = MOUSE.ROTATE;
@@ -14938,16 +15158,16 @@ var SectionModels = class {
14938
15158
  if (!models) this.models.set(model, models = /* @__PURE__ */ new Map());
14939
15159
  const key = JSON.stringify([rotation.x, rotation.y, rotation.z, variant.uvlock, tints]);
14940
15160
  const template = await cached(models, key, async () => {
14941
- const object = new SectionModel(model, {
15161
+ const object2 = new SectionModel(model, {
14942
15162
  instanceMeshes: false,
14943
15163
  mergeMeshes: false,
14944
15164
  tints,
14945
15165
  uvLockRotation: variant.uvlock && (rotation.x !== 0 || rotation.y !== 0) ? [rotation.x, rotation.y, rotation.z] : void 0
14946
15166
  });
14947
- await object.init();
14948
- const geometry = object.children[0].geometry;
15167
+ await object2.init();
15168
+ const geometry = object2.children[0].geometry;
14949
15169
  geometry.applyMatrix4(new Matrix412().makeRotationFromEuler(rotation));
14950
- object.clear();
15170
+ object2.clear();
14951
15171
  const cullFaces = CUBE_FACES.map((face) => {
14952
15172
  const local = CUBE_FACES.findIndex((name) => name === atlas.model.elements[0].faces[face]?.cullface);
14953
15173
  if (local < 0) return 0;
@@ -15135,10 +15355,10 @@ var MineRenderWorld = class {
15135
15355
  await block.object.updateFluid((x, y, z) => {
15136
15356
  const neighbor = pos.clone().add(new Vector316(x, y, z));
15137
15357
  const section = this.getChunkAt(neighbor);
15138
- const object = section?.isBlockVisibleAt(neighbor) ? section.getBlockAt(neighbor)?.object : void 0;
15358
+ const object2 = section?.isBlockVisibleAt(neighbor) ? section.getBlockAt(neighbor)?.object : void 0;
15139
15359
  return {
15140
- fluid: object?.fluidKind,
15141
- level: object?.fluidLevel,
15360
+ fluid: object2?.fluidKind,
15361
+ level: object2?.fluidLevel,
15142
15362
  solid: section?.isOccludingAt(neighbor) ?? false
15143
15363
  };
15144
15364
  });
@@ -15367,7 +15587,7 @@ var Chunk = class _Chunk {
15367
15587
  this.renderedBlocks.get(index)?.object?.removeFromScene();
15368
15588
  if (this.sectionBlocks.delete(index)) this.meshDirty = true;
15369
15589
  this.renderedBlocks.delete(index);
15370
- let object;
15590
+ let object2;
15371
15591
  try {
15372
15592
  if (!readBlock) return void 0;
15373
15593
  const stored = readBlock();
@@ -15382,22 +15602,22 @@ var Chunk = class _Chunk {
15382
15602
  this.sectionBlocks.set(index, { index, template, cullMask: 0 });
15383
15603
  this.meshDirty = true;
15384
15604
  } else {
15385
- object = await this.scene.addBlock(blockState, {
15605
+ object2 = await this.scene.addBlock(blockState, {
15386
15606
  mergeMeshes: true,
15387
15607
  instanceMeshes: true,
15388
15608
  maxInstanceCount: 2e3,
15389
15609
  initialState: stored.properties
15390
15610
  });
15391
- object.setPosition(MineRenderWorld.worldToScenePosition(worldPos));
15611
+ object2.setPosition(MineRenderWorld.worldToScenePosition(worldPos));
15392
15612
  }
15393
15613
  const info = { get block() {
15394
15614
  return readBlock();
15395
- }, object };
15615
+ }, object: object2 };
15396
15616
  this.renderedBlocks.set(index, info);
15397
15617
  return info;
15398
15618
  } catch (error) {
15399
15619
  this.data.set(index, void 0);
15400
- object?.removeFromScene();
15620
+ object2?.removeFromScene();
15401
15621
  throw error;
15402
15622
  } finally {
15403
15623
  await onBlocksChanged?.([worldPos]);
@@ -15570,6 +15790,8 @@ export {
15570
15790
  NodeCache,
15571
15791
  NodeEnv,
15572
15792
  OrbitControls,
15793
+ PackFormats,
15794
+ PackMetadata,
15573
15795
  PersistentCache,
15574
15796
  Renderer,
15575
15797
  RequestError,