minerender 2.1.0-alpha.144 → 2.1.0-alpha.145

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.js CHANGED
@@ -1896,40 +1896,6 @@ var MineRender = (() => {
1896
1896
  }
1897
1897
  });
1898
1898
 
1899
- // src/cache/PersistentCache.ts
1900
- var _PersistentCache, PersistentCache;
1901
- var init_PersistentCache = __esm({
1902
- "src/cache/PersistentCache.ts"() {
1903
- init_dirname();
1904
- init_buffer2();
1905
- init_process2();
1906
- init_Env();
1907
- _PersistentCache = class _PersistentCache {
1908
- constructor(backing) {
1909
- this.backing = backing;
1910
- }
1911
- /** Opens a named store in the active environment using the current cache schema version. */
1912
- static open(name2) {
1913
- return Env.provider.openCache(name2, _PersistentCache.VERSION);
1914
- }
1915
- /** Loads a missing entry and stores only non-nullish results. */
1916
- async getOrLoad(key, loader) {
1917
- let v5 = await this.get(key);
1918
- if (typeof v5 === "undefined" || v5 === null) {
1919
- v5 = await loader(key);
1920
- if (typeof v5 !== "undefined" && v5 !== null) {
1921
- await this.put(key, v5);
1922
- }
1923
- }
1924
- return v5;
1925
- }
1926
- };
1927
- /** Bump to invalidate every persisted entry. */
1928
- _PersistentCache.VERSION = 2;
1929
- PersistentCache = _PersistentCache;
1930
- }
1931
- });
1932
-
1933
1899
  // src/util/log.ts
1934
1900
  function readSwitch() {
1935
1901
  switchRead = true;
@@ -2014,6 +1980,40 @@ var MineRender = (() => {
2014
1980
  }
2015
1981
  });
2016
1982
 
1983
+ // src/cache/PersistentCache.ts
1984
+ var _PersistentCache, PersistentCache;
1985
+ var init_PersistentCache = __esm({
1986
+ "src/cache/PersistentCache.ts"() {
1987
+ init_dirname();
1988
+ init_buffer2();
1989
+ init_process2();
1990
+ init_Env();
1991
+ _PersistentCache = class _PersistentCache {
1992
+ constructor(backing) {
1993
+ this.backing = backing;
1994
+ }
1995
+ /** Opens a named store in the active environment using the current cache schema version. */
1996
+ static open(name2) {
1997
+ return Env.provider.openCache(name2, _PersistentCache.VERSION);
1998
+ }
1999
+ /** Loads a missing entry and stores only non-nullish results. */
2000
+ async getOrLoad(key, loader) {
2001
+ let v5 = await this.get(key);
2002
+ if (typeof v5 === "undefined" || v5 === null) {
2003
+ v5 = await loader(key);
2004
+ if (typeof v5 !== "undefined" && v5 !== null) {
2005
+ await this.put(key, v5);
2006
+ }
2007
+ }
2008
+ return v5;
2009
+ }
2010
+ };
2011
+ /** Bump to invalidate every persisted entry. */
2012
+ _PersistentCache.VERSION = 2;
2013
+ PersistentCache = _PersistentCache;
2014
+ }
2015
+ });
2016
+
2017
2017
  // ../../node_modules/localforage/dist/localforage.js
