minerender 2.1.0-alpha.21 → 2.1.0-alpha.22

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.
@@ -157,6 +157,7 @@ __export(index_browser_exports, {
157
157
  DISPLAY_POSITIONS: () => DISPLAY_POSITIONS,
158
158
  DefaultBlockStates: () => DefaultBlockStates,
159
159
  DisplayPosition: () => DisplayPosition,
160
+ DisplayTransforms: () => DisplayTransforms,
160
161
  Entities: () => Entities,
161
162
  EntityModels: () => EntityModels,
162
163
  EntityObject: () => EntityObject,
@@ -1250,7 +1251,7 @@ var Meshes = class _Meshes {
1250
1251
  };
1251
1252
 
1252
1253
  // src/UVMapper.ts
1253
- var import_three8 = require("three");
1254
+ var import_three9 = require("three");
1254
1255
 
1255
1256
  // src/model/ModelMerger.ts
1256
1257
  var import_ts_deepmerge = __toESM(require_dist());
@@ -1341,15 +1342,77 @@ function isAssetKey(obj) {
1341
1342
  return isBasicAssetKey(obj) && obj.isAssetKey === true;
1342
1343
  }
1343
1344
 
1345
+ // src/model/DisplayTransforms.ts
1346
+ var import_three7 = require("three");
1347
+
1348
+ // src/model/DisplayPosition.ts
1349
+ var DisplayPosition = /* @__PURE__ */ ((DisplayPosition2) => {
1350
+ DisplayPosition2["THIRDPERSON_RIGHTHAND"] = "thirdperson_righthand";
1351
+ DisplayPosition2["THIRDPERSON_LEFTHAND"] = "thirdperson_lefthand";
1352
+ DisplayPosition2["FIRSTPERSON_RIGHTHAND"] = "firstperson_righthand";
1353
+ DisplayPosition2["FIRSTPERSON_LEFTHAND"] = "firstperson_lefthand";
1354
+ DisplayPosition2["GUI"] = "gui";
1355
+ DisplayPosition2["HEAD"] = "head";
1356
+ DisplayPosition2["GROUND"] = "ground";
1357
+ DisplayPosition2["FIXED"] = "fixed";
1358
+ DisplayPosition2["ON_SHELF"] = "on_shelf";
1359
+ return DisplayPosition2;
1360
+ })(DisplayPosition || {});
1361
+ var DISPLAY_POSITIONS = Object.values(DisplayPosition);
1362
+
1363
+ // src/model/DisplayTransforms.ts
1364
+ var DisplayTransforms = class {
1365
+ /** Resolve hand fallbacks within one model, before inheriting parent display entries. */
1366
+ static withHandFallbacks(display) {
1367
+ if (!display) return void 0;
1368
+ const resolved = { ...display };
1369
+ for (const [left, right] of [
1370
+ ["thirdperson_lefthand" /* THIRDPERSON_LEFTHAND */, "thirdperson_righthand" /* THIRDPERSON_RIGHTHAND */],
1371
+ ["firstperson_lefthand" /* FIRSTPERSON_LEFTHAND */, "firstperson_righthand" /* FIRSTPERSON_RIGHTHAND */]
1372
+ ]) {
1373
+ if (resolved[left] === void 0 && resolved[right] !== void 0) resolved[left] = resolved[right];
1374
+ }
1375
+ return resolved;
1376
+ }
1377
+ /** Build a display pose for geometry already centered at the model's [8, 8, 8] pivot. */
1378
+ static getMatrix(display, position) {
1379
+ const transform = this.withHandFallbacks(display)?.[position] ?? {};
1380
+ const left = position === "firstperson_lefthand" /* FIRSTPERSON_LEFTHAND */ || position === "thirdperson_lefthand" /* THIRDPERSON_LEFTHAND */;
1381
+ const sign = left ? -1 : 1;
1382
+ const [x, y, z] = transform.rotation ?? [0, 0, 0];
1383
+ const rotation = new import_three7.Quaternion().setFromEuler(new import_three7.Euler(toRadians(x), sign * toRadians(y), sign * toRadians(z), "XYZ"));
1384
+ const translation = new import_three7.Vector3(...transform.translation ?? [0, 0, 0]).clampScalar(-80, 80);
1385
+ translation.x *= sign;
1386
+ const scale = new import_three7.Vector3(...transform.scale ?? [1, 1, 1]).clampScalar(-4, 4);
1387
+ return new import_three7.Matrix4().compose(translation, rotation, scale);
1388
+ }
1389
+ static apply(geometry, matrix) {
1390
+ geometry.applyMatrix4(matrix);
1391
+ if (matrix.determinant() < 0) {
1392
+ if (!geometry.index) geometry.setIndex(Array.from({ length: geometry.getAttribute("position").count }, (_, i) => i));
1393
+ const index = geometry.index;
1394
+ for (let i = 0; i < index.count; i += 3) {
1395
+ const second = index.getX(i + 1);
1396
+ index.setX(i + 1, index.getX(i + 2));
1397
+ index.setX(i + 2, second);
1398
+ }
1399
+ index.needsUpdate = true;
1400
+ }
1401
+ }
1402
+ };
1403
+
1344
1404
  // src/model/ModelMerger.ts
1345
1405
  var ModelMerger = class {
1346
1406
  static async mergeWithParents(model) {
1347
1407
  const models = await this.collectAllParents(model);
1348
1408
  let merged = {};
1349
- for (let parentModel of models) {
1350
- merged = import_ts_deepmerge.default.withOptions({ mergeArrays: false }, merged, parentModel);
1409
+ for (const source of [...models, model]) {
1410
+ const inheritedDisplay = merged.display;
1411
+ merged = import_ts_deepmerge.default.withOptions({ mergeArrays: false }, merged, source);
1412
+ if (source.display) {
1413
+ merged.display = { ...inheritedDisplay, ...DisplayTransforms.withHandFallbacks(source.display) };
1414
+ }
1351
1415
  }
1352
- merged = import_ts_deepmerge.default.withOptions({ mergeArrays: false }, merged, model);
1353
1416
  merged.hierarchy = models.map((m) => m.parent).filter((p12) => `${p12}`);
1354
1417
  merged.hierarchy.push(`${merged.parent}`);
1355
1418
  return merged;
@@ -1604,9 +1667,9 @@ var BatchedExecutor = class {
1604
1667
  };
1605
1668
 
1606
1669
  // src/util/model.ts
1607
- var import_three7 = require("three");
1670
+ var import_three8 = require("three");
1608
1671
  function applyElementRotation(rotation, geometry) {
1609
- const origin = new import_three7.Vector3(rotation.origin[0], rotation.origin[1], rotation.origin[2]);
1672
+ const origin = new import_three8.Vector3(rotation.origin[0], rotation.origin[1], rotation.origin[2]);
1610
1673
  geometry.translate(-origin.x, -origin.y, -origin.z);
1611
1674
  switch (rotation.axis) {
1612
1675
  case "x" /* X */:
@@ -1631,7 +1694,7 @@ function applyElementRotation(rotation, geometry) {
1631
1694
  geometry.translate(origin.x, origin.y, origin.z);
1632
1695
  }
1633
1696
  function applyModelPartRotation(modelPart, geometry) {
1634
- const origin = new import_three7.Vector3(modelPart.pivotX, modelPart.pivotY, modelPart.pivotZ);
1697
+ const origin = new import_three8.Vector3(modelPart.pivotX, modelPart.pivotY, modelPart.pivotZ);
1635
1698
  geometry.translate(-origin.x, -origin.y, -origin.z);
1636
1699
  geometry.rotateX(toRadians(modelPart.pitch));
1637
1700
  geometry.rotateY(toRadians(modelPart.yaw));
@@ -1641,42 +1704,42 @@ function applyModelPartRotation(modelPart, geometry) {
1641
1704
  function applyGenericRotation(axis, rotation, obj) {
1642
1705
  switch (axis) {
1643
1706
  case "x" /* X */:
1644
- obj.rotateOnAxis(new import_three7.Vector3(1, 0, 0), toRadians(rotation));
1707
+ obj.rotateOnAxis(new import_three8.Vector3(1, 0, 0), toRadians(rotation));
1645
1708
  break;
1646
1709
  case "y" /* Y */:
1647
- obj.rotateOnAxis(new import_three7.Vector3(0, 1, 0), toRadians(rotation));
1710
+ obj.rotateOnAxis(new import_three8.Vector3(0, 1, 0), toRadians(rotation));
1648
1711
  break;
1649
1712
  case "z" /* Z */:
1650
- obj.rotateOnAxis(new import_three7.Vector3(0, 0, 1), toRadians(rotation));
1713
+ obj.rotateOnAxis(new import_three8.Vector3(0, 0, 1), toRadians(rotation));
1651
1714
  break;
1652
1715
  }
1653
1716
  }
1654
1717
  function addBox3WireframeToObject(box, obj, color = 16777215, w = 2) {
1655
- let size = new import_three7.Vector3();
1718
+ let size = new import_three8.Vector3();
1656
1719
  box.getSize(size);
1657
- let boxGeo = new import_three7.BoxGeometry(size.x, size.y, size.z, 1, 1, 1);
1658
- let wireGeo = new import_three7.EdgesGeometry(boxGeo);
1659
- let wireMat = new import_three7.LineBasicMaterial({ color, linewidth: w });
1660
- let wireframe = new import_three7.LineSegments(wireGeo, wireMat);
1720
+ let boxGeo = new import_three8.BoxGeometry(size.x, size.y, size.z, 1, 1, 1);
1721
+ let wireGeo = new import_three8.EdgesGeometry(boxGeo);
1722
+ let wireMat = new import_three8.LineBasicMaterial({ color, linewidth: w });
1723
+ let wireframe = new import_three8.LineSegments(wireGeo, wireMat);
1661
1724
  obj.add(wireframe);
1662
- let axes = new import_three7.AxesHelper(1);
1725
+ let axes = new import_three8.AxesHelper(1);
1663
1726
  obj.add(axes);
1664
1727
  }
1665
1728
  function addWireframeToObject(obj, color = 16777215, w = 2) {
1666
- let boxGeo = new import_three7.BoxGeometry(16, 16, 16, 1, 1, 1);
1667
- let wireGeo = new import_three7.EdgesGeometry(boxGeo);
1668
- let wireMat = new import_three7.LineBasicMaterial({ color, linewidth: w });
1669
- let wireframe = new import_three7.LineSegments(wireGeo, wireMat);
1729
+ let boxGeo = new import_three8.BoxGeometry(16, 16, 16, 1, 1, 1);
1730
+ let wireGeo = new import_three8.EdgesGeometry(boxGeo);
1731
+ let wireMat = new import_three8.LineBasicMaterial({ color, linewidth: w });
1732
+ let wireframe = new import_three8.LineSegments(wireGeo, wireMat);
1670
1733
  obj.add(wireframe);
1671
- let axes = new import_three7.AxesHelper(1);
1734
+ let axes = new import_three8.AxesHelper(1);
1672
1735
  obj.add(axes);
1673
1736
  }
1674
1737
  function addWireframeToMesh(geo, mesh, color = 16777215, w = 2) {
1675
- let wireGeo = new import_three7.EdgesGeometry(geo);
1676
- let wireMat = new import_three7.LineBasicMaterial({ color, linewidth: w });
1677
- let wireframe = new import_three7.LineSegments(wireGeo, wireMat);
1738
+ let wireGeo = new import_three8.EdgesGeometry(geo);
1739
+ let wireMat = new import_three8.LineBasicMaterial({ color, linewidth: w });
1740
+ let wireframe = new import_three8.LineSegments(wireGeo, wireMat);
1678
1741
  mesh.add(wireframe);
1679
- let axes = new import_three7.AxesHelper(1);
1742
+ let axes = new import_three8.AxesHelper(1);
1680
1743
  mesh.add(axes);
1681
1744
  }
1682
1745
 
@@ -2220,12 +2283,12 @@ var X = 0;
2220
2283
  var Y = 1;
2221
2284
  var Z = 2;
2222
2285
  var FACE_UV_AXES = {
2223
- east: [new import_three8.Vector3(0, 0, -1), new import_three8.Vector3(0, -1, 0)],
2224
- west: [new import_three8.Vector3(0, 0, 1), new import_three8.Vector3(0, -1, 0)],
2225
- up: [new import_three8.Vector3(1, 0, 0), new import_three8.Vector3(0, 0, 1)],
2226
- down: [new import_three8.Vector3(1, 0, 0), new import_three8.Vector3(0, 0, -1)],
2227
- south: [new import_three8.Vector3(1, 0, 0), new import_three8.Vector3(0, -1, 0)],
2228
- north: [new import_three8.Vector3(-1, 0, 0), new import_three8.Vector3(0, -1, 0)]
2286
+ east: [new import_three9.Vector3(0, 0, -1), new import_three9.Vector3(0, -1, 0)],
2287
+ west: [new import_three9.Vector3(0, 0, 1), new import_three9.Vector3(0, -1, 0)],
2288
+ up: [new import_three9.Vector3(1, 0, 0), new import_three9.Vector3(0, 0, 1)],
2289
+ down: [new import_three9.Vector3(1, 0, 0), new import_three9.Vector3(0, 0, -1)],
2290
+ south: [new import_three9.Vector3(1, 0, 0), new import_three9.Vector3(0, -1, 0)],
2291
+ north: [new import_three9.Vector3(-1, 0, 0), new import_three9.Vector3(0, -1, 0)]
2229
2292
  };
2230
2293
  var UVMapper = class {
2231
2294
  static makeUv(uvCoord, originalTextureSize, actualTextureSize) {
@@ -2322,7 +2385,7 @@ var UVMapper = class {
2322
2385
  return array;
2323
2386
  }
2324
2387
  static facesToUv(faces, originalTextureSize, actualTextureSize) {
2325
- return new import_three8.Float32BufferAttribute(this.facesToUvArray(faces, originalTextureSize, actualTextureSize), 2);
2388
+ return new import_three9.Float32BufferAttribute(this.facesToUvArray(faces, originalTextureSize, actualTextureSize), 2);
2326
2389
  }
2327
2390
  static lockUvs(geometry, faces, atlas, rotation) {
2328
2391
  const uv = geometry.getAttribute("uv");
@@ -2400,32 +2463,32 @@ var UVMapper = class {
2400
2463
  v1 *= scaleV;
2401
2464
  u2 *= scaleU;
2402
2465
  v2 *= scaleV;
2403
- let tl = new import_three8.Vector2(u1, v1);
2404
- let tr = new import_three8.Vector2(u2, v1);
2405
- let bl = new import_three8.Vector2(u1, v2);
2406
- let br = new import_three8.Vector2(u2, v2);
2466
+ let tl = new import_three9.Vector2(u1, v1);
2467
+ let tr = new import_three9.Vector2(u2, v1);
2468
+ let bl = new import_three9.Vector2(u1, v2);
2469
+ let br = new import_three9.Vector2(u2, v2);
2407
2470
  switch (rotation) {
2408
2471
  case 0:
2409
2472
  case 360:
2410
2473
  default:
2411
2474
  break;
2412
2475
  case 90:
2413
- tl = new import_three8.Vector2(u1, v2);
2414
- tr = new import_three8.Vector2(u1, v1);
2415
- bl = new import_three8.Vector2(u2, v2);
2416
- br = new import_three8.Vector2(u2, v1);
2476
+ tl = new import_three9.Vector2(u1, v2);
2477
+ tr = new import_three9.Vector2(u1, v1);
2478
+ bl = new import_three9.Vector2(u2, v2);
2479
+ br = new import_three9.Vector2(u2, v1);
2417
2480
  break;
2418
2481
  case 180:
2419
- tl = new import_three8.Vector2(u2, v2);
2420
- tr = new import_three8.Vector2(u1, v2);
2421
- bl = new import_three8.Vector2(u2, v1);
2422
- br = new import_three8.Vector2(u1, v1);
2482
+ tl = new import_three9.Vector2(u2, v2);
2483
+ tr = new import_three9.Vector2(u1, v2);
2484
+ bl = new import_three9.Vector2(u2, v1);
2485
+ br = new import_three9.Vector2(u1, v1);
2423
2486
  break;
2424
2487
  case 270:
2425
- tl = new import_three8.Vector2(u2, v1);
2426
- tr = new import_three8.Vector2(u2, v2);
2427
- bl = new import_three8.Vector2(u1, v1);
2428
- br = new import_three8.Vector2(u1, v2);
2488
+ tl = new import_three9.Vector2(u2, v1);
2489
+ tr = new import_three9.Vector2(u2, v2);
2490
+ bl = new import_three9.Vector2(u1, v1);
2491
+ br = new import_three9.Vector2(u1, v2);
2429
2492
  break;
2430
2493
  }
2431
2494
  return [tl, tr, bl, br];
@@ -2572,7 +2635,7 @@ var UVMapper = class {
2572
2635
  const faceTexture = face.texture.substr(1);
2573
2636
  const texPosition = positions[faceTexture] || [0, 0];
2574
2637
  const texSize = sizes[faceTexture] || [16, 16];
2575
- let texPosV = new import_three8.Vector2(texPosition[0], texPosition[1]);
2638
+ let texPosV = new import_three9.Vector2(texPosition[0], texPosition[1]);
2576
2639
  const [tl, tr, bl, br] = this.expandAndRotateMcUvs(face.uv, face.rotation, texSize[0], texSize[1]);
2577
2640
  tl.add(texPosV);
2578
2641
  tr.add(texPosV);
@@ -2806,7 +2869,7 @@ var BlockEntityModels = class {
2806
2869
  };
2807
2870
 
2808
2871
  // src/renderer/SceneObject.ts
2809
- var import_three9 = require("three");
2872
+ var import_three10 = require("three");
2810
2873
 
2811
2874
  // src/instance/InstanceReference.ts
2812
2875
  var InstanceReference = class {
@@ -2865,7 +2928,7 @@ var MineRenderError = class _MineRenderError extends Error {
2865
2928
  // src/renderer/SceneObject.ts
2866
2929
  var import_ts_deepmerge3 = __toESM(require_dist());
2867
2930
  var p6 = prefix("SceneObject");
2868
- var _SceneObject = class _SceneObject extends import_three9.Object3D {
2931
+ var _SceneObject = class _SceneObject extends import_three10.Object3D {
2869
2932
  constructor(options) {
2870
2933
  super();
2871
2934
  this.isSceneObject = true;
@@ -2903,7 +2966,7 @@ var _SceneObject = class _SceneObject extends import_three9.Object3D {
2903
2966
  return group;
2904
2967
  }
2905
2968
  createGroup(name, x = 0, y = 0, z = 0, offsetAxis, offset = 0) {
2906
- const obj = new import_three9.Object3D();
2969
+ const obj = new import_three10.Object3D();
2907
2970
  if (name) {
2908
2971
  obj.name = `group:${name}`;
2909
2972
  }
@@ -2953,7 +3016,7 @@ var _SceneObject = class _SceneObject extends import_three9.Object3D {
2953
3016
  return mesh;
2954
3017
  }
2955
3018
  createMesh(name, geometry, material, offsetAxis, offset = 0) {
2956
- const mesh = new import_three9.Mesh(geometry, material);
3019
+ const mesh = new import_three10.Mesh(geometry, material);
2957
3020
  if (name) {
2958
3021
  mesh.name = `mesh:${name}`;
2959
3022
  }
@@ -2965,7 +3028,7 @@ var _SceneObject = class _SceneObject extends import_three9.Object3D {
2965
3028
  return mesh;
2966
3029
  }
2967
3030
  createInstancedMesh(name, geometry, material, count) {
2968
- const mesh = new import_three9.InstancedMesh(geometry, material, count);
3031
+ const mesh = new import_three10.InstancedMesh(geometry, material, count);
2969
3032
  mesh.count = 0;
2970
3033
  if (name) {
2971
3034
  mesh.name = `mesh:${name}`;
@@ -3043,7 +3106,7 @@ var _SceneObject = class _SceneObject extends import_three9.Object3D {
3043
3106
  nextInstance() {
3044
3107
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3045
3108
  const i = this._instanceCounter++;
3046
- this.setMatrixAt(i, new import_three9.Matrix4());
3109
+ this.setMatrixAt(i, new import_three10.Matrix4());
3047
3110
  const mesh = this.children[0];
3048
3111
  if (mesh && isInstancedMesh(mesh)) {
3049
3112
  mesh.count = Math.min(this._instanceCounter, mesh.instanceMatrix.count);
@@ -3060,7 +3123,7 @@ var _SceneObject = class _SceneObject extends import_three9.Object3D {
3060
3123
  }
3061
3124
  //</editor-fold>
3062
3125
  //<editor-fold desc="TRANSFORMATION">
3063
- getMatrixAt(index, matrix = new import_three9.Matrix4()) {
3126
+ getMatrixAt(index, matrix = new import_three10.Matrix4()) {
3064
3127
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3065
3128
  const child = this.children[0];
3066
3129
  if (child && isInstancedMesh(child)) {
@@ -3079,16 +3142,16 @@ var _SceneObject = class _SceneObject extends import_three9.Object3D {
3079
3142
  }
3080
3143
  setPositionRotationScaleAt(index, position, rotation, scale) {
3081
3144
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3082
- const oldPosition = new import_three9.Vector3();
3083
- const oldRotation = new import_three9.Quaternion();
3084
- const oldScale = new import_three9.Vector3();
3085
- const matrix = new import_three9.Matrix4();
3145
+ const oldPosition = new import_three10.Vector3();
3146
+ const oldRotation = new import_three10.Quaternion();
3147
+ const oldScale = new import_three10.Vector3();
3148
+ const matrix = new import_three10.Matrix4();
3086
3149
  if (!scale || !rotation || !position) {
3087
3150
  this.getMatrixAt(index, matrix).decompose(oldPosition, oldRotation, oldScale);
3088
3151
  }
3089
3152
  matrix.compose(
3090
3153
  position ? position : oldPosition,
3091
- rotation ? new import_three9.Quaternion().setFromEuler(rotation) : oldRotation,
3154
+ rotation ? new import_three10.Quaternion().setFromEuler(rotation) : oldRotation,
3092
3155
  scale ? scale : oldScale
3093
3156
  );
3094
3157
  this.setMatrixAt(index, matrix);
@@ -3097,7 +3160,7 @@ var _SceneObject = class _SceneObject extends import_three9.Object3D {
3097
3160
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3098
3161
  this.setPositionRotationScaleAt(index, position);
3099
3162
  }
3100
- getPositionAt(index, vector = new import_three9.Vector3()) {
3163
+ getPositionAt(index, vector = new import_three10.Vector3()) {
3101
3164
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3102
3165
  const matrix = this.getMatrixAt(index);
3103
3166
  vector.setFromMatrixPosition(matrix);
@@ -3107,7 +3170,7 @@ var _SceneObject = class _SceneObject extends import_three9.Object3D {
3107
3170
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3108
3171
  this.setPositionRotationScaleAt(index, void 0, rotation, void 0);
3109
3172
  }
3110
- getRotationAt(index, euler = new import_three9.Euler()) {
3173
+ getRotationAt(index, euler = new import_three10.Euler()) {
3111
3174
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3112
3175
  const matrix = this.getMatrixAt(index);
3113
3176
  euler.setFromRotationMatrix(matrix);
@@ -3117,7 +3180,7 @@ var _SceneObject = class _SceneObject extends import_three9.Object3D {
3117
3180
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3118
3181
  this.setPositionRotationScaleAt(index, void 0, void 0, scale);
3119
3182
  }
3120
- getScaleAt(index, vector = new import_three9.Vector3()) {
3183
+ getScaleAt(index, vector = new import_three10.Vector3()) {
3121
3184
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3122
3185
  const matrix = this.getMatrixAt(index);
3123
3186
  vector.setFromMatrixScale(matrix);
@@ -3239,7 +3302,7 @@ function isSceneObject(obj) {
3239
3302
 
3240
3303
  // src/entity/scene/EntityObject.ts
3241
3304
  var import_ts_deepmerge4 = __toESM(require_dist());
3242
- var import_three11 = require("three");
3305
+ var import_three12 = require("three");
3243
3306
  var THREE3 = __toESM(require("three"));
3244
3307
  var EntityObject = class extends SceneObject {
3245
3308
  constructor(entity, options) {
@@ -3277,7 +3340,7 @@ var EntityObject = class extends SceneObject {
3277
3340
  for (let partName in this.entity.parts) {
3278
3341
  const part = this.entity.parts[partName];
3279
3342
  const texture = new MinecraftCubeTexture(part.textureOffsetU, part.textureOffsetV, part.textureWidth, part.textureHeight);
3280
- const partAnchor = new import_three11.Object3D();
3343
+ const partAnchor = new import_three12.Object3D();
3281
3344
  partAnchor.position.x = part.pivotX;
3282
3345
  partAnchor.position.y = part.pivotY;
3283
3346
  partAnchor.position.z = part.pivotZ;
@@ -3331,16 +3394,16 @@ var GuiObject = class extends SceneObject {
3331
3394
  };
3332
3395
 
3333
3396
  // src/inspector/SceneInspector.ts
3334
- var import_three12 = require("three");
3397
+ var import_three13 = require("three");
3335
3398
  var p7 = prefix("SceneInspector");
3336
3399
  var help = "<span>Ctrl+Click to Select<br/></span><br/>";
3337
3400
  var SceneInspector = class {
3338
3401
  constructor(renderer) {
3339
3402
  this.renderer = renderer;
3340
- this.mouse = new import_three12.Vector2();
3403
+ this.mouse = new import_three13.Vector2();
3341
3404
  this.objectInfoContainer = document.createElement("div");
3342
3405
  this.objectControlsContainer = document.createElement("div");
3343
- this.raycaster = new import_three12.Raycaster();
3406
+ this.raycaster = new import_three13.Raycaster();
3344
3407
  this.init();
3345
3408
  }
3346
3409
  init() {
@@ -3743,20 +3806,6 @@ function isInstanceable(obj) {
3743
3806
  return "nextInstance" in obj;
3744
3807
  }
3745
3808
 
3746
- // src/model/DisplayPosition.ts
3747
- var DisplayPosition = /* @__PURE__ */ ((DisplayPosition2) => {
3748
- DisplayPosition2["THIRDPERSON_RIGHTHAND"] = "thirdperson_righthand";
3749
- DisplayPosition2["THIRDPERSON_LEFTHAND"] = "thirdperson_lefthand";
3750
- DisplayPosition2["FIRSTPERSON_RIGHTHAND"] = "firstperson_righthand";
3751
- DisplayPosition2["FIRSTPERSON_LEFTHAND"] = "firstperson_lefthand";
3752
- DisplayPosition2["GUI"] = "gui";
3753
- DisplayPosition2["HEAD"] = "head";
3754
- DisplayPosition2["GROUND"] = "ground";
3755
- DisplayPosition2["FIXED"] = "fixed";
3756
- return DisplayPosition2;
3757
- })(DisplayPosition || {});
3758
- var DISPLAY_POSITIONS = Object.values(DisplayPosition);
3759
-
3760
3809
  // src/model/GuiLight.ts
3761
3810
  var GuiLight = /* @__PURE__ */ ((GuiLight2) => {
3762
3811
  GuiLight2["FRONT"] = "front";
@@ -3865,10 +3914,10 @@ var BlockTints = class {
3865
3914
  };
3866
3915
 
3867
3916
  // src/model/scene/ModelObject.ts
3868
- var import_three15 = require("three");
3917
+ var import_three16 = require("three");
3869
3918
 
3870
3919
  // src/three/BufferGeometryUtils.js
3871
- var import_three14 = require("three");
3920
+ var import_three15 = require("three");
3872
3921
  function computeTangents(geometry) {
3873
3922
  geometry.computeTangents();
3874
3923
  console.warn("THREE.BufferGeometryUtils: .computeTangents() has been removed. Use BufferGeometry.computeTangents() instead.");
@@ -3880,7 +3929,7 @@ function mergeBufferGeometries(geometries, useGroups = false) {
3880
3929
  const attributes = {};
3881
3930
  const morphAttributes = {};
3882
3931
  const morphTargetsRelative = geometries[0].morphTargetsRelative;
3883
- const mergedGeometry = new import_three14.BufferGeometry();
3932
+ const mergedGeometry = new import_three15.BufferGeometry();
3884
3933
  let offset = 0;
3885
3934
  for (let i = 0; i < geometries.length; ++i) {
3886
3935
  const geometry = geometries[i];
@@ -4004,7 +4053,7 @@ function mergeBufferAttributes(attributes) {
4004
4053
  array.set(attributes[i].array, offset);
4005
4054
  offset += attributes[i].array.length;
4006
4055
  }
4007
- return new import_three14.BufferAttribute(array, itemSize, normalized);
4056
+ return new import_three15.BufferAttribute(array, itemSize, normalized);
4008
4057
  }
4009
4058
  function interleaveAttributes(attributes) {
4010
4059
  let TypedArray;
@@ -4020,7 +4069,7 @@ function interleaveAttributes(attributes) {
4020
4069
  arrayLength += attribute.array.length;
4021
4070
  stride += attribute.itemSize;
4022
4071
  }
4023
- const interleavedBuffer = new import_three14.InterleavedBuffer(new TypedArray(arrayLength), stride);
4072
+ const interleavedBuffer = new import_three15.InterleavedBuffer(new TypedArray(arrayLength), stride);
4024
4073
  let offset = 0;
4025
4074
  const res = [];
4026
4075
  const getters = ["getX", "getY", "getZ", "getW"];
@@ -4029,7 +4078,7 @@ function interleaveAttributes(attributes) {
4029
4078
  const attribute = attributes[j];
4030
4079
  const itemSize = attribute.itemSize;
4031
4080
  const count = attribute.count;
4032
- const iba = new import_three14.InterleavedBufferAttribute(interleavedBuffer, itemSize, offset, attribute.normalized);
4081
+ const iba = new import_three15.InterleavedBufferAttribute(interleavedBuffer, itemSize, offset, attribute.normalized);
4033
4082
  res.push(iba);
4034
4083
  offset += itemSize;
4035
4084
  for (let c = 0; c < count; c++) {
@@ -4113,13 +4162,13 @@ function mergeVertices(geometry, tolerance = 1e-4) {
4113
4162
  const name = attributeNames[i];
4114
4163
  const oldAttribute = geometry.getAttribute(name);
4115
4164
  const buffer = new oldAttribute.array.constructor(attrArrays[name]);
4116
- const attribute = new import_three14.BufferAttribute(buffer, oldAttribute.itemSize, oldAttribute.normalized);
4165
+ const attribute = new import_three15.BufferAttribute(buffer, oldAttribute.itemSize, oldAttribute.normalized);
4117
4166
  result.setAttribute(name, attribute);
4118
4167
  if (name in morphAttrsArrays) {
4119
4168
  for (let j = 0; j < morphAttrsArrays[name].length; j++) {
4120
4169
  const oldMorphAttribute = geometry.morphAttributes[name][j];
4121
4170
  const buffer2 = new oldMorphAttribute.array.constructor(morphAttrsArrays[name][j]);
4122
- const morphAttribute = new import_three14.BufferAttribute(buffer2, oldMorphAttribute.itemSize, oldMorphAttribute.normalized);
4171
+ const morphAttribute = new import_three15.BufferAttribute(buffer2, oldMorphAttribute.itemSize, oldMorphAttribute.normalized);
4123
4172
  result.morphAttributes[name][j] = morphAttribute;
4124
4173
  }
4125
4174
  }
@@ -4128,11 +4177,11 @@ function mergeVertices(geometry, tolerance = 1e-4) {
4128
4177
  return result;
4129
4178
  }
4130
4179
  function toTrianglesDrawMode(geometry, drawMode) {
4131
- if (drawMode === import_three14.TrianglesDrawMode) {
4180
+ if (drawMode === import_three15.TrianglesDrawMode) {
4132
4181
  console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.");
4133
4182
  return geometry;
4134
4183
  }
4135
- if (drawMode === import_three14.TriangleFanDrawMode || drawMode === import_three14.TriangleStripDrawMode) {
4184
+ if (drawMode === import_three15.TriangleFanDrawMode || drawMode === import_three15.TriangleStripDrawMode) {
4136
4185
  let index = geometry.getIndex();
4137
4186
  if (index === null) {
4138
4187
  const indices = [];
@@ -4150,7 +4199,7 @@ function toTrianglesDrawMode(geometry, drawMode) {
4150
4199
  }
4151
4200
  const numberOfTriangles = index.count - 2;
4152
4201
  const newIndices = [];
4153
- if (drawMode === import_three14.TriangleFanDrawMode) {
4202
+ if (drawMode === import_three15.TriangleFanDrawMode) {
4154
4203
  for (let i = 1; i <= numberOfTriangles; i++) {
4155
4204
  newIndices.push(index.getX(0));
4156
4205
  newIndices.push(index.getX(i));
@@ -4186,15 +4235,15 @@ function computeMorphedAttributes(object) {
4186
4235
  console.error("THREE.BufferGeometryUtils: Geometry is not of type BufferGeometry.");
4187
4236
  return null;
4188
4237
  }
4189
- const _vA = new import_three14.Vector3();
4190
- const _vB = new import_three14.Vector3();
4191
- const _vC = new import_three14.Vector3();
4192
- const _tempA = new import_three14.Vector3();
4193
- const _tempB = new import_three14.Vector3();
4194
- const _tempC = new import_three14.Vector3();
4195
- const _morphA = new import_three14.Vector3();
4196
- const _morphB = new import_three14.Vector3();
4197
- const _morphC = new import_three14.Vector3();
4238
+ const _vA = new import_three15.Vector3();
4239
+ const _vB = new import_three15.Vector3();
4240
+ const _vC = new import_three15.Vector3();
4241
+ const _tempA = new import_three15.Vector3();
4242
+ const _tempB = new import_three15.Vector3();
4243
+ const _tempC = new import_three15.Vector3();
4244
+ const _morphA = new import_three15.Vector3();
4245
+ const _morphB = new import_three15.Vector3();
4246
+ const _morphC = new import_three15.Vector3();
4198
4247
  function _calculateMorphedAttributeData(object2, material2, attribute, morphAttribute, morphTargetsRelative2, a2, b2, c2, modifiedAttributeArray) {
4199
4248
  _vA.fromBufferAttribute(attribute, a2);
4200
4249
  _vB.fromBufferAttribute(attribute, b2);
@@ -4389,8 +4438,8 @@ function computeMorphedAttributes(object) {
4389
4438
  }
4390
4439
  }
4391
4440
  }
4392
- const morphedPositionAttribute = new import_three14.Float32BufferAttribute(modifiedPosition, 3);
4393
- const morphedNormalAttribute = new import_three14.Float32BufferAttribute(modifiedNormal, 3);
4441
+ const morphedPositionAttribute = new import_three15.Float32BufferAttribute(modifiedPosition, 3);
4442
+ const morphedNormalAttribute = new import_three15.Float32BufferAttribute(modifiedNormal, 3);
4394
4443
  return {
4395
4444
  positionAttribute,
4396
4445
  normalAttribute,
@@ -4431,13 +4480,14 @@ var _ModelObject = class _ModelObject extends SceneObject {
4431
4480
  createMeshes(force = false) {
4432
4481
  if (this.meshesCreated && !force) return;
4433
4482
  const mat = Materials.MISSING_TEXTURE;
4483
+ const displayTransform = this.options.displayPosition ? DisplayTransforms.getMatrix(this.originalModel.display, this.options.displayPosition) : void 0;
4434
4484
  let allGeos = [];
4435
4485
  if (this.atlas) {
4436
4486
  if (this.atlas.model.elements) {
4437
4487
  this.atlas.model.elements?.forEach((el) => {
4438
4488
  const elGeo = this._getBoxGeometryFromElement(el).clone();
4439
4489
  if (this.options.uvLockRotation) {
4440
- UVMapper.lockUvs(elGeo, el.faces, this.atlas, new import_three15.Euler(...this.options.uvLockRotation));
4490
+ UVMapper.lockUvs(elGeo, el.faces, this.atlas, new import_three16.Euler(...this.options.uvLockRotation));
4441
4491
  }
4442
4492
  if (this.options.tints) {
4443
4493
  const colors = new Float32Array(elGeo.getAttribute("position").count * 3).fill(1);
@@ -4446,19 +4496,20 @@ var _ModelObject = class _ModelObject extends SceneObject {
4446
4496
  if (tintIndex === void 0 || tintIndex < 0) continue;
4447
4497
  const tint = this.options.tints[tintIndex];
4448
4498
  if (tint === void 0) continue;
4449
- const color = new import_three15.Color(tint);
4499
+ const color = new import_three16.Color(tint);
4450
4500
  for (let vertex = 0; vertex < 4; vertex++) {
4451
4501
  color.toArray(colors, (faceIndex * 4 + vertex) * 3);
4452
4502
  }
4453
4503
  }
4454
- elGeo.setAttribute("color", new import_three15.BufferAttribute(colors, 3));
4504
+ elGeo.setAttribute("color", new import_three16.BufferAttribute(colors, 3));
4455
4505
  }
4456
- elGeo.applyMatrix4(new import_three15.Matrix4().makeTranslation((el.to[0] - el.from[0]) / 2, (el.to[1] - el.from[1]) / 2, (el.to[2] - el.from[2]) / 2));
4457
- elGeo.applyMatrix4(new import_three15.Matrix4().makeTranslation(el.from[0], el.from[1], el.from[2]));
4506
+ elGeo.applyMatrix4(new import_three16.Matrix4().makeTranslation((el.to[0] - el.from[0]) / 2, (el.to[1] - el.from[1]) / 2, (el.to[2] - el.from[2]) / 2));
4507
+ elGeo.applyMatrix4(new import_three16.Matrix4().makeTranslation(el.from[0], el.from[1], el.from[2]));
4458
4508
  if (el.rotation) {
4459
4509
  applyElementRotation(el.rotation, elGeo);
4460
4510
  }
4461
- elGeo.applyMatrix4(new import_three15.Matrix4().makeTranslation(-8, -8, -8));
4511
+ elGeo.applyMatrix4(new import_three16.Matrix4().makeTranslation(-8, -8, -8));
4512
+ if (displayTransform) DisplayTransforms.apply(elGeo, displayTransform);
4462
4513
  if (this.options.mergeMeshes) {
4463
4514
  allGeos.push(elGeo);
4464
4515
  } else {
@@ -4479,7 +4530,8 @@ var _ModelObject = class _ModelObject extends SceneObject {
4479
4530
  if (allGeos.length > 0) {
4480
4531
  combinedGeo = mergeBufferGeometries(allGeos);
4481
4532
  } else {
4482
- combinedGeo = new import_three15.BoxGeometry(16, 16, 16);
4533
+ combinedGeo = new import_three16.BoxGeometry(16, 16, 16);
4534
+ if (displayTransform) DisplayTransforms.apply(combinedGeo, displayTransform);
4483
4535
  }
4484
4536
  combinedGeo.computeBoundingBox();
4485
4537
  let mesh;
@@ -4533,7 +4585,7 @@ function isModelObject(obj) {
4533
4585
 
4534
4586
  // src/model/block/scene/BlockObject.ts
4535
4587
  var import_ts_deepmerge6 = __toESM(require_dist());
4536
- var import_three16 = require("three");
4588
+ var import_three17 = require("three");
4537
4589
  var p10 = prefix("BlockObject");
4538
4590
  function matchesCondition(condition, state) {
4539
4591
  return Object.entries(condition).every(([key, value]) => {
@@ -4590,7 +4642,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
4590
4642
  if (isModelObject(model)) {
4591
4643
  model.removeFromScene();
4592
4644
  } else if (isInstanceReference(model)) {
4593
- model.setScale(new import_three16.Vector3(0, 0, 0));
4645
+ model.setScale(new import_three17.Vector3(0, 0, 0));
4594
4646
  }
4595
4647
  }
4596
4648
  super.removeFromScene();
@@ -4651,7 +4703,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
4651
4703
  }
4652
4704
  for (let model of this._models) {
4653
4705
  if (isInstanceReference(model)) {
4654
- model.setScale(new import_three16.Vector3(0, 0, 0));
4706
+ model.setScale(new import_three17.Vector3(0, 0, 0));
4655
4707
  } else {
4656
4708
  model.dispose();
4657
4709
  }
@@ -4688,7 +4740,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
4688
4740
  await this.createVariant(variant);
4689
4741
  }
4690
4742
  async createVariant(variant) {
4691
- const rotation = new import_three16.Euler();
4743
+ const rotation = new import_three17.Euler();
4692
4744
  if (typeof variant.x !== "undefined") {
4693
4745
  rotation.x = toRadians(clampRotationDegrees(variant.x));
4694
4746
  }
@@ -4775,7 +4827,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
4775
4827
  setPositionRotationScaleAt(index, position, rotation, scale) {
4776
4828
  super.setPositionRotationScaleAt(index, position, rotation, scale);
4777
4829
  }
4778
- getMatrixAt(index, matrix = new import_three16.Matrix4()) {
4830
+ getMatrixAt(index, matrix = new import_three17.Matrix4()) {
4779
4831
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
4780
4832
  const child = this._models[0];
4781
4833
  if (child && isModelObject(child)) {
@@ -4854,7 +4906,7 @@ var StructureParser = class {
4854
4906
  };
4855
4907
 
4856
4908
  // src/renderer/MineRenderScene.ts
4857
- var import_three17 = require("three");
4909
+ var import_three18 = require("three");
4858
4910
  var import_ts_deepmerge8 = __toESM(require_dist());
4859
4911
 
4860
4912
  // src/skin/SkinPart.ts
@@ -5698,7 +5750,7 @@ var SkinObject = class extends SceneObject {
5698
5750
  };
5699
5751
 
5700
5752
  // src/renderer/MineRenderScene.ts
5701
- var _MineRenderScene = class _MineRenderScene extends import_three17.Scene {
5753
+ var _MineRenderScene = class _MineRenderScene extends import_three18.Scene {
5702
5754
  constructor(options) {
5703
5755
  super();
5704
5756
  this.isMineRenderScene = true;
@@ -5771,7 +5823,8 @@ var _MineRenderScene = class _MineRenderScene extends import_three17.Scene {
5771
5823
  console.log("instanceMeshes + key");
5772
5824
  let key = asset.key.serialize();
5773
5825
  if (isModelObject(obj)) {
5774
- const { uvLockRotation, tints } = obj.options;
5826
+ const { displayPosition, uvLockRotation, tints } = obj.options;
5827
+ if (displayPosition) key += `|display:${displayPosition}`;
5775
5828
  if (uvLockRotation) key += `|uvlock:${uvLockRotation.join(",")}`;
5776
5829
  const palette = Object.entries(tints ?? {}).sort(([a], [b]) => Number(a) - Number(b));
5777
5830
  if (palette.length) key += `|tints:${JSON.stringify(palette)}`;
@@ -5820,17 +5873,17 @@ function isMineRenderScene(obj) {
5820
5873
  }
5821
5874
 
5822
5875
  // src/renderer/Renderer.ts
5823
- var import_three19 = require("three");
5876
+ var import_three20 = require("three");
5824
5877
  var import_ts_deepmerge9 = __toESM(require_dist());
5825
5878
  var import_stats = __toESM(require("stats.js"));
5826
5879
  var import_postprocessing = require("postprocessing");
5827
5880
 
5828
5881
  // src/three/OrbitControls.js
5829
- var import_three18 = require("three");
5882
+ var import_three19 = require("three");
5830
5883
  var _changeEvent = { type: "change" };
5831
5884
  var _startEvent = { type: "start" };
5832
5885
  var _endEvent = { type: "end" };
5833
- var OrbitControls = class extends import_three18.EventDispatcher {
5886
+ var OrbitControls = class extends import_three19.EventDispatcher {
5834
5887
  constructor(object, domElement) {
5835
5888
  super();
5836
5889
  if (domElement === void 0) console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.');
@@ -5839,7 +5892,7 @@ var OrbitControls = class extends import_three18.EventDispatcher {
5839
5892
  this.domElement = domElement;
5840
5893
  this.domElement.style.touchAction = "none";
5841
5894
  this.enabled = true;
5842
- this.target = new import_three18.Vector3();
5895
+ this.target = new import_three19.Vector3();
5843
5896
  this.minDistance = 0;
5844
5897
  this.maxDistance = Infinity;
5845
5898
  this.minZoom = 0;
@@ -5861,8 +5914,8 @@ var OrbitControls = class extends import_three18.EventDispatcher {
5861
5914
  this.autoRotate = false;
5862
5915
  this.autoRotateSpeed = 2;
5863
5916
  this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" };
5864
- this.mouseButtons = { LEFT: import_three18.MOUSE.ROTATE, MIDDLE: import_three18.MOUSE.DOLLY, RIGHT: import_three18.MOUSE.PAN };
5865
- this.touches = { ONE: import_three18.TOUCH.ROTATE, TWO: import_three18.TOUCH.DOLLY_PAN };
5917
+ this.mouseButtons = { LEFT: import_three19.MOUSE.ROTATE, MIDDLE: import_three19.MOUSE.DOLLY, RIGHT: import_three19.MOUSE.PAN };
5918
+ this.touches = { ONE: import_three19.TOUCH.ROTATE, TWO: import_three19.TOUCH.DOLLY_PAN };
5866
5919
  this.target0 = this.target.clone();
5867
5920
  this.position0 = this.object.position.clone();
5868
5921
  this.zoom0 = this.object.zoom;
@@ -5891,11 +5944,11 @@ var OrbitControls = class extends import_three18.EventDispatcher {
5891
5944
  state = STATE.NONE;
5892
5945
  };
5893
5946
  this.update = function() {
5894
- const offset = new import_three18.Vector3();
5895
- const quat = new import_three18.Quaternion().setFromUnitVectors(object.up, new import_three18.Vector3(0, 1, 0));
5947
+ const offset = new import_three19.Vector3();
5948
+ const quat = new import_three19.Quaternion().setFromUnitVectors(object.up, new import_three19.Vector3(0, 1, 0));
5896
5949
  const quatInverse = quat.clone().invert();
5897
- const lastPosition = new import_three18.Vector3();
5898
- const lastQuaternion = new import_three18.Quaternion();
5950
+ const lastPosition = new import_three19.Vector3();
5951
+ const lastQuaternion = new import_three19.Quaternion();
5899
5952
  const twoPI = 2 * Math.PI;
5900
5953
  return function update() {
5901
5954
  const position = scope.object.position;
@@ -5981,20 +6034,20 @@ var OrbitControls = class extends import_three18.EventDispatcher {
5981
6034
  };
5982
6035
  let state = STATE.NONE;
5983
6036
  const EPS = 1e-6;
5984
- const spherical = new import_three18.Spherical();
5985
- const sphericalDelta = new import_three18.Spherical();
6037
+ const spherical = new import_three19.Spherical();
6038
+ const sphericalDelta = new import_three19.Spherical();
5986
6039
  let scale = 1;
5987
- const panOffset = new import_three18.Vector3();
6040
+ const panOffset = new import_three19.Vector3();
5988
6041
  let zoomChanged = false;
5989
- const rotateStart = new import_three18.Vector2();
5990
- const rotateEnd = new import_three18.Vector2();
5991
- const rotateDelta = new import_three18.Vector2();
5992
- const panStart = new import_three18.Vector2();
5993
- const panEnd = new import_three18.Vector2();
5994
- const panDelta = new import_three18.Vector2();
5995
- const dollyStart = new import_three18.Vector2();
5996
- const dollyEnd = new import_three18.Vector2();
5997
- const dollyDelta = new import_three18.Vector2();
6042
+ const rotateStart = new import_three19.Vector2();
6043
+ const rotateEnd = new import_three19.Vector2();
6044
+ const rotateDelta = new import_three19.Vector2();
6045
+ const panStart = new import_three19.Vector2();
6046
+ const panEnd = new import_three19.Vector2();
6047
+ const panDelta = new import_three19.Vector2();
6048
+ const dollyStart = new import_three19.Vector2();
6049
+ const dollyEnd = new import_three19.Vector2();
6050
+ const dollyDelta = new import_three19.Vector2();
5998
6051
  const pointers = [];
5999
6052
  const pointerPositions = {};
6000
6053
  function getAutoRotationAngle() {
@@ -6010,7 +6063,7 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6010
6063
  sphericalDelta.phi -= angle;
6011
6064
  }
6012
6065
  const panLeft = function() {
6013
- const v = new import_three18.Vector3();
6066
+ const v = new import_three19.Vector3();
6014
6067
  return function panLeft2(distance, objectMatrix) {
6015
6068
  v.setFromMatrixColumn(objectMatrix, 0);
6016
6069
  v.multiplyScalar(-distance);
@@ -6018,7 +6071,7 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6018
6071
  };
6019
6072
  }();
6020
6073
  const panUp = function() {
6021
- const v = new import_three18.Vector3();
6074
+ const v = new import_three19.Vector3();
6022
6075
  return function panUp2(distance, objectMatrix) {
6023
6076
  if (scope.screenSpacePanning === true) {
6024
6077
  v.setFromMatrixColumn(objectMatrix, 1);
@@ -6031,7 +6084,7 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6031
6084
  };
6032
6085
  }();
6033
6086
  const pan = function() {
6034
- const offset = new import_three18.Vector3();
6087
+ const offset = new import_three19.Vector3();
6035
6088
  return function pan2(deltaX, deltaY) {
6036
6089
  const element = scope.domElement;
6037
6090
  if (scope.object.isPerspectiveCamera) {
@@ -6280,12 +6333,12 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6280
6333
  mouseAction = -1;
6281
6334
  }
6282
6335
  switch (mouseAction) {
6283
- case import_three18.MOUSE.DOLLY:
6336
+ case import_three19.MOUSE.DOLLY:
6284
6337
  if (scope.enableZoom === false) return;
6285
6338
  handleMouseDownDolly(event);
6286
6339
  state = STATE.DOLLY;
6287
6340
  break;
6288
- case import_three18.MOUSE.ROTATE:
6341
+ case import_three19.MOUSE.ROTATE:
6289
6342
  if (event.ctrlKey || event.metaKey || event.shiftKey) {
6290
6343
  if (scope.enablePan === false) return;
6291
6344
  handleMouseDownPan(event);
@@ -6296,7 +6349,7 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6296
6349
  state = STATE.ROTATE;
6297
6350
  }
6298
6351
  break;
6299
- case import_three18.MOUSE.PAN:
6352
+ case import_three19.MOUSE.PAN:
6300
6353
  if (event.ctrlKey || event.metaKey || event.shiftKey) {
6301
6354
  if (scope.enableRotate === false) return;
6302
6355
  handleMouseDownRotate(event);
@@ -6352,12 +6405,12 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6352
6405
  switch (pointers.length) {
6353
6406
  case 1:
6354
6407
  switch (scope.touches.ONE) {
6355
- case import_three18.TOUCH.ROTATE:
6408
+ case import_three19.TOUCH.ROTATE:
6356
6409
  if (scope.enableRotate === false) return;
6357
6410
  handleTouchStartRotate();
6358
6411
  state = STATE.TOUCH_ROTATE;
6359
6412
  break;
6360
- case import_three18.TOUCH.PAN:
6413
+ case import_three19.TOUCH.PAN:
6361
6414
  if (scope.enablePan === false) return;
6362
6415
  handleTouchStartPan();
6363
6416
  state = STATE.TOUCH_PAN;
@@ -6368,12 +6421,12 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6368
6421
  break;
6369
6422
  case 2:
6370
6423
  switch (scope.touches.TWO) {
6371
- case import_three18.TOUCH.DOLLY_PAN:
6424
+ case import_three19.TOUCH.DOLLY_PAN:
6372
6425
  if (scope.enableZoom === false && scope.enablePan === false) return;
6373
6426
  handleTouchStartDollyPan();
6374
6427
  state = STATE.TOUCH_DOLLY_PAN;
6375
6428
  break;
6376
- case import_three18.TOUCH.DOLLY_ROTATE:
6429
+ case import_three19.TOUCH.DOLLY_ROTATE:
6377
6430
  if (scope.enableZoom === false && scope.enableRotate === false) return;
6378
6431
  handleTouchStartDollyRotate();
6379
6432
  state = STATE.TOUCH_DOLLY_ROTATE;
@@ -6440,7 +6493,7 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6440
6493
  function trackPointer(event) {
6441
6494
  let position = pointerPositions[event.pointerId];
6442
6495
  if (position === void 0) {
6443
- position = new import_three18.Vector2();
6496
+ position = new import_three19.Vector2();
6444
6497
  pointerPositions[event.pointerId] = position;
6445
6498
  }
6446
6499
  position.set(event.pageX, event.pageY);
@@ -6460,10 +6513,10 @@ var MapControls = class extends OrbitControls {
6460
6513
  constructor(object, domElement) {
6461
6514
  super(object, domElement);
6462
6515
  this.screenSpacePanning = false;
6463
- this.mouseButtons.LEFT = import_three18.MOUSE.PAN;
6464
- this.mouseButtons.RIGHT = import_three18.MOUSE.ROTATE;
6465
- this.touches.ONE = import_three18.TOUCH.PAN;
6466
- this.touches.TWO = import_three18.TOUCH.DOLLY_ROTATE;
6516
+ this.mouseButtons.LEFT = import_three19.MOUSE.PAN;
6517
+ this.mouseButtons.RIGHT = import_three19.MOUSE.ROTATE;
6518
+ this.touches.ONE = import_three19.TOUCH.PAN;
6519
+ this.touches.TWO = import_three19.TOUCH.DOLLY_ROTATE;
6467
6520
  }
6468
6521
  };
6469
6522
 
@@ -6500,14 +6553,14 @@ var _Renderer = class _Renderer {
6500
6553
  switch (this.options.camera.type) {
6501
6554
  case "perspective":
6502
6555
  default:
6503
- return new import_three19.PerspectiveCamera(
6556
+ return new import_three20.PerspectiveCamera(
6504
6557
  this.options.camera.perspective.fov,
6505
6558
  this.options.camera.perspective.aspect ?? this.viewWidth / this.viewHeight,
6506
6559
  this.options.camera.near,
6507
6560
  this.options.camera.far
6508
6561
  );
6509
6562
  case "orthographic":
6510
- return new import_three19.OrthographicCamera(
6563
+ return new import_three20.OrthographicCamera(
6511
6564
  this.options.camera.orthographic.left ?? this.viewWidth / -2,
6512
6565
  this.options.camera.orthographic.right ?? this.viewWidth / 2,
6513
6566
  this.options.camera.orthographic.top ?? this.viewHeight / 2,
@@ -6518,7 +6571,7 @@ var _Renderer = class _Renderer {
6518
6571
  }
6519
6572
  }
6520
6573
  createRenderer() {
6521
- const renderer = new import_three19.WebGLRenderer({
6574
+ const renderer = new import_three20.WebGLRenderer({
6522
6575
  antialias: this.options.render.antialias,
6523
6576
  alpha: true,
6524
6577
  powerPreference: "high-performance",
@@ -6526,8 +6579,8 @@ var _Renderer = class _Renderer {
6526
6579
  });
6527
6580
  renderer.setClearColor(0, 0);
6528
6581
  renderer.shadowMap.enabled = true;
6529
- renderer.shadowMap.type = import_three19.PCFSoftShadowMap;
6530
- renderer.outputColorSpace = import_three19.SRGBColorSpace;
6582
+ renderer.shadowMap.type = import_three20.PCFSoftShadowMap;
6583
+ renderer.outputColorSpace = import_three20.SRGBColorSpace;
6531
6584
  renderer.setSize(this.viewWidth, this.viewHeight);
6532
6585
  return renderer;
6533
6586
  }
@@ -6561,20 +6614,20 @@ var _Renderer = class _Renderer {
6561
6614
  window["__THREE_DEVTOOLS__"].dispatchEvent(new CustomEvent("observe", { detail: this.scene }));
6562
6615
  }
6563
6616
  if (this.options.debug.grid) {
6564
- const gridHelper = new import_three19.GridHelper(128, 16);
6617
+ const gridHelper = new import_three20.GridHelper(128, 16);
6565
6618
  this._debugHelpers.push(gridHelper);
6566
6619
  this.scene.add(gridHelper);
6567
- const gridHelper2 = new import_three19.GridHelper(128, 16);
6620
+ const gridHelper2 = new import_three20.GridHelper(128, 16);
6568
6621
  this._debugHelpers.push(gridHelper2);
6569
6622
  gridHelper2.rotation.x = 90 * (Math.PI / 180);
6570
6623
  this.scene.add(gridHelper2);
6571
- const gridHelper3 = new import_three19.GridHelper(128, 16);
6624
+ const gridHelper3 = new import_three20.GridHelper(128, 16);
6572
6625
  this._debugHelpers.push(gridHelper3);
6573
6626
  gridHelper3.rotation.z = 90 * (Math.PI / 180);
6574
6627
  this.scene.add(gridHelper3);
6575
6628
  }
6576
6629
  if (this.options.debug.axes) {
6577
- const axesHelper = new import_three19.AxesHelper(64);
6630
+ const axesHelper = new import_three20.AxesHelper(64);
6578
6631
  this._debugHelpers.push(axesHelper);
6579
6632
  this.scene.add(axesHelper);
6580
6633
  }
@@ -6778,8 +6831,8 @@ _Renderer.DEFAULT_OPTIONS = (0, import_ts_deepmerge9.default)({}, {
6778
6831
  top: void 0,
6779
6832
  bottom: void 0
6780
6833
  },
6781
- position: new import_three19.Vector3(50, 50, 50),
6782
- lookingAt: new import_three19.Vector3(0, 0, 0)
6834
+ position: new import_three20.Vector3(50, 50, 50),
6835
+ lookingAt: new import_three20.Vector3(0, 0, 0)
6783
6836
  },
6784
6837
  render: {
6785
6838
  fpsLimit: 60,
@@ -6973,10 +7026,10 @@ var Skins = class {
6973
7026
  };
6974
7027
 
6975
7028
  // src/world/Chunk.ts
6976
- var import_three22 = require("three");
7029
+ var import_three23 = require("three");
6977
7030
 
6978
7031
  // src/world/MineRenderWorld.ts
6979
- var import_three21 = require("three");
7032
+ var import_three22 = require("three");
6980
7033
  var MineRenderWorld = class {
6981
7034
  constructor(scene) {
6982
7035
  this._size = 4;
@@ -6987,10 +7040,10 @@ var MineRenderWorld = class {
6987
7040
  }
6988
7041
  getBlockAt(posOrX, y, z) {
6989
7042
  if (typeof posOrX == "number") {
6990
- return this.getBlockAt(new import_three21.Vector3(posOrX, y, z));
7043
+ return this.getBlockAt(new import_three22.Vector3(posOrX, y, z));
6991
7044
  }
6992
7045
  if (isTripleArray(posOrX)) {
6993
- return this.getBlockAt(new import_three21.Vector3(posOrX[0], posOrX[1], posOrX[2]));
7046
+ return this.getBlockAt(new import_three22.Vector3(posOrX[0], posOrX[1], posOrX[2]));
6994
7047
  }
6995
7048
  const chunk = this.getChunkAt(posOrX);
6996
7049
  if (typeof chunk === "undefined") {
@@ -7001,10 +7054,10 @@ var MineRenderWorld = class {
7001
7054
  }
7002
7055
  async setBlockAt(posOrX, yOrBlock, z, block) {
7003
7056
  if (typeof posOrX == "number") {
7004
- return this.setBlockAt(new import_three21.Vector3(posOrX, yOrBlock, z), block);
7057
+ return this.setBlockAt(new import_three22.Vector3(posOrX, yOrBlock, z), block);
7005
7058
  }
7006
7059
  if (isTripleArray(posOrX)) {
7007
- return this.setBlockAt(new import_three21.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
7060
+ return this.setBlockAt(new import_three22.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
7008
7061
  }
7009
7062
  this.validatePosBounds(posOrX);
7010
7063
  const chunk = this.getOrCreateChunkAt(posOrX);
@@ -7050,14 +7103,14 @@ var MineRenderWorld = class {
7050
7103
  return this._chunks[index];
7051
7104
  }
7052
7105
  static worldToScenePosition(pos) {
7053
- return new import_three21.Vector3(
7106
+ return new import_three22.Vector3(
7054
7107
  pos.x * 16,
7055
7108
  pos.y * 16,
7056
7109
  pos.z * 16
7057
7110
  );
7058
7111
  }
7059
7112
  static sceneToWorldPosition(pos) {
7060
- return new import_three21.Vector3(
7113
+ return new import_three22.Vector3(
7061
7114
  pos.x / 16,
7062
7115
  pos.y / 16,
7063
7116
  pos.z / 16
@@ -7094,12 +7147,12 @@ var Chunk = class _Chunk {
7094
7147
  this.x = x;
7095
7148
  this.y = y;
7096
7149
  this.z = z;
7097
- let anchor = new import_three22.Object3D();
7150
+ let anchor = new import_three23.Object3D();
7098
7151
  this._anchor = anchor;
7099
7152
  scene.add(anchor);
7100
7153
  anchor.position.set(this.x * 256 + 128 - 8, this.y * 256 + 128 - 8, this.z * 256 + 128 - 8);
7101
7154
  addBox3WireframeToObject(
7102
- new import_three22.Box3(new import_three22.Vector3(0, 0, 0), new import_three22.Vector3(256, 256, 256)),
7155
+ new import_three23.Box3(new import_three23.Vector3(0, 0, 0), new import_three23.Vector3(256, 256, 256)),
7103
7156
  anchor,
7104
7157
  16776960,
7105
7158
  4
@@ -7107,10 +7160,10 @@ var Chunk = class _Chunk {
7107
7160
  }
7108
7161
  getBlockAt(posOrX, y, z) {
7109
7162
  if (typeof posOrX == "number") {
7110
- return this.getBlockAt(new import_three22.Vector3(posOrX, y, z));
7163
+ return this.getBlockAt(new import_three23.Vector3(posOrX, y, z));
7111
7164
  }
7112
7165
  if (isTripleArray(posOrX)) {
7113
- return this.getBlockAt(new import_three22.Vector3(posOrX[0], posOrX[1], posOrX[2]));
7166
+ return this.getBlockAt(new import_three23.Vector3(posOrX[0], posOrX[1], posOrX[2]));
7114
7167
  }
7115
7168
  const pos = this.worldPosToChunkPos(posOrX);
7116
7169
  const index = _Chunk.chunkPosToBlockIndex(pos);
@@ -7118,10 +7171,10 @@ var Chunk = class _Chunk {
7118
7171
  }
7119
7172
  async setBlockAt(posOrX, yOrBlock, z, block) {
7120
7173
  if (typeof posOrX == "number") {
7121
- return this.setBlockAt(new import_three22.Vector3(posOrX, yOrBlock, z), block);
7174
+ return this.setBlockAt(new import_three23.Vector3(posOrX, yOrBlock, z), block);
7122
7175
  }
7123
7176
  if (isTripleArray(posOrX)) {
7124
- return this.setBlockAt(new import_three22.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
7177
+ return this.setBlockAt(new import_three23.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
7125
7178
  }
7126
7179
  const worldPos = posOrX;
7127
7180
  const pos = this.worldPosToChunkPos(worldPos);
@@ -7167,7 +7220,7 @@ var Chunk = class _Chunk {
7167
7220
  }
7168
7221
  async clear() {
7169
7222
  let promises = [];
7170
- let pos = new import_three22.Vector3();
7223
+ let pos = new import_three23.Vector3();
7171
7224
  for (let x = 0; x < 16; x++) {
7172
7225
  for (let z = 0; z < 16; z++) {
7173
7226
  for (let y = 0; y < 16; y++) {
@@ -7186,14 +7239,14 @@ var Chunk = class _Chunk {
7186
7239
  return pos.y * 16 * 16 + pos.z * 16 + pos.x;
7187
7240
  }
7188
7241
  worldPosToChunkPos(pos) {
7189
- return new import_three22.Vector3(
7242
+ return new import_three23.Vector3(
7190
7243
  pos.x - this.x * 16,
7191
7244
  pos.y - this.y * 16,
7192
7245
  pos.z - this.z * 16
7193
7246
  );
7194
7247
  }
7195
7248
  chunkPosToWorldPos(pos) {
7196
- return new import_three22.Vector3(
7249
+ return new import_three23.Vector3(
7197
7250
  this.x * 16 + pos.x,
7198
7251
  this.y * 16 + pos.y,
7199
7252
  this.z * 16 + pos.z