minerender 2.1.0-alpha.136 → 2.1.0-alpha.137

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.
Files changed (56) hide show
  1. package/dist/browser/esm/Materials.mjs +3 -1
  2. package/dist/browser/esm/Materials.mjs.map +1 -1
  3. package/dist/browser/esm/Ticker.mjs +3 -1
  4. package/dist/browser/esm/Ticker.mjs.map +1 -1
  5. package/dist/browser/esm/UVMapper.mjs +9 -9
  6. package/dist/browser/esm/UVMapper.mjs.map +1 -1
  7. package/dist/browser/esm/assets/AssetLoader.mjs +4 -4
  8. package/dist/browser/esm/assets/AssetLoader.mjs.map +1 -1
  9. package/dist/browser/esm/assets/BlockEntities.mjs +3 -1
  10. package/dist/browser/esm/assets/BlockEntities.mjs.map +1 -1
  11. package/dist/browser/esm/assets/_fonts/Unihex.mjs +4 -2
  12. package/dist/browser/esm/assets/_fonts/Unihex.mjs.map +1 -1
  13. package/dist/browser/esm/assets/source/HostedAssetSource.mjs +6 -7
  14. package/dist/browser/esm/assets/source/HostedAssetSource.mjs.map +1 -1
  15. package/dist/browser/esm/env/browser/BrowserCache.mjs +3 -3
  16. package/dist/browser/esm/env/browser/BrowserCache.mjs.map +1 -1
  17. package/dist/browser/esm/image/ImageLoader.mjs +3 -3
  18. package/dist/browser/esm/image/ImageLoader.mjs.map +1 -1
  19. package/dist/browser/esm/index.browser.d.mts +32 -1
  20. package/dist/browser/esm/inspector/SceneInspector.mjs +3 -3
  21. package/dist/browser/esm/inspector/SceneInspector.mjs.map +1 -1
  22. package/dist/browser/esm/instance/InstanceManager.mjs +4 -4
  23. package/dist/browser/esm/instance/InstanceManager.mjs.map +1 -1
  24. package/dist/browser/esm/model/block/scene/BlockObject.mjs +3 -1
  25. package/dist/browser/esm/model/block/scene/BlockObject.mjs.map +1 -1
  26. package/dist/browser/esm/model/scene/ModelObject.mjs +4 -4
  27. package/dist/browser/esm/model/scene/ModelObject.mjs.map +1 -1
  28. package/dist/browser/esm/renderer/Renderer.mjs +4 -2
  29. package/dist/browser/esm/renderer/Renderer.mjs.map +1 -1
  30. package/dist/browser/esm/renderer/SceneObject.mjs +0 -6
  31. package/dist/browser/esm/renderer/SceneObject.mjs.map +1 -1
  32. package/dist/browser/esm/request/Requests.mjs +3 -3
  33. package/dist/browser/esm/request/Requests.mjs.map +1 -1
  34. package/dist/browser/esm/skin/Skins.mjs +6 -4
  35. package/dist/browser/esm/skin/Skins.mjs.map +1 -1
  36. package/dist/browser/esm/texture/TextureLoader.mjs +4 -2
  37. package/dist/browser/esm/texture/TextureLoader.mjs.map +1 -1
  38. package/dist/browser/esm/util/log.mjs +75 -0
  39. package/dist/browser/esm/util/log.mjs.map +1 -1
  40. package/dist/browser/esm/util/performance.mjs.map +1 -1
  41. package/dist/browser/esm/world/MineRenderWorld.mjs +4 -2
  42. package/dist/browser/esm/world/MineRenderWorld.mjs.map +1 -1
  43. package/dist/browser/esm/world/_entities/WorldEntities.mjs +3 -1
  44. package/dist/browser/esm/world/_entities/WorldEntities.mjs.map +1 -1
  45. package/dist/browser/index.d.ts +32 -1
  46. package/dist/browser/index.js +445 -384
  47. package/dist/browser/index.js.map +1 -1
  48. package/dist/bundle.js +2143 -2080
  49. package/dist/bundle.js.map +1 -1
  50. package/dist/node/index.d.mts +32 -1
  51. package/dist/node/index.d.ts +32 -1
  52. package/dist/node/index.js +445 -382
  53. package/dist/node/index.js.map +1 -1
  54. package/dist/node/index.mjs +416 -354
  55. package/dist/node/index.mjs.map +1 -1
  56. package/package.json +1 -1
@@ -88,12 +88,80 @@ var init_PersistentCache = __esm({
88
88
  });
89
89
 
90
90
  // src/util/log.ts
91
+ function readSwitch() {
92
+ switchRead = true;
93
+ let value;
94
+ if (typeof runtime.process?.versions?.node === "string") {
95
+ value = runtime.process.env?.MINERENDER_LOG;
96
+ } else {
97
+ try {
98
+ value = runtime.localStorage?.getItem("minerender:log");
99
+ } catch {
100
+ }
101
+ }
102
+ if (value) {
103
+ for (const entry of value.split(",")) {
104
+ const separator = entry.indexOf("=");
105
+ const name = separator < 0 ? void 0 : entry.slice(0, separator).trim();
106
+ const setting = (separator < 0 ? entry : entry.slice(separator + 1)).trim();
107
+ if (!Object.prototype.hasOwnProperty.call(levels, setting) || name === "") continue;
108
+ if (name === void 0) {
109
+ switchThreshold = setting;
110
+ } else {
111
+ switchNamespaces ?? (switchNamespaces = /* @__PURE__ */ new Map());
112
+ switchNamespaces.set(name, setting);
113
+ }
114
+ }
115
+ }
116
+ }
117
+ function logger(namespace) {
118
+ const write = (level, args) => {
119
+ if (!switchRead) readSwitch();
120
+ if (levels[level] < levels[switchNamespaces?.get(namespace) ?? switchThreshold ?? namespaces?.get(namespace) ?? threshold]) return;
121
+ if (logHandler) {
122
+ logHandler(level, namespace, args);
123
+ return;
124
+ }
125
+ if (tagStyle === void 0) {
126
+ tagStyle = typeof runtime.process?.versions?.node === "string" ? runtime.process.stdout?.isTTY === true ? "ansi" : "plain" : "browser";
127
+ }
128
+ if (tagStyle === "browser") {
129
+ console[level](`%cMineRender%c ${namespace}`, "background:#3c8527;color:#fff;border-radius:3px;padding:0 4px", "font-weight:bold", ...args);
130
+ } else {
131
+ const color2 = colors[level];
132
+ const tag = `[minerender:${namespace}]`;
133
+ console[level](tagStyle === "ansi" ? `\x1B[${color2}m${tag}\x1B[0m` : tag, ...args);
134
+ }
135
+ };
136
+ return {
137
+ debug: (...args) => write("debug", args),
138
+ info: (...args) => write("info", args),
139
+ warn: (...args) => write("warn", args),
140
+ error: (...args) => write("error", args)
141
+ };
142
+ }
91
143
  function prefix(prefix2) {
92
144
  return `${FgGreen}MR${BgBlack}${prefix2 ?? ""}${Reset}`;
93
145
  }
