minerender 2.1.0-alpha.22 → 2.1.0-alpha.24

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.
@@ -413,7 +413,7 @@ var _Caching = class _Caching {
413
413
  this.listAssetCache,
414
414
  this.defaultBlockStatesCache,
415
415
  this.blockTintCache,
416
- this.entityModelsCache
416
+ this.entityModelCache
417
417
  ];
418
418
  }
419
419
  static clear() {
@@ -456,7 +456,7 @@ _Caching.blockStateCache = Caches.builder().expireAfterWrite(Time.minutes(10)).e
456
456
  _Caching.listAssetCache = _Caching.createAssetCache();
457
457
  _Caching.defaultBlockStatesCache = _Caching.createAssetCache();
458
458
  _Caching.blockTintCache = _Caching.createAssetCache();
459
- _Caching.entityModelsCache = _Caching.createAssetCache();
459
+ _Caching.entityModelCache = _Caching.createAssetCache();
460
460
  var Caching = _Caching;
461
461
 
462
462
  // src/Geometries.ts
@@ -1400,7 +1400,7 @@ var BlockStates = class {
1400
1400
  void 0,
1401
1401
  "assets",
1402
1402
  ".json",
1403
- DEFAULT_ROOT
1403
+ AssetLoader.ROOT
1404
1404
  );
1405
1405
  return Caching.listAssetCache.get(key.serialize(), () => {
1406
1406
  return AssetLoader.get(key, "list" /* LIST */);
@@ -1535,14 +1535,6 @@ function applyElementRotation(rotation, geometry) {
1535
1535
  }
1536
1536
  geometry.translate(origin.x, origin.y, origin.z);
1537
1537
  }
1538
- function applyModelPartRotation(modelPart, geometry) {
1539
- const origin = new Vector33(modelPart.pivotX, modelPart.pivotY, modelPart.pivotZ);
1540
- geometry.translate(-origin.x, -origin.y, -origin.z);
1541
- geometry.rotateX(toRadians(modelPart.pitch));
1542
- geometry.rotateY(toRadians(modelPart.yaw));
1543
- geometry.rotateZ(toRadians(modelPart.roll));
1544
- geometry.translate(origin.x, origin.y, origin.z);
1545
- }
1546
1538
  function applyGenericRotation(axis, rotation, obj) {
1547
1539
  switch (axis) {
1548
1540
  case "x" /* X */:
@@ -1641,17 +1633,17 @@ var _HostedAssetSource = class _HostedAssetSource extends AssetSource {
1641
1633
  if (typeof namespaced !== "undefined") {
1642
1634
  return namespaced;
1643
1635
  }
1644
- if (typeof key.root !== "undefined" && key.root !== DEFAULT_ROOT || typeof this.root !== "undefined" && this.root !== DEFAULT_ROOT) {
1636
+ if (typeof key.root !== "undefined" && key.root !== AssetLoader.ROOT || typeof this.root !== "undefined" && this.root !== AssetLoader.ROOT) {
1645
1637
  console.info(p3, "Retrying", key, "with default root+namespace");
1646
- const namespacedRootedKey = new AssetKey(DEFAULT_NAMESPACE, key.path, key.assetType, key.type, key.rootType, key.extension, DEFAULT_ROOT);
1638
+ const namespacedRootedKey = new AssetKey(DEFAULT_NAMESPACE, key.path, key.assetType, key.type, key.rootType, key.extension, AssetLoader.ROOT);
1647
1639
  const namespacedRooted = await this.load(namespacedRootedKey, parser);
1648
1640
  if (typeof namespacedRooted !== "undefined") {
1649
1641
  return namespacedRooted;
1650
1642
  }
1651
1643
  }
1652
- } else if (typeof key.root !== "undefined" && key.root !== DEFAULT_ROOT || typeof this.root !== "undefined" && this.root !== DEFAULT_ROOT) {
1644
+ } else if (typeof key.root !== "undefined" && key.root !== AssetLoader.ROOT || typeof this.root !== "undefined" && this.root !== AssetLoader.ROOT) {
1653
1645
  console.info(p3, "Retrying", key, "with default root");
1654
- const rootKey = new AssetKey(key.namespace, key.path, key.assetType, key.type, key.rootType, key.extension, DEFAULT_ROOT);
1646
+ const rootKey = new AssetKey(key.namespace, key.path, key.assetType, key.type, key.rootType, key.extension, AssetLoader.ROOT);
1655
1647
  const rooted = await this.load(rootKey, parser);
1656
1648
  if (typeof rooted !== "undefined") {
1657
1649
  return rooted;
@@ -1840,6 +1832,20 @@ var ArchiveAssetSource = class _ArchiveAssetSource extends AssetSource {
1840
1832
  // src/assets/AssetLoader.ts
1841
1833
  var p4 = prefix("AssetLoader");
1842
1834
  var _AssetLoader = class _AssetLoader {
1835
+ static get version() {
1836
+ return this.ROOT.substring(this.ROOT.lastIndexOf("/") + 1);
1837
+ }
1838
+ static setVersion(version) {
1839
+ this.ROOT = `https://assets.mcasset.cloud/${version}`;
1840
+ const source = new HostedAssetSource(this.ROOT, { retryDefaults: false });
1841
+ const index = this._SOURCES.findIndex((s) => s.key === "mcassets");
1842
+ if (index !== -1) {
1843
+ this._SOURCES[index] = { key: "mcassets", source };
1844
+ } else {
1845
+ this.addSource("mcassets", source);
1846
+ }
1847
+ Caching.clear();
1848
+ }
1843
1849
  static addSource(key, source, override = true) {
1844
1850
  if (override) {
1845
1851
  const existing = this.removeSource(key);
@@ -1902,7 +1908,7 @@ var _AssetLoader = class _AssetLoader {
1902
1908
  _AssetLoader.ROOT = DEFAULT_ROOT;
1903
1909
  _AssetLoader._SOURCES = [];
1904
1910
  _AssetLoader.addSource("mcassets-fallback", new HostedAssetSource("https://raw.githubusercontent.com/InventivetalentDev/minerender-fallback-assets/master", { retryDefaults: false }));
1905
- _AssetLoader.addSource("mcassets", new HostedAssetSource(DEFAULT_ROOT, { retryDefaults: false }));
1911
+ _AssetLoader.addSource("mcassets", new HostedAssetSource(_AssetLoader.ROOT, { retryDefaults: false }));
1906
1912
  var AssetLoader = _AssetLoader;
1907
1913
 
1908
1914
  // src/assets/ModelTextures.ts
@@ -2550,18 +2556,18 @@ var MinecraftCubeTexture = class {
2550
2556
  }
2551
2557
  getUvEast(w, h, l) {
2552
2558
  return [
2553
- [this.mapW(this.u), this.mapH(this.v + l + h)],
2554
- [this.mapW(this.u + l), this.mapH(this.v + l + h)],
2555
- [this.mapW(this.u), this.mapH(this.v + l)],
2556
- [this.mapW(this.u + l), this.mapH(this.v + l)]
2559
+ [this.mapW(this.u + l + w + l), this.mapH(this.v + l + h)],
2560
+ [this.mapW(this.u + l + w), this.mapH(this.v + l + h)],
2561
+ [this.mapW(this.u + l + w + l), this.mapH(this.v + l)],
2562
+ [this.mapW(this.u + l + w), this.mapH(this.v + l)]
2557
2563
  ];
2558
2564
  }
2559
2565
  getUvWest(w, h, l) {
2560
2566
  return [
2561
- [this.mapW(this.u + l + w), this.mapH(this.v + l + h)],
2562
- [this.mapW(this.u + l + w + l), this.mapH(this.v + l + h)],
2563
- [this.mapW(this.u + l + w), this.mapH(this.v + l)],
2564
- [this.mapW(this.u + l + w + l), this.mapH(this.v + l)]
2567
+ [this.mapW(this.u + l), this.mapH(this.v + l + h)],
2568
+ [this.mapW(this.u), this.mapH(this.v + l + h)],
2569
+ [this.mapW(this.u + l), this.mapH(this.v + l)],
2570
+ [this.mapW(this.u), this.mapH(this.v + l)]
2565
2571
  ];
2566
2572
  }
2567
2573
  getUvUp(w, h, l) {
@@ -2574,26 +2580,26 @@ var MinecraftCubeTexture = class {
2574
2580
  }
2575
2581
  getUvDown(w, h, l) {
2576
2582
  return [
2577
- [this.mapW(this.u + l), this.mapH(this.v + l)],
2578
- [this.mapW(this.u + l + w), this.mapH(this.v + l)],
2579
2583
  [this.mapW(this.u + l), this.mapH(this.v)],
2580
- [this.mapW(this.u + l + w), this.mapH(this.v)]
2584
+ [this.mapW(this.u + l + w), this.mapH(this.v)],
2585
+ [this.mapW(this.u + l), this.mapH(this.v + l)],
2586
+ [this.mapW(this.u + l + w), this.mapH(this.v + l)]
2581
2587
  ];
2582
2588
  }
2583
2589
  getUvSouth(w, h, l) {
2584
2590
  return [
2585
- [this.mapW(this.u + l + w + l), this.mapH(this.v + l + h)],
2586
2591
  [this.mapW(this.u + l + w + l + w), this.mapH(this.v + l + h)],
2587
- [this.mapW(this.u + l + w + l), this.mapH(this.v + l)],
2588
- [this.mapW(this.u + l + w + l + w), this.mapH(this.v + l)]
2592
+ [this.mapW(this.u + l + w + l), this.mapH(this.v + l + h)],
2593
+ [this.mapW(this.u + l + w + l + w), this.mapH(this.v + l)],
2594
+ [this.mapW(this.u + l + w + l), this.mapH(this.v + l)]
2589
2595
  ];
2590
2596
  }
2591
2597
  getUvNorth(w, h, l) {
2592
2598
  return [
2593
- [this.mapW(this.u + l), this.mapH(this.v + l + h)],
2594
2599
  [this.mapW(this.u + l + w), this.mapH(this.v + l + h)],
2595
- [this.mapW(this.u + l), this.mapH(this.v + l)],
2596
- [this.mapW(this.u + l + w), this.mapH(this.v + l)]
2600
+ [this.mapW(this.u + l), this.mapH(this.v + l + h)],
2601
+ [this.mapW(this.u + l + w), this.mapH(this.v + l)],
2602
+ [this.mapW(this.u + l), this.mapH(this.v + l)]
2597
2603
  ];
2598
2604
  }
2599
2605
  getFaceUv(face, w, h, l) {
@@ -2612,10 +2618,12 @@ var MinecraftCubeTexture = class {
2612
2618
  return this.getUvNorth(w, h, l);
2613
2619
  }
2614
2620
  }
2615
- toUvArray(w, h, l) {
2621
+ toUvArray(w, h, l, mirror = false) {
2616
2622
  const uv = [];
2617
2623
  for (let i = 0; i < CUBE_FACES.length; i++) {
2618
- UVMapper.setFaceUvInArray(uv, i * 4, this.getFaceUv(CUBE_FACES[i], w, h, l));
2624
+ const face = mirror && i < 2 ? CUBE_FACES[1 - i] : CUBE_FACES[i];
2625
+ const corners = this.getFaceUv(face, w, h, l);
2626
+ UVMapper.setFaceUvInArray(uv, i * 4, mirror ? [corners[1], corners[0], corners[3], corners[2]] : corners);
2619
2627
  }
2620
2628
  return uv;
2621
2629
  }
@@ -2645,69 +2653,51 @@ function shutdown() {
2645
2653
  Caching.end();
2646
2654
  }
2647
2655
 
2648
- // src/assets/Entities.ts
2649
- var Entities = class {
2650
- static async getBlockEntityModels() {
2651
- const key = AssetKey.parse("models", "minerender:blockEntityModels");
2652
- console.log(key);
2653
- return Caching.entityModelsCache.get(key.serialize(), () => {
2654
- return AssetLoader.get(key, "json" /* JSON */);
2655
- });
2656
- }
2657
- static async getEntityModels() {
2658
- const key = AssetKey.parse("models", "minerender:entityModels");
2659
- console.log(key);
2660
- return Caching.entityModelsCache.get(key.serialize(), () => {
2661
- return AssetLoader.get(key, "json" /* JSON */);
2662
- });
2656
+ // src/error/MineRenderError.ts
2657
+ var MineRenderError = class _MineRenderError extends Error {
2658
+ constructor(msg) {
2659
+ super(msg);
2660
+ Object.setPrototypeOf(this, _MineRenderError.prototype);
2663
2661
  }
2664
- // BlockEntity names are hardcoded
2665
- static async getBlockList() {
2666
- const models = await this.getBlockEntityModels();
2667
- if (!models) {
2668
- return [];
2669
- }
2670
- return Object.keys(models);
2662
+ get name() {
2663
+ return "MineRenderError";
2671
2664
  }
2665
+ };
2666
+
2667
+ // src/assets/Entities.ts
2668
+ var Entities = class {
2672
2669
  static async getEntityList() {
2673
- const models = await this.getEntityModels();
2674
- if (!models) {
2675
- return [];
2676
- }
2677
- return Object.keys(models);
2678
- }
2679
- static async getBlock(modelKey, textureKey) {
2680
- const models = await this.getBlockEntityModels();
2681
- if (!models) {
2682
- return void 0;
2683
- }
2684
- if (!textureKey) {
2685
- textureKey = modelKey;
2686
- }
2687
- const baseKey = modelKey.path.includes("/") ? new BasicAssetKey(modelKey.namespace, modelKey.path.split("/")[0]) : modelKey;
2688
- return {
2689
- key: textureKey,
2690
- parts: models[baseKey.toNamespacedString()]
2670
+ const collect = async (path) => {
2671
+ const prefix2 = path ? `${path}/` : "";
2672
+ const key = new AssetKey(DEFAULT_NAMESPACE, `${prefix2}_list`, void 0, void 0, "entity-models", ".json");
2673
+ const list = await Caching.listAssetCache.get(key.serialize(), () => AssetLoader.get(key, "list" /* LIST */));
2674
+ if (!list) return [];
2675
+ const files = list.files.filter((file) => file.endsWith(".json") && file !== "_list.json").map((file) => `${prefix2}${file.slice(0, -5)}`);
2676
+ const children = await Promise.all(list.directories.map((directory) => collect(`${prefix2}${directory}`)));
2677
+ return [...files, ...children.flat()];
2691
2678
  };
2679
+ return collect("");
2692
2680
  }
2693
- static async getEntity(modelKey, textureKey) {
2694
- const models = await this.getEntityModels();
2695
- if (!models) {
2696
- return void 0;
2697
- }
2698
- if (!textureKey) {
2699
- textureKey = modelKey;
2681
+ static async getEntity(modelKey, textureKey, options) {
2682
+ const path = isAssetKey(modelKey) ? modelKey.getFullPath() : modelKey.path;
2683
+ const key = new AssetKey(modelKey.namespace, path, void 0, void 0, "entity-models", ".json");
2684
+ const model = await Caching.entityModelCache.get(key.serialize(), () => AssetLoader.get(key, "json" /* JSON */));
2685
+ if (!model) return void 0;
2686
+ const layerName = options?.layer ?? "main";
2687
+ const layer = model.layers[layerName];
2688
+ if (!layer) {
2689
+ throw new MineRenderError(`Entity ${model.id} has no layer "${layerName}". Available layers: ${Object.keys(model.layers).join(", ")}`);
2700
2690
  }
2701
- const baseKey = modelKey.path.includes("/") ? new BasicAssetKey(modelKey.namespace, modelKey.path.split("/")[0]) : modelKey;
2702
- return {
2703
- key: textureKey,
2704
- parts: models[baseKey.toNamespacedString()]
2705
- };
2691
+ return { key: textureKey ?? modelKey, layer, id: model.id };
2692
+ }
2693
+ /** @deprecated Use getEntityList(); block entities share the entity dataset. */
2694
+ static getBlockList() {
2695
+ return this.getEntityList();
2696
+ }
2697
+ /** @deprecated Use getEntity(); block entities share the entity dataset. */
2698
+ static getBlock(modelKey, textureKey, options) {
2699
+ return this.getEntity(modelKey, textureKey, options);
2706
2700
  }
2707
- };
2708
- var EntityModels = class {
2709
- };
2710
- var BlockEntityModels = class {
2711
2701
  };
2712
2702
 
2713
2703
  // src/renderer/SceneObject.ts
@@ -2756,17 +2746,6 @@ function isInstanceReference(obj) {
2756
2746
  return obj.isInstanceReference;
2757
2747
  }
2758
2748
 
2759
- // src/error/MineRenderError.ts
2760
- var MineRenderError = class _MineRenderError extends Error {
2761
- constructor(msg) {
2762
- super(msg);
2763
- Object.setPrototypeOf(this, _MineRenderError.prototype);
2764
- }
2765
- get name() {
2766
- return "MineRenderError";
2767
- }
2768
- };
2769
-
2770
2749
  // src/renderer/SceneObject.ts
2771
2750
  var import_ts_deepmerge3 = __toESM(require_dist());
2772
2751
  var p6 = prefix("SceneObject");
@@ -2892,15 +2871,8 @@ var _SceneObject = class _SceneObject extends Object3D2 {
2892
2871
  return this.toggleObjectVisibility(this.getMeshByName(name), visible);
2893
2872
  }
2894
2873
  iterateAllMeshes(cb) {
2895
- this.children.forEach((obj) => {
2896
- if (obj.isMesh) {
2897
- cb(obj);
2898
- }
2899
- obj.children.forEach((obj1) => {
2900
- if (obj1.isMesh) {
2901
- cb(obj1);
2902
- }
2903
- });
2874
+ this.traverse((obj) => {
2875
+ if (isMesh(obj)) cb(obj);
2904
2876
  });
2905
2877
  }
2906
2878
  //</editor-fold>
@@ -3145,14 +3117,13 @@ function isSceneObject(obj) {
3145
3117
  // src/entity/scene/EntityObject.ts
3146
3118
  var import_ts_deepmerge4 = __toESM(require_dist());
3147
3119
  import { Object3D as Object3D3 } from "three";
3148
- import * as THREE3 from "three";
3149
- var EntityObject = class extends SceneObject {
3120
+ var _EntityObject = class _EntityObject extends SceneObject {
3150
3121
  constructor(entity, options) {
3151
3122
  super();
3152
3123
  this.entity = entity;
3153
3124
  this.isEntityObject = true;
3154
3125
  this.meshesCreated = false;
3155
- this.options = (0, import_ts_deepmerge4.default)({}, SceneObject.DEFAULT_OPTIONS, options ?? {});
3126
+ this.options = (0, import_ts_deepmerge4.default)({}, _EntityObject.DEFAULT_OPTIONS, options ?? {});
3156
3127
  }
3157
3128
  async init() {
3158
3129
  this.createMeshes();
@@ -3162,10 +3133,10 @@ var EntityObject = class extends SceneObject {
3162
3133
  super.dispose();
3163
3134
  }
3164
3135
  get textureKey() {
3136
+ const key = this.entity.key;
3165
3137
  return new AssetKey(
3166
- this.entity.key?.namespace ?? DEFAULT_NAMESPACE,
3167
- this.entity.key.path,
3168
- //TODO: texture may differ from entity name; most of them are in subdirectories for multiple variants etc.
3138
+ key.namespace,
3139
+ isAssetKey(key) ? key.getFullPath() : key.path,
3169
3140
  "textures",
3170
3141
  "entity",
3171
3142
  "assets",
@@ -3175,36 +3146,41 @@ var EntityObject = class extends SceneObject {
3175
3146
  async loadTextures() {
3176
3147
  this.imageData = await ModelTextures.get(this.textureKey);
3177
3148
  }
3178
- //TODO: abstract this, since extracted model data can be used for entities, blocks, players
3179
3149
  createMeshes(force = false) {
3180
3150
  if (this.meshesCreated && !force) return;
3181
- const mat = Materials.MISSING_TEXTURE;
3182
- for (let partName in this.entity.parts) {
3183
- const part = this.entity.parts[partName];
3184
- const texture = new MinecraftCubeTexture(part.textureOffsetU, part.textureOffsetV, part.textureWidth, part.textureHeight);
3185
- const partAnchor = new Object3D3();
3186
- partAnchor.position.x = part.pivotX;
3187
- partAnchor.position.y = part.pivotY;
3188
- partAnchor.position.z = part.pivotZ;
3189
- for (let cube of part.cubes) {
3190
- const w = cube.maxX - cube.minX;
3191
- const h = cube.maxY - cube.minY;
3192
- const l = cube.maxZ - cube.minZ;
3193
- const uv = texture.toUvArray(w, h, l);
3194
- const cubeGeo = this._getBoxGeometryForDimensionsAndUv(w, h, l, uv).clone();
3195
- cubeGeo.applyMatrix4(new THREE3.Matrix4().makeTranslation(w / 2, h / 2, l / 2));
3196
- cubeGeo.applyMatrix4(new THREE3.Matrix4().makeTranslation(cube.minX, cube.minY, cube.minZ));
3197
- applyModelPartRotation(part, cubeGeo);
3198
- const mesh = this.createMesh(partName, cubeGeo, mat);
3199
- partAnchor.add(mesh);
3200
- if (this.options.wireframe) {
3201
- addWireframeToMesh(cubeGeo, mesh);
3202
- }
3203
- }
3204
- this.add(partAnchor);
3205
- }
3151
+ const modelRoot = new Object3D3();
3152
+ if (this.options.flip) modelRoot.scale.set(-1, -1, 1);
3153
+ this.add(modelRoot);
3154
+ this.createPart("root", this.entity.layer.root, modelRoot, this.entity.layer.texture, Materials.MISSING_TEXTURE);
3206
3155
  this.meshesCreated = true;
3207
3156
  }
3157
+ createPart(name, part, parent, textureSize, material) {
3158
+ const anchor = this.createGroup(name);
3159
+ anchor.position.fromArray(part.pose.offset);
3160
+ anchor.rotation.set(...part.pose.rotation, "ZYX");
3161
+ anchor.scale.fromArray(part.pose.scale ?? [1, 1, 1]);
3162
+ parent.add(anchor);
3163
+ const size = part.texture ?? textureSize;
3164
+ for (const cube of part.cubes) {
3165
+ const [width, height, depth] = cube.size;
3166
+ const [growX, growY, growZ] = cube.grow ?? [0, 0, 0];
3167
+ const texture = new MinecraftCubeTexture(...cube.uv, ...size);
3168
+ const uv = size[0] === 0 || size[1] === 0 ? new Array(48).fill(0) : texture.toUvArray(width, height, depth, cube.mirror);
3169
+ const geometry = this._getBoxGeometryForDimensionsAndUv(
3170
+ width + growX * 2,
3171
+ height + growY * 2,
3172
+ depth + growZ * 2,
3173
+ uv
3174
+ ).clone();
3175
+ geometry.translate(cube.origin[0] + width / 2, cube.origin[1] + height / 2, cube.origin[2] + depth / 2);
3176
+ const mesh = this.createMesh(name, geometry, material);
3177
+ anchor.add(mesh);
3178
+ if (this.options.wireframe) addWireframeToMesh(geometry, mesh);
3179
+ }
3180
+ for (const [childName, child] of Object.entries(part.children)) {
3181
+ this.createPart(childName, child, anchor, size, material);
3182
+ }
3183
+ }
3208
3184
  async applyTextures() {
3209
3185
  const assetKeyStr = this.textureKey.serialize();
3210
3186
  const keyStr = `entity:${assetKeyStr}`;
@@ -3225,7 +3201,8 @@ var EntityObject = class extends SceneObject {
3225
3201
  this.notifyDirty();
3226
3202
  }
3227
3203
  };
3228
- EntityObject.DEFAULT_OPTIONS = (0, import_ts_deepmerge4.default)({}, SceneObject.DEFAULT_OPTIONS, {});
3204
+ _EntityObject.DEFAULT_OPTIONS = (0, import_ts_deepmerge4.default)({}, SceneObject.DEFAULT_OPTIONS, { flip: true });
3205
+ var EntityObject = _EntityObject;
3229
3206
  function isEntityObject(obj) {
3230
3207
  return obj.isEntityObject;
3231
3208
  }
@@ -3756,7 +3733,7 @@ var BlockTints = class {
3756
3733
  };
3757
3734
 
3758
3735
  // src/model/scene/ModelObject.ts
3759
- import { BoxGeometry as BoxGeometry5, BufferAttribute as BufferAttribute4, Color as Color3, Euler as Euler5, Matrix4 as Matrix46 } from "three";
3736
+ import { BoxGeometry as BoxGeometry5, BufferAttribute as BufferAttribute4, Color as Color3, Euler as Euler4, Matrix4 as Matrix44 } from "three";
3760
3737
 
3761
3738
  // src/three/BufferGeometryUtils.js
3762
3739
  import {
@@ -3768,7 +3745,7 @@ import {
3768
3745
  TriangleFanDrawMode,
3769
3746
  TriangleStripDrawMode,
3770
3747
  TrianglesDrawMode,
3771
- Vector3 as Vector37
3748
+ Vector3 as Vector36
3772
3749
  } from "three";
3773
3750
  function computeTangents(geometry) {
3774
3751
  geometry.computeTangents();
@@ -4087,15 +4064,15 @@ function computeMorphedAttributes(object) {
4087
4064
  console.error("THREE.BufferGeometryUtils: Geometry is not of type BufferGeometry.");
4088
4065
  return null;
4089
4066
  }
4090
- const _vA = new Vector37();
4091
- const _vB = new Vector37();
4092
- const _vC = new Vector37();
4093
- const _tempA = new Vector37();
4094
- const _tempB = new Vector37();
4095
- const _tempC = new Vector37();
4096
- const _morphA = new Vector37();
4097
- const _morphB = new Vector37();
4098
- const _morphC = new Vector37();
4067
+ const _vA = new Vector36();
4068
+ const _vB = new Vector36();
4069
+ const _vC = new Vector36();
4070
+ const _tempA = new Vector36();
4071
+ const _tempB = new Vector36();
4072
+ const _tempC = new Vector36();
4073
+ const _morphA = new Vector36();
4074
+ const _morphB = new Vector36();
4075
+ const _morphC = new Vector36();
4099
4076
  function _calculateMorphedAttributeData(object2, material2, attribute, morphAttribute, morphTargetsRelative2, a2, b2, c2, modifiedAttributeArray) {
4100
4077
  _vA.fromBufferAttribute(attribute, a2);
4101
4078
  _vB.fromBufferAttribute(attribute, b2);
@@ -4339,7 +4316,7 @@ var _ModelObject = class _ModelObject extends SceneObject {
4339
4316
  this.atlas.model.elements?.forEach((el) => {
4340
4317
  const elGeo = this._getBoxGeometryFromElement(el).clone();
4341
4318
  if (this.options.uvLockRotation) {
4342
- UVMapper.lockUvs(elGeo, el.faces, this.atlas, new Euler5(...this.options.uvLockRotation));
4319
+ UVMapper.lockUvs(elGeo, el.faces, this.atlas, new Euler4(...this.options.uvLockRotation));
4343
4320
  }
4344
4321
  if (this.options.tints) {
4345
4322
  const colors = new Float32Array(elGeo.getAttribute("position").count * 3).fill(1);
@@ -4355,12 +4332,12 @@ var _ModelObject = class _ModelObject extends SceneObject {
4355
4332
  }
4356
4333
  elGeo.setAttribute("color", new BufferAttribute4(colors, 3));
4357
4334
  }
4358
- elGeo.applyMatrix4(new Matrix46().makeTranslation((el.to[0] - el.from[0]) / 2, (el.to[1] - el.from[1]) / 2, (el.to[2] - el.from[2]) / 2));
4359
- elGeo.applyMatrix4(new Matrix46().makeTranslation(el.from[0], el.from[1], el.from[2]));
4335
+ elGeo.applyMatrix4(new Matrix44().makeTranslation((el.to[0] - el.from[0]) / 2, (el.to[1] - el.from[1]) / 2, (el.to[2] - el.from[2]) / 2));
4336
+ elGeo.applyMatrix4(new Matrix44().makeTranslation(el.from[0], el.from[1], el.from[2]));
4360
4337
  if (el.rotation) {
4361
4338
  applyElementRotation(el.rotation, elGeo);
4362
4339
  }
4363
- elGeo.applyMatrix4(new Matrix46().makeTranslation(-8, -8, -8));
4340
+ elGeo.applyMatrix4(new Matrix44().makeTranslation(-8, -8, -8));
4364
4341
  if (displayTransform) DisplayTransforms.apply(elGeo, displayTransform);
4365
4342
  if (this.options.mergeMeshes) {
4366
4343
  allGeos.push(elGeo);
@@ -4437,7 +4414,7 @@ function isModelObject(obj) {
4437
4414
 
4438
4415
  // src/model/block/scene/BlockObject.ts
4439
4416
  var import_ts_deepmerge6 = __toESM(require_dist());
4440
- import { Euler as Euler6, Matrix4 as Matrix47, Vector3 as Vector38 } from "three";
4417
+ import { Euler as Euler5, Matrix4 as Matrix45, Vector3 as Vector37 } from "three";
4441
4418
  var p10 = prefix("BlockObject");
4442
4419
  function matchesCondition(condition, state) {
4443
4420
  return Object.entries(condition).every(([key, value]) => {
@@ -4494,7 +4471,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
4494
4471
  if (isModelObject(model)) {
4495
4472
  model.removeFromScene();
4496
4473
  } else if (isInstanceReference(model)) {
4497
- model.setScale(new Vector38(0, 0, 0));
4474
+ model.setScale(new Vector37(0, 0, 0));
4498
4475
  }
4499
4476
  }
4500
4477
  super.removeFromScene();
@@ -4555,7 +4532,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
4555
4532
  }
4556
4533
  for (let model of this._models) {
4557
4534
  if (isInstanceReference(model)) {
4558
- model.setScale(new Vector38(0, 0, 0));
4535
+ model.setScale(new Vector37(0, 0, 0));
4559
4536
  } else {
4560
4537
  model.dispose();
4561
4538
  }
@@ -4592,7 +4569,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
4592
4569
  await this.createVariant(variant);
4593
4570
  }
4594
4571
  async createVariant(variant) {
4595
- const rotation = new Euler6();
4572
+ const rotation = new Euler5();
4596
4573
  if (typeof variant.x !== "undefined") {
4597
4574
  rotation.x = toRadians(clampRotationDegrees(variant.x));
4598
4575
  }
@@ -4679,7 +4656,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
4679
4656
  setPositionRotationScaleAt(index, position, rotation, scale) {
4680
4657
  super.setPositionRotationScaleAt(index, position, rotation, scale);
4681
4658
  }
4682
- getMatrixAt(index, matrix = new Matrix47()) {
4659
+ getMatrixAt(index, matrix = new Matrix45()) {
4683
4660
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
4684
4661
  const child = this._models[0];
4685
4662
  if (child && isModelObject(child)) {
@@ -5725,7 +5702,7 @@ function isMineRenderScene(obj) {
5725
5702
  }
5726
5703
 
5727
5704
  // src/renderer/Renderer.ts
5728
- import { AxesHelper as AxesHelper3, GridHelper, OrthographicCamera, PCFSoftShadowMap, PerspectiveCamera, SRGBColorSpace as SRGBColorSpace3, Vector3 as Vector310, WebGLRenderer } from "three";
5705
+ import { AxesHelper as AxesHelper2, GridHelper, OrthographicCamera, PCFSoftShadowMap, PerspectiveCamera, SRGBColorSpace as SRGBColorSpace3, Vector3 as Vector39, WebGLRenderer } from "three";
5729
5706
  var import_ts_deepmerge9 = __toESM(require_dist());
5730
5707
  import Stats from "stats.js";
5731
5708
  import { EffectComposer, RenderPass } from "postprocessing";
@@ -5738,7 +5715,7 @@ import {
5738
5715
  Spherical,
5739
5716
  TOUCH,
5740
5717
  Vector2 as Vector23,
5741
- Vector3 as Vector39
5718
+ Vector3 as Vector38
5742
5719
  } from "three";
5743
5720
  var _changeEvent = { type: "change" };
5744
5721
  var _startEvent = { type: "start" };
@@ -5752,7 +5729,7 @@ var OrbitControls = class extends EventDispatcher {
5752
5729
  this.domElement = domElement;
5753
5730
  this.domElement.style.touchAction = "none";
5754
5731
  this.enabled = true;
5755
- this.target = new Vector39();
5732
+ this.target = new Vector38();
5756
5733
  this.minDistance = 0;
5757
5734
  this.maxDistance = Infinity;
5758
5735
  this.minZoom = 0;
@@ -5804,10 +5781,10 @@ var OrbitControls = class extends EventDispatcher {
5804
5781
  state = STATE.NONE;
5805
5782
  };
5806
5783
  this.update = function() {
5807
- const offset = new Vector39();
5808
- const quat = new Quaternion4().setFromUnitVectors(object.up, new Vector39(0, 1, 0));
5784
+ const offset = new Vector38();
5785
+ const quat = new Quaternion4().setFromUnitVectors(object.up, new Vector38(0, 1, 0));
5809
5786
  const quatInverse = quat.clone().invert();
5810
- const lastPosition = new Vector39();
5787
+ const lastPosition = new Vector38();
5811
5788
  const lastQuaternion = new Quaternion4();
5812
5789
  const twoPI = 2 * Math.PI;
5813
5790
  return function update() {
@@ -5897,7 +5874,7 @@ var OrbitControls = class extends EventDispatcher {
5897
5874
  const spherical = new Spherical();
5898
5875
  const sphericalDelta = new Spherical();
5899
5876
  let scale = 1;
5900
- const panOffset = new Vector39();
5877
+ const panOffset = new Vector38();
5901
5878
  let zoomChanged = false;
5902
5879
  const rotateStart = new Vector23();
5903
5880
  const rotateEnd = new Vector23();
@@ -5923,7 +5900,7 @@ var OrbitControls = class extends EventDispatcher {
5923
5900
  sphericalDelta.phi -= angle;
5924
5901
  }
5925
5902
  const panLeft = function() {
5926
- const v = new Vector39();
5903
+ const v = new Vector38();
5927
5904
  return function panLeft2(distance, objectMatrix) {
5928
5905
  v.setFromMatrixColumn(objectMatrix, 0);
5929
5906
  v.multiplyScalar(-distance);
@@ -5931,7 +5908,7 @@ var OrbitControls = class extends EventDispatcher {
5931
5908
  };
5932
5909
  }();
5933
5910
  const panUp = function() {
5934
- const v = new Vector39();
5911
+ const v = new Vector38();
5935
5912
  return function panUp2(distance, objectMatrix) {
5936
5913
  if (scope.screenSpacePanning === true) {
5937
5914
  v.setFromMatrixColumn(objectMatrix, 1);
@@ -5944,7 +5921,7 @@ var OrbitControls = class extends EventDispatcher {
5944
5921
  };
5945
5922
  }();
5946
5923
  const pan = function() {
5947
- const offset = new Vector39();
5924
+ const offset = new Vector38();
5948
5925
  return function pan2(deltaX, deltaY) {
5949
5926
  const element = scope.domElement;
5950
5927
  if (scope.object.isPerspectiveCamera) {
@@ -6487,7 +6464,7 @@ var _Renderer = class _Renderer {
6487
6464
  this.scene.add(gridHelper3);
6488
6465
  }
6489
6466
  if (this.options.debug.axes) {
6490
- const axesHelper = new AxesHelper3(64);
6467
+ const axesHelper = new AxesHelper2(64);
6491
6468
  this._debugHelpers.push(axesHelper);
6492
6469
  this.scene.add(axesHelper);
6493
6470
  }
@@ -6691,8 +6668,8 @@ _Renderer.DEFAULT_OPTIONS = (0, import_ts_deepmerge9.default)({}, {
6691
6668
  top: void 0,
6692
6669
  bottom: void 0
6693
6670
  },
6694
- position: new Vector310(50, 50, 50),
6695
- lookingAt: new Vector310(0, 0, 0)
6671
+ position: new Vector39(50, 50, 50),
6672
+ lookingAt: new Vector39(0, 0, 0)
6696
6673
  },
6697
6674
  render: {
6698
6675
  fpsLimit: 60,
@@ -6886,10 +6863,10 @@ var Skins = class {
6886
6863
  };
6887
6864
 
6888
6865
  // src/world/Chunk.ts
6889
- import { Box3 as Box32, Object3D as Object3D6, Vector3 as Vector312 } from "three";
6866
+ import { Box3 as Box32, Object3D as Object3D6, Vector3 as Vector311 } from "three";
6890
6867
 
6891
6868
  // src/world/MineRenderWorld.ts
6892
- import { Vector3 as Vector311 } from "three";
6869
+ import { Vector3 as Vector310 } from "three";
6893
6870
  var MineRenderWorld = class {
6894
6871
  constructor(scene) {
6895
6872
  this._size = 4;
@@ -6900,10 +6877,10 @@ var MineRenderWorld = class {
6900
6877
  }
6901
6878
  getBlockAt(posOrX, y, z) {
6902
6879
  if (typeof posOrX == "number") {
6903
- return this.getBlockAt(new Vector311(posOrX, y, z));
6880
+ return this.getBlockAt(new Vector310(posOrX, y, z));
6904
6881
  }
6905
6882
  if (isTripleArray(posOrX)) {
6906
- return this.getBlockAt(new Vector311(posOrX[0], posOrX[1], posOrX[2]));
6883
+ return this.getBlockAt(new Vector310(posOrX[0], posOrX[1], posOrX[2]));
6907
6884
  }
6908
6885
  const chunk = this.getChunkAt(posOrX);
6909
6886
  if (typeof chunk === "undefined") {
@@ -6914,10 +6891,10 @@ var MineRenderWorld = class {
6914
6891
  }
6915
6892
  async setBlockAt(posOrX, yOrBlock, z, block) {
6916
6893
  if (typeof posOrX == "number") {
6917
- return this.setBlockAt(new Vector311(posOrX, yOrBlock, z), block);
6894
+ return this.setBlockAt(new Vector310(posOrX, yOrBlock, z), block);
6918
6895
  }
6919
6896
  if (isTripleArray(posOrX)) {
6920
- return this.setBlockAt(new Vector311(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
6897
+ return this.setBlockAt(new Vector310(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
6921
6898
  }
6922
6899
  this.validatePosBounds(posOrX);
6923
6900
  const chunk = this.getOrCreateChunkAt(posOrX);
@@ -6963,14 +6940,14 @@ var MineRenderWorld = class {
6963
6940
  return this._chunks[index];
6964
6941
  }
6965
6942
  static worldToScenePosition(pos) {
6966
- return new Vector311(
6943
+ return new Vector310(
6967
6944
  pos.x * 16,
6968
6945
  pos.y * 16,
6969
6946
  pos.z * 16
6970
6947
  );
6971
6948
  }
6972
6949
  static sceneToWorldPosition(pos) {
6973
- return new Vector311(
6950
+ return new Vector310(
6974
6951
  pos.x / 16,
6975
6952
  pos.y / 16,
6976
6953
  pos.z / 16
@@ -7012,7 +6989,7 @@ var Chunk = class _Chunk {
7012
6989
  scene.add(anchor);
7013
6990
  anchor.position.set(this.x * 256 + 128 - 8, this.y * 256 + 128 - 8, this.z * 256 + 128 - 8);
7014
6991
  addBox3WireframeToObject(
7015
- new Box32(new Vector312(0, 0, 0), new Vector312(256, 256, 256)),
6992
+ new Box32(new Vector311(0, 0, 0), new Vector311(256, 256, 256)),
7016
6993
  anchor,
7017
6994
  16776960,
7018
6995
  4
@@ -7020,10 +6997,10 @@ var Chunk = class _Chunk {
7020
6997
  }
7021
6998
  getBlockAt(posOrX, y, z) {
7022
6999
  if (typeof posOrX == "number") {
7023
- return this.getBlockAt(new Vector312(posOrX, y, z));
7000
+ return this.getBlockAt(new Vector311(posOrX, y, z));
7024
7001
  }
7025
7002
  if (isTripleArray(posOrX)) {
7026
- return this.getBlockAt(new Vector312(posOrX[0], posOrX[1], posOrX[2]));
7003
+ return this.getBlockAt(new Vector311(posOrX[0], posOrX[1], posOrX[2]));
7027
7004
  }
7028
7005
  const pos = this.worldPosToChunkPos(posOrX);
7029
7006
  const index = _Chunk.chunkPosToBlockIndex(pos);
@@ -7031,10 +7008,10 @@ var Chunk = class _Chunk {
7031
7008
  }
7032
7009
  async setBlockAt(posOrX, yOrBlock, z, block) {
7033
7010
  if (typeof posOrX == "number") {
7034
- return this.setBlockAt(new Vector312(posOrX, yOrBlock, z), block);
7011
+ return this.setBlockAt(new Vector311(posOrX, yOrBlock, z), block);
7035
7012
  }
7036
7013
  if (isTripleArray(posOrX)) {
7037
- return this.setBlockAt(new Vector312(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
7014
+ return this.setBlockAt(new Vector311(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
7038
7015
  }
7039
7016
  const worldPos = posOrX;
7040
7017
  const pos = this.worldPosToChunkPos(worldPos);
@@ -7080,7 +7057,7 @@ var Chunk = class _Chunk {
7080
7057
  }
7081
7058
  async clear() {
7082
7059
  let promises = [];
7083
- let pos = new Vector312();
7060
+ let pos = new Vector311();
7084
7061
  for (let x = 0; x < 16; x++) {
7085
7062
  for (let z = 0; z < 16; z++) {
7086
7063
  for (let y = 0; y < 16; y++) {
@@ -7099,14 +7076,14 @@ var Chunk = class _Chunk {
7099
7076
  return pos.y * 16 * 16 + pos.z * 16 + pos.x;
7100
7077
  }
7101
7078
  worldPosToChunkPos(pos) {
7102
- return new Vector312(
7079
+ return new Vector311(
7103
7080
  pos.x - this.x * 16,
7104
7081
  pos.y - this.y * 16,
7105
7082
  pos.z - this.z * 16
7106
7083
  );
7107
7084
  }
7108
7085
  chunkPosToWorldPos(pos) {
7109
- return new Vector312(
7086
+ return new Vector311(
7110
7087
  this.x * 16 + pos.x,
7111
7088
  this.y * 16 + pos.y,
7112
7089
  this.z * 16 + pos.z
@@ -7127,7 +7104,6 @@ export {
7127
7104
  BUILTIN_GENERATED,
7128
7105
  BasicAssetKey,
7129
7106
  BatchedExecutor,
7130
- BlockEntityModels,
7131
7107
  BlockObject,
7132
7108
  BlockStates,
7133
7109
  BlockTints,
@@ -7149,7 +7125,6 @@ export {
7149
7125
  DisplayPosition,
7150
7126
  DisplayTransforms,
7151
7127
  Entities,
7152
- EntityModels,
7153
7128
  EntityObject,
7154
7129
  Env,
7155
7130
  Geometries,
@@ -7201,7 +7176,6 @@ export {
7201
7176
  addWireframeToObject,
7202
7177
  applyElementRotation,
7203
7178
  applyGenericRotation,
7204
- applyModelPartRotation,
7205
7179
  axisToVec3,
7206
7180
  base64decode,
7207
7181
  base64encode,