minerender 2.1.0-alpha.23 → 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.
@@ -405,7 +405,7 @@ var Caching = class _Caching {
405
405
  this.blockTintCache = _Caching.createAssetCache();
406
406
  }
407
407
  static {
408
- this.entityModelsCache = _Caching.createAssetCache();
408
+ this.entityModelCache = _Caching.createAssetCache();
409
409
  }
410
410
  static createAssetCache() {
411
411
  return Caches.builder().expireAfterWrite(Time.minutes(10)).expireAfterAccess(Time.minutes(5)).expirationInterval(Time.seconds(30)).buildAsync();
@@ -430,7 +430,7 @@ var Caching = class _Caching {
430
430
  this.listAssetCache,
431
431
  this.defaultBlockStatesCache,
432
432
  this.blockTintCache,
433
- this.entityModelsCache
433
+ this.entityModelCache
434
434
  ];
435
435
  }
436
436
  static clear() {
@@ -1540,14 +1540,6 @@ function applyElementRotation(rotation, geometry) {
1540
1540
  }
1541
1541
  geometry.translate(origin.x, origin.y, origin.z);
1542
1542
  }
1543
- function applyModelPartRotation(modelPart, geometry) {
1544
- const origin = new Vector33(modelPart.pivotX, modelPart.pivotY, modelPart.pivotZ);
1545
- geometry.translate(-origin.x, -origin.y, -origin.z);
1546
- geometry.rotateX(toRadians(modelPart.pitch));
1547
- geometry.rotateY(toRadians(modelPart.yaw));
1548
- geometry.rotateZ(toRadians(modelPart.roll));
1549
- geometry.translate(origin.x, origin.y, origin.z);
1550
- }
1551
1543
  function applyGenericRotation(axis, rotation, obj) {
1552
1544
  switch (axis) {
1553
1545
  case "x" /* X */:
@@ -2604,18 +2596,18 @@ var MinecraftCubeTexture = class {
2604
2596
  }
2605
2597
  getUvEast(w, h, l) {
2606
2598
  return [
2607
- [this.mapW(this.u), this.mapH(this.v + l + h)],
2608
- [this.mapW(this.u + l), this.mapH(this.v + l + h)],
2609
- [this.mapW(this.u), this.mapH(this.v + l)],
2610
- [this.mapW(this.u + l), this.mapH(this.v + l)]
2599
+ [this.mapW(this.u + l + w + l), this.mapH(this.v + l + h)],
2600
+ [this.mapW(this.u + l + w), this.mapH(this.v + l + h)],
2601
+ [this.mapW(this.u + l + w + l), this.mapH(this.v + l)],
2602
+ [this.mapW(this.u + l + w), this.mapH(this.v + l)]
2611
2603
  ];
2612
2604
  }
2613
2605
  getUvWest(w, h, l) {
2614
2606
  return [
2615
- [this.mapW(this.u + l + w), this.mapH(this.v + l + h)],
2616
- [this.mapW(this.u + l + w + l), this.mapH(this.v + l + h)],
2617
- [this.mapW(this.u + l + w), this.mapH(this.v + l)],
2618
- [this.mapW(this.u + l + w + l), this.mapH(this.v + l)]
2607
+ [this.mapW(this.u + l), this.mapH(this.v + l + h)],
2608
+ [this.mapW(this.u), this.mapH(this.v + l + h)],
2609
+ [this.mapW(this.u + l), this.mapH(this.v + l)],
2610
+ [this.mapW(this.u), this.mapH(this.v + l)]
2619
2611
  ];
2620
2612
  }
2621
2613
  getUvUp(w, h, l) {
@@ -2628,26 +2620,26 @@ var MinecraftCubeTexture = class {
2628
2620
  }
2629
2621
  getUvDown(w, h, l) {
2630
2622
  return [
2631
- [this.mapW(this.u + l), this.mapH(this.v + l)],
2632
- [this.mapW(this.u + l + w), this.mapH(this.v + l)],
2633
2623
  [this.mapW(this.u + l), this.mapH(this.v)],
2634
- [this.mapW(this.u + l + w), this.mapH(this.v)]
2624
+ [this.mapW(this.u + l + w), this.mapH(this.v)],
2625
+ [this.mapW(this.u + l), this.mapH(this.v + l)],
2626
+ [this.mapW(this.u + l + w), this.mapH(this.v + l)]
2635
2627
  ];
2636
2628
  }
2637
2629
  getUvSouth(w, h, l) {
2638
2630
  return [
2639
- [this.mapW(this.u + l + w + l), this.mapH(this.v + l + h)],
2640
2631
  [this.mapW(this.u + l + w + l + w), this.mapH(this.v + l + h)],
2641
- [this.mapW(this.u + l + w + l), this.mapH(this.v + l)],
2642
- [this.mapW(this.u + l + w + l + w), this.mapH(this.v + l)]
2632
+ [this.mapW(this.u + l + w + l), this.mapH(this.v + l + h)],
2633
+ [this.mapW(this.u + l + w + l + w), this.mapH(this.v + l)],
2634
+ [this.mapW(this.u + l + w + l), this.mapH(this.v + l)]
2643
2635
  ];
2644
2636
  }
2645
2637
  getUvNorth(w, h, l) {
2646
2638
  return [
2647
- [this.mapW(this.u + l), this.mapH(this.v + l + h)],
2648
2639
  [this.mapW(this.u + l + w), this.mapH(this.v + l + h)],
2649
- [this.mapW(this.u + l), this.mapH(this.v + l)],
2650
- [this.mapW(this.u + l + w), this.mapH(this.v + l)]
2640
+ [this.mapW(this.u + l), this.mapH(this.v + l + h)],
2641
+ [this.mapW(this.u + l + w), this.mapH(this.v + l)],
2642
+ [this.mapW(this.u + l), this.mapH(this.v + l)]
2651
2643
  ];
2652
2644
  }
2653
2645
  getFaceUv(face, w, h, l) {
@@ -2666,10 +2658,12 @@ var MinecraftCubeTexture = class {
2666
2658
  return this.getUvNorth(w, h, l);
2667
2659
  }
2668
2660
  }
2669
- toUvArray(w, h, l) {
2661
+ toUvArray(w, h, l, mirror = false) {
2670
2662
  const uv = [];
2671
2663
  for (let i = 0; i < CUBE_FACES.length; i++) {
2672
- UVMapper.setFaceUvInArray(uv, i * 4, this.getFaceUv(CUBE_FACES[i], w, h, l));
2664
+ const face = mirror && i < 2 ? CUBE_FACES[1 - i] : CUBE_FACES[i];
2665
+ const corners = this.getFaceUv(face, w, h, l);
2666
+ UVMapper.setFaceUvInArray(uv, i * 4, mirror ? [corners[1], corners[0], corners[3], corners[2]] : corners);
2673
2667
  }
2674
2668
  return uv;
2675
2669
  }
@@ -2699,69 +2693,51 @@ function shutdown() {
2699
2693
  Caching.end();
2700
2694
  }
2701
2695
 
2702
- // src/assets/Entities.ts
2703
- var Entities = class {
2704
- static async getBlockEntityModels() {
2705
- const key = AssetKey.parse("models", "minerender:blockEntityModels");
2706
- console.log(key);
2707
- return Caching.entityModelsCache.get(key.serialize(), () => {
2708
- return AssetLoader.get(key, "json" /* JSON */);
2709
- });
2710
- }
2711
- static async getEntityModels() {
2712
- const key = AssetKey.parse("models", "minerender:entityModels");
2713
- console.log(key);
2714
- return Caching.entityModelsCache.get(key.serialize(), () => {
2715
- return AssetLoader.get(key, "json" /* JSON */);
2716
- });
2696
+ // src/error/MineRenderError.ts
2697
+ var MineRenderError = class _MineRenderError extends Error {
2698
+ constructor(msg) {
2699
+ super(msg);
2700
+ Object.setPrototypeOf(this, _MineRenderError.prototype);
2717
2701
  }
2718
- // BlockEntity names are hardcoded
2719
- static async getBlockList() {
2720
- const models = await this.getBlockEntityModels();
2721
- if (!models) {
2722
- return [];
2723
- }
2724
- return Object.keys(models);
2702
+ get name() {
2703
+ return "MineRenderError";
2725
2704
  }
2705
+ };
2706
+
2707
+ // src/assets/Entities.ts
2708
+ var Entities = class {
2726
2709
  static async getEntityList() {
2727
- const models = await this.getEntityModels();
2728
- if (!models) {
2729
- return [];
2730
- }
2731
- return Object.keys(models);
2732
- }
2733
- static async getBlock(modelKey, textureKey) {
2734
- const models = await this.getBlockEntityModels();
2735
- if (!models) {
2736
- return void 0;
2737
- }
2738
- if (!textureKey) {
2739
- textureKey = modelKey;
2740
- }
2741
- const baseKey = modelKey.path.includes("/") ? new BasicAssetKey(modelKey.namespace, modelKey.path.split("/")[0]) : modelKey;
2742
- return {
2743
- key: textureKey,
2744
- parts: models[baseKey.toNamespacedString()]
2710
+ const collect = async (path) => {
2711
+ const prefix2 = path ? `${path}/` : "";
2712
+ const key = new AssetKey(DEFAULT_NAMESPACE, `${prefix2}_list`, void 0, void 0, "entity-models", ".json");
2713
+ const list = await Caching.listAssetCache.get(key.serialize(), () => AssetLoader.get(key, "list" /* LIST */));
2714
+ if (!list) return [];
2715
+ const files = list.files.filter((file) => file.endsWith(".json") && file !== "_list.json").map((file) => `${prefix2}${file.slice(0, -5)}`);
2716
+ const children = await Promise.all(list.directories.map((directory) => collect(`${prefix2}${directory}`)));
2717
+ return [...files, ...children.flat()];
2745
2718
  };
2719
+ return collect("");
2746
2720
  }
2747
- static async getEntity(modelKey, textureKey) {
2748
- const models = await this.getEntityModels();
2749
- if (!models) {
2750
- return void 0;
2721
+ static async getEntity(modelKey, textureKey, options) {
2722
+ const path = isAssetKey(modelKey) ? modelKey.getFullPath() : modelKey.path;
2723
+ const key = new AssetKey(modelKey.namespace, path, void 0, void 0, "entity-models", ".json");
2724
+ const model = await Caching.entityModelCache.get(key.serialize(), () => AssetLoader.get(key, "json" /* JSON */));
2725
+ if (!model) return void 0;
2726
+ const layerName = options?.layer ?? "main";
2727
+ const layer = model.layers[layerName];
2728
+ if (!layer) {
2729
+ throw new MineRenderError(`Entity ${model.id} has no layer "${layerName}". Available layers: ${Object.keys(model.layers).join(", ")}`);
2751
2730
  }
2752
- if (!textureKey) {
2753
- textureKey = modelKey;
2754
- }
2755
- const baseKey = modelKey.path.includes("/") ? new BasicAssetKey(modelKey.namespace, modelKey.path.split("/")[0]) : modelKey;
2756
- return {
2757
- key: textureKey,
2758
- parts: models[baseKey.toNamespacedString()]
2759
- };
2731
+ return { key: textureKey ?? modelKey, layer, id: model.id };
2732
+ }
2733
+ /** @deprecated Use getEntityList(); block entities share the entity dataset. */
2734
+ static getBlockList() {
2735
+ return this.getEntityList();
2736
+ }
2737
+ /** @deprecated Use getEntity(); block entities share the entity dataset. */
2738
+ static getBlock(modelKey, textureKey, options) {
2739
+ return this.getEntity(modelKey, textureKey, options);
2760
2740
  }
2761
- };
2762
- var EntityModels = class {
2763
- };
2764
- var BlockEntityModels = class {
2765
2741
  };
2766
2742
 
2767
2743
  // src/renderer/SceneObject.ts
@@ -2810,17 +2786,6 @@ function isInstanceReference(obj) {
2810
2786
  return obj.isInstanceReference;
2811
2787
  }
2812
2788
 
2813
- // src/error/MineRenderError.ts
2814
- var MineRenderError = class _MineRenderError extends Error {
2815
- constructor(msg) {
2816
- super(msg);
2817
- Object.setPrototypeOf(this, _MineRenderError.prototype);
2818
- }
2819
- get name() {
2820
- return "MineRenderError";
2821
- }
2822
- };
2823
-
2824
2789
  // src/renderer/SceneObject.ts
2825
2790
  var import_ts_deepmerge3 = __toESM(require_dist());
2826
2791
  var p6 = prefix("SceneObject");
@@ -2954,15 +2919,8 @@ var SceneObject = class _SceneObject extends Object3D2 {
2954
2919
  return this.toggleObjectVisibility(this.getMeshByName(name), visible);
2955
2920
  }
2956
2921
  iterateAllMeshes(cb) {
2957
- this.children.forEach((obj) => {
2958
- if (obj.isMesh) {
2959
- cb(obj);
2960
- }
2961
- obj.children.forEach((obj1) => {
2962
- if (obj1.isMesh) {
2963
- cb(obj1);
2964
- }
2965
- });
2922
+ this.traverse((obj) => {
2923
+ if (isMesh(obj)) cb(obj);
2966
2924
  });
2967
2925
  }
2968
2926
  //</editor-fold>
@@ -3200,17 +3158,16 @@ function isSceneObject(obj) {
3200
3158
  // src/entity/scene/EntityObject.ts
3201
3159
  var import_ts_deepmerge4 = __toESM(require_dist());
3202
3160
  import { Object3D as Object3D3 } from "three";
3203
- import * as THREE3 from "three";
3204
- var EntityObject = class extends SceneObject {
3161
+ var EntityObject = class _EntityObject extends SceneObject {
3205
3162
  constructor(entity, options) {
3206
3163
  super();
3207
3164
  this.entity = entity;
3208
3165
  this.isEntityObject = true;
3209
3166
  this.meshesCreated = false;
3210
- this.options = (0, import_ts_deepmerge4.default)({}, SceneObject.DEFAULT_OPTIONS, options ?? {});
3167
+ this.options = (0, import_ts_deepmerge4.default)({}, _EntityObject.DEFAULT_OPTIONS, options ?? {});
3211
3168
  }
3212
3169
  static {
3213
- this.DEFAULT_OPTIONS = (0, import_ts_deepmerge4.default)({}, SceneObject.DEFAULT_OPTIONS, {});
3170
+ this.DEFAULT_OPTIONS = (0, import_ts_deepmerge4.default)({}, SceneObject.DEFAULT_OPTIONS, { flip: true });
3214
3171
  }
3215
3172
  async init() {
3216
3173
  this.createMeshes();
@@ -3220,10 +3177,10 @@ var EntityObject = class extends SceneObject {
3220
3177
  super.dispose();
3221
3178
  }
3222
3179
  get textureKey() {
3180
+ const key = this.entity.key;
3223
3181
  return new AssetKey(
3224
- this.entity.key?.namespace ?? DEFAULT_NAMESPACE,
3225
- this.entity.key.path,
3226
- //TODO: texture may differ from entity name; most of them are in subdirectories for multiple variants etc.
3182
+ key.namespace,
3183
+ isAssetKey(key) ? key.getFullPath() : key.path,
3227
3184
  "textures",
3228
3185
  "entity",
3229
3186
  "assets",
@@ -3233,36 +3190,41 @@ var EntityObject = class extends SceneObject {
3233
3190
  async loadTextures() {
3234
3191
  this.imageData = await ModelTextures.get(this.textureKey);
3235
3192
  }
3236
- //TODO: abstract this, since extracted model data can be used for entities, blocks, players
3237
3193
  createMeshes(force = false) {
3238
3194
  if (this.meshesCreated && !force) return;
3239
- const mat = Materials.MISSING_TEXTURE;
3240
- for (let partName in this.entity.parts) {
3241
- const part = this.entity.parts[partName];
3242
- const texture = new MinecraftCubeTexture(part.textureOffsetU, part.textureOffsetV, part.textureWidth, part.textureHeight);
3243
- const partAnchor = new Object3D3();
3244
- partAnchor.position.x = part.pivotX;
3245
- partAnchor.position.y = part.pivotY;
3246
- partAnchor.position.z = part.pivotZ;
3247
- for (let cube of part.cubes) {
3248
- const w = cube.maxX - cube.minX;
3249
- const h = cube.maxY - cube.minY;
3250
- const l = cube.maxZ - cube.minZ;
3251
- const uv = texture.toUvArray(w, h, l);
3252
- const cubeGeo = this._getBoxGeometryForDimensionsAndUv(w, h, l, uv).clone();
3253
- cubeGeo.applyMatrix4(new THREE3.Matrix4().makeTranslation(w / 2, h / 2, l / 2));
3254
- cubeGeo.applyMatrix4(new THREE3.Matrix4().makeTranslation(cube.minX, cube.minY, cube.minZ));
3255
- applyModelPartRotation(part, cubeGeo);
3256
- const mesh = this.createMesh(partName, cubeGeo, mat);
3257
- partAnchor.add(mesh);
3258
- if (this.options.wireframe) {
3259
- addWireframeToMesh(cubeGeo, mesh);
3260
- }
3261
- }
3262
- this.add(partAnchor);
3263
- }
3195
+ const modelRoot = new Object3D3();
3196
+ if (this.options.flip) modelRoot.scale.set(-1, -1, 1);
3197
+ this.add(modelRoot);
3198
+ this.createPart("root", this.entity.layer.root, modelRoot, this.entity.layer.texture, Materials.MISSING_TEXTURE);
3264
3199
  this.meshesCreated = true;
3265
3200
  }
3201
+ createPart(name, part, parent, textureSize, material) {
3202
+ const anchor = this.createGroup(name);
3203
+ anchor.position.fromArray(part.pose.offset);
3204
+ anchor.rotation.set(...part.pose.rotation, "ZYX");
3205
+ anchor.scale.fromArray(part.pose.scale ?? [1, 1, 1]);
3206
+ parent.add(anchor);
3207
+ const size = part.texture ?? textureSize;
3208
+ for (const cube of part.cubes) {
3209
+ const [width, height, depth] = cube.size;
3210
+ const [growX, growY, growZ] = cube.grow ?? [0, 0, 0];
3211
+ const texture = new MinecraftCubeTexture(...cube.uv, ...size);
3212
+ const uv = size[0] === 0 || size[1] === 0 ? new Array(48).fill(0) : texture.toUvArray(width, height, depth, cube.mirror);
3213
+ const geometry = this._getBoxGeometryForDimensionsAndUv(
3214
+ width + growX * 2,
3215
+ height + growY * 2,
3216
+ depth + growZ * 2,
3217
+ uv
3218
+ ).clone();
3219
+ geometry.translate(cube.origin[0] + width / 2, cube.origin[1] + height / 2, cube.origin[2] + depth / 2);
3220
+ const mesh = this.createMesh(name, geometry, material);
3221
+ anchor.add(mesh);
3222
+ if (this.options.wireframe) addWireframeToMesh(geometry, mesh);
3223
+ }
3224
+ for (const [childName, child] of Object.entries(part.children)) {
3225
+ this.createPart(childName, child, anchor, size, material);
3226
+ }
3227
+ }
3266
3228
  async applyTextures() {
3267
3229
  const assetKeyStr = this.textureKey.serialize();
3268
3230
  const keyStr = `entity:${assetKeyStr}`;
@@ -3813,7 +3775,7 @@ var BlockTints = class {
3813
3775
  };
3814
3776
 
3815
3777
  // src/model/scene/ModelObject.ts
3816
- import { BoxGeometry as BoxGeometry5, BufferAttribute as BufferAttribute4, Color as Color3, Euler as Euler5, Matrix4 as Matrix46 } from "three";
3778
+ import { BoxGeometry as BoxGeometry5, BufferAttribute as BufferAttribute4, Color as Color3, Euler as Euler4, Matrix4 as Matrix44 } from "three";
3817
3779
 
3818
3780
  // src/three/BufferGeometryUtils.js
3819
3781
  import {
@@ -3825,7 +3787,7 @@ import {
3825
3787
  TriangleFanDrawMode,
3826
3788
  TriangleStripDrawMode,
3827
3789
  TrianglesDrawMode,
3828
- Vector3 as Vector37
3790
+ Vector3 as Vector36
3829
3791
  } from "three";
3830
3792
  function computeTangents(geometry) {
3831
3793
  geometry.computeTangents();
@@ -4144,15 +4106,15 @@ function computeMorphedAttributes(object) {
4144
4106
  console.error("THREE.BufferGeometryUtils: Geometry is not of type BufferGeometry.");
4145
4107
  return null;
4146
4108
  }
4147
- const _vA = new Vector37();
4148
- const _vB = new Vector37();
4149
- const _vC = new Vector37();
4150
- const _tempA = new Vector37();
4151
- const _tempB = new Vector37();
4152
- const _tempC = new Vector37();
4153
- const _morphA = new Vector37();
4154
- const _morphB = new Vector37();
4155
- const _morphC = new Vector37();
4109
+ const _vA = new Vector36();
4110
+ const _vB = new Vector36();
4111
+ const _vC = new Vector36();
4112
+ const _tempA = new Vector36();
4113
+ const _tempB = new Vector36();
4114
+ const _tempC = new Vector36();
4115
+ const _morphA = new Vector36();
4116
+ const _morphB = new Vector36();
4117
+ const _morphC = new Vector36();
4156
4118
  function _calculateMorphedAttributeData(object2, material2, attribute, morphAttribute, morphTargetsRelative2, a2, b2, c2, modifiedAttributeArray) {
4157
4119
  _vA.fromBufferAttribute(attribute, a2);
4158
4120
  _vB.fromBufferAttribute(attribute, b2);
@@ -4399,7 +4361,7 @@ var ModelObject = class _ModelObject extends SceneObject {
4399
4361
  this.atlas.model.elements?.forEach((el) => {
4400
4362
  const elGeo = this._getBoxGeometryFromElement(el).clone();
4401
4363
  if (this.options.uvLockRotation) {
4402
- UVMapper.lockUvs(elGeo, el.faces, this.atlas, new Euler5(...this.options.uvLockRotation));
4364
+ UVMapper.lockUvs(elGeo, el.faces, this.atlas, new Euler4(...this.options.uvLockRotation));
4403
4365
  }
4404
4366
  if (this.options.tints) {
4405
4367
  const colors = new Float32Array(elGeo.getAttribute("position").count * 3).fill(1);
@@ -4415,12 +4377,12 @@ var ModelObject = class _ModelObject extends SceneObject {
4415
4377
  }
4416
4378
  elGeo.setAttribute("color", new BufferAttribute4(colors, 3));
4417
4379
  }
4418
- 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));
4419
- elGeo.applyMatrix4(new Matrix46().makeTranslation(el.from[0], el.from[1], el.from[2]));
4380
+ 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));
4381
+ elGeo.applyMatrix4(new Matrix44().makeTranslation(el.from[0], el.from[1], el.from[2]));
4420
4382
  if (el.rotation) {
4421
4383
  applyElementRotation(el.rotation, elGeo);
4422
4384
  }
4423
- elGeo.applyMatrix4(new Matrix46().makeTranslation(-8, -8, -8));
4385
+ elGeo.applyMatrix4(new Matrix44().makeTranslation(-8, -8, -8));
4424
4386
  if (displayTransform) DisplayTransforms.apply(elGeo, displayTransform);
4425
4387
  if (this.options.mergeMeshes) {
4426
4388
  allGeos.push(elGeo);
@@ -4495,7 +4457,7 @@ function isModelObject(obj) {
4495
4457
 
4496
4458
  // src/model/block/scene/BlockObject.ts
4497
4459
  var import_ts_deepmerge6 = __toESM(require_dist());
4498
- import { Euler as Euler6, Matrix4 as Matrix47, Vector3 as Vector38 } from "three";
4460
+ import { Euler as Euler5, Matrix4 as Matrix45, Vector3 as Vector37 } from "three";
4499
4461
  var p10 = prefix("BlockObject");
4500
4462
  function matchesCondition(condition, state) {
4501
4463
  return Object.entries(condition).every(([key, value]) => {
@@ -4557,7 +4519,7 @@ var BlockObject = class _BlockObject extends SceneObject {
4557
4519
  if (isModelObject(model)) {
4558
4520
  model.removeFromScene();
4559
4521
  } else if (isInstanceReference(model)) {
4560
- model.setScale(new Vector38(0, 0, 0));
4522
+ model.setScale(new Vector37(0, 0, 0));
4561
4523
  }
4562
4524
  }
4563
4525
  super.removeFromScene();
@@ -4618,7 +4580,7 @@ var BlockObject = class _BlockObject extends SceneObject {
4618
4580
  }
4619
4581
  for (let model of this._models) {
4620
4582
  if (isInstanceReference(model)) {
4621
- model.setScale(new Vector38(0, 0, 0));
4583
+ model.setScale(new Vector37(0, 0, 0));
4622
4584
  } else {
4623
4585
  model.dispose();
4624
4586
  }
@@ -4655,7 +4617,7 @@ var BlockObject = class _BlockObject extends SceneObject {
4655
4617
  await this.createVariant(variant);
4656
4618
  }
4657
4619
  async createVariant(variant) {
4658
- const rotation = new Euler6();
4620
+ const rotation = new Euler5();
4659
4621
  if (typeof variant.x !== "undefined") {
4660
4622
  rotation.x = toRadians(clampRotationDegrees(variant.x));
4661
4623
  }
@@ -4742,7 +4704,7 @@ var BlockObject = class _BlockObject extends SceneObject {
4742
4704
  setPositionRotationScaleAt(index, position, rotation, scale) {
4743
4705
  super.setPositionRotationScaleAt(index, position, rotation, scale);
4744
4706
  }
4745
- getMatrixAt(index, matrix = new Matrix47()) {
4707
+ getMatrixAt(index, matrix = new Matrix45()) {
4746
4708
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
4747
4709
  const child = this._models[0];
4748
4710
  if (child && isModelObject(child)) {
@@ -5785,7 +5747,7 @@ function isMineRenderScene(obj) {
5785
5747
  }
5786
5748
 
5787
5749
  // src/renderer/Renderer.ts
5788
- import { AxesHelper as AxesHelper3, GridHelper, OrthographicCamera, PCFSoftShadowMap, PerspectiveCamera, SRGBColorSpace as SRGBColorSpace3, Vector3 as Vector310, WebGLRenderer } from "three";
5750
+ import { AxesHelper as AxesHelper2, GridHelper, OrthographicCamera, PCFSoftShadowMap, PerspectiveCamera, SRGBColorSpace as SRGBColorSpace3, Vector3 as Vector39, WebGLRenderer } from "three";
5789
5751
  var import_ts_deepmerge9 = __toESM(require_dist());
5790
5752
  import Stats from "stats.js";
5791
5753
  import { EffectComposer, RenderPass } from "postprocessing";
@@ -5798,7 +5760,7 @@ import {
5798
5760
  Spherical,
5799
5761
  TOUCH,
5800
5762
  Vector2 as Vector23,
5801
- Vector3 as Vector39
5763
+ Vector3 as Vector38
5802
5764
  } from "three";
5803
5765
  var _changeEvent = { type: "change" };
5804
5766
  var _startEvent = { type: "start" };
@@ -5812,7 +5774,7 @@ var OrbitControls = class extends EventDispatcher {
5812
5774
  this.domElement = domElement;
5813
5775
  this.domElement.style.touchAction = "none";
5814
5776
  this.enabled = true;
5815
- this.target = new Vector39();
5777
+ this.target = new Vector38();
5816
5778
  this.minDistance = 0;
5817
5779
  this.maxDistance = Infinity;
5818
5780
  this.minZoom = 0;
@@ -5864,10 +5826,10 @@ var OrbitControls = class extends EventDispatcher {
5864
5826
  state = STATE.NONE;
5865
5827
  };
5866
5828
  this.update = function() {
5867
- const offset = new Vector39();
5868
- const quat = new Quaternion4().setFromUnitVectors(object.up, new Vector39(0, 1, 0));
5829
+ const offset = new Vector38();
5830
+ const quat = new Quaternion4().setFromUnitVectors(object.up, new Vector38(0, 1, 0));
5869
5831
  const quatInverse = quat.clone().invert();
5870
- const lastPosition = new Vector39();
5832
+ const lastPosition = new Vector38();
5871
5833
  const lastQuaternion = new Quaternion4();
5872
5834
  const twoPI = 2 * Math.PI;
5873
5835
  return function update() {
@@ -5957,7 +5919,7 @@ var OrbitControls = class extends EventDispatcher {
5957
5919
  const spherical = new Spherical();
5958
5920
  const sphericalDelta = new Spherical();
5959
5921
  let scale = 1;
5960
- const panOffset = new Vector39();
5922
+ const panOffset = new Vector38();
5961
5923
  let zoomChanged = false;
5962
5924
  const rotateStart = new Vector23();
5963
5925
  const rotateEnd = new Vector23();
@@ -5983,7 +5945,7 @@ var OrbitControls = class extends EventDispatcher {
5983
5945
  sphericalDelta.phi -= angle;
5984
5946
  }
5985
5947
  const panLeft = function() {
5986
- const v = new Vector39();
5948
+ const v = new Vector38();
5987
5949
  return function panLeft2(distance, objectMatrix) {
5988
5950
  v.setFromMatrixColumn(objectMatrix, 0);
5989
5951
  v.multiplyScalar(-distance);
@@ -5991,7 +5953,7 @@ var OrbitControls = class extends EventDispatcher {
5991
5953
  };
5992
5954
  }();
5993
5955
  const panUp = function() {
5994
- const v = new Vector39();
5956
+ const v = new Vector38();
5995
5957
  return function panUp2(distance, objectMatrix) {
5996
5958
  if (scope.screenSpacePanning === true) {
5997
5959
  v.setFromMatrixColumn(objectMatrix, 1);
@@ -6004,7 +5966,7 @@ var OrbitControls = class extends EventDispatcher {
6004
5966
  };
6005
5967
  }();
6006
5968
  const pan = function() {
6007
- const offset = new Vector39();
5969
+ const offset = new Vector38();
6008
5970
  return function pan2(deltaX, deltaY) {
6009
5971
  const element = scope.domElement;
6010
5972
  if (scope.object.isPerspectiveCamera) {
@@ -6481,8 +6443,8 @@ var Renderer = class _Renderer {
6481
6443
  top: void 0,
6482
6444
  bottom: void 0
6483
6445
  },
6484
- position: new Vector310(50, 50, 50),
6485
- lookingAt: new Vector310(0, 0, 0)
6446
+ position: new Vector39(50, 50, 50),
6447
+ lookingAt: new Vector39(0, 0, 0)
6486
6448
  },
6487
6449
  render: {
6488
6450
  fpsLimit: 60,
@@ -6586,7 +6548,7 @@ var Renderer = class _Renderer {
6586
6548
  this.scene.add(gridHelper3);
6587
6549
  }
6588
6550
  if (this.options.debug.axes) {
6589
- const axesHelper = new AxesHelper3(64);
6551
+ const axesHelper = new AxesHelper2(64);
6590
6552
  this._debugHelpers.push(axesHelper);
6591
6553
  this.scene.add(axesHelper);
6592
6554
  }
@@ -6947,10 +6909,10 @@ var Skins = class {
6947
6909
  };
6948
6910
 
6949
6911
  // src/world/Chunk.ts
6950
- import { Box3 as Box32, Object3D as Object3D6, Vector3 as Vector312 } from "three";
6912
+ import { Box3 as Box32, Object3D as Object3D6, Vector3 as Vector311 } from "three";
6951
6913
 
6952
6914
  // src/world/MineRenderWorld.ts
6953
- import { Vector3 as Vector311 } from "three";
6915
+ import { Vector3 as Vector310 } from "three";
6954
6916
  var MineRenderWorld = class {
6955
6917
  constructor(scene) {
6956
6918
  this._size = 4;
@@ -6961,10 +6923,10 @@ var MineRenderWorld = class {
6961
6923
  }
6962
6924
  getBlockAt(posOrX, y, z) {
6963
6925
  if (typeof posOrX == "number") {
6964
- return this.getBlockAt(new Vector311(posOrX, y, z));
6926
+ return this.getBlockAt(new Vector310(posOrX, y, z));
6965
6927
  }
6966
6928
  if (isTripleArray(posOrX)) {
6967
- return this.getBlockAt(new Vector311(posOrX[0], posOrX[1], posOrX[2]));
6929
+ return this.getBlockAt(new Vector310(posOrX[0], posOrX[1], posOrX[2]));
6968
6930
  }
6969
6931
  const chunk = this.getChunkAt(posOrX);
6970
6932
  if (typeof chunk === "undefined") {
@@ -6975,10 +6937,10 @@ var MineRenderWorld = class {
6975
6937
  }
6976
6938
  async setBlockAt(posOrX, yOrBlock, z, block) {
6977
6939
  if (typeof posOrX == "number") {
6978
- return this.setBlockAt(new Vector311(posOrX, yOrBlock, z), block);
6940
+ return this.setBlockAt(new Vector310(posOrX, yOrBlock, z), block);
6979
6941
  }
6980
6942
  if (isTripleArray(posOrX)) {
6981
- return this.setBlockAt(new Vector311(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
6943
+ return this.setBlockAt(new Vector310(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
6982
6944
  }
6983
6945
  this.validatePosBounds(posOrX);
6984
6946
  const chunk = this.getOrCreateChunkAt(posOrX);
@@ -7024,14 +6986,14 @@ var MineRenderWorld = class {
7024
6986
  return this._chunks[index];
7025
6987
  }
7026
6988
  static worldToScenePosition(pos) {
7027
- return new Vector311(
6989
+ return new Vector310(
7028
6990
  pos.x * 16,
7029
6991
  pos.y * 16,
7030
6992
  pos.z * 16
7031
6993
  );
7032
6994
  }
7033
6995
  static sceneToWorldPosition(pos) {
7034
- return new Vector311(
6996
+ return new Vector310(
7035
6997
  pos.x / 16,
7036
6998
  pos.y / 16,
7037
6999
  pos.z / 16
@@ -7073,7 +7035,7 @@ var Chunk = class _Chunk {
7073
7035
  scene.add(anchor);
7074
7036
  anchor.position.set(this.x * 256 + 128 - 8, this.y * 256 + 128 - 8, this.z * 256 + 128 - 8);
7075
7037
  addBox3WireframeToObject(
7076
- new Box32(new Vector312(0, 0, 0), new Vector312(256, 256, 256)),
7038
+ new Box32(new Vector311(0, 0, 0), new Vector311(256, 256, 256)),
7077
7039
  anchor,
7078
7040
  16776960,
7079
7041
  4
@@ -7081,10 +7043,10 @@ var Chunk = class _Chunk {
7081
7043
  }
7082
7044
  getBlockAt(posOrX, y, z) {
7083
7045
  if (typeof posOrX == "number") {
7084
- return this.getBlockAt(new Vector312(posOrX, y, z));
7046
+ return this.getBlockAt(new Vector311(posOrX, y, z));
7085
7047
  }
7086
7048
  if (isTripleArray(posOrX)) {
7087
- return this.getBlockAt(new Vector312(posOrX[0], posOrX[1], posOrX[2]));
7049
+ return this.getBlockAt(new Vector311(posOrX[0], posOrX[1], posOrX[2]));
7088
7050
  }
7089
7051
  const pos = this.worldPosToChunkPos(posOrX);
7090
7052
  const index = _Chunk.chunkPosToBlockIndex(pos);
@@ -7092,10 +7054,10 @@ var Chunk = class _Chunk {
7092
7054
  }
7093
7055
  async setBlockAt(posOrX, yOrBlock, z, block) {
7094
7056
  if (typeof posOrX == "number") {
7095
- return this.setBlockAt(new Vector312(posOrX, yOrBlock, z), block);
7057
+ return this.setBlockAt(new Vector311(posOrX, yOrBlock, z), block);
7096
7058
  }
7097
7059
  if (isTripleArray(posOrX)) {
7098
- return this.setBlockAt(new Vector312(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
7060
+ return this.setBlockAt(new Vector311(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
7099
7061
  }
7100
7062
  const worldPos = posOrX;
7101
7063
  const pos = this.worldPosToChunkPos(worldPos);
@@ -7141,7 +7103,7 @@ var Chunk = class _Chunk {
7141
7103
  }
7142
7104
  async clear() {
7143
7105
  let promises = [];
7144
- let pos = new Vector312();
7106
+ let pos = new Vector311();
7145
7107
  for (let x = 0; x < 16; x++) {
7146
7108
  for (let z = 0; z < 16; z++) {
7147
7109
  for (let y = 0; y < 16; y++) {
@@ -7160,14 +7122,14 @@ var Chunk = class _Chunk {
7160
7122
  return pos.y * 16 * 16 + pos.z * 16 + pos.x;
7161
7123
  }
7162
7124
  worldPosToChunkPos(pos) {
7163
- return new Vector312(
7125
+ return new Vector311(
7164
7126
  pos.x - this.x * 16,
7165
7127
  pos.y - this.y * 16,
7166
7128
  pos.z - this.z * 16
7167
7129
  );
7168
7130
  }
7169
7131
  chunkPosToWorldPos(pos) {
7170
- return new Vector312(
7132
+ return new Vector311(
7171
7133
  this.x * 16 + pos.x,
7172
7134
  this.y * 16 + pos.y,
7173
7135
  this.z * 16 + pos.z
@@ -7188,7 +7150,6 @@ export {
7188
7150
  BUILTIN_GENERATED,
7189
7151
  BasicAssetKey,
7190
7152
  BatchedExecutor,
7191
- BlockEntityModels,
7192
7153
  BlockObject,
7193
7154
  BlockStates,
7194
7155
  BlockTints,
@@ -7208,7 +7169,6 @@ export {
7208
7169
  DisplayPosition,
7209
7170
  DisplayTransforms,
7210
7171
  Entities,
7211
- EntityModels,
7212
7172
  EntityObject,
7213
7173
  Env,
7214
7174
  Geometries,
@@ -7262,7 +7222,6 @@ export {
7262
7222
  addWireframeToObject,
7263
7223
  applyElementRotation,
7264
7224
  applyGenericRotation,
7265
- applyModelPartRotation,
7266
7225
  axisToVec3,
7267
7226
  base64decode,
7268
7227
  base64encode,