94
- var Reset, FgGreen, BgBlack;
146
+ var runtime, levels, colors, threshold, namespaces, logHandler, tagStyle, switchRead, switchThreshold, switchNamespaces, Logging, Reset, FgGreen, BgBlack;
95
147
  var init_log = __esm({
96
148
  "src/util/log.ts"() {
149
+ runtime = globalThis;
150
+ levels = { debug: 0, info: 1, warn: 2, error: 3, silent: 4 };
151
+ colors = { debug: 90, info: 36, warn: 33, error: 31 };
152
+ threshold = "warn";
153
+ switchRead = false;
154
+ Logging = class {
155
+ /** Updates the given settings and keeps the others. */
156
+ static configure(options) {
157
+ if (options.level !== void 0) threshold = options.level;
158
+ if (options.namespaces !== void 0) namespaces = new Map(Object.entries(options.namespaces));
159
+ }
160
+ /** Sends messages to `handler` instead of the console. Call without an argument to restore console output. */
161
+ static setHandler(handler) {
162
+ logHandler = handler;
163
+ }
164
+ };
97
165
  Reset = "\x1B[0m";
98
166
  FgGreen = "\x1B[32m";
99
167
  BgBlack = "\x1B[40m";
@@ -443,12 +511,12 @@ async function abortable(promise, signal) {
443
511
  signal.removeEventListener("abort", abort);
444
512
  }
445
513
  }
446
- var import_jobqu, p2, RequestError, RequestQueue, Requests;
514
+ var import_jobqu, log2, RequestError, RequestQueue, Requests;
447
515
  var init_Requests = __esm({
448
516
  "src/request/Requests.ts"() {
449
517
  import_jobqu = require("jobqu");
450
518
  init_log();
451
- p2 = prefix("Requests");
519
+ log2 = logger("Requests");
452
520
  RequestError = class extends Error {
453
521
  constructor(message, response, cause) {
454
522
  super(message);
@@ -475,7 +543,7 @@ var init_Requests = __esm({
475
543
  try {
476
544
  return await abortable(this.queue.add(request), signal);
477
545
  } catch (error) {
478
- console.debug(p2, "Request failed", error);
546
+ log2.debug("Request failed", error);
479
547
  const delay = this.retryDelay(error, request, retries);
480
548
  if (delay === void 0) {
481
549
  throw error;
@@ -657,7 +725,7 @@ var init_base64 = __esm({
657
725
  });
658
726
 
659
727
  // src/image/ImageLoader.ts
660
- var p3, ImageLoader;
728
+ var log3, ImageLoader;
661
729
  var init_ImageLoader = __esm({
662
730
  "src/image/ImageLoader.ts"() {
663
731
  init_CanvasCompat();
@@ -668,7 +736,7 @@ var init_ImageLoader = __esm({
668
736
  init_WrappedImage();
669
737
  init_base64();
670
738
  init_log();
671
- p3 = prefix("ImageLoader");
739
+ log3 = logger("ImageLoader");
672
740
  ImageLoader = class _ImageLoader {
673
741
  static _createImage() {
674
742
  return createImage();
@@ -693,7 +761,7 @@ var init_ImageLoader = __esm({
693
761
  return image;
694
762
  }
695
763
  static async loadData(src) {
696
- console.debug(p3, "loadData", src);
764
+ log3.debug("loadData", src);
697
765
  const image = await this.loadCanvasData(src);
698
766
  return image.data.getImageData(0, 0, image.width, image.height);
699
767
  }
@@ -800,13 +868,15 @@ var init_ImageLoader = __esm({
800
868
  });
801
869
 
802
870
  // src/texture/TextureLoader.ts
803
- var import_three3, THREE, TextureLoader;
871
+ var import_three3, THREE, log4, TextureLoader;
804
872
  var init_TextureLoader = __esm({
805
873
  "src/texture/TextureLoader.ts"() {
806
874
  import_three3 = require("three");
807
875
  THREE = __toESM(require("three"));
808
876
  init_ImageLoader();
809
877
  init_Textures();
878
+ init_log();
879
+ log4 = logger("TextureLoader");
810
880
  TextureLoader = class {
811
881
  /** Reports whether image loading failed, so cached textures can be retried. */
812
882
  static hasFailed(texture) {
@@ -822,7 +892,7 @@ var init_TextureLoader = __esm({
822
892
  texture.needsUpdate = true;
823
893
  }, (error) => {
824
894
  this.failedTextures.add(texture);
825
- console.warn("Failed to load texture", src, error);
895
+ log4.warn("Failed to load texture", src, error);
826
896
  });
827
897
  texture.image = image;
828
898
  texture.format = format2;
@@ -838,7 +908,7 @@ var init_TextureLoader = __esm({
838
908
  texture.needsUpdate = true;
839
909
  }).catch((error) => {
840
910
  this.failedTextures.add(texture);
841
- console.warn("Failed to load texture", src, error);
911
+ log4.warn("Failed to load texture", src, error);
842
912
  });
843
913
  texture.format = format2;
844
914
  texture.rotation = rotation;
@@ -914,7 +984,7 @@ var init_Textures = __esm({
914
984
  });
915
985
 
916
986
  // src/Materials.ts
917
- var import_three5, Materials;
987
+ var import_three5, log5, Materials;
918
988
  var init_Materials = __esm({
919
989
  "src/Materials.ts"() {
920
990
  init_CacheKey();
@@ -922,6 +992,8 @@ var init_Materials = __esm({
922
992
  init_Textures();
923
993
  init_TextureLoader();
924
994
  init_Caching();
995
+ init_log();
996
+ log5 = logger("Materials");
925
997
  Materials = class _Materials {
926
998
  /** Shared checkerboard material, created on first access. */
927
999
  static get MISSING_TEXTURE() {
@@ -1192,7 +1264,7 @@ var init_Materials = __esm({
1192
1264
  Object.assign(material.defaultAttributeValues, { shade: [1], uvBounds: [0, 0, 1, 1] });
1193
1265
  return material;
1194
1266
  } catch (e) {
1195
- console.warn(e);
1267
+ log5.warn(e);
1196
1268
  }
1197
1269
  return this.createBasicCanvasMaterial(canvas, transparent, shade);
1198
1270
  }
@@ -1333,12 +1405,12 @@ var init_AssetKey = __esm({
1333
1405
  }
1334
1406
  /** Joins the type subdirectory and path without adding a namespace or file extension. */
1335
1407
  getFullPath() {
1336
- let p11 = [];
1408
+ let p = [];
1337
1409
  if (this.type) {
1338
- p11.push(this.type);
1410
+ p.push(this.type);
1339
1411
  }
1340
- p11.push(this.path);
1341
- return p11.join("/");
1412
+ p.push(this.path);
1413
+ return p.join("/");
1342
1414
  }
1343
1415
  toNamespacedString() {
1344
1416
  return this.namespace + ":" + this.getFullPath();
@@ -1384,184 +1456,6 @@ var init_AssetSource = __esm({
1384
1456
  }
1385
1457
  });
1386
1458
 
1387
- // src/util/BatchedExecutor.ts
1388
- var import_jobqu2, BatchedExecutor;
1389
- var init_BatchedExecutor = __esm({
1390
- "src/util/BatchedExecutor.ts"() {
1391
- import_jobqu2 = require("jobqu");
1392
- BatchedExecutor = class {
1393
- /**
1394
- * @param interval - Delay between queue runs, in milliseconds.
1395
- * @param batch - Maximum tasks started per run and maximum tasks active at once.
1396
- */
1397
- constructor(interval = 1, batch = 30) {
1398
- if (!Number.isFinite(interval) || interval < 0) throw new RangeError("Batch interval must be finite and nonnegative");
1399
- if (!Number.isInteger(batch) || batch < 1) throw new RangeError("Batch size must be a positive integer");
1400
- this.interval = interval;
1401
- this.batch = batch;
1402
- this.queue = new import_jobqu2.JobQueue(async (task) => task(), { interval, maxPerRun: batch, maxActive: batch });
1403
- }
1404
- /** Queues a task and resolves with its result, or rejects with its error. */
1405
- submit(task) {
1406
- return this.queue.add(() => task());
1407
- }
1408
- /** Rejects queued and future tasks. Tasks already running are allowed to finish. */
1409
- stop() {
1410
- this.queue.end();
1411
- }
1412
- };
1413
- }
1414
- });
1415
-
1416
- // src/util/model.ts
1417
- function applyElementRotation(rotation, geometry) {
1418
- const origin = new import_three7.Vector3(rotation.origin[0], rotation.origin[1], rotation.origin[2]);
1419
- geometry.translate(-origin.x, -origin.y, -origin.z);
1420
- switch (rotation.axis) {
1421
- case "x" /* X */:
1422
- geometry.rotateX(toRadians(rotation.angle));
1423
- break;
1424
- case "y" /* Y */:
1425
- geometry.rotateY(toRadians(rotation.angle));
1426
- break;
1427
- case "z" /* Z */:
1428
- geometry.rotateZ(toRadians(rotation.angle));
1429
- break;
1430
- }
1431
- if (rotation.rescale) {
1432
- const angle = toRadians(rotation.angle);
1433
- const s = 1 / Math.max(Math.abs(Math.cos(angle)), Math.abs(Math.sin(angle)));
1434
- geometry.scale(
1435
- rotation.axis === "x" /* X */ ? 1 : s,
1436
- rotation.axis === "y" /* Y */ ? 1 : s,
1437
- rotation.axis === "z" /* Z */ ? 1 : s
1438
- );
1439
- }
1440
- geometry.translate(origin.x, origin.y, origin.z);
1441
- }
1442
- function applyGenericRotation(axis, rotation, obj) {
1443
- switch (axis) {
1444
- case "x" /* X */:
1445
- obj.rotateOnAxis(new import_three7.Vector3(1, 0, 0), toRadians(rotation));
1446
- break;
1447
- case "y" /* Y */:
1448
- obj.rotateOnAxis(new import_three7.Vector3(0, 1, 0), toRadians(rotation));
1449
- break;
1450
- case "z" /* Z */:
1451
- obj.rotateOnAxis(new import_three7.Vector3(0, 0, 1), toRadians(rotation));
1452
- break;
1453
- }
1454
- }
1455
- function addBox3WireframeToObject(box, obj, color2 = 16777215, w = 2) {
1456
- let size = new import_three7.Vector3();
1457
- box.getSize(size);
1458
- let boxGeo = new import_three7.BoxGeometry(size.x, size.y, size.z, 1, 1, 1);
1459
- let wireGeo = new import_three7.EdgesGeometry(boxGeo);
1460
- let wireMat = new import_three7.LineBasicMaterial({ color: color2, linewidth: w });
1461
- let wireframe = new import_three7.LineSegments(wireGeo, wireMat);
1462
- obj.add(wireframe);
1463
- let axes = new import_three7.AxesHelper(1);
1464
- obj.add(axes);
1465
- }
1466
- function addWireframeToObject(obj, color2 = 16777215, w = 2) {
1467
- let boxGeo = new import_three7.BoxGeometry(16, 16, 16, 1, 1, 1);
1468
- let wireGeo = new import_three7.EdgesGeometry(boxGeo);
1469
- let wireMat = new import_three7.LineBasicMaterial({ color: color2, linewidth: w });
1470
- let wireframe = new import_three7.LineSegments(wireGeo, wireMat);
1471
- obj.add(wireframe);
1472
- let axes = new import_three7.AxesHelper(1);
1473
- obj.add(axes);
1474
- }
1475
- function addWireframeToMesh(geo, mesh, color2 = 16777215, w = 2) {
1476
- let wireGeo = new import_three7.EdgesGeometry(geo);
1477
- let wireMat = new import_three7.LineBasicMaterial({ color: color2, linewidth: w });
1478
- let wireframe = new import_three7.LineSegments(wireGeo, wireMat);
1479
- mesh.add(wireframe);
1480
- let axes = new import_three7.AxesHelper(1);
1481
- mesh.add(axes);
1482
- return () => {
1483
- wireGeo.dispose();
1484
- wireMat.dispose();
1485
- axes.dispose();
1486
- };
1487
- }
1488
- var import_three7;
1489
- var init_model = __esm({
1490
- "src/util/model.ts"() {
1491
- init_Axis();
1492
- init_util();
1493
- import_three7 = require("three");
1494
- }
1495
- });
1496
-
1497
- // src/util/performance.ts
1498
- function captureException(e, ...extra) {
1499
- console.error(e, extra);
1500
- }
1501
- function timingStart(marker) {
1502
- console.time(marker);
1503
- }
1504
- function timingEnd(marker) {
1505
- console.timeEnd(marker);
1506
- }
1507
- var init_performance = __esm({
1508
- "src/util/performance.ts"() {
1509
- }
1510
- });
1511
-
1512
- // src/util/sha.ts
1513
- function sha1(str) {
1514
- return (0, import_sha1.default)(str).toString();
1515
- }
1516
- function sha256(str) {
1517
- return (0, import_sha256.default)(str).toString();
1518
- }
1519
- function sha512(str) {
1520
- return (0, import_sha512.default)(str).toString();
1521
- }
1522
- var import_sha1, import_sha256, import_sha512;
1523
- var init_sha = __esm({
1524
- "src/util/sha.ts"() {
1525
- import_sha1 = __toESM(require("crypto-js/sha1.js"));
1526
- import_sha256 = __toESM(require("crypto-js/sha256.js"));
1527
- import_sha512 = __toESM(require("crypto-js/sha512.js"));
1528
- }
1529
- });
1530
-
1531
- // src/util/three.ts
1532
- function isObject3D(obj) {
1533
- return obj.isObject3D;
1534
- }
1535
- function isMesh(obj) {
1536
- return obj.isMesh;
1537
- }
1538
- function isInstancedMesh(obj) {
1539
- return obj.isInstancedMesh;
1540
- }
1541
- function isPerspectiveCamera(obj) {
1542
- return obj.isPerspectiveCamera;
1543
- }
1544
- function isOrthographicCamera(obj) {
1545
- return obj.isOrthographicCamera;
1546
- }
1547
- var init_three = __esm({
1548
- "src/util/three.ts"() {
1549
- }
1550
- });
1551
-
1552
- // src/util/index.ts
1553
- var init_util2 = __esm({
1554
- "src/util/index.ts"() {
1555
- init_BatchedExecutor();
1556
- init_log();
1557
- init_model();
1558
- init_performance();
1559
- init_sha();
1560
- init_three();
1561
- init_util();
1562
- }
1563
- });
1564
-
1565
1459
  // src/nbt/NBTHelper.ts
1566
1460
  function commonJsExports(module2) {
1567
1461
  return module2.default ?? module2;
@@ -1647,8 +1541,8 @@ var require_dist = __commonJS({
1647
1541
  __assign = Object.assign || function(t) {
1648
1542
  for (var s, i = 1, n = arguments.length; i < n; i++) {
1649
1543
  s = arguments[i];
1650
- for (var p11 in s) if (Object.prototype.hasOwnProperty.call(s, p11))
1651
- t[p11] = s[p11];
1544
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
1545
+ t[p] = s[p];
1652
1546
  }
1653
1547
  return t;
1654
1548
  };
@@ -1740,11 +1634,11 @@ var init_merge = __esm({
1740
1634
  });
1741
1635
 
1742
1636
  // src/assets/source/HostedAssetSource.ts
1743
- var BINARY_TIMEOUT, p4, DEFAULT_OPTIONS, _HostedAssetSource, HostedAssetSource;
1637
+ var BINARY_TIMEOUT, log6, DEFAULT_OPTIONS, _HostedAssetSource, HostedAssetSource;
1744
1638
  var init_HostedAssetSource = __esm({
1745
1639
  "src/assets/source/HostedAssetSource.ts"() {
1746
1640
  init_AssetSource();
1747
- init_util2();
1641
+ init_log();
1748
1642
  init_nbt();
1749
1643
  init_image();
1750
1644
  init_AssetKey();
@@ -1754,7 +1648,7 @@ var init_HostedAssetSource = __esm({
1754
1648
  init_parser();
1755
1649
  init_merge();
1756
1650
  BINARY_TIMEOUT = 6e4;
1757
- p4 = prefix("HostedAssetSource");
1651
+ log6 = logger("HostedAssetSource");
1758
1652
  DEFAULT_OPTIONS = {
1759
1653
  retryDefaults: true
1760
1654
  };
@@ -1766,14 +1660,14 @@ var init_HostedAssetSource = __esm({
1766
1660
  return direct;
1767
1661
  }
1768
1662
  if (key.namespace !== DEFAULT_NAMESPACE) {
1769
- console.info(p4, "Retrying", key, "with default namespace");
1663
+ log6.debug("Retrying", key, "with default namespace");
1770
1664
  const namespaceKey = new AssetKey(DEFAULT_NAMESPACE, key.path, key.assetType, key.type, key.rootType, key.extension, key.root);
1771
1665
  const namespaced = await this.load(namespaceKey, parser);
1772
1666
  if (typeof namespaced !== "undefined") {
1773
1667
  return namespaced;
1774
1668
  }
1775
1669
  if (typeof key.root !== "undefined" && key.root !== AssetLoader.ROOT || typeof this.root !== "undefined" && this.root !== AssetLoader.ROOT) {
1776
- console.info(p4, "Retrying", key, "with default root+namespace");
1670
+ log6.debug("Retrying", key, "with default root+namespace");
1777
1671
  const namespacedRootedKey = new AssetKey(DEFAULT_NAMESPACE, key.path, key.assetType, key.type, key.rootType, key.extension, AssetLoader.ROOT);
1778
1672
  const namespacedRooted = await this.load(namespacedRootedKey, parser);
1779
1673
  if (typeof namespacedRooted !== "undefined") {
@@ -1781,7 +1675,7 @@ var init_HostedAssetSource = __esm({
1781
1675
  }
1782
1676
  }
1783
1677
  } else if (typeof key.root !== "undefined" && key.root !== AssetLoader.ROOT || typeof this.root !== "undefined" && this.root !== AssetLoader.ROOT) {
1784
- console.info(p4, "Retrying", key, "with default root");
1678
+ log6.debug("Retrying", key, "with default root");
1785
1679
  const rootKey = new AssetKey(key.namespace, key.path, key.assetType, key.type, key.rootType, key.extension, AssetLoader.ROOT);
1786
1680
  const rooted = await this.load(rootKey, parser);
1787
1681
  if (typeof rooted !== "undefined") {
@@ -1791,9 +1685,8 @@ var init_HostedAssetSource = __esm({
1791
1685
  return void 0;
1792
1686
  }
1793
1687
  async load(key, parser) {
1794
- console.info(p4, "Loading", key);
1795
1688
  const url = `${this.assetBasePath(key)}${key.type !== void 0 ? key.type + "/" : ""}${key.path}${key.extension}`;
1796
- console.debug(p4, url);
1689
+ log6.debug("Loading", url);
1797
1690
  const request = { url };
1798
1691
  try {
1799
1692
  parser.config(request);
@@ -2246,7 +2139,7 @@ var init_source = __esm({
2246
2139
  });
2247
2140
 
2248
2141
  // src/assets/AssetLoader.ts
2249
- var p5, AssetLoader;
2142
+ var log7, AssetLoader;
2250
2143
  var init_AssetLoader = __esm({
2251
2144
  "src/assets/AssetLoader.ts"() {
2252
2145
  init_AssetDefaults();
@@ -2254,7 +2147,7 @@ var init_AssetLoader = __esm({
2254
2147
  init_log();
2255
2148
  init_source();
2256
2149
  init_Caching();
2257
- p5 = prefix("AssetLoader");
2150
+ log7 = logger("AssetLoader");
2258
2151
  AssetLoader = class {
2259
2152
  static get _SOURCES() {
2260
2153
  return this.sources ?? (this.sources = [{ key: "mcassets", source: new HostedAssetSource(this.ROOT, { retryDefaults: false }) }]);
@@ -2309,11 +2202,11 @@ ${key}` : key;
2309
2202
  if (override) {
2310
2203
  const existing = this.removeSource(key);
2311
2204
  if (existing) {
2312
- console.log(p5, "Removed existing AssetSource", key);
2205
+ log7.info("Removed existing AssetSource", key);
2313
2206
  }
2314
2207
  }
2315
2208
  this._SOURCES.unshift({ key, source });
2316
- console.log(p5, "Added AssetSource", key);
2209
+ log7.info("Added AssetSource", key);
2317
2210
  }
2318
2211
  /** Removes and returns the first source with this name. Call {@link Caching.clear} to reload assets. */
2319
2212
  static removeSource(key) {
@@ -2493,9 +2386,11 @@ var init_CanvasImage = __esm({
2493
2386
  });
2494
2387
 
2495
2388
  // src/Ticker.ts
2496
- var _Ticker, Ticker;
2389
+ var log8, _Ticker, Ticker;
2497
2390
  var init_Ticker = __esm({
2498
2391
  "src/Ticker.ts"() {
2392
+ init_log();
2393
+ log8 = logger("Ticker");
2499
2394
  _Ticker = class _Ticker {
2500
2395
  static schedule(fn, ms) {
2501
2396
  const handle = setInterval(fn, ms);
@@ -2513,7 +2408,7 @@ var init_Ticker = __esm({
2513
2408
  try {
2514
2409
  t();
2515
2410
  } catch (e) {
2516
- console.warn(e);
2411
+ log8.warn(e);
2517
2412
  }
2518
2413
  });
2519
2414
  _Ticker.oneSecondTicks++;
@@ -2758,10 +2653,10 @@ var init_cubeUv = __esm({
2758
2653
  });
2759
2654
 
2760
2655
  // src/UVMapper.ts
2761
- var import_three8, p6, X, Y, Z, FACE_UV_AXES, UVMapper, MinecraftFaceUV;
2656
+ var import_three7, log9, X, Y, Z, FACE_UV_AXES, UVMapper, MinecraftFaceUV;
2762
2657
  var init_UVMapper = __esm({
2763
2658
  "src/UVMapper.ts"() {
2764
- import_three8 = require("three");
2659
+ import_three7 = require("three");
2765
2660
  init_CubeFace();
2766
2661
  init_ModelTextures();
2767
2662
  init_WrappedImage();
@@ -2773,17 +2668,17 @@ var init_UVMapper = __esm({
2773
2668
  init_ModelGenerator();
2774
2669
  init_log();
2775
2670
  init_cubeUv();
2776
- p6 = prefix("UVMapper");
2671
+ log9 = logger("UVMapper");
2777
2672
  X = 0;
2778
2673
  Y = 1;
2779
2674
  Z = 2;
2780
2675
  FACE_UV_AXES = {
2781
- east: [new import_three8.Vector3(0, 0, -1), new import_three8.Vector3(0, -1, 0)],
2782
- west: [new import_three8.Vector3(0, 0, 1), new import_three8.Vector3(0, -1, 0)],
2783
- up: [new import_three8.Vector3(1, 0, 0), new import_three8.Vector3(0, 0, 1)],
2784
- down: [new import_three8.Vector3(1, 0, 0), new import_three8.Vector3(0, 0, -1)],
2785
- south: [new import_three8.Vector3(1, 0, 0), new import_three8.Vector3(0, -1, 0)],
2786
- north: [new import_three8.Vector3(-1, 0, 0), new import_three8.Vector3(0, -1, 0)]
2676
+ east: [new import_three7.Vector3(0, 0, -1), new import_three7.Vector3(0, -1, 0)],
2677
+ west: [new import_three7.Vector3(0, 0, 1), new import_three7.Vector3(0, -1, 0)],
2678
+ up: [new import_three7.Vector3(1, 0, 0), new import_three7.Vector3(0, 0, 1)],
2679
+ down: [new import_three7.Vector3(1, 0, 0), new import_three7.Vector3(0, 0, -1)],
2680
+ south: [new import_three7.Vector3(1, 0, 0), new import_three7.Vector3(0, -1, 0)],
2681
+ north: [new import_three7.Vector3(-1, 0, 0), new import_three7.Vector3(0, -1, 0)]
2787
2682
  };
2788
2683
  UVMapper = class {
2789
2684
  static makeUv(uvCoord, originalTextureSize, actualTextureSize) {
@@ -2850,7 +2745,7 @@ var init_UVMapper = __esm({
2850
2745
  return facesToUvArray(faces, originalTextureSize, actualTextureSize);
2851
2746
  }
2852
2747
  static facesToUv(faces, originalTextureSize, actualTextureSize) {
2853
- return new import_three8.Float32BufferAttribute(this.facesToUvArray(faces, originalTextureSize, actualTextureSize), 2);
2748
+ return new import_three7.Float32BufferAttribute(this.facesToUvArray(faces, originalTextureSize, actualTextureSize), 2);
2854
2749
  }
2855
2750
  /** Bounds texture sampling to texel centres without changing cropped face UVs. */
2856
2751
  static setAtlasUvBounds(geometry, faces, atlas) {
@@ -2881,7 +2776,7 @@ var init_UVMapper = __esm({
2881
2776
  bounds.set([minU + insetU, minV + insetV, maxU - insetU, maxV - insetV], (faceIndex * 4 + corner) * 4);
2882
2777
  }
2883
2778
  }
2884
- geometry.setAttribute("uvBounds", new import_three8.Float32BufferAttribute(bounds, 4));
2779
+ geometry.setAttribute("uvBounds", new import_three7.Float32BufferAttribute(bounds, 4));
2885
2780
  }
2886
2781
  static lockUvs(geometry, faces, atlas, rotation) {
2887
2782
  const uv = geometry.getAttribute("uv");
@@ -2963,32 +2858,32 @@ var init_UVMapper = __esm({
2963
2858
  v1 *= scaleV;
2964
2859
  u2 *= scaleU;
2965
2860
  v2 *= scaleV;
2966
- let tl = new import_three8.Vector2(u1, v1);
2967
- let tr = new import_three8.Vector2(u2, v1);
2968
- let bl = new import_three8.Vector2(u1, v2);
2969
- let br = new import_three8.Vector2(u2, v2);
2861
+ let tl = new import_three7.Vector2(u1, v1);
2862
+ let tr = new import_three7.Vector2(u2, v1);
2863
+ let bl = new import_three7.Vector2(u1, v2);
2864
+ let br = new import_three7.Vector2(u2, v2);
2970
2865
  switch (rotation) {
2971
2866
  case 0:
2972
2867
  case 360:
2973
2868
  default:
2974
2869
  break;
2975
2870
  case 90:
2976
- tl = new import_three8.Vector2(u1, v2);
2977
- tr = new import_three8.Vector2(u1, v1);
2978
- bl = new import_three8.Vector2(u2, v2);
2979
- br = new import_three8.Vector2(u2, v1);
2871
+ tl = new import_three7.Vector2(u1, v2);
2872
+ tr = new import_three7.Vector2(u1, v1);
2873
+ bl = new import_three7.Vector2(u2, v2);
2874
+ br = new import_three7.Vector2(u2, v1);
2980
2875
  break;
2981
2876
  case 180:
2982
- tl = new import_three8.Vector2(u2, v2);
2983
- tr = new import_three8.Vector2(u1, v2);
2984
- bl = new import_three8.Vector2(u2, v1);
2985
- br = new import_three8.Vector2(u1, v1);
2877
+ tl = new import_three7.Vector2(u2, v2);
2878
+ tr = new import_three7.Vector2(u1, v2);
2879
+ bl = new import_three7.Vector2(u2, v1);
2880
+ br = new import_three7.Vector2(u1, v1);
2986
2881
  break;
2987
2882
  case 270:
2988
- tl = new import_three8.Vector2(u2, v1);
2989
- tr = new import_three8.Vector2(u2, v2);
2990
- bl = new import_three8.Vector2(u1, v1);
2991
- br = new import_three8.Vector2(u1, v2);
2883
+ tl = new import_three7.Vector2(u2, v1);
2884
+ tr = new import_three7.Vector2(u2, v2);
2885
+ bl = new import_three7.Vector2(u1, v1);
2886
+ br = new import_three7.Vector2(u1, v2);
2992
2887
  break;
2993
2888
  }
2994
2889
  return [tl, tr, bl, br];
@@ -3006,7 +2901,7 @@ var init_UVMapper = __esm({
3006
2901
  model.elements = originalModel.elements.map((element) => ({ ...element }));
3007
2902
  }
3008
2903
  const isItemModel = !("elements" in model);
3009
- console.debug(p6, "Creating Atlas for", model.key);
2904
+ log9.debug("Creating Atlas for", model.key);
3010
2905
  if (model.textures) {
3011
2906
  const promises = [];
3012
2907
  const uniqueTextureNames = [];
@@ -3020,7 +2915,7 @@ var init_UVMapper = __esm({
3020
2915
  const assetKey = AssetKey.parse("textures", textureValue, model.key);
3021
2916
  promises.push(ModelTextures.get(assetKey).then((asset2) => {
3022
2917
  if (!asset2) {
3023
- console.warn(p6, "Missing texture", assetKey);
2918
+ log9.warn("Missing texture", assetKey);
3024
2919
  return;
3025
2920
  }
3026
2921
  textureMap[textureKey] = new WrappedImage(asset2);
@@ -3032,7 +2927,7 @@ var init_UVMapper = __esm({
3032
2927
  }
3033
2928
  await Promise.all(promises);
3034
2929
  const textureCount = uniqueTextureNames.length;
3035
- console.debug(p6, "Creating Atlas for", textureCount, "textures");
2930
+ log9.debug("Creating Atlas for", textureCount, "textures");
3036
2931
  this.fillMissingTextureKeys(model.textures, textureMap);
3037
2932
  this.fillMissingTextureKeys(model.textures, metaMap);
3038
2933
  const sizes = {};
@@ -3063,7 +2958,7 @@ var init_UVMapper = __esm({
3063
2958
  this.fillMissingTextureKeys(model.textures, sizes);
3064
2959
  const s = Math.ceil(Math.sqrt(textureCount + 1));
3065
2960
  const size = Math.ceil(s * maxWidth);
3066
- console.debug(p6, "Atlas size:", size);
2961
+ log9.debug("Atlas size:", size);
3067
2962
  const squaredSize = size * size;
3068
2963
  const image = new CanvasImage(size, size);
3069
2964
  const missing = Textures.getMissing().image;
@@ -3142,7 +3037,7 @@ var init_UVMapper = __esm({
3142
3037
  }
3143
3038
  this.fillMissingTextureKeys(model.textures, positions);
3144
3039
  if (isItemModel) {
3145
- console.debug(p6, "Generating item model for", model);
3040
+ log9.debug("Generating item model for", model);
3146
3041
  model.elements = [];
3147
3042
  for (let layerName of ModelGenerator.ITEM_LAYERS) {
3148
3043
  const textureImage = textureMap[layerName];
@@ -3158,7 +3053,7 @@ var init_UVMapper = __esm({
3158
3053
  ), layerName));
3159
3054
  }
3160
3055
  }
3161
- console.debug(p6, "Item model elements", model.elements);
3056
+ log9.debug("Item model elements", model.elements);
3162
3057
  }
3163
3058
  if (!model.elements) {
3164
3059
  }
@@ -3183,7 +3078,7 @@ var init_UVMapper = __esm({
3183
3078
  const faceTexture = face.texture.substr(1);
3184
3079
  const texPosition = positions[faceTexture] || [0, 0];
3185
3080
  const texSize = sizes[faceTexture] || [16, 16];
3186
- let texPosV = new import_three8.Vector2(texPosition[0], texPosition[1]);
3081
+ let texPosV = new import_three7.Vector2(texPosition[0], texPosition[1]);
3187
3082
  const [tl, tr, bl, br] = this.expandAndRotateMcUvs(face.uv, face.rotation, texSize[0], texSize[1]);
3188
3083
  tl.add(texPosV);
3189
3084
  tr.add(texPosV);
@@ -3215,7 +3110,7 @@ var init_UVMapper = __esm({
3215
3110
  hasTranslucency
3216
3111
  );
3217
3112
  } else {
3218
- console.warn(p6, "Model does not have any textures", model);
3113
+ log9.warn("Model does not have any textures", model);
3219
3114
  }
3220
3115
  return void 0;
3221
3116
  }
@@ -3540,10 +3435,10 @@ var init_DisplayPosition = __esm({
3540
3435
  });
3541
3436
 
3542
3437
  // src/model/DisplayTransforms.ts
3543
- var import_three9, DisplayTransforms;
3438
+ var import_three8, DisplayTransforms;
3544
3439
  var init_DisplayTransforms = __esm({
3545
3440
  "src/model/DisplayTransforms.ts"() {
3546
- import_three9 = require("three");
3441
+ import_three8 = require("three");
3547
3442
  init_DisplayPosition();
3548
3443
  init_util();
3549
3444
  DisplayTransforms = class {
@@ -3562,7 +3457,7 @@ var init_DisplayTransforms = __esm({
3562
3457
  /** Build a display pose for geometry already centered at the model's [8, 8, 8] pivot. */
3563
3458
  static getMatrix(display, position) {
3564
3459
  const transform = this.getTransform(display, position);
3565
- return new import_three9.Matrix4().compose(transform.position, transform.quaternion, transform.scale);
3460
+ return new import_three8.Matrix4().compose(transform.position, transform.quaternion, transform.scale);
3566
3461
  }
3567
3462
  /** Position, rotation, and scale of a display pose for geometry already centered at the model's [8, 8, 8] pivot. */
3568
3463
  static getTransform(display, position) {
@@ -3570,10 +3465,10 @@ var init_DisplayTransforms = __esm({
3570
3465
  const left = position === "firstperson_lefthand" /* FIRSTPERSON_LEFTHAND */ || position === "thirdperson_lefthand" /* THIRDPERSON_LEFTHAND */;
3571
3466
  const sign = left ? -1 : 1;
3572
3467
  const [x, y, z] = transform.rotation ?? [0, 0, 0];
3573
- const rotation = new import_three9.Quaternion().setFromEuler(new import_three9.Euler(toRadians(x), sign * toRadians(y), sign * toRadians(z), "XYZ"));
3574
- const translation = new import_three9.Vector3(...transform.translation ?? [0, 0, 0]).clampScalar(-80, 80);
3468
+ const rotation = new import_three8.Quaternion().setFromEuler(new import_three8.Euler(toRadians(x), sign * toRadians(y), sign * toRadians(z), "XYZ"));
3469
+ const translation = new import_three8.Vector3(...transform.translation ?? [0, 0, 0]).clampScalar(-80, 80);
3575
3470
  translation.x *= sign;
3576
- const scale = new import_three9.Vector3(...transform.scale ?? [1, 1, 1]).clampScalar(-4, 4);
3471
+ const scale = new import_three8.Vector3(...transform.scale ?? [1, 1, 1]).clampScalar(-4, 4);
3577
3472
  return { position: translation, quaternion: rotation, scale };
3578
3473
  }
3579
3474
  /** Transforms geometry in place and reverses triangle winding when the matrix reflects it. */
@@ -3617,7 +3512,7 @@ var init_ModelMerger = __esm({
3617
3512
  merged.display = { ...inheritedDisplay, ...DisplayTransforms.withHandFallbacks(source.display) };
3618
3513
  }
3619
3514
  }
3620
- merged.hierarchy = models.map((m) => m.parent).filter((p11) => `${p11}`);
3515
+ merged.hierarchy = models.map((m) => m.parent).filter((p) => `${p}`);
3621
3516
  merged.hierarchy.push(`${merged.parent}`);
3622
3517
  if (model.components) merged.components = model.components;
3623
3518
  return merged;
@@ -3696,11 +3591,11 @@ var init_BannerPatterns = __esm({
3696
3591
  static async getLayers(value, target, root) {
3697
3592
  if (value === void 0) return [];
3698
3593
  if (!Array.isArray(value)) throw new Error("banner_patterns must be an array");
3699
- const colors = value.length ? await this.getColors(root) : void 0;
3594
+ const colors2 = value.length ? await this.getColors(root) : void 0;
3700
3595
  return Promise.all(value.slice(0, 16).map(async (layer) => {
3701
3596
  if (!layer || typeof layer !== "object" || Array.isArray(layer)) throw new Error("Each banner pattern requires a pattern and dye color");
3702
- if (typeof layer.color !== "string" || !Object.prototype.hasOwnProperty.call(colors, layer.color)) throw new Error(`Unsupported dye color ${layer.color}`);
3703
- const color2 = colors[layer.color];
3597
+ if (typeof layer.color !== "string" || !Object.prototype.hasOwnProperty.call(colors2, layer.color)) throw new Error(`Unsupported dye color ${layer.color}`);
3598
+ const color2 = colors2[layer.color];
3704
3599
  let pattern2 = layer.pattern;
3705
3600
  if (typeof pattern2 === "string") {
3706
3601
  const id = this.identifier(pattern2);
@@ -3809,49 +3704,49 @@ var init_ItemTints = __esm({
3809
3704
  const sources = model.tints;
3810
3705
  if (!sources?.length) return tints;
3811
3706
  const components = model.components ?? {};
3812
- const colors = { ...tints };
3707
+ const colors2 = { ...tints };
3813
3708
  await Promise.all(sources.map(async (source, index) => {
3814
- if (colors[index] !== void 0) return;
3709
+ if (colors2[index] !== void 0) return;
3815
3710
  switch (source.type) {
3816
3711
  case "constant":
3817
3712
  case "minecraft:constant":
3818
- colors[index] = this.rgb(source.value);
3713
+ colors2[index] = this.rgb(source.value);
3819
3714
  break;
3820
3715
  case "grass":
3821
3716
  case "minecraft:grass":
3822
- colors[index] = await Colormaps.grassColor(model.key, source.temperature, source.downfall);
3717
+ colors2[index] = await Colormaps.grassColor(model.key, source.temperature, source.downfall);
3823
3718
  break;
3824
3719
  case "dye":
3825
3720
  case "minecraft:dye":
3826
- colors[index] = this.colorOrDefault(components["minecraft:dyed_color"], source.default, true);
3721
+ colors2[index] = this.colorOrDefault(components["minecraft:dyed_color"], source.default, true);
3827
3722
  break;
3828
3723
  case "potion":
3829
3724
  case "minecraft:potion": {
3830
- colors[index] = await this.potionColor(components["minecraft:potion_contents"], source.default, model.key?.root);
3725
+ colors2[index] = await this.potionColor(components["minecraft:potion_contents"], source.default, model.key?.root);
3831
3726
  break;
3832
3727
  }
3833
3728
  case "map_color":
3834
3729
  case "minecraft:map_color":
3835
- colors[index] = this.colorOrDefault(components["minecraft:map_color"], source.default);
3730
+ colors2[index] = this.colorOrDefault(components["minecraft:map_color"], source.default);
3836
3731
  break;
3837
3732
  case "firework":
3838
3733
  case "minecraft:firework": {
3839
3734
  const values = this.componentField(components, "firework_explosion", "colors");
3840
3735
  if (values !== void 0 && !Array.isArray(values)) throw new MineRenderError("Item tint firework_explosion.colors must be an array");
3841
3736
  if (!values?.length) {
3842
- colors[index] = this.rgb(source.default);
3737
+ colors2[index] = this.rgb(source.default);
3843
3738
  break;
3844
3739
  }
3845
3740
  const rgb = values.map((value) => this.componentColor(value));
3846
3741
  const red = Math.floor(rgb.reduce((sum, color2) => sum + (color2 >> 16 & 255), 0) / rgb.length);
3847
3742
  const green = Math.floor(rgb.reduce((sum, color2) => sum + (color2 >> 8 & 255), 0) / rgb.length);
3848
3743
  const blue = Math.floor(rgb.reduce((sum, color2) => sum + (color2 & 255), 0) / rgb.length);
3849
- colors[index] = red << 16 | green << 8 | blue;
3744
+ colors2[index] = red << 16 | green << 8 | blue;
3850
3745
  break;
3851
3746
  }
3852
3747
  case "team":
3853
3748
  case "minecraft:team":
3854
- colors[index] = this.rgb(source.default);
3749
+ colors2[index] = this.rgb(source.default);
3855
3750
  break;
3856
3751
  case "custom_model_data":
3857
3752
  case "minecraft:custom_model_data": {
@@ -3859,14 +3754,14 @@ var init_ItemTints = __esm({
3859
3754
  if (!Number.isSafeInteger(colorIndex) || colorIndex < 0) throw new MineRenderError("Item tint custom_model_data index must be a nonnegative integer");
3860
3755
  const values = this.componentField(components, "custom_model_data", "colors");
3861
3756
  if (values !== void 0 && !Array.isArray(values)) throw new MineRenderError("Item tint custom_model_data.colors must be an array");
3862
- colors[index] = this.colorOrDefault(values?.[colorIndex], source.default, true);
3757
+ colors2[index] = this.colorOrDefault(values?.[colorIndex], source.default, true);
3863
3758
  break;
3864
3759
  }
3865
3760
  default:
3866
3761
  throw new MineRenderError(`Unsupported item tint source ${source.type}`);
3867
3762
  }
3868
3763
  }));
3869
- return colors;
3764
+ return colors2;
3870
3765
  }
3871
3766
  /** Whether a potion component contains a known effect, including effects with hidden particles. */
3872
3767
  static async hasPotionEffects(value, root) {
@@ -4438,7 +4333,7 @@ function createPermutation() {
4438
4333
  return values;
4439
4334
  }
4440
4335
  function swampGrassColor(x, z) {
4441
- const p11 = permutation ?? (permutation = createPermutation());
4336
+ const p = permutation ?? (permutation = createPermutation());
4442
4337
  x *= 0.0225;
4443
4338
  z *= 0.0225;
4444
4339
  const s = (x + z) * skew;
@@ -4449,7 +4344,7 @@ function swampGrassColor(x, z) {
4449
4344
  const corner = (gx, gz, a, b) => {
4450
4345
  let falloff = 0.5 - a * a - b * b;
4451
4346
  if (falloff < 0) return 0;
4452
- const gradient = gradients[p11[gx + p11[gz & 255] & 255] % 12];
4347
+ const gradient = gradients[p[gx + p[gz & 255] & 255] % 12];
4453
4348
  falloff *= falloff;
4454
4349
  return falloff * falloff * (gradient[0] * a + gradient[1] * b);
4455
4350
  };
@@ -4527,14 +4422,16 @@ var init_Biomes = __esm({
4527
4422
  });
4528
4423
 
4529
4424
  // src/assets/BlockEntities.ts
4530
- var import_three10, BlockEntities;
4425
+ var import_three9, log10, BlockEntities;
4531
4426
  var init_BlockEntities = __esm({
4532
4427
  "src/assets/BlockEntities.ts"() {
4533
- import_three10 = require("three");
4428
+ import_three9 = require("three");
4534
4429
  init_AssetKey();
4535
4430
  init_AssetLoader();
4536
4431
  init_source();
4537
4432
  init_Caching();
4433
+ init_log();
4434
+ log10 = logger("BlockEntities");
4538
4435
  BlockEntities = class {
4539
4436
  /**
4540
4437
  * Loads the block index of a version. Versions and sources without one yield an empty index, and so does
@@ -4548,7 +4445,7 @@ var init_BlockEntities = __esm({
4548
4445
  try {
4549
4446
  return await AssetLoader.get(key, "json" /* JSON */) ?? {};
4550
4447
  } catch (error) {
4551
- console.warn("Could not load the block entity index; block entities are drawn as plain block models", error);
4448
+ log10.warn("Could not load the block entity index; block entities are drawn as plain block models", error);
4552
4449
  return {};
4553
4450
  }
4554
4451
  });
@@ -4575,8 +4472,8 @@ var init_BlockEntities = __esm({
4575
4472
  return { parts, rotation, translation: entry.translation ?? [0, 0, 0] };
4576
4473
  }
4577
4474
  /** Placement in block space (0..16 per axis), applied on top of the model's own transform. */
4578
- static matrix(resolved, matrix = new import_three10.Matrix4()) {
4579
- return matrix.makeTranslation(8, 0, 8).multiply(new import_three10.Matrix4().makeRotationY(resolved.rotation * Math.PI / 180)).multiply(new import_three10.Matrix4().makeTranslation(resolved.translation[0] - 8, resolved.translation[1], resolved.translation[2] - 8));
4475
+ static matrix(resolved, matrix = new import_three9.Matrix4()) {
4476
+ return matrix.makeTranslation(8, 0, 8).multiply(new import_three9.Matrix4().makeRotationY(resolved.rotation * Math.PI / 180)).multiply(new import_three9.Matrix4().makeTranslation(resolved.translation[0] - 8, resolved.translation[1], resolved.translation[2] - 8));
4580
4477
  }
4581
4478
  };
4582
4479
  }
@@ -4819,7 +4716,7 @@ async function parseUnihex(key) {
4819
4716
  }
4820
4717
  return { indices, rows, metrics };
4821
4718
  } catch (error) {
4822
- console.warn(`Could not load Unihex file ${key.toNamespacedString()}`, error);
4719
+ log11.warn(`Could not load Unihex file ${key.toNamespacedString()}`, error);
4823
4720
  return void 0;
4824
4721
  }
4825
4722
  }
@@ -4838,7 +4735,7 @@ async function loadUnihex(provider, fontKey, characters) {
4838
4735
  return { ...override, from, to };
4839
4736
  });
4840
4737
  } catch (error) {
4841
- console.warn(`Could not load Unihex file ${key.toNamespacedString()}`, error);
4738
+ log11.warn(`Could not load Unihex file ${key.toNamespacedString()}`, error);
4842
4739
  return glyphs;
4843
4740
  }
4844
4741
  const file = await Caching.unihexCache.get(key.serialize(), () => parseUnihex(key));
@@ -4886,7 +4783,7 @@ async function loadUnihex(provider, fontKey, characters) {
4886
4783
  }
4887
4784
  return glyphs;
4888
4785
  }
4889
- var import_zip2, ATLAS_SIZE, GLYPH_HEIGHT, UnihexAtlas, atlases;
4786
+ var import_zip2, log11, ATLAS_SIZE, GLYPH_HEIGHT, UnihexAtlas, atlases;
4890
4787
  var init_Unihex = __esm({
4891
4788
  "src/assets/_fonts/Unihex.ts"() {
4892
4789
  import_zip2 = require("@zip.js/zip.js");
@@ -4896,6 +4793,8 @@ var init_Unihex = __esm({
4896
4793
  init_Caching();
4897
4794
  init_AssetParsers();
4898
4795
  init_CanvasCompat();
4796
+ init_log();
4797
+ log11 = logger("Unihex");
4899
4798
  ATLAS_SIZE = 512;
4900
4799
  GLYPH_HEIGHT = 16;
4901
4800
  UnihexAtlas = class {
@@ -5060,8 +4959,8 @@ var init_Fonts = __esm({
5060
4959
  });
5061
4960
 
5062
4961
  // src/entity/EntityAnimation.ts
5063
- function catmullRom(delta, p0, p1, p22, p32) {
5064
- return 0.5 * (2 * p1 + (p22 - p0) * delta + (2 * p0 - 5 * p1 + 4 * p22 - p32) * delta * delta + (3 * p1 - p0 - 3 * p22 + p32) * delta * delta * delta);
4962
+ function catmullRom(delta, p0, p1, p2, p3) {
4963
+ return 0.5 * (2 * p1 + (p2 - p0) * delta + (2 * p0 - 5 * p1 + 4 * p2 - p3) * delta * delta + (3 * p1 - p0 - 3 * p2 + p3) * delta * delta * delta);
5065
4964
  }
5066
4965
  function sampleEntityKeyframes(keyframes, time) {
5067
4966
  if (keyframes.length === 0) return [0, 0, 0];
@@ -5114,10 +5013,10 @@ function validateAnimationWeights(weights, count) {
5114
5013
  }
5115
5014
  return values;
5116
5015
  }
5117
- var import_three11, ZERO, EntityAnimationPlayer;
5016
+ var import_three10, ZERO, EntityAnimationPlayer;
5118
5017
  var init_EntityAnimationPlayer = __esm({
5119
5018
  "src/entity/scene/EntityAnimationPlayer.ts"() {
5120
- import_three11 = require("three");
5019
+ import_three10 = require("three");
5121
5020
  init_EntityAnimation();
5122
5021
  ZERO = [0, 0, 0];
5123
5022
  EntityAnimationPlayer = class {
@@ -5183,9 +5082,9 @@ var init_EntityAnimationPlayer = __esm({
5183
5082
  position: object4.position.clone(),
5184
5083
  rotation: object4.rotation.clone(),
5185
5084
  scale: object4.scale.clone(),
5186
- basePosition: pose ? new import_three11.Vector3(...pose.offset) : object4.position.clone(),
5187
- baseRotation: pose ? new import_three11.Euler(...pose.rotation, "ZYX") : object4.rotation.clone(),
5188
- baseScale: pose ? new import_three11.Vector3(...pose.scale ?? [1, 1, 1]) : object4.scale.clone()
5085
+ basePosition: pose ? new import_three10.Vector3(...pose.offset) : object4.position.clone(),
5086
+ baseRotation: pose ? new import_three10.Euler(...pose.rotation, "ZYX") : object4.rotation.clone(),
5087
+ baseScale: pose ? new import_three10.Vector3(...pose.scale ?? [1, 1, 1]) : object4.scale.clone()
5189
5088
  });
5190
5089
  }
5191
5090
  }
@@ -5321,14 +5220,35 @@ var init_InstanceReference = __esm({
5321
5220
  }
5322
5221
  });
5323
5222
 
5223
+ // src/util/three.ts
5224
+ function isObject3D(obj) {
5225
+ return obj.isObject3D;
5226
+ }
5227
+ function isMesh(obj) {
5228
+ return obj.isMesh;
5229
+ }
5230
+ function isInstancedMesh(obj) {
5231
+ return obj.isInstancedMesh;
5232
+ }
5233
+ function isPerspectiveCamera(obj) {
5234
+ return obj.isPerspectiveCamera;
5235
+ }
5236
+ function isOrthographicCamera(obj) {
5237
+ return obj.isOrthographicCamera;
5238
+ }
5239
+ var init_three = __esm({
5240
+ "src/util/three.ts"() {
5241
+ }
5242
+ });
5243
+
5324
5244
  // src/renderer/SceneObject.ts
5325
5245
  function isSceneObject(obj) {
5326
5246
  return obj.isSceneObject;
5327
5247
  }
5328
- var import_three12, p7, _SceneObject, SceneObject;
5248
+ var import_three11, _SceneObject, SceneObject;
5329
5249
  var init_SceneObject = __esm({
5330
5250
  "src/renderer/SceneObject.ts"() {
5331
- import_three12 = require("three");
5251
+ import_three11 = require("three");
5332
5252
  init_Geometries();
5333
5253
  init_cubeUv();
5334
5254
  init_Axis();
@@ -5338,9 +5258,7 @@ var init_SceneObject = __esm({
5338
5258
  init_three();
5339
5259
  init_Disposable();
5340
5260
  init_merge();
5341
- init_log();
5342
- p7 = prefix("SceneObject");
5343
- _SceneObject = class _SceneObject extends import_three12.Object3D {
5261
+ _SceneObject = class _SceneObject extends import_three11.Object3D {
5344
5262
  constructor(options) {
5345
5263
  super();
5346
5264
  this.isSceneObject = true;
@@ -5351,7 +5269,6 @@ var init_SceneObject = __esm({
5351
5269
  this.freeInstanceIndices = [];
5352
5270
  this.hiddenInstanceMatrices = /* @__PURE__ */ new Map();
5353
5271
  this.options = (0, import_ts_deepmerge.default)({}, _SceneObject.DEFAULT_OPTIONS, options ?? {});
5354
- console.log("SceneObject options", this.options);
5355
5272
  }
5356
5273
  set scene(scene) {
5357
5274
  if (!!this._scene) throw new MineRenderError("Scene already set");
@@ -5380,13 +5297,12 @@ var init_SceneObject = __esm({
5380
5297
  this.remove(existing);
5381
5298
  }
5382
5299
  }
5383
- console.log("add", group, group.name);
5384
5300
  this.add(group);
5385
5301
  this.notifyDirty();
5386
5302
  return group;
5387
5303
  }
5388
5304
  createGroup(name, x = 0, y = 0, z = 0, offsetAxis, offset = 0) {
5389
- const obj = new import_three12.Object3D();
5305
+ const obj = new import_three11.Object3D();
5390
5306
  if (name) {
5391
5307
  obj.name = `group:${name}`;
5392
5308
  }
@@ -5420,11 +5336,9 @@ var init_SceneObject = __esm({
5420
5336
  if (name) {
5421
5337
  const existing = parent.getObjectByName(mesh.name);
5422
5338
  if (existing) {
5423
- console.log("remove", existing.name, existing);
5424
5339
  parent.remove(existing);
5425
5340
  }
5426
5341
  }
5427
- console.log("add", mesh, mesh.name);
5428
5342
  parent.add(mesh);
5429
5343
  }
5430
5344
  createAndAddMesh(name, group, geometry, material, offsetAxis, offset = 0) {
@@ -5438,7 +5352,7 @@ var init_SceneObject = __esm({
5438
5352
  return mesh;
5439
5353
  }
5440
5354
  createMesh(name, geometry, material, offsetAxis, offset = 0) {
5441
- const mesh = new import_three12.Mesh(geometry, material);
5355
+ const mesh = new import_three11.Mesh(geometry, material);
5442
5356
  if (name) {
5443
5357
  mesh.name = `mesh:${name}`;
5444
5358
  }
@@ -5450,7 +5364,7 @@ var init_SceneObject = __esm({
5450
5364
  return mesh;
5451
5365
  }
5452
5366
  createInstancedMesh(name, geometry, material, count) {
5453
- const mesh = new import_three12.InstancedMesh(geometry, material, count);
5367
+ const mesh = new import_three11.InstancedMesh(geometry, material, count);
5454
5368
  mesh.count = 0;
5455
5369
  this.instanceMesh = mesh;
5456
5370
  this._isInstanced = true;
@@ -5533,11 +5447,11 @@ var init_SceneObject = __esm({
5533
5447
  this._instanceCounter = this.instanceReferences.size;
5534
5448
  mesh.count = Math.max(mesh.count, index + 1);
5535
5449
  if (mesh.instanceColor) {
5536
- mesh.setColorAt(index, new import_three12.Color(16777215));
5450
+ mesh.setColorAt(index, new import_three11.Color(16777215));
5537
5451
  mesh.instanceColor.needsUpdate = true;
5538
5452
  }
5539
5453
  if (this._scene) this._scene.stats.instanceCount++;
5540
- this.setMatrixAt(index, new import_three12.Matrix4());
5454
+ this.setMatrixAt(index, new import_three11.Matrix4());
5541
5455
  return reference;
5542
5456
  }
5543
5457
  /** Returns the live reference for a raycast hit on this object's instance mesh. */
@@ -5551,7 +5465,7 @@ var init_SceneObject = __esm({
5551
5465
  if (!this.instanceReferences.has(index)) return;
5552
5466
  const mesh = this.instanceMesh;
5553
5467
  this.hiddenInstanceMatrices.delete(index);
5554
- this.setMatrixAt(index, new import_three12.Matrix4().makeScale(0, 0, 0));
5468
+ this.setMatrixAt(index, new import_three11.Matrix4().makeScale(0, 0, 0));
5555
5469
  this.instanceReferences.delete(index);
5556
5470
  this.freeInstanceIndices.push(index);
5557
5471
  this._instanceCounter = this.instanceReferences.size;
@@ -5564,7 +5478,7 @@ var init_SceneObject = __esm({
5564
5478
  const grow = (attribute, fill) => {
5565
5479
  const array = new Float32Array(capacity * attribute.itemSize).fill(fill);
5566
5480
  array.set(attribute.array);
5567
- return new import_three12.InstancedBufferAttribute(array, attribute.itemSize, attribute.normalized, attribute.meshPerAttribute).setUsage(attribute.usage);
5481
+ return new import_three11.InstancedBufferAttribute(array, attribute.itemSize, attribute.normalized, attribute.meshPerAttribute).setUsage(attribute.usage);
5568
5482
  };
5569
5483
  const matrix = grow(mesh.instanceMatrix, 0);
5570
5484
  const color2 = mesh.instanceColor ? grow(mesh.instanceColor, 1) : null;
@@ -5581,7 +5495,7 @@ var init_SceneObject = __esm({
5581
5495
  }
5582
5496
  //</editor-fold>
5583
5497
  //<editor-fold desc="TRANSFORMATION">
5584
- getMatrixAt(index, matrix = new import_three12.Matrix4()) {
5498
+ getMatrixAt(index, matrix = new import_three11.Matrix4()) {
5585
5499
  if (!this.instanceReferences.has(index)) throw new MineRenderError("Instance is not active");
5586
5500
  const hidden = this.hiddenInstanceMatrices.get(index);
5587
5501
  if (hidden) {
@@ -5597,7 +5511,7 @@ var init_SceneObject = __esm({
5597
5511
  if (hidden) {
5598
5512
  hidden.copy(matrix);
5599
5513
  }
5600
- mesh.setMatrixAt(index, hidden ? new import_three12.Matrix4().makeScale(0, 0, 0) : matrix);
5514
+ mesh.setMatrixAt(index, hidden ? new import_three11.Matrix4().makeScale(0, 0, 0) : matrix);
5601
5515
  mesh.instanceMatrix.needsUpdate = true;
5602
5516
  mesh.boundingBox = null;
5603
5517
  mesh.boundingSphere = null;
@@ -5625,16 +5539,16 @@ var init_SceneObject = __esm({
5625
5539
  }
5626
5540
  setPositionRotationScaleAt(index, position, rotation, scale) {
5627
5541
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
5628
- const oldPosition = new import_three12.Vector3();
5629
- const oldRotation = new import_three12.Quaternion();
5630
- const oldScale = new import_three12.Vector3();
5631
- const matrix = new import_three12.Matrix4();
5542
+ const oldPosition = new import_three11.Vector3();
5543
+ const oldRotation = new import_three11.Quaternion();
5544
+ const oldScale = new import_three11.Vector3();
5545
+ const matrix = new import_three11.Matrix4();
5632
5546
  if (!scale || !rotation || !position) {
5633
5547
  this.getMatrixAt(index, matrix).decompose(oldPosition, oldRotation, oldScale);
5634
5548
  }
5635
5549
  matrix.compose(
5636
5550
  position ? position : oldPosition,
5637
- rotation ? new import_three12.Quaternion().setFromEuler(rotation) : oldRotation,
5551
+ rotation ? new import_three11.Quaternion().setFromEuler(rotation) : oldRotation,
5638
5552
  scale ? scale : oldScale
5639
5553
  );
5640
5554
  this.setMatrixAt(index, matrix);
@@ -5643,7 +5557,7 @@ var init_SceneObject = __esm({
5643
5557
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
5644
5558
  this.setPositionRotationScaleAt(index, position);
5645
5559
  }
5646
- getPositionAt(index, vector = new import_three12.Vector3()) {
5560
+ getPositionAt(index, vector = new import_three11.Vector3()) {
5647
5561
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
5648
5562
  const matrix = this.getMatrixAt(index);
5649
5563
  vector.setFromMatrixPosition(matrix);
@@ -5653,17 +5567,17 @@ var init_SceneObject = __esm({
5653
5567
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
5654
5568
  this.setPositionRotationScaleAt(index, void 0, rotation, void 0);
5655
5569
  }
5656
- getRotationAt(index, euler = new import_three12.Euler()) {
5570
+ getRotationAt(index, euler = new import_three11.Euler()) {
5657
5571
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
5658
- const rotation = new import_three12.Quaternion();
5659
- this.getMatrixAt(index).decompose(new import_three12.Vector3(), rotation, new import_three12.Vector3());
5572
+ const rotation = new import_three11.Quaternion();
5573
+ this.getMatrixAt(index).decompose(new import_three11.Vector3(), rotation, new import_three11.Vector3());
5660
5574
  return euler.setFromQuaternion(rotation);
5661
5575
  }
5662
5576
  setScaleAt(index, scale) {
5663
5577
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
5664
5578
  this.setPositionRotationScaleAt(index, void 0, void 0, scale);
5665
5579
  }
5666
- getScaleAt(index, vector = new import_three12.Vector3()) {
5580
+ getScaleAt(index, vector = new import_three11.Vector3()) {
5667
5581
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
5668
5582
  const matrix = this.getMatrixAt(index);
5669
5583
  vector.setFromMatrixScale(matrix);
@@ -5802,6 +5716,87 @@ var init_SceneObject = __esm({
5802
5716
  }
5803
5717
  });
5804
5718
 
5719
+ // src/util/model.ts
5720
+ function applyElementRotation(rotation, geometry) {
5721
+ const origin = new import_three13.Vector3(rotation.origin[0], rotation.origin[1], rotation.origin[2]);
5722
+ geometry.translate(-origin.x, -origin.y, -origin.z);
5723
+ switch (rotation.axis) {
5724
+ case "x" /* X */:
5725
+ geometry.rotateX(toRadians(rotation.angle));
5726
+ break;
5727
+ case "y" /* Y */:
5728
+ geometry.rotateY(toRadians(rotation.angle));
5729
+ break;
5730
+ case "z" /* Z */:
5731
+ geometry.rotateZ(toRadians(rotation.angle));
5732
+ break;
5733
+ }
5734
+ if (rotation.rescale) {
5735
+ const angle = toRadians(rotation.angle);
5736
+ const s = 1 / Math.max(Math.abs(Math.cos(angle)), Math.abs(Math.sin(angle)));
5737
+ geometry.scale(
5738
+ rotation.axis === "x" /* X */ ? 1 : s,
5739
+ rotation.axis === "y" /* Y */ ? 1 : s,
5740
+ rotation.axis === "z" /* Z */ ? 1 : s
5741
+ );
5742
+ }
5743
+ geometry.translate(origin.x, origin.y, origin.z);
5744
+ }
5745
+ function applyGenericRotation(axis, rotation, obj) {
5746
+ switch (axis) {
5747
+ case "x" /* X */:
5748
+ obj.rotateOnAxis(new import_three13.Vector3(1, 0, 0), toRadians(rotation));
5749
+ break;
5750
+ case "y" /* Y */:
5751
+ obj.rotateOnAxis(new import_three13.Vector3(0, 1, 0), toRadians(rotation));
5752
+ break;
5753
+ case "z" /* Z */:
5754
+ obj.rotateOnAxis(new import_three13.Vector3(0, 0, 1), toRadians(rotation));
5755
+ break;
5756
+ }
5757
+ }
5758
+ function addBox3WireframeToObject(box, obj, color2 = 16777215, w = 2) {
5759
+ let size = new import_three13.Vector3();
5760
+ box.getSize(size);
5761
+ let boxGeo = new import_three13.BoxGeometry(size.x, size.y, size.z, 1, 1, 1);
5762
+ let wireGeo = new import_three13.EdgesGeometry(boxGeo);
5763
+ let wireMat = new import_three13.LineBasicMaterial({ color: color2, linewidth: w });
5764
+ let wireframe = new import_three13.LineSegments(wireGeo, wireMat);
5765
+ obj.add(wireframe);
5766
+ let axes = new import_three13.AxesHelper(1);
5767
+ obj.add(axes);
5768
+ }
5769
+ function addWireframeToObject(obj, color2 = 16777215, w = 2) {
5770
+ let boxGeo = new import_three13.BoxGeometry(16, 16, 16, 1, 1, 1);
5771
+ let wireGeo = new import_three13.EdgesGeometry(boxGeo);
5772
+ let wireMat = new import_three13.LineBasicMaterial({ color: color2, linewidth: w });
5773
+ let wireframe = new import_three13.LineSegments(wireGeo, wireMat);
5774
+ obj.add(wireframe);
5775
+ let axes = new import_three13.AxesHelper(1);
5776
+ obj.add(axes);
5777
+ }
5778
+ function addWireframeToMesh(geo, mesh, color2 = 16777215, w = 2) {
5779
+ let wireGeo = new import_three13.EdgesGeometry(geo);
5780
+ let wireMat = new import_three13.LineBasicMaterial({ color: color2, linewidth: w });
5781
+ let wireframe = new import_three13.LineSegments(wireGeo, wireMat);
5782
+ mesh.add(wireframe);
5783
+ let axes = new import_three13.AxesHelper(1);
5784
+ mesh.add(axes);
5785
+ return () => {
5786
+ wireGeo.dispose();
5787
+ wireMat.dispose();
5788
+ axes.dispose();
5789
+ };
5790
+ }
5791
+ var import_three13;
5792
+ var init_model = __esm({
5793
+ "src/util/model.ts"() {
5794
+ init_Axis();
5795
+ init_util();
5796
+ import_three13 = require("three");
5797
+ }
5798
+ });
5799
+
5805
5800
  // src/entity/scene/EntityObject.ts
5806
5801
  var EntityObject_exports = {};
5807
5802
  __export(EntityObject_exports, {
@@ -8317,7 +8312,7 @@ function createGuiTextGeometry(layout, shadow = true) {
8317
8312
  }
8318
8313
  }
8319
8314
  }
8320
- return batches.map(({ image, positions, uvs, colors, indices }) => ({ image, geometry: new import_three20.BufferGeometry().setAttribute("position", new import_three20.Float32BufferAttribute(positions, 3)).setAttribute("uv", new import_three20.Float32BufferAttribute(uvs, 2)).setAttribute("color", new import_three20.Float32BufferAttribute(colors, 3)).setIndex(indices) }));
8315
+ return batches.map(({ image, positions, uvs, colors: colors2, indices }) => ({ image, geometry: new import_three20.BufferGeometry().setAttribute("position", new import_three20.Float32BufferAttribute(positions, 3)).setAttribute("uv", new import_three20.Float32BufferAttribute(uvs, 2)).setAttribute("color", new import_three20.Float32BufferAttribute(colors2, 3)).setIndex(indices) }));
8321
8316
  }
8322
8317
  var import_three20;
8323
8318
  var init_GuiText = __esm({
@@ -8993,11 +8988,13 @@ var init_ModelCulling = __esm({
8993
8988
  });
8994
8989
 
8995
8990
  // src/skin/Skins.ts
8996
- var Skins;
8991
+ var log12, Skins;
8997
8992
  var init_Skins = __esm({
8998
8993
  "src/skin/Skins.ts"() {
8999
8994
  init_Requests();
9000
8995
  init_Caching();
8996
+ init_log();
8997
+ log12 = logger("Skins");
9001
8998
  Skins = class {
9002
8999
  //<editor-fold desc="Skins">
9003
9000
  /** Returns a skin URL for {@link MineRenderScene.addSkin}, or `undefined` if name lookup fails. */
@@ -9069,7 +9066,7 @@ var init_Skins = __esm({
9069
9066
  }
9070
9067
  return void 0;
9071
9068
  }).catch((err) => {
9072
- console.warn(err);
9069
+ log12.warn(err);
9073
9070
  return void 0;
9074
9071
  });
9075
9072
  }
@@ -9084,7 +9081,7 @@ var init_Skins = __esm({
9084
9081
  }
9085
9082
  return void 0;
9086
9083
  }).catch((err) => {
9087
- console.warn(err);
9084
+ log12.warn(err);
9088
9085
  return void 0;
9089
9086
  });
9090
9087
  }
@@ -9098,7 +9095,7 @@ var init_Skins = __esm({
9098
9095
  }
9099
9096
  return void 0;
9100
9097
  }).catch((err) => {
9101
- console.warn(err);
9098
+ log12.warn(err);
9102
9099
  return void 0;
9103
9100
  });
9104
9101
  }
@@ -9122,7 +9119,7 @@ var init_Skins = __esm({
9122
9119
  }
9123
9120
  return void 0;
9124
9121
  }).catch((err) => {
9125
- console.warn(err);
9122
+ log12.warn(err);
9126
9123
  return void 0;
9127
9124
  });
9128
9125
  }
@@ -9566,10 +9563,10 @@ var init_SpecialItems = __esm({
9566
9563
  case "minecraft:shield":
9567
9564
  case "shield": {
9568
9565
  const banner = special.type === "banner" || special.type === "minecraft:banner";
9569
- const colors = await BannerPatterns.getColors(root);
9566
+ const colors2 = await BannerPatterns.getColors(root);
9570
9567
  const dye = banner ? special.color : components["minecraft:base_color"];
9571
- if (dye !== void 0 && (typeof dye !== "string" || !Object.prototype.hasOwnProperty.call(colors, dye))) throw new Error(`Unsupported dye color ${dye}`);
9572
- const color2 = dye === void 0 ? void 0 : colors[dye];
9568
+ if (dye !== void 0 && (typeof dye !== "string" || !Object.prototype.hasOwnProperty.call(colors2, dye))) throw new Error(`Unsupported dye color ${dye}`);
9569
+ const color2 = dye === void 0 ? void 0 : colors2[dye];
9573
9570
  const patterns = await BannerPatterns.getLayers(components["minecraft:banner_patterns"], banner ? "banner" : "shield", root);
9574
9571
  const patterned = banner || color2 !== void 0 || patterns.length > 0;
9575
9572
  const baseTexture = texture(banner ? "banner_base" : patterned ? "shield_base" : "shield_base_nopattern", "");
@@ -9594,7 +9591,7 @@ var init_SpecialItems = __esm({
9594
9591
  }
9595
9592
  const tints = {};
9596
9593
  if (patterned) {
9597
- const draws = [{ texture: texture(`${banner ? "banner" : "shield"}/base`, ""), color: color2 ?? colors.white }, ...patterns];
9594
+ const draws = [{ texture: texture(`${banner ? "banner" : "shield"}/base`, ""), color: color2 ?? colors2.white }, ...patterns];
9598
9595
  draws.forEach((draw, index) => {
9599
9596
  const name = index === 0 ? "pattern_base" : `pattern_${index - 1}`;
9600
9597
  layers[name] = { key: draw.texture, texture: draw.texture, layer: overlay2, render: "no_outline", tint: name };
@@ -9924,7 +9921,7 @@ __export(ModelObject_exports, {
9924
9921
  function isModelObject(obj) {
9925
9922
  return obj.isModelObject;
9926
9923
  }
9927
- var import_three27, p8, _ModelObject, ModelObject;
9924
+ var import_three27, log13, _ModelObject, ModelObject;
9928
9925
  var init_ModelObject = __esm({
9929
9926
  "src/model/scene/ModelObject.ts"() {
9930
9927
  init_SceneObject();
@@ -9944,7 +9941,7 @@ var init_ModelObject = __esm({
9944
9941
  init_GuiLight();
9945
9942
  init_ItemTints();
9946
9943
  init_ItemGlint();
9947
- p8 = prefix("ModelObject");
9944
+ log13 = logger("ModelObject");
9948
9945
  _ModelObject = class _ModelObject extends SceneObject {
9949
9946
  constructor(originalModel, options) {
9950
9947
  super(options);
@@ -10095,7 +10092,7 @@ var init_ModelObject = __esm({
10095
10092
  }
10096
10093
  UVMapper.setAtlasUvBounds(elGeo, el.faces, this.atlas);
10097
10094
  if (this.options.tints) {
10098
- const colors = new Float32Array(elGeo.getAttribute("position").count * 3).fill(1);
10095
+ const colors2 = new Float32Array(elGeo.getAttribute("position").count * 3).fill(1);
10099
10096
  for (const [faceIndex, faceName] of CUBE_FACES.entries()) {
10100
10097
  const tintIndex = el.faces[faceName]?.tintindex;
10101
10098
  if (tintIndex === void 0 || tintIndex < 0) continue;
@@ -10103,10 +10100,10 @@ var init_ModelObject = __esm({
10103
10100
  if (tint === void 0) continue;
10104
10101
  const color2 = new import_three27.Color(tint);
10105
10102
  for (let vertex = 0; vertex < 4; vertex++) {
10106
- color2.toArray(colors, (faceIndex * 4 + vertex) * 3);
10103
+ color2.toArray(colors2, (faceIndex * 4 + vertex) * 3);
10107
10104
  }
10108
10105
  }
10109
- elGeo.setAttribute("color", new import_three27.BufferAttribute(colors, 3));
10106
+ elGeo.setAttribute("color", new import_three27.BufferAttribute(colors2, 3));
10110
10107
  }
10111
10108
  elGeo.applyMatrix4(new import_three27.Matrix4().makeTranslation((el.to[0] - el.from[0]) / 2, (el.to[1] - el.from[1]) / 2, (el.to[2] - el.from[2]) / 2));
10112
10109
  elGeo.applyMatrix4(new import_three27.Matrix4().makeTranslation(el.from[0], el.from[1], el.from[2]));
@@ -10126,10 +10123,10 @@ var init_ModelObject = __esm({
10126
10123
  }
10127
10124
  });
10128
10125
  } else {
10129
- console.debug(p8, this.atlas.model, "has no elements");
10126
+ log13.debug(this.atlas.model, "has no elements");
10130
10127
  }
10131
10128
  } else {
10132
- console.debug(p8, "Missing atlas for", this);
10129
+ log13.debug("Missing atlas for", this);
10133
10130
  }
10134
10131
  if (this.options.mergeMeshes) {
10135
10132
  let combinedGeo;
@@ -10903,9 +10900,9 @@ var init_FluidModelObject = __esm({
10903
10900
  }
10904
10901
  geometry.clearGroups();
10905
10902
  const color2 = new import_three33.Color(this.options.tints?.[0] ?? (this.kind === "water" ? 4159204 : 16777215));
10906
- const colors = new Float32Array(geometry.getAttribute("position").count * 3);
10907
- for (let i = 0; i < colors.length; i += 3) color2.toArray(colors, i);
10908
- geometry.setAttribute("color", new import_three33.BufferAttribute(colors, 3));
10903
+ const colors2 = new Float32Array(geometry.getAttribute("position").count * 3);
10904
+ for (let i = 0; i < colors2.length; i += 3) color2.toArray(colors2, i);
10905
+ geometry.setAttribute("color", new import_three33.BufferAttribute(colors2, 3));
10909
10906
  geometry.computeBoundingBox();
10910
10907
  geometry.computeBoundingSphere();
10911
10908
  if (this.options.instanceMeshes) {
@@ -10942,7 +10939,7 @@ __export(BlockObject_exports, {
10942
10939
  function isBlockObject(obj) {
10943
10940
  return obj.isBlockObject;
10944
10941
  }
10945
- var import_three34, _BlockObject, BlockObject;
10942
+ var import_three34, log16, _BlockObject, BlockObject;
10946
10943
  var init_BlockObject = __esm({
10947
10944
  "src/model/block/scene/BlockObject.ts"() {
10948
10945
  init_SceneObject();
@@ -10961,6 +10958,8 @@ var init_BlockObject = __esm({
10961
10958
  init_BlockEntities();
10962
10959
  init_Entities();
10963
10960
  init_Biomes();
10961
+ init_log();
10962
+ log16 = logger("BlockObject");
10964
10963
  _BlockObject = class _BlockObject extends SceneObject {
10965
10964
  constructor(blockState3, options) {
10966
10965
  super(options);
@@ -11065,7 +11064,7 @@ var init_BlockObject = __esm({
11065
11064
  created.push(await this.scene.addEntity(entity, { wireframe: this.options.wireframe }));
11066
11065
  }
11067
11066
  } catch (error) {
11068
- console.warn(`Could not draw block entity ${key.toNamespacedString()}, using its block model`, error);
11067
+ log16.warn(`Could not draw block entity ${key.toNamespacedString()}, using its block model`, error);
11069
11068
  this.removeEntities(created);
11070
11069
  return false;
11071
11070
  }
@@ -11440,6 +11439,7 @@ __export(index_browser_exports, {
11440
11439
  ItemGlint: () => ItemGlint,
11441
11440
  ItemTints: () => ItemTints,
11442
11441
  LitematicaParser: () => LitematicaParser,
11442
+ Logging: () => Logging,
11443
11443
  MapControls: () => MapControls,
11444
11444
  Materials: () => Materials,
11445
11445
  Meshes: () => Meshes,
@@ -11551,6 +11551,7 @@ __export(index_browser_exports, {
11551
11551
  isTripleArray: () => isTripleArray,
11552
11552
  isVector3: () => isVector3,
11553
11553
  layoutGuiText: () => layoutGuiText,
11554
+ logger: () => logger,
11554
11555
  md5: () => md5,
11555
11556
  mergeBufferAttributes: () => mergeBufferAttributes,
11556
11557
  mergeBufferGeometries: () => mergeBufferGeometries,
@@ -11596,7 +11597,7 @@ init_Env();
11596
11597
  // src/env/browser/BrowserCache.ts
11597
11598
  init_PersistentCache();
11598
11599
  init_log();
11599
- var p = prefix("BrowserCache");
11600
+ var log = logger("BrowserCache");
11600
11601
  var BrowserCache = class extends PersistentCache {
11601
11602
  constructor(backing) {
11602
11603
  super(backing);
@@ -11607,7 +11608,7 @@ var BrowserCache = class extends PersistentCache {
11607
11608
  return true;
11608
11609
  } catch (error) {
11609
11610
  this.memory = /* @__PURE__ */ new Map();
11610
- console.warn(p, "Could not open browser storage; using an in-memory store", error);
11611
+ log.warn("Could not open browser storage; using an in-memory store", error);
11611
11612
  return false;
11612
11613
  }
11613
11614
  }
@@ -12016,15 +12017,15 @@ var OBJExporter = class {
12016
12017
  let nbVertex = 0;
12017
12018
  const geometry = points.geometry;
12018
12019
  const vertices = geometry.getAttribute("position");
12019
- const colors = geometry.getAttribute("color");
12020
+ const colors2 = geometry.getAttribute("color");
12020
12021
  output += "o " + points.name + "\n";
12021
12022
  if (vertices !== void 0) {
12022
12023
  for (let i = 0, l = vertices.count; i < l; i++, nbVertex++) {
12023
12024
  vertex.fromBufferAttribute(vertices, i);
12024
12025
  vertex.applyMatrix4(points.matrixWorld);
12025
12026
  output += "v " + vertex.x + " " + vertex.y + " " + vertex.z;
12026
- if (colors !== void 0) {
12027
- color2.fromBufferAttribute(colors, i);
12027
+ if (colors2 !== void 0) {
12028
+ color2.fromBufferAttribute(colors2, i);
12028
12029
  import_three16.ColorManagement.workingToColorSpace(color2, import_three16.SRGBColorSpace);
12029
12030
  output += " " + color2.r + " " + color2.g + " " + color2.b;
12030
12031
  }
@@ -12108,7 +12109,7 @@ var PLYExporter = class {
12108
12109
  const vertices = geometry.getAttribute("position");
12109
12110
  const normals = geometry.getAttribute("normal");
12110
12111
  const uvs = geometry.getAttribute("uv");
12111
- const colors = geometry.getAttribute("color");
12112
+ const colors2 = geometry.getAttribute("color");
12112
12113
  const indices = geometry.getIndex();
12113
12114
  if (vertices === void 0) {
12114
12115
  return;
@@ -12124,9 +12125,9 @@ var PLYExporter = class {
12124
12125
  includeUVs = true;
12125
12126
  uvType = getPlyType(uvs.array);
12126
12127
  }
12127
- if (colors !== void 0) {
12128
+ if (colors2 !== void 0) {
12128
12129
  includeColors = true;
12129
- colorType = getPlyType(colors.array);
12130
+ colorType = getPlyType(colors2.array);
12130
12131
  }
12131
12132
  for (const name of customAttributeNames) {
12132
12133
  const attr = geometry.getAttribute(name);
@@ -12137,16 +12138,16 @@ var PLYExporter = class {
12137
12138
  const geometry = mesh.geometry;
12138
12139
  const vertices = geometry.getAttribute("position");
12139
12140
  const normals = geometry.getAttribute("normal");
12140
- const colors = geometry.getAttribute("color");
12141
+ const colors2 = geometry.getAttribute("color");
12141
12142
  vertexCount += vertices.count;
12142
12143
  positionType = getPlyType(vertices.array);
12143
12144
  if (normals !== void 0) {
12144
12145
  includeNormals = true;
12145
12146
  normalType = getPlyType(normals.array);
12146
12147
  }
12147
- if (colors !== void 0) {
12148
+ if (colors2 !== void 0) {
12148
12149
  includeColors = true;
12149
- colorType = getPlyType(colors.array);
12150
+ colorType = getPlyType(colors2.array);
12150
12151
  }
12151
12152
  for (const name of customAttributeNames) {
12152
12153
  const attr = geometry.getAttribute(name);
@@ -12236,7 +12237,7 @@ property list uchar int vertex_index
12236
12237
  const vertices = geometry.getAttribute("position");
12237
12238
  const normals = geometry.getAttribute("normal");
12238
12239
  const uvs = geometry.getAttribute("uv");
12239
- const colors = geometry.getAttribute("color");
12240
+ const colors2 = geometry.getAttribute("color");
12240
12241
  const indices = geometry.getIndex();
12241
12242
  normalMatrixWorld.getNormalMatrix(mesh.matrixWorld);
12242
12243
  for (let i = 0, l = vertices.count; i < l; i++) {
@@ -12281,8 +12282,8 @@ property list uchar int vertex_index
12281
12282
  }
12282
12283
  }
12283
12284
  if (includeColors === true) {
12284
- if (colors != null) {
12285
- tempColor.fromBufferAttribute(colors, i);
12285
+ if (colors2 != null) {
12286
+ tempColor.fromBufferAttribute(colors2, i);
12286
12287
  import_three17.ColorManagement.workingToColorSpace(tempColor, import_three17.SRGBColorSpace);
12287
12288
  const r = colorIsFloat ? tempColor.r : Math.round(tempColor.r * colorScale);
12288
12289
  const g = colorIsFloat ? tempColor.g : Math.round(tempColor.g * colorScale);
@@ -12359,7 +12360,7 @@ property list uchar int vertex_index
12359
12360
  const vertices = geometry.getAttribute("position");
12360
12361
  const normals = geometry.getAttribute("normal");
12361
12362
  const uvs = geometry.getAttribute("uv");
12362
- const colors = geometry.getAttribute("color");
12363
+ const colors2 = geometry.getAttribute("color");
12363
12364
  const indices = geometry.getIndex();
12364
12365
  normalMatrixWorld.getNormalMatrix(mesh.matrixWorld);
12365
12366
  for (let i = 0, l = vertices.count; i < l; i++) {
@@ -12383,8 +12384,8 @@ property list uchar int vertex_index
12383
12384
  }
12384
12385
  }
12385
12386
  if (includeColors === true) {
12386
- if (colors != null) {
12387
- tempColor.fromBufferAttribute(colors, i);
12387
+ if (colors2 != null) {
12388
+ tempColor.fromBufferAttribute(colors2, i);
12388
12389
  import_three17.ColorManagement.workingToColorSpace(tempColor, import_three17.SRGBColorSpace);
12389
12390
  const r = colorIsFloat ? tempColor.r : Math.round(tempColor.r * colorScale);
12390
12391
  const g = colorIsFloat ? tempColor.g : Math.round(tempColor.g * colorScale);
@@ -12626,11 +12627,11 @@ function createSnapshot(root, gltf, bakeColors = false) {
12626
12627
  if (instanceColor) tint.multiply(instanceColor);
12627
12628
  if (bakeColors) {
12628
12629
  const original = geometry.getAttribute("color");
12629
- const colors = new import_three19.Float32BufferAttribute(new Float32Array(geometry.getAttribute("position").count * 3), 3);
12630
- for (let i = 0; i < colors.count; i++) {
12631
- colors.setXYZ(i, (original?.getX(i) ?? 1) * tint.r, (original?.getY(i) ?? 1) * tint.g, (original?.getZ(i) ?? 1) * tint.b);
12630
+ const colors2 = new import_three19.Float32BufferAttribute(new Float32Array(geometry.getAttribute("position").count * 3), 3);
12631
+ for (let i = 0; i < colors2.count; i++) {
12632
+ colors2.setXYZ(i, (original?.getX(i) ?? 1) * tint.r, (original?.getY(i) ?? 1) * tint.g, (original?.getZ(i) ?? 1) * tint.b);
12632
12633
  }
12633
- geometry.setAttribute("color", colors);
12634
+ geometry.setAttribute("color", colors2);
12634
12635
  } else if (material.color) {
12635
12636
  material.color.copy(tint);
12636
12637
  }
@@ -12679,8 +12680,8 @@ function selectAlphaMode(material, geometry) {
12679
12680
  const texture = material.map;
12680
12681
  if (material.type !== "MeshBasicMaterial" || !material.transparent || !material.depthWrite || material.opacity !== 1 || material.alphaMap || !texture?.isDataTexture || texture.format !== import_three19.RGBAFormat || texture.type !== import_three19.UnsignedByteType || texture.wrapS !== import_three19.ClampToEdgeWrapping || texture.wrapT !== import_three19.ClampToEdgeWrapping || texture.magFilter !== import_three19.NearestFilter || texture.minFilter !== import_three19.NearestFilter || texture.anisotropy > 1 || texture.offset.x !== 0 || texture.offset.y !== 0 || texture.repeat.x !== 1 || texture.repeat.y !== 1 || texture.rotation !== 0 || !texture.matrixAutoUpdate && !texture.matrix.elements.every((value, i) => value === (i % 4 === 0 ? 1 : 0))) return;
12681
12682
  const uv = geometry.getAttribute(texture.channel === 0 ? "uv" : `uv${texture.channel}`);
12682
- const colors = geometry.getAttribute("color");
12683
- if (!uv || material.vertexColors && colors?.itemSize === 4) return;
12683
+ const colors2 = geometry.getAttribute("color");
12684
+ if (!uv || material.vertexColors && colors2?.itemSize === 4) return;
12684
12685
  const { data, width, height } = texture.image;
12685
12686
  if (!data || width < 1 || height < 1 || data.length < width * height * 4) return;
12686
12687
  const count = geometry.index?.count ?? uv.count;
@@ -13089,7 +13090,7 @@ init_SceneObject();
13089
13090
  init_util();
13090
13091
  init_log();
13091
13092
  init_three();
13092
- var p9 = prefix("SceneInspector");
13093
+ var log14 = logger("SceneInspector");
13093
13094
  var help = "<span>Ctrl/Cmd+Click to Select<br/></span><br/>";
13094
13095
  var SceneInspector = class {
13095
13096
  constructor(renderer) {
@@ -13183,7 +13184,7 @@ var SceneInspector = class {
13183
13184
  }
13184
13185
  selectObject(targetObject, targetIntersection, instance = this.getIntersectionInstance(targetIntersection)) {
13185
13186
  this.selectedObject = targetObject;
13186
- console.log(p9, "selected", targetObject);
13187
+ log14.debug("selected", targetObject);
13187
13188
  this.redraw(targetObject, targetIntersection, instance);
13188
13189
  }
13189
13190
  redraw(targetObject, targetIntersection, instance) {
@@ -13443,7 +13444,7 @@ var SceneStatsDisplay = class {
13443
13444
 
13444
13445
  // src/instance/InstanceManager.ts
13445
13446
  init_log();
13446
- var p10 = prefix("InstanceManager");
13447
+ var log15 = logger("InstanceManager");
13447
13448
  var InstanceManager = class {
13448
13449
  constructor() {
13449
13450
  this.isInstanceManager = true;
@@ -13452,7 +13453,7 @@ var InstanceManager = class {
13452
13453
  /** Allocates a new placement of a cached model, or returns `undefined` if the key is unknown. */
13453
13454
  async get(key) {
13454
13455
  if (key in this.instanceCache) {
13455
- console.debug(p10, "key in cache", key);
13456
+ log15.debug("key in cache", key);
13456
13457
  return (await this.instanceCache[key]).nextInstance();
13457
13458
  }
13458
13459
  return void 0;
@@ -13462,7 +13463,7 @@ var InstanceManager = class {
13462
13463
  if (key in this.instanceCache) {
13463
13464
  return await this.get(key);
13464
13465
  }
13465
- console.debug(p10, "key not in cache", key);
13466
+ log15.debug("key not in cache", key);
13466
13467
  const pending = Promise.resolve().then(supplier).then((obj) => obj.nextInstance());
13467
13468
  this.instanceCache[key] = pending;
13468
13469
  try {
@@ -16064,6 +16065,8 @@ var MapControls = class extends OrbitControls {
16064
16065
  };
16065
16066
 
16066
16067
  // src/renderer/Renderer.ts
16068
+ init_log();
16069
+ var log17 = logger("Renderer");
16067
16070
  var _Renderer = class _Renderer {
16068
16071
  constructor(options, surface) {
16069
16072
  this._width = 0;
@@ -16308,10 +16311,10 @@ var _Renderer = class _Renderer {
16308
16311
  this._element = element;
16309
16312
  this._element.appendChild(this.renderer.domElement);
16310
16313
  if (this.viewWidth == 0) {
16311
- console.warn("0 element width");
16314
+ log17.warn("0 element width");
16312
16315
  }
16313
16316
  if (this.viewHeight == 0) {
16314
- console.warn("0 element height");
16317
+ log17.warn("0 element height");
16315
16318
  }
16316
16319
  this.resize(this.viewWidth, this.viewHeight);
16317
16320
  }
@@ -17165,8 +17168,62 @@ init_Textures();
17165
17168
  // src/three/index.ts
17166
17169
  init_BufferGeometryUtils();
17167
17170
 
17168
- // src/index.ts
17169
- init_util2();
17171
+ // src/util/BatchedExecutor.ts
17172
+ var import_jobqu2 = require("jobqu");
17173
+ var BatchedExecutor = class {
17174
+ /**
17175
+ * @param interval - Delay between queue runs, in milliseconds.
17176
+ * @param batch - Maximum tasks started per run and maximum tasks active at once.
17177
+ */
17178
+ constructor(interval = 1, batch = 30) {
17179
+ if (!Number.isFinite(interval) || interval < 0) throw new RangeError("Batch interval must be finite and nonnegative");
17180
+ if (!Number.isInteger(batch) || batch < 1) throw new RangeError("Batch size must be a positive integer");
17181
+ this.interval = interval;
17182
+ this.batch = batch;
17183
+ this.queue = new import_jobqu2.JobQueue(async (task) => task(), { interval, maxPerRun: batch, maxActive: batch });
17184
+ }
17185
+ /** Queues a task and resolves with its result, or rejects with its error. */
17186
+ submit(task) {
17187
+ return this.queue.add(() => task());
17188
+ }
17189
+ /** Rejects queued and future tasks. Tasks already running are allowed to finish. */
17190
+ stop() {
17191
+ this.queue.end();
17192
+ }
17193
+ };
17194
+
17195
+ // src/util/index.ts
17196
+ init_log();
17197
+ init_model();
17198
+
17199
+ // src/util/performance.ts
17200
+ function captureException(e, ...extra) {
17201
+ console.error(e, extra);
17202
+ }
17203
+ function timingStart(marker) {
17204
+ console.time(marker);
17205
+ }
17206
+ function timingEnd(marker) {
17207
+ console.timeEnd(marker);
17208
+ }
17209
+
17210
+ // src/util/sha.ts
17211
+ var import_sha1 = __toESM(require("crypto-js/sha1.js"));
17212
+ var import_sha256 = __toESM(require("crypto-js/sha256.js"));
17213
+ var import_sha512 = __toESM(require("crypto-js/sha512.js"));
17214
+ function sha1(str) {
17215
+ return (0, import_sha1.default)(str).toString();
17216
+ }
17217
+ function sha256(str) {
17218
+ return (0, import_sha256.default)(str).toString();
17219
+ }
17220
+ function sha512(str) {
17221
+ return (0, import_sha512.default)(str).toString();
17222
+ }
17223
+
17224
+ // src/util/index.ts
17225
+ init_three();
17226
+ init_util();
17170
17227
 
17171
17228
  // src/world/AnvilParser.ts
17172
17229
  init_MineRenderError();
@@ -18256,6 +18313,8 @@ function hitNormal(hit) {
18256
18313
  }
18257
18314
 
18258
18315
  // src/world/_entities/WorldEntities.ts
18316
+ init_log();
18317
+ var log18 = logger("WorldEntities");
18259
18318
  var WorldEntities = class {
18260
18319
  constructor(scene) {
18261
18320
  this.scene = scene;
@@ -18324,7 +18383,7 @@ var WorldEntities = class {
18324
18383
  placement.owner.set(object4, { type: key.toNamespacedString(), position: placement.position });
18325
18384
  this.scene.add(object4);
18326
18385
  } catch (error) {
18327
- console.warn(`Could not draw saved entity ${placement.key.toNamespacedString()}, skipping it`, error);
18386
+ log18.warn(`Could not draw saved entity ${placement.key.toNamespacedString()}, skipping it`, error);
18328
18387
  } finally {
18329
18388
  if (object4 && !placement.owner.has(object4)) object4.dispose();
18330
18389
  }
@@ -18401,14 +18460,14 @@ var BiomeBlend = class {
18401
18460
  this.tiles.set(key, tile);
18402
18461
  } else {
18403
18462
  const snapshot = new AssetKey("minecraft", "", void 0, void 0, "assets", ".json", root);
18404
- const colors = this.buildTile(kind, snapshot, tileX, quartY, tileZ, this._radius).then((result2) => {
18405
- if (!result2.complete && this.tiles.get(key)?.colors === colors) this.tiles.delete(key);
18463
+ const colors2 = this.buildTile(kind, snapshot, tileX, quartY, tileZ, this._radius).then((result2) => {
18464
+ if (!result2.complete && this.tiles.get(key)?.colors === colors2) this.tiles.delete(key);
18406
18465
  return result2;
18407
18466
  }, (error) => {
18408
- if (this.tiles.get(key)?.colors === colors) this.tiles.delete(key);
18467
+ if (this.tiles.get(key)?.colors === colors2) this.tiles.delete(key);
18409
18468
  throw error;
18410
18469
  });
18411
- tile = { x: tileX, z: tileZ, colors };
18470
+ tile = { x: tileX, z: tileZ, colors: colors2 };
18412
18471
  this.tiles.set(key, tile);
18413
18472
  if (this.tiles.size > MAX_TILES) this.tiles.delete(this.tiles.keys().next().value);
18414
18473
  }
@@ -18466,7 +18525,7 @@ var BiomeBlend = class {
18466
18525
  }
18467
18526
  }
18468
18527
  }
18469
- const colors = new Int32Array(256).fill(-1), width = radius * 2 + 1;
18528
+ const colors2 = new Int32Array(256).fill(-1), width = radius * 2 + 1;
18470
18529
  for (let z = 0; z < 16; z++) {
18471
18530
  for (let x = 0; x < 16; x++) {
18472
18531
  if (samples[(z + radius) * size + x + radius] === -1) continue;
@@ -18474,10 +18533,10 @@ var BiomeBlend = class {
18474
18533
  const bottomLeft = (z + width) * stride + x, bottomRight = bottomLeft + width;
18475
18534
  const sum = (values) => values[bottomRight] - values[bottomLeft] - values[topRight] + values[topLeft];
18476
18535
  const count = sum(sums[3]);
18477
- if (count) colors[z * 16 + x] = Math.floor(sum(sums[0]) / count) << 16 | Math.floor(sum(sums[1]) / count) << 8 | Math.floor(sum(sums[2]) / count);
18536
+ if (count) colors2[z * 16 + x] = Math.floor(sum(sums[0]) / count) << 16 | Math.floor(sum(sums[1]) / count) << 8 | Math.floor(sum(sums[2]) / count);
18478
18537
  }
18479
18538
  }
18480
- return { colors, complete, failures };
18539
+ return { colors: colors2, complete, failures };
18481
18540
  }
18482
18541
  };
18483
18542
 
@@ -18536,6 +18595,8 @@ function skipsBlockFace(data, rule, block, neighbor, face) {
18536
18595
  }
18537
18596
 
18538
18597
  // src/world/MineRenderWorld.ts
18598
+ init_log();
18599
+ var log19 = logger("MineRenderWorld");
18539
18600
  var MineRenderWorld = class {
18540
18601
  constructor(scene, options = {}) {
18541
18602
  this._chunks = /* @__PURE__ */ new Map();
@@ -18891,7 +18952,7 @@ var MineRenderWorld = class {
18891
18952
  } finally {
18892
18953
  this.markBiomesChanged(chunk.x, chunk.z, void 0, false);
18893
18954
  const failures = await this.refreshBiomes();
18894
- if (failures.size) console.warn("Failed to refresh biome colors", failures.values().next().value);
18955
+ if (failures.size) log19.warn("Failed to refresh biome colors", failures.values().next().value);
18895
18956
  await this.updateCulling([...changes.values()]);
18896
18957
  }
18897
18958
  }
@@ -18909,7 +18970,7 @@ var MineRenderWorld = class {
18909
18970
  await this.clearChunkColumn(x, z);
18910
18971
  } finally {
18911
18972
  const failures = await this.refreshBiomes();
18912
- if (failures.size) console.warn("Failed to refresh biome colors", failures.values().next().value);
18973
+ if (failures.size) log19.warn("Failed to refresh biome colors", failures.values().next().value);
18913
18974
  await this.updateCulling([]);
18914
18975
  }
18915
18976
  }
@@ -19334,7 +19395,7 @@ function buildSectionGeometry(input) {
19334
19395
  }
19335
19396
  }
19336
19397
  const positions = new Float32Array(faces * 12), normals = new Float32Array(faces * 12);
19337
- const uvs = new Float32Array(faces * 8), uvBounds = new Float32Array(faces * 16), colors = new Float32Array(faces * 12);
19398
+ const uvs = new Float32Array(faces * 8), uvBounds = new Float32Array(faces * 16), colors2 = new Float32Array(faces * 12);
19338
19399
  const shade = new Float32Array(faces * 4).fill(1);
19339
19400
  const outputIndices = new Uint32Array(faces * 6);
19340
19401
  const blockIndices = new Uint16Array(faces);
@@ -19373,9 +19434,9 @@ function buildSectionGeometry(input) {
19373
19434
  uvBounds[vertex * 4 + 2] = mapU(template.uvBounds[source * 4 + 2]);
19374
19435
  uvBounds[vertex * 4 + 3] = mapV(template.uvBounds[source * 4 + 3]);
19375
19436
  const factor = brightness * (ambientMask ? cornerBrightness2[corner] : 1);
19376
- colors[vertex * 3] = (tint === void 0 ? template.colors[source * 3] : biomeTints[tint]) * factor;
19377
- colors[vertex * 3 + 1] = (tint === void 0 ? template.colors[source * 3 + 1] : biomeTints[tint + 1]) * factor;
19378
- colors[vertex * 3 + 2] = (tint === void 0 ? template.colors[source * 3 + 2] : biomeTints[tint + 2]) * factor;
19437
+ colors2[vertex * 3] = (tint === void 0 ? template.colors[source * 3] : biomeTints[tint]) * factor;
19438
+ colors2[vertex * 3 + 1] = (tint === void 0 ? template.colors[source * 3 + 1] : biomeTints[tint + 1]) * factor;
19439
+ colors2[vertex * 3 + 2] = (tint === void 0 ? template.colors[source * 3 + 2] : biomeTints[tint + 2]) * factor;
19379
19440
  }
19380
19441
  for (let corner = 0; corner < 6; corner++) outputIndices[indexOffset++] = start + template.indices[quad * 6 + corner];
19381
19442
  }
@@ -19410,15 +19471,15 @@ function buildSectionGeometry(input) {
19410
19471
  mapU((rect[0] + rect[2]) / atlas.width),
19411
19472
  mapV(1 - rect[1] / atlas.height)
19412
19473
  ], vertex * 4);
19413
- colors[vertex * 3] = tint[0] * brightness;
19414
- colors[vertex * 3 + 1] = tint[1] * brightness;
19415
- colors[vertex * 3 + 2] = tint[2] * brightness;
19474
+ colors2[vertex * 3] = tint[0] * brightness;
19475
+ colors2[vertex * 3 + 1] = tint[1] * brightness;
19476
+ colors2[vertex * 3 + 2] = tint[2] * brightness;
19416
19477
  }
19417
19478
  outputIndices.set([start, start + 1, start + 2, start, start + 2, start + 3], indexOffset);
19418
19479
  indexOffset += 6;
19419
19480
  }
19420
19481
  }
19421
- return { layer: page.layer, width: page.width, height: page.height, placements: page.placements, positions, normals, uvs, uvBounds, colors, shade, indices: outputIndices, blockIndices };
19482
+ return { layer: page.layer, width: page.width, height: page.height, placements: page.placements, positions, normals, uvs, uvBounds, colors: colors2, shade, indices: outputIndices, blockIndices };
19422
19483
  });
19423
19484
  }
19424
19485
  function sectionGeometryTransferables(pages) {