2018
2018
  var require_localforage = __commonJS({
2019
2019
  "../../node_modules/localforage/dist/localforage.js"(exports13, module2) {
@@ -4180,7 +4180,7 @@ var MineRender = (() => {
4180
4180
  canvas.style.display = "block";
4181
4181
  return canvas;
4182
4182
  }
4183
- function log2(...params) {
4183
+ function log3(...params) {
4184
4184
  const message = "THREE." + params.shift();
4185
4185
  if (_setConsoleFunction) {
4186
4186
  _setConsoleFunction("log", message, ...params);
@@ -15870,7 +15870,7 @@ var MineRender = (() => {
15870
15870
  */
15871
15871
  clone(data) {
15872
15872
  if (data === void 0) {
15873
- log2("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");
15873
+ log3("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");
15874
15874
  const array = [];
15875
15875
  for (let i4 = 0; i4 < this.count; i4++) {
15876
15876
  const index = i4 * this.data.stride + this.offset;
@@ -15899,7 +15899,7 @@ var MineRender = (() => {
15899
15899
  */
15900
15900
  toJSON(data) {
15901
15901
  if (data === void 0) {
15902
- log2("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");
15902
+ log3("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");
15903
15903
  const array = [];
15904
15904
  for (let i4 = 0; i4 < this.count; i4++) {
15905
15905
  const index = i4 * this.data.stride + this.offset;
@@ -31890,11 +31890,11 @@ void main() {
31890
31890
  };
31891
31891
  function onContextLost(event) {
31892
31892
  event.preventDefault();
31893
- log2("WebGLRenderer: Context Lost.");
31893
+ log3("WebGLRenderer: Context Lost.");
31894
31894
  _isContextLost = true;
31895
31895
  }
31896
31896
  function onContextRestore() {
31897
- log2("WebGLRenderer: Context Restored.");
31897
+ log3("WebGLRenderer: Context Restored.");
31898
31898
  _isContextLost = false;
31899
31899
  const infoAutoReset = info.autoReset;
31900
31900
  const shadowMapEnabled = shadowMap.enabled;
@@ -36232,7 +36232,7 @@ void main() {
36232
36232
  signal.removeEventListener("abort", abort2);
36233
36233
  }
36234
36234
  }
36235
- var import_jobqu, log3, RequestError, RequestQueue, Requests;
36235
+ var import_jobqu, log4, RequestError, RequestQueue, Requests;
36236
36236
  var init_Requests = __esm({
36237
36237
  "src/request/Requests.ts"() {
36238
36238
  init_dirname();
@@ -36240,7 +36240,7 @@ void main() {
36240
36240
  init_process2();
36241
36241
  import_jobqu = __toESM(require_src());
36242
36242
  init_log();
36243
- log3 = logger("Requests");
36243
+ log4 = logger("Requests");
36244
36244
  RequestError = class extends Error {
36245
36245
  constructor(message, response, cause) {
36246
36246
  super(message);
@@ -36267,7 +36267,7 @@ void main() {
36267
36267
  try {
36268
36268
  return await abortable(this.queue.add(request), signal);
36269
36269
  } catch (error2) {
36270
- log3.debug("Request failed", error2);
36270
+ log4.debug("Request failed", error2);
36271
36271
  const delay = this.retryDelay(error2, request, retries);
36272
36272
  if (delay === void 0) {
36273
36273
  throw error2;
@@ -36455,7 +36455,7 @@ void main() {
36455
36455
  });
36456
36456
 
36457
36457
  // src/image/ImageLoader.ts
36458
- var log4, ImageLoader2;
36458
+ var log5, ImageLoader2;
36459
36459
  var init_ImageLoader = __esm({
36460
36460
  "src/image/ImageLoader.ts"() {
36461
36461
  init_dirname();
@@ -36469,7 +36469,7 @@ void main() {
36469
36469
  init_WrappedImage();
36470
36470
  init_base64();
36471
36471
  init_log();
36472
- log4 = logger("ImageLoader");
36472
+ log5 = logger("ImageLoader");
36473
36473
  ImageLoader2 = class _ImageLoader {
36474
36474
  static _createImage() {
36475
36475
  return createImage();
@@ -36494,7 +36494,7 @@ void main() {
36494
36494
  return image;
36495
36495
  }
36496
36496
  static async loadData(src) {
36497
- log4.debug("loadData", src);
36497
+ log5.debug("loadData", src);
36498
36498
  const image = await this.loadCanvasData(src);
36499
36499
  return image.data.getImageData(0, 0, image.width, image.height);
36500
36500
  }
@@ -36601,7 +36601,7 @@ void main() {
36601
36601
  });
36602
36602
 
36603
36603
  // src/texture/TextureLoader.ts
36604
- var log5, TextureLoader2;
36604
+ var log6, TextureLoader2;
36605
36605
  var init_TextureLoader = __esm({
36606
36606
  "src/texture/TextureLoader.ts"() {
36607
36607
  init_dirname();
@@ -36612,7 +36612,7 @@ void main() {
36612
36612
  init_ImageLoader();
36613
36613
  init_Textures();
36614
36614
  init_log();
36615
- log5 = logger("TextureLoader");
36615
+ log6 = logger("TextureLoader");
36616
36616
  TextureLoader2 = class {
36617
36617
  /** Reports whether image loading failed, so cached textures can be retried. */
36618
36618
  static hasFailed(texture) {
@@ -36628,7 +36628,7 @@ void main() {
36628
36628
  texture.needsUpdate = true;
36629
36629
  }, (error2) => {
36630
36630
  this.failedTextures.add(texture);
36631
- log5.warn("Failed to load texture", src, error2);
36631
+ log6.warn("Failed to load texture", src, error2);
36632
36632
  });
36633
36633
  texture.image = image;
36634
36634
  texture.format = format3;
@@ -36644,7 +36644,7 @@ void main() {
36644
36644
  texture.needsUpdate = true;
36645
36645
  }).catch((error2) => {
36646
36646
  this.failedTextures.add(texture);
36647
- log5.warn("Failed to load texture", src, error2);
36647
+ log6.warn("Failed to load texture", src, error2);
36648
36648
  });
36649
36649
  texture.format = format3;
36650
36650
  texture.rotation = rotation;
@@ -36723,7 +36723,7 @@ void main() {
36723
36723
  });
36724
36724
 
36725
36725
  // src/Materials.ts
36726
- var log6, Materials;
36726
+ var log7, Materials;
36727
36727
  var init_Materials = __esm({
36728
36728
  "src/Materials.ts"() {
36729
36729
  init_dirname();
@@ -36735,7 +36735,7 @@ void main() {
36735
36735
  init_TextureLoader();
36736
36736
  init_Caching();
36737
36737
  init_log();
36738
- log6 = logger("Materials");
36738
+ log7 = logger("Materials");
36739
36739
  Materials = class _Materials {
36740
36740
  /** Shared checkerboard material, created on first access. */
36741
36741
  static get MISSING_TEXTURE() {
@@ -37006,7 +37006,7 @@ void main() {
37006
37006
  Object.assign(material.defaultAttributeValues, { shade: [1], uvBounds: [0, 0, 1, 1] });
37007
37007
  return material;
37008
37008
  } catch (e6) {
37009
- log6.warn(e6);
37009
+ log7.warn(e6);
37010
37010
  }
37011
37011
  return this.createBasicCanvasMaterial(canvas, transparent, shade);
37012
37012
  }
@@ -58568,7 +58568,7 @@ void main() {
58568
58568
  exports$17.callbackify = callbackify2;
58569
58569
  return exports$17;
58570
58570
  }
58571
- var exports$c4, _dewExec$b4, exports$b4, _dewExec$a4, exports$a4, _dewExec$94, exports$94, _dewExec$84, exports$84, _dewExec$74, exports$74, _dewExec$64, exports$64, _dewExec$54, _global$22, exports$54, _dewExec$44, _global$12, exports$44, _dewExec$34, exports$34, _dewExec$25, exports$25, _dewExec$15, exports$17, _dewExec9, _global4, exports11, _extend, callbackify, debuglog, deprecate, format, inherits, inspect, isArray, isBoolean, isBuffer, isDate, isError, isFunction, isNull, isNullOrUndefined, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isUndefined, log7, promisify3, types, TextEncoder2, TextDecoder2;
58571
+ var exports$c4, _dewExec$b4, exports$b4, _dewExec$a4, exports$a4, _dewExec$94, exports$94, _dewExec$84, exports$84, _dewExec$74, exports$74, _dewExec$64, exports$64, _dewExec$54, _global$22, exports$54, _dewExec$44, _global$12, exports$44, _dewExec$34, exports$34, _dewExec$25, exports$25, _dewExec$15, exports$17, _dewExec9, _global4, exports11, _extend, callbackify, debuglog, deprecate, format, inherits, inspect, isArray, isBoolean, isBuffer, isDate, isError, isFunction, isNull, isNullOrUndefined, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isUndefined, log8, promisify3, types, TextEncoder2, TextDecoder2;
58572
58572
  var init_util3 = __esm({
58573
58573
  "../../node_modules/@jspm/core/nodelibs/browser/util.js"() {
58574
58574
  init_dirname();
@@ -58652,7 +58652,7 @@ void main() {
58652
58652
  isString = exports11.isString;
58653
58653
  isSymbol = exports11.isSymbol;
58654
58654
  isUndefined = exports11.isUndefined;
58655
- log7 = exports11.log;
58655
+ log8 = exports11.log;
58656
58656
  promisify3 = exports11.promisify;
58657
58657
  types = exports11.types;
58658
58658
  TextEncoder2 = exports11.TextEncoder = globalThis.TextEncoder;
@@ -71058,7 +71058,7 @@ return ${compiler2.callType("value", tagType)}
71058
71058
  });
71059
71059
 
71060
71060
  // src/assets/source/HostedAssetSource.ts
71061
- var BINARY_TIMEOUT, log8, DEFAULT_OPTIONS2, _HostedAssetSource, HostedAssetSource;
71061
+ var BINARY_TIMEOUT, log9, DEFAULT_OPTIONS2, _HostedAssetSource, HostedAssetSource;
71062
71062
  var init_HostedAssetSource = __esm({
71063
71063
  "src/assets/source/HostedAssetSource.ts"() {
71064
71064
  init_dirname();
@@ -71075,7 +71075,7 @@ return ${compiler2.callType("value", tagType)}
71075
71075
  init_parser();
71076
71076
  init_merge();
71077
71077
  BINARY_TIMEOUT = 6e4;
71078
- log8 = logger("HostedAssetSource");
71078
+ log9 = logger("HostedAssetSource");
71079
71079
  DEFAULT_OPTIONS2 = {
71080
71080
  retryDefaults: true
71081
71081
  };
@@ -71087,14 +71087,14 @@ return ${compiler2.callType("value", tagType)}
71087
71087
  return direct;
71088
71088
  }
71089
71089
  if (key.namespace !== DEFAULT_NAMESPACE) {
71090
- log8.debug("Retrying", key, "with default namespace");
71090
+ log9.debug("Retrying", key, "with default namespace");
71091
71091
  const namespaceKey = new AssetKey(DEFAULT_NAMESPACE, key.path, key.assetType, key.type, key.rootType, key.extension, key.root);
71092
71092
  const namespaced = await this.load(namespaceKey, parser);
71093
71093
  if (typeof namespaced !== "undefined") {
71094
71094
  return namespaced;
71095
71095
  }
71096
71096
  if (typeof key.root !== "undefined" && key.root !== AssetLoader.ROOT || typeof this.root !== "undefined" && this.root !== AssetLoader.ROOT) {
71097
- log8.debug("Retrying", key, "with default root+namespace");
71097
+ log9.debug("Retrying", key, "with default root+namespace");
71098
71098
  const namespacedRootedKey = new AssetKey(DEFAULT_NAMESPACE, key.path, key.assetType, key.type, key.rootType, key.extension, AssetLoader.ROOT);
71099
71099
  const namespacedRooted = await this.load(namespacedRootedKey, parser);
71100
71100
  if (typeof namespacedRooted !== "undefined") {
@@ -71102,7 +71102,7 @@ return ${compiler2.callType("value", tagType)}
71102
71102
  }
71103
71103
  }
71104
71104
  } else if (typeof key.root !== "undefined" && key.root !== AssetLoader.ROOT || typeof this.root !== "undefined" && this.root !== AssetLoader.ROOT) {
71105
- log8.debug("Retrying", key, "with default root");
71105
+ log9.debug("Retrying", key, "with default root");
71106
71106
  const rootKey = new AssetKey(key.namespace, key.path, key.assetType, key.type, key.rootType, key.extension, AssetLoader.ROOT);
71107
71107
  const rooted = await this.load(rootKey, parser);
71108
71108
  if (typeof rooted !== "undefined") {
@@ -71113,7 +71113,7 @@ return ${compiler2.callType("value", tagType)}
71113
71113
  }
71114
71114
  async load(key, parser) {
71115
71115
  const url = `${this.assetBasePath(key)}${key.type !== void 0 ? key.type + "/" : ""}${key.path}${key.extension}`;
71116
- log8.debug("Loading", url);
71116
+ log9.debug("Loading", url);
71117
71117
  const request = { url };
71118
71118
  try {
71119
71119
  parser.config(request);
@@ -81239,7 +81239,7 @@ return ${compiler2.callType("value", tagType)}
81239
81239
  });
81240
81240
 
81241
81241
  // src/assets/AssetLoader.ts
81242
- var log9, AssetLoader;
81242
+ var log10, AssetLoader;
81243
81243
  var init_AssetLoader = __esm({
81244
81244
  "src/assets/AssetLoader.ts"() {
81245
81245
  init_dirname();
@@ -81250,7 +81250,7 @@ return ${compiler2.callType("value", tagType)}
81250
81250
  init_log();
81251
81251
  init_source();
81252
81252
  init_Caching();
81253
- log9 = logger("AssetLoader");
81253
+ log10 = logger("AssetLoader");
81254
81254
  AssetLoader = class {
81255
81255
  static get _SOURCES() {
81256
81256
  return this.sources ?? (this.sources = [{ key: "mcassets", source: new HostedAssetSource(this.ROOT, { retryDefaults: false }) }]);
@@ -81305,11 +81305,11 @@ ${key}` : key;
81305
81305
  if (override) {
81306
81306
  const existing = this.removeSource(key);
81307
81307
  if (existing) {
81308
- log9.info("Removed existing AssetSource", key);
81308
+ log10.info("Removed existing AssetSource", key);
81309
81309
  }
81310
81310
  }
81311
81311
  this._SOURCES.unshift({ key, source });
81312
- log9.info("Added AssetSource", key);
81312
+ log10.info("Added AssetSource", key);
81313
81313
  }
81314
81314
  /** Removes and returns the first source with this name. Call {@link Caching.clear} to reload assets. */
81315
81315
  static removeSource(key) {
@@ -81495,14 +81495,14 @@ ${key}` : key;
81495
81495
  });
81496
81496
 
81497
81497
  // src/Ticker.ts
81498
- var log10, _Ticker, Ticker;
81498
+ var log11, _Ticker, Ticker;
81499
81499
  var init_Ticker = __esm({
81500
81500
  "src/Ticker.ts"() {
81501
81501
  init_dirname();
81502
81502
  init_buffer2();
81503
81503
  init_process2();
81504
81504
  init_log();
81505
- log10 = logger("Ticker");
81505
+ log11 = logger("Ticker");
81506
81506
  _Ticker = class _Ticker {
81507
81507
  static schedule(fn, ms) {
81508
81508
  const handle = setInterval(fn, ms);
@@ -81520,7 +81520,7 @@ ${key}` : key;
81520
81520
  try {
81521
81521
  t5();
81522
81522
  } catch (e6) {
81523
- log10.warn(e6);
81523
+ log11.warn(e6);
81524
81524
  }
81525
81525
  });
81526
81526
  _Ticker.oneSecondTicks++;
@@ -81774,7 +81774,7 @@ ${key}` : key;
81774
81774
  });
81775
81775
 
81776
81776
  // src/UVMapper.ts
81777
- var log11, X3, Y4, Z3, FACE_UV_AXES, UVMapper, MinecraftFaceUV;
81777
+ var log12, X3, Y4, Z3, FACE_UV_AXES, UVMapper, MinecraftFaceUV;
81778
81778
  var init_UVMapper = __esm({
81779
81779
  "src/UVMapper.ts"() {
81780
81780
  init_dirname();
@@ -81792,7 +81792,7 @@ ${key}` : key;
81792
81792
  init_ModelGenerator();
81793
81793
  init_log();
81794
81794
  init_cubeUv();
81795
- log11 = logger("UVMapper");
81795
+ log12 = logger("UVMapper");
81796
81796
  X3 = 0;
81797
81797
  Y4 = 1;
81798
81798
  Z3 = 2;
@@ -82025,7 +82025,7 @@ ${key}` : key;
82025
82025
  model.elements = originalModel.elements.map((element) => ({ ...element }));
82026
82026
  }
82027
82027
  const isItemModel = !("elements" in model);
82028
- log11.debug("Creating Atlas for", model.key);
82028
+ log12.debug("Creating Atlas for", model.key);
82029
82029
  if (model.textures) {
82030
82030
  const promises = [];
82031
82031
  const uniqueTextureNames = [];
@@ -82039,7 +82039,7 @@ ${key}` : key;
82039
82039
  const assetKey = AssetKey.parse("textures", textureValue, model.key);
82040
82040
  promises.push(ModelTextures.get(assetKey).then((asset2) => {
82041
82041
  if (!asset2) {
82042
- log11.warn("Missing texture", assetKey);
82042
+ log12.warn("Missing texture", assetKey);
82043
82043
  return;
82044
82044
  }
82045
82045
  textureMap[textureKey] = new WrappedImage(asset2);
@@ -82051,7 +82051,7 @@ ${key}` : key;
82051
82051
  }
82052
82052
  await Promise.all(promises);
82053
82053
  const textureCount = uniqueTextureNames.length;
82054
- log11.debug("Creating Atlas for", textureCount, "textures");
82054
+ log12.debug("Creating Atlas for", textureCount, "textures");
82055
82055
  this.fillMissingTextureKeys(model.textures, textureMap);
82056
82056
  this.fillMissingTextureKeys(model.textures, metaMap);
82057
82057
  const sizes = {};
@@ -82082,7 +82082,7 @@ ${key}` : key;
82082
82082
  this.fillMissingTextureKeys(model.textures, sizes);
82083
82083
  const s4 = Math.ceil(Math.sqrt(textureCount + 1));
82084
82084
  const size = Math.ceil(s4 * maxWidth);
82085
- log11.debug("Atlas size:", size);
82085
+ log12.debug("Atlas size:", size);
82086
82086
  const squaredSize = size * size;
82087
82087
  const image = new CanvasImage(size, size);
82088
82088
  const missing = Textures.getMissing().image;
@@ -82161,7 +82161,7 @@ ${key}` : key;
82161
82161
  }
82162
82162
  this.fillMissingTextureKeys(model.textures, positions);
82163
82163
  if (isItemModel) {
82164
- log11.debug("Generating item model for", model);
82164
+ log12.debug("Generating item model for", model);
82165
82165
  model.elements = [];
82166
82166
  for (let layerName of ModelGenerator.ITEM_LAYERS) {
82167
82167
  const textureImage = textureMap[layerName];
@@ -82177,7 +82177,7 @@ ${key}` : key;
82177
82177
  ), layerName));
82178
82178
  }
82179
82179
  }
82180
- log11.debug("Item model elements", model.elements);
82180
+ log12.debug("Item model elements", model.elements);
82181
82181
  }
82182
82182
  if (!model.elements) {
82183
82183
  }
@@ -82234,7 +82234,7 @@ ${key}` : key;
82234
82234
  hasTranslucency
82235
82235
  );
82236
82236
  } else {
82237
- log11.warn("Model does not have any textures", model);
82237
+ log12.warn("Model does not have any textures", model);
82238
82238
  }
82239
82239
  return void 0;
82240
82240
  }
@@ -83770,7 +83770,7 @@ ${key}` : key, async () => {
83770
83770
  });
83771
83771
 
83772
83772
  // src/assets/BlockEntities.ts
83773
- var log12, BlockEntities;
83773
+ var log13, BlockEntities;
83774
83774
  var init_BlockEntities = __esm({
83775
83775
  "src/assets/BlockEntities.ts"() {
83776
83776
  init_dirname();
@@ -83783,7 +83783,7 @@ ${key}` : key, async () => {
83783
83783
  init_source();
83784
83784
  init_Caching();
83785
83785
  init_log();
83786
- log12 = logger("BlockEntities");
83786
+ log13 = logger("BlockEntities");
83787
83787
  BlockEntities = class {
83788
83788
  /**
83789
83789
  * Loads the block index of a version. Versions and sources without one yield an empty index, and so does
@@ -83798,7 +83798,7 @@ ${key}` : key, async () => {
83798
83798
  key.root = await Entities.getDatasetRoot(root);
83799
83799
  return await AssetLoader.get(key, "json" /* JSON */) ?? {};
83800
83800
  } catch (error2) {
83801
- log12.warn("Could not load the block entity index; block entities are drawn as plain block models", error2);
83801
+ log13.warn("Could not load the block entity index; block entities are drawn as plain block models", error2);
83802
83802
  return {};
83803
83803
  }
83804
83804
  });
@@ -83942,7 +83942,7 @@ ${key}` : key, async () => {
83942
83942
  }
83943
83943
  return { indices, rows, metrics };
83944
83944
  } catch (error2) {
83945
- log13.warn(`Could not load Unihex file ${key.toNamespacedString()}`, error2);
83945
+ log14.warn(`Could not load Unihex file ${key.toNamespacedString()}`, error2);
83946
83946
  return void 0;
83947
83947
  }
83948
83948
  }
@@ -83961,7 +83961,7 @@ ${key}` : key, async () => {
83961
83961
  return { ...override, from, to };
83962
83962
  });
83963
83963
  } catch (error2) {
83964
- log13.warn(`Could not load Unihex file ${key.toNamespacedString()}`, error2);
83964
+ log14.warn(`Could not load Unihex file ${key.toNamespacedString()}`, error2);
83965
83965
  return glyphs;
83966
83966
  }
83967
83967
  const file = await Caching.unihexCache.get(key.serialize(), () => parseUnihex(key));
@@ -84009,7 +84009,7 @@ ${key}` : key, async () => {
84009
84009
  }
84010
84010
  return glyphs;
84011
84011
  }
84012
- var log13, ATLAS_SIZE, GLYPH_HEIGHT, UnihexAtlas, atlases;
84012
+ var log14, ATLAS_SIZE, GLYPH_HEIGHT, UnihexAtlas, atlases;
84013
84013
  var init_Unihex = __esm({
84014
84014
  "src/assets/_fonts/Unihex.ts"() {
84015
84015
  init_dirname();
@@ -84023,7 +84023,7 @@ ${key}` : key, async () => {
84023
84023
  init_AssetParsers();
84024
84024
  init_CanvasCompat();
84025
84025
  init_log();
84026
- log13 = logger("Unihex");
84026
+ log14 = logger("Unihex");
84027
84027
  ATLAS_SIZE = 512;
84028
84028
  GLYPH_HEIGHT = 16;
84029
84029
  UnihexAtlas = class {
@@ -88252,7 +88252,7 @@ ${key}` : key, async () => {
88252
88252
  });
88253
88253
 
88254
88254
  // src/skin/Skins.ts
88255
- var log14, Skins;
88255
+ var log15, Skins;
88256
88256
  var init_Skins = __esm({
88257
88257
  "src/skin/Skins.ts"() {
88258
88258
  init_dirname();
@@ -88261,7 +88261,7 @@ ${key}` : key, async () => {
88261
88261
  init_Requests();
88262
88262
  init_Caching();
88263
88263
  init_log();
88264
- log14 = logger("Skins");
88264
+ log15 = logger("Skins");
88265
88265
  Skins = class {
88266
88266
  //<editor-fold desc="Skins">
88267
88267
  /** Returns a skin URL for {@link MineRenderScene.addSkin}, or `undefined` if name lookup fails. */
@@ -88333,7 +88333,7 @@ ${key}` : key, async () => {
88333
88333
  }
88334
88334
  return void 0;
88335
88335
  }).catch((err2) => {
88336
- log14.warn(err2);
88336
+ log15.warn(err2);
88337
88337
  return void 0;
88338
88338
  });
88339
88339
  }
@@ -88348,7 +88348,7 @@ ${key}` : key, async () => {
88348
88348
  }
88349
88349
  return void 0;
88350
88350
  }).catch((err2) => {
88351
- log14.warn(err2);
88351
+ log15.warn(err2);
88352
88352
  return void 0;
88353
88353
  });
88354
88354
  }
@@ -88362,7 +88362,7 @@ ${key}` : key, async () => {
88362
88362
  }
88363
88363
  return void 0;
88364
88364
  }).catch((err2) => {
88365
- log14.warn(err2);
88365
+ log15.warn(err2);
88366
88366
  return void 0;
88367
88367
  });
88368
88368
  }
@@ -88386,7 +88386,7 @@ ${key}` : key, async () => {
88386
88386
  }
88387
88387
  return void 0;
88388
88388
  }).catch((err2) => {
88389
- log14.warn(err2);
88389
+ log15.warn(err2);
88390
88390
  return void 0;
88391
88391
  });
88392
88392
  }
@@ -91940,7 +91940,7 @@ ${shader.fragmentShader}`.replace(
91940
91940
  function isModelObject(obj) {
91941
91941
  return obj.isModelObject;
91942
91942
  }
91943
- var log15, _ModelObject, ModelObject;
91943
+ var log16, _ModelObject, ModelObject;
91944
91944
  var init_ModelObject = __esm({
91945
91945
  "src/model/scene/ModelObject.ts"() {
91946
91946
  init_dirname();
@@ -91963,7 +91963,7 @@ ${shader.fragmentShader}`.replace(
91963
91963
  init_GuiLight();
91964
91964
  init_ItemTints();
91965
91965
  init_ItemGlint();
91966
- log15 = logger("ModelObject");
91966
+ log16 = logger("ModelObject");
91967
91967
  _ModelObject = class _ModelObject extends SceneObject {
91968
91968
  constructor(originalModel, options) {
91969
91969
  super(options);
@@ -92145,10 +92145,10 @@ ${shader.fragmentShader}`.replace(
92145
92145
  }
92146
92146
  });
92147
92147
  } else {
92148
- log15.debug(this.atlas.model, "has no elements");
92148
+ log16.debug(this.atlas.model, "has no elements");
92149
92149
  }
92150
92150
  } else {
92151
- log15.debug("Missing atlas for", this);
92151
+ log16.debug("Missing atlas for", this);
92152
92152
  }
92153
92153
  if (this.options.mergeMeshes) {
92154
92154
  let combinedGeo;
@@ -92978,7 +92978,7 @@ ${shader.fragmentShader}`.replace(
92978
92978
  function isBlockObject(obj) {
92979
92979
  return obj.isBlockObject;
92980
92980
  }
92981
- var log18, _BlockObject, BlockObject;
92981
+ var log19, _BlockObject, BlockObject;
92982
92982
  var init_BlockObject = __esm({
92983
92983
  "src/model/block/scene/BlockObject.ts"() {
92984
92984
  init_dirname();
@@ -93001,7 +93001,7 @@ ${shader.fragmentShader}`.replace(
93001
93001
  init_Entities();
93002
93002
  init_Biomes();
93003
93003
  init_log();
93004
- log18 = logger("BlockObject");
93004
+ log19 = logger("BlockObject");
93005
93005
  _BlockObject = class _BlockObject extends SceneObject {
93006
93006
  constructor(blockState3, options) {
93007
93007
  super(options);
@@ -93106,7 +93106,7 @@ ${shader.fragmentShader}`.replace(
93106
93106
  created.push(await this.scene.addEntity(entity, { wireframe: this.options.wireframe }));
93107
93107
  }
93108
93108
  } catch (error2) {
93109
- log18.warn(`Could not draw block entity ${key.toNamespacedString()}, using its block model`, error2);
93109
+ log19.warn(`Could not draw block entity ${key.toNamespacedString()}, using its block model`, error2);
93110
93110
  this.removeEntities(created);
93111
93111
  return false;
93112
93112
  }
@@ -94486,6 +94486,7 @@ ${shader.fragmentShader}`.replace(
94486
94486
  init_buffer2();
94487
94487
  init_process2();
94488
94488
  init_Env();
94489
+ init_log();
94489
94490
 
94490
94491
  // src/env/browser/BrowserCache.ts
94491
94492
  init_dirname();
@@ -94592,6 +94593,7 @@ ${shader.fragmentShader}`.replace(
94592
94593
 
94593
94594
  // src/env/browser/BrowserEnv.ts
94594
94595
  var import_meta = {};
94596
+ var log2 = logger("BrowserEnv");
94595
94597
  function lazyLocalForage(options) {
94596
94598
  let instance;
94597
94599
  const store = () => instance ?? (instance = Promise.resolve().then(() => __toESM(require_localforage())).then((module2) => module2.default.createInstance(options)));
@@ -94607,7 +94609,8 @@ ${shader.fragmentShader}`.replace(
94607
94609
  };
94608
94610
  }
94609
94611
  var BrowserEnv = class {
94610
- constructor() {
94612
+ constructor(options = {}) {
94613
+ this.options = options;
94611
94614
  this.name = "browser";
94612
94615
  }
94613
94616
  createCanvas(width, height) {
@@ -94636,14 +94639,18 @@ ${shader.fragmentShader}`.replace(
94636
94639
  createWorker(name2) {
94637
94640
  if (name2 !== "section" || typeof Worker === "undefined") return void 0;
94638
94641
  try {
94642
+ const sectionWorker = this.options.sectionWorker;
94643
+ if (typeof sectionWorker === "function") return sectionWorker();
94644
+ if (sectionWorker !== void 0) return new Worker(sectionWorker, { type: "module" });
94639
94645
  return new Worker(new URL("./section.worker.mjs", import_meta.url), { type: "module" });
94640
- } catch {
94646
+ } catch (error2) {
94647
+ log2.warn("Could not start the section worker, so sections build on the main thread. Pass sectionWorker to registerBrowserEnv to load it from another URL.", error2);
94641
94648
  return void 0;
94642
94649
  }
94643
94650
  }
94644
94651
  };
94645
- function registerBrowserEnv() {
94646
- const env3 = new BrowserEnv();
94652
+ function registerBrowserEnv(options) {
94653
+ const env3 = new BrowserEnv(options);
94647
94654
  Env.register(env3);
94648
94655
  return env3;
94649
94656
  }
@@ -96138,7 +96145,7 @@ property list uchar int vertex_index
96138
96145
  init_util();
96139
96146
  init_log();
96140
96147
  init_three();
96141
- var log16 = logger("SceneInspector");
96148
+ var log17 = logger("SceneInspector");
96142
96149
  var help = "<span>Ctrl/Cmd+Click to Select<br/></span><br/>";
96143
96150
  var SceneInspector = class {
96144
96151
  constructor(renderer) {
@@ -96232,7 +96239,7 @@ property list uchar int vertex_index
96232
96239
  }
96233
96240
  selectObject(targetObject, targetIntersection, instance = this.getIntersectionInstance(targetIntersection)) {
96234
96241
  this.selectedObject = targetObject;
96235
- log16.debug("selected", targetObject);
96242
+ log17.debug("selected", targetObject);
96236
96243
  this.redraw(targetObject, targetIntersection, instance);
96237
96244
  }
96238
96245
  redraw(targetObject, targetIntersection, instance) {
@@ -96503,7 +96510,7 @@ property list uchar int vertex_index
96503
96510
  init_buffer2();
96504
96511
  init_process2();
96505
96512
  init_log();
96506
- var log17 = logger("InstanceManager");
96513
+ var log18 = logger("InstanceManager");
96507
96514
  var InstanceManager = class {
96508
96515
  constructor() {
96509
96516
  this.isInstanceManager = true;
@@ -96512,7 +96519,7 @@ property list uchar int vertex_index
96512
96519
  /** Allocates a new placement of a cached model, or returns `undefined` if the key is unknown. */
96513
96520
  async get(key) {
96514
96521
  if (key in this.instanceCache) {
96515
- log17.debug("key in cache", key);
96522
+ log18.debug("key in cache", key);
96516
96523
  return (await this.instanceCache[key]).nextInstance();
96517
96524
  }
96518
96525
  return void 0;
@@ -96522,7 +96529,7 @@ property list uchar int vertex_index
96522
96529
  if (key in this.instanceCache) {
96523
96530
  return await this.get(key);
96524
96531
  }
96525
- log17.debug("key not in cache", key);
96532
+ log18.debug("key not in cache", key);
96526
96533
  const pending = Promise.resolve().then(supplier).then((obj) => obj.nextInstance());
96527
96534
  this.instanceCache[key] = pending;
96528
96535
  try {
@@ -101213,7 +101220,7 @@ gl_FragDepth=readDepth(vUv);
101213
101220
 
101214
101221
  // src/renderer/Renderer.ts
101215
101222
  init_log();
101216
- var log19 = logger("Renderer");
101223
+ var log20 = logger("Renderer");
101217
101224
  var _Renderer = class _Renderer {
101218
101225
  constructor(options, surface) {
101219
101226
  this._width = 0;
@@ -101458,10 +101465,10 @@ gl_FragDepth=readDepth(vUv);
101458
101465
  this._element = element;
101459
101466
  this._element.appendChild(this.renderer.domElement);
101460
101467
  if (this.viewWidth == 0) {
101461
- log19.warn("0 element width");
101468
+ log20.warn("0 element width");
101462
101469
  }
101463
101470
  if (this.viewHeight == 0) {
101464
- log19.warn("0 element height");
101471
+ log20.warn("0 element height");
101465
101472
  }
101466
101473
  this.resize(this.viewWidth, this.viewHeight);
101467
101474
  }
@@ -103581,7 +103588,7 @@ gl_FragDepth=readDepth(vUv);
103581
103588
 
103582
103589
  // src/world/_entities/WorldEntities.ts
103583
103590
  init_log();
103584
- var log20 = logger("WorldEntities");
103591
+ var log21 = logger("WorldEntities");
103585
103592
  var WorldEntities = class {
103586
103593
  constructor(scene) {
103587
103594
  this.scene = scene;
@@ -103650,7 +103657,7 @@ gl_FragDepth=readDepth(vUv);
103650
103657
  placement.owner.set(object4, { type: key.toNamespacedString(), position: placement.position });
103651
103658
  this.scene.add(object4);
103652
103659
  } catch (error2) {
103653
- log20.warn(`Could not draw saved entity ${placement.key.toNamespacedString()}, skipping it`, error2);
103660
+ log21.warn(`Could not draw saved entity ${placement.key.toNamespacedString()}, skipping it`, error2);
103654
103661
  } finally {
103655
103662
  if (object4 && !placement.owner.has(object4)) object4.dispose();
103656
103663
  }
@@ -103872,7 +103879,7 @@ gl_FragDepth=readDepth(vUv);
103872
103879
 
103873
103880
  // src/world/MineRenderWorld.ts
103874
103881
  init_log();
103875
- var log21 = logger("MineRenderWorld");
103882
+ var log22 = logger("MineRenderWorld");
103876
103883
  var YIELD_INTERVAL_MS = 8;
103877
103884
  var MineRenderWorld = class {
103878
103885
  constructor(scene, options = {}) {
@@ -104200,7 +104207,7 @@ gl_FragDepth=readDepth(vUv);
104200
104207
  } finally {
104201
104208
  try {
104202
104209
  const failures = await this.refreshBiomes(true);
104203
- if (failures.size) log21.warn("Failed to refresh biome colors", failures.values().next().value);
104210
+ if (failures.size) log22.warn("Failed to refresh biome colors", failures.values().next().value);
104204
104211
  } catch (error2) {
104205
104212
  if (!failed) {
104206
104213
  failed = true;
@@ -104306,7 +104313,7 @@ gl_FragDepth=readDepth(vUv);
104306
104313
  if (deferCulling) await this.updateCulling([...changes.values()], true);
104307
104314
  else {
104308
104315
  const failures = await this.refreshBiomes();
104309
- if (failures.size) log21.warn("Failed to refresh biome colors", failures.values().next().value);
104316
+ if (failures.size) log22.warn("Failed to refresh biome colors", failures.values().next().value);
104310
104317
  await this.updateCulling([...changes.values()]);
104311
104318
  }
104312
104319
  }
@@ -104345,7 +104352,7 @@ gl_FragDepth=readDepth(vUv);
104345
104352
  }
104346
104353
  } finally {
104347
104354
  const failures = await this.refreshBiomes(true);
104348
- if (failures.size) log21.warn("Failed to refresh biome colors", failures.values().next().value);
104355
+ if (failures.size) log22.warn("Failed to refresh biome colors", failures.values().next().value);
104349
104356
  await this.updateCulling([]);
104350
104357
  }
104351
104358
  }
@@ -104902,6 +104909,8 @@ gl_FragDepth=readDepth(vUv);
104902
104909
  init_buffer2();
104903
104910
  init_process2();
104904
104911
  init_Env();
104912
+ init_log();
104913
+ var log23 = logger("SectionWorker");
104905
104914
  var _SectionWorker = class _SectionWorker {
104906
104915
  constructor(worker) {
104907
104916
  this.worker = worker;
@@ -104915,8 +104924,12 @@ gl_FragDepth=readDepth(vUv);
104915
104924
  if (reply.type === "pages") pending.resolve(reply.pages);
104916
104925
  else pending.reject(new Error(reply.message));
104917
104926
  });
104918
- worker.addEventListener("error", (event) => this.fail(event.message || "Section worker failed"));
104919
- worker.addEventListener("messageerror", () => this.fail("Section worker message could not be deserialized"));
104927
+ const fallBack = (message) => {
104928
+ log23.warn(`${message}, so sections build on the main thread`);
104929
+ this.fail(message);
104930
+ };
104931
+ worker.addEventListener("error", (event) => fallBack(event.message || "Section worker failed"));
104932
+ worker.addEventListener("messageerror", () => fallBack("Section worker message could not be deserialized"));
104920
104933
  }
104921
104934
  /** The shared worker, or undefined when the environment has none or a previous worker failed. */
104922
104935
  static shared() {