minerender 2.1.0-alpha.22 → 2.1.0-alpha.23

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.
@@ -1405,7 +1405,7 @@ var BlockStates = class {
1405
1405
  void 0,
1406
1406
  "assets",
1407
1407
  ".json",
1408
- DEFAULT_ROOT
1408
+ AssetLoader.ROOT
1409
1409
  );
1410
1410
  return Caching.listAssetCache.get(key.serialize(), () => {
1411
1411
  return AssetLoader.get(key, "list" /* LIST */);
@@ -1722,17 +1722,17 @@ var HostedAssetSource = class _HostedAssetSource extends AssetSource {
1722
1722
  if (typeof namespaced !== "undefined") {
1723
1723
  return namespaced;
1724
1724
  }
1725
- if (typeof key.root !== "undefined" && key.root !== DEFAULT_ROOT || typeof this.root !== "undefined" && this.root !== DEFAULT_ROOT) {
1725
+ if (typeof key.root !== "undefined" && key.root !== AssetLoader.ROOT || typeof this.root !== "undefined" && this.root !== AssetLoader.ROOT) {
1726
1726
  console.info(p3, "Retrying", key, "with default root+namespace");
1727
- const namespacedRootedKey = new AssetKey(DEFAULT_NAMESPACE, key.path, key.assetType, key.type, key.rootType, key.extension, DEFAULT_ROOT);
1727
+ const namespacedRootedKey = new AssetKey(DEFAULT_NAMESPACE, key.path, key.assetType, key.type, key.rootType, key.extension, AssetLoader.ROOT);
1728
1728
  const namespacedRooted = await this.load(namespacedRootedKey, parser);
1729
1729
  if (typeof namespacedRooted !== "undefined") {
1730
1730
  return namespacedRooted;
1731
1731
  }
1732
1732
  }
1733
- } else if (typeof key.root !== "undefined" && key.root !== DEFAULT_ROOT || typeof this.root !== "undefined" && this.root !== DEFAULT_ROOT) {
1733
+ } else if (typeof key.root !== "undefined" && key.root !== AssetLoader.ROOT || typeof this.root !== "undefined" && this.root !== AssetLoader.ROOT) {
1734
1734
  console.info(p3, "Retrying", key, "with default root");
1735
- const rootKey = new AssetKey(key.namespace, key.path, key.assetType, key.type, key.rootType, key.extension, DEFAULT_ROOT);
1735
+ const rootKey = new AssetKey(key.namespace, key.path, key.assetType, key.type, key.rootType, key.extension, AssetLoader.ROOT);
1736
1736
  const rooted = await this.load(rootKey, parser);
1737
1737
  if (typeof rooted !== "undefined") {
1738
1738
  return rooted;
@@ -1866,6 +1866,20 @@ var AssetLoader = class {
1866
1866
  static {
1867
1867
  this._SOURCES = [];
1868
1868
  }
1869
+ static get version() {
1870
+ return this.ROOT.substring(this.ROOT.lastIndexOf("/") + 1);
1871
+ }
1872
+ static setVersion(version) {
1873
+ this.ROOT = `https://assets.mcasset.cloud/${version}`;
1874
+ const source = new HostedAssetSource(this.ROOT, { retryDefaults: false });
1875
+ const index = this._SOURCES.findIndex((s) => s.key === "mcassets");
1876
+ if (index !== -1) {
1877
+ this._SOURCES[index] = { key: "mcassets", source };
1878
+ } else {
1879
+ this.addSource("mcassets", source);
1880
+ }
1881
+ Caching.clear();
1882
+ }
1869
1883
  static addSource(key, source, override = true) {
1870
1884
  if (override) {
1871
1885
  const existing = this.removeSource(key);
@@ -1888,7 +1902,7 @@ var AssetLoader = class {
1888
1902
  }
1889
1903
  static {
1890
1904
  this.addSource("mcassets-fallback", new HostedAssetSource("https://raw.githubusercontent.com/InventivetalentDev/minerender-fallback-assets/master", { retryDefaults: false }));
1891
- this.addSource("mcassets", new HostedAssetSource(DEFAULT_ROOT, { retryDefaults: false }));
1905
+ this.addSource("mcassets", new HostedAssetSource(this.ROOT, { retryDefaults: false }));
1892
1906
  }
1893
1907
  static async getAll(key, parser) {
1894
1908
  let promises = [];