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.
@@ -155,6 +155,7 @@ __export(index_node_exports, {
155
155
  DISPLAY_POSITIONS: () => DISPLAY_POSITIONS,
156
156
  DefaultBlockStates: () => DefaultBlockStates,
157
157
  DisplayPosition: () => DisplayPosition,
158
+ DisplayTransforms: () => DisplayTransforms,
158
159
  Entities: () => Entities,
159
160
  EntityModels: () => EntityModels,
160
161
  EntityObject: () => EntityObject,
@@ -1254,7 +1255,7 @@ var Meshes = class _Meshes {
1254
1255
  };
1255
1256
 
1256
1257
  // src/UVMapper.ts
1257
- var import_three8 = require("three");
1258
+ var import_three9 = require("three");
1258
1259
 
1259
1260
  // src/model/ModelMerger.ts
1260
1261
  var import_ts_deepmerge = __toESM(require_dist());
@@ -1345,15 +1346,77 @@ function isAssetKey(obj) {
1345
1346
  return isBasicAssetKey(obj) && obj.isAssetKey === true;
1346
1347
  }
1347
1348
 
1349
+ // src/model/DisplayTransforms.ts
1350
+ var import_three7 = require("three");
1351
+
1352
+ // src/model/DisplayPosition.ts
1353
+ var DisplayPosition = /* @__PURE__ */ ((DisplayPosition2) => {
1354
+ DisplayPosition2["THIRDPERSON_RIGHTHAND"] = "thirdperson_righthand";
1355
+ DisplayPosition2["THIRDPERSON_LEFTHAND"] = "thirdperson_lefthand";
1356
+ DisplayPosition2["FIRSTPERSON_RIGHTHAND"] = "firstperson_righthand";
1357
+ DisplayPosition2["FIRSTPERSON_LEFTHAND"] = "firstperson_lefthand";
1358
+ DisplayPosition2["GUI"] = "gui";
1359
+ DisplayPosition2["HEAD"] = "head";
1360
+ DisplayPosition2["GROUND"] = "ground";
1361
+ DisplayPosition2["FIXED"] = "fixed";
1362
+ DisplayPosition2["ON_SHELF"] = "on_shelf";
1363
+ return DisplayPosition2;
1364
+ })(DisplayPosition || {});
1365
+ var DISPLAY_POSITIONS = Object.values(DisplayPosition);
1366
+
1367
+ // src/model/DisplayTransforms.ts
1368
+ var DisplayTransforms = class {
1369
+ /** Resolve hand fallbacks within one model, before inheriting parent display entries. */
1370
+ static withHandFallbacks(display) {
1371
+ if (!display) return void 0;
1372
+ const resolved = { ...display };
1373
+ for (const [left, right] of [
1374
+ ["thirdperson_lefthand" /* THIRDPERSON_LEFTHAND */, "thirdperson_righthand" /* THIRDPERSON_RIGHTHAND */],
1375
+ ["firstperson_lefthand" /* FIRSTPERSON_LEFTHAND */, "firstperson_righthand" /* FIRSTPERSON_RIGHTHAND */]
1376
+ ]) {
1377
+ if (resolved[left] === void 0 && resolved[right] !== void 0) resolved[left] = resolved[right];
1378
+ }
1379
+ return resolved;
1380
+ }
1381
+ /** Build a display pose for geometry already centered at the model's [8, 8, 8] pivot. */
1382
+ static getMatrix(display, position) {
1383
+ const transform = this.withHandFallbacks(display)?.[position] ?? {};
1384
+ const left = position === "firstperson_lefthand" /* FIRSTPERSON_LEFTHAND */ || position === "thirdperson_lefthand" /* THIRDPERSON_LEFTHAND */;
1385
+ const sign = left ? -1 : 1;
1386
+ const [x, y, z] = transform.rotation ?? [0, 0, 0];
1387
+ const rotation = new import_three7.Quaternion().setFromEuler(new import_three7.Euler(toRadians(x), sign * toRadians(y), sign * toRadians(z), "XYZ"));
1388
+ const translation = new import_three7.Vector3(...transform.translation ?? [0, 0, 0]).clampScalar(-80, 80);
1389
+ translation.x *= sign;
1390
+ const scale = new import_three7.Vector3(...transform.scale ?? [1, 1, 1]).clampScalar(-4, 4);
1391
+ return new import_three7.Matrix4().compose(translation, rotation, scale);
1392
+ }
1393
+ static apply(geometry, matrix) {
1394
+ geometry.applyMatrix4(matrix);
1395
+ if (matrix.determinant() < 0) {
1396
+ if (!geometry.index) geometry.setIndex(Array.from({ length: geometry.getAttribute("position").count }, (_, i) => i));
1397
+ const index = geometry.index;
1398
+ for (let i = 0; i < index.count; i += 3) {
1399
+ const second = index.getX(i + 1);
1400
+ index.setX(i + 1, index.getX(i + 2));
1401
+ index.setX(i + 2, second);
1402
+ }
1403
+ index.needsUpdate = true;
1404
+ }
1405
+ }
1406
+ };
1407
+
1348
1408
  // src/model/ModelMerger.ts
1349
1409
  var ModelMerger = class {
1350
1410
  static async mergeWithParents(model) {
1351
1411
  const models = await this.collectAllParents(model);
1352
1412
  let merged = {};
1353
- for (let parentModel of models) {
1354
- merged = import_ts_deepmerge.default.withOptions({ mergeArrays: false }, merged, parentModel);
1413
+ for (const source of [...models, model]) {
1414
+ const inheritedDisplay = merged.display;
1415
+ merged = import_ts_deepmerge.default.withOptions({ mergeArrays: false }, merged, source);
1416
+ if (source.display) {
1417
+ merged.display = { ...inheritedDisplay, ...DisplayTransforms.withHandFallbacks(source.display) };
1418
+ }
1355
1419
  }
1356
- merged = import_ts_deepmerge.default.withOptions({ mergeArrays: false }, merged, model);
1357
1420
  merged.hierarchy = models.map((m) => m.parent).filter((p12) => `${p12}`);
1358
1421
  merged.hierarchy.push(`${merged.parent}`);
1359
1422
  return merged;
@@ -1608,9 +1671,9 @@ var BatchedExecutor = class {
1608
1671
  };
1609
1672
 
1610
1673
  // src/util/model.ts
1611
- var import_three7 = require("three");
1674
+ var import_three8 = require("three");
1612
1675
  function applyElementRotation(rotation, geometry) {
1613
- const origin = new import_three7.Vector3(rotation.origin[0], rotation.origin[1], rotation.origin[2]);
1676
+ const origin = new import_three8.Vector3(rotation.origin[0], rotation.origin[1], rotation.origin[2]);
1614
1677
  geometry.translate(-origin.x, -origin.y, -origin.z);
1615
1678
  switch (rotation.axis) {
1616
1679
  case "x" /* X */:
@@ -1635,7 +1698,7 @@ function applyElementRotation(rotation, geometry) {
1635
1698
  geometry.translate(origin.x, origin.y, origin.z);
1636
1699
  }
1637
1700
  function applyModelPartRotation(modelPart, geometry) {
1638
- const origin = new import_three7.Vector3(modelPart.pivotX, modelPart.pivotY, modelPart.pivotZ);
1701
+ const origin = new import_three8.Vector3(modelPart.pivotX, modelPart.pivotY, modelPart.pivotZ);
1639
1702
  geometry.translate(-origin.x, -origin.y, -origin.z);
1640
1703
  geometry.rotateX(toRadians(modelPart.pitch));
1641
1704
  geometry.rotateY(toRadians(modelPart.yaw));
@@ -1645,42 +1708,42 @@ function applyModelPartRotation(modelPart, geometry) {
1645
1708
  function applyGenericRotation(axis, rotation, obj) {
1646
1709
  switch (axis) {
1647
1710
  case "x" /* X */:
1648
- obj.rotateOnAxis(new import_three7.Vector3(1, 0, 0), toRadians(rotation));
1711
+ obj.rotateOnAxis(new import_three8.Vector3(1, 0, 0), toRadians(rotation));
1649
1712
  break;
1650
1713
  case "y" /* Y */:
1651
- obj.rotateOnAxis(new import_three7.Vector3(0, 1, 0), toRadians(rotation));
1714
+ obj.rotateOnAxis(new import_three8.Vector3(0, 1, 0), toRadians(rotation));
1652
1715
  break;
1653
1716
  case "z" /* Z */:
1654
- obj.rotateOnAxis(new import_three7.Vector3(0, 0, 1), toRadians(rotation));
1717
+ obj.rotateOnAxis(new import_three8.Vector3(0, 0, 1), toRadians(rotation));
1655
1718
  break;
1656
1719
  }
1657
1720
  }
1658
1721
  function addBox3WireframeToObject(box, obj, color = 16777215, w = 2) {
1659
- let size = new import_three7.Vector3();
1722
+ let size = new import_three8.Vector3();
1660
1723
  box.getSize(size);
1661
- let boxGeo = new import_three7.BoxGeometry(size.x, size.y, size.z, 1, 1, 1);
1662
- let wireGeo = new import_three7.EdgesGeometry(boxGeo);
1663
- let wireMat = new import_three7.LineBasicMaterial({ color, linewidth: w });
1664
- let wireframe = new import_three7.LineSegments(wireGeo, wireMat);
1724
+ let boxGeo = new import_three8.BoxGeometry(size.x, size.y, size.z, 1, 1, 1);
1725
+ let wireGeo = new import_three8.EdgesGeometry(boxGeo);
1726
+ let wireMat = new import_three8.LineBasicMaterial({ color, linewidth: w });
1727
+ let wireframe = new import_three8.LineSegments(wireGeo, wireMat);
1665
1728
  obj.add(wireframe);
1666
- let axes = new import_three7.AxesHelper(1);
1729
+ let axes = new import_three8.AxesHelper(1);
1667
1730
  obj.add(axes);
1668
1731
  }
1669
1732
  function addWireframeToObject(obj, color = 16777215, w = 2) {
1670
- let boxGeo = new import_three7.BoxGeometry(16, 16, 16, 1, 1, 1);
1671
- let wireGeo = new import_three7.EdgesGeometry(boxGeo);
1672
- let wireMat = new import_three7.LineBasicMaterial({ color, linewidth: w });
1673
- let wireframe = new import_three7.LineSegments(wireGeo, wireMat);
1733
+ let boxGeo = new import_three8.BoxGeometry(16, 16, 16, 1, 1, 1);
1734
+ let wireGeo = new import_three8.EdgesGeometry(boxGeo);
1735
+ let wireMat = new import_three8.LineBasicMaterial({ color, linewidth: w });
1736
+ let wireframe = new import_three8.LineSegments(wireGeo, wireMat);
1674
1737
  obj.add(wireframe);
1675
- let axes = new import_three7.AxesHelper(1);
1738
+ let axes = new import_three8.AxesHelper(1);
1676
1739
  obj.add(axes);
1677
1740
  }
1678
1741
  function addWireframeToMesh(geo, mesh, color = 16777215, w = 2) {
1679
- let wireGeo = new import_three7.EdgesGeometry(geo);
1680
- let wireMat = new import_three7.LineBasicMaterial({ color, linewidth: w });
1681
- let wireframe = new import_three7.LineSegments(wireGeo, wireMat);
1742
+ let wireGeo = new import_three8.EdgesGeometry(geo);
1743
+ let wireMat = new import_three8.LineBasicMaterial({ color, linewidth: w });
1744
+ let wireframe = new import_three8.LineSegments(wireGeo, wireMat);
1682
1745
  mesh.add(wireframe);
1683
- let axes = new import_three7.AxesHelper(1);
1746
+ let axes = new import_three8.AxesHelper(1);
1684
1747
  mesh.add(axes);
1685
1748
  }
1686
1749
 
@@ -2259,12 +2322,12 @@ var X = 0;
2259
2322
  var Y = 1;
2260
2323
  var Z = 2;
2261
2324
  var FACE_UV_AXES = {
2262
- east: [new import_three8.Vector3(0, 0, -1), new import_three8.Vector3(0, -1, 0)],
2263
- west: [new import_three8.Vector3(0, 0, 1), new import_three8.Vector3(0, -1, 0)],
2264
- up: [new import_three8.Vector3(1, 0, 0), new import_three8.Vector3(0, 0, 1)],
2265
- down: [new import_three8.Vector3(1, 0, 0), new import_three8.Vector3(0, 0, -1)],
2266
- south: [new import_three8.Vector3(1, 0, 0), new import_three8.Vector3(0, -1, 0)],
2267
- north: [new import_three8.Vector3(-1, 0, 0), new import_three8.Vector3(0, -1, 0)]
2325
+ east: [new import_three9.Vector3(0, 0, -1), new import_three9.Vector3(0, -1, 0)],
2326
+ west: [new import_three9.Vector3(0, 0, 1), new import_three9.Vector3(0, -1, 0)],
2327
+ up: [new import_three9.Vector3(1, 0, 0), new import_three9.Vector3(0, 0, 1)],
2328
+ down: [new import_three9.Vector3(1, 0, 0), new import_three9.Vector3(0, 0, -1)],
2329
+ south: [new import_three9.Vector3(1, 0, 0), new import_three9.Vector3(0, -1, 0)],
2330
+ north: [new import_three9.Vector3(-1, 0, 0), new import_three9.Vector3(0, -1, 0)]
2268
2331
  };
2269
2332
  var UVMapper = class {
2270
2333
  static makeUv(uvCoord, originalTextureSize, actualTextureSize) {
@@ -2361,7 +2424,7 @@ var UVMapper = class {
2361
2424
  return array;
2362
2425
  }
2363
2426
  static facesToUv(faces, originalTextureSize, actualTextureSize) {
2364
- return new import_three8.Float32BufferAttribute(this.facesToUvArray(faces, originalTextureSize, actualTextureSize), 2);
2427
+ return new import_three9.Float32BufferAttribute(this.facesToUvArray(faces, originalTextureSize, actualTextureSize), 2);
2365
2428
  }
2366
2429
  static lockUvs(geometry, faces, atlas, rotation) {
2367
2430
  const uv = geometry.getAttribute("uv");
@@ -2439,32 +2502,32 @@ var UVMapper = class {
2439
2502
  v1 *= scaleV;
2440
2503
  u2 *= scaleU;
2441
2504
  v2 *= scaleV;
2442
- let tl = new import_three8.Vector2(u1, v1);
2443
- let tr = new import_three8.Vector2(u2, v1);
2444
- let bl = new import_three8.Vector2(u1, v2);
2445
- let br = new import_three8.Vector2(u2, v2);
2505
+ let tl = new import_three9.Vector2(u1, v1);
2506
+ let tr = new import_three9.Vector2(u2, v1);
2507
+ let bl = new import_three9.Vector2(u1, v2);
2508
+ let br = new import_three9.Vector2(u2, v2);
2446
2509
  switch (rotation) {
2447
2510
  case 0:
2448
2511
  case 360:
2449
2512
  default:
2450
2513
  break;
2451
2514
  case 90:
2452
- tl = new import_three8.Vector2(u1, v2);
2453
- tr = new import_three8.Vector2(u1, v1);
2454
- bl = new import_three8.Vector2(u2, v2);
2455
- br = new import_three8.Vector2(u2, v1);
2515
+ tl = new import_three9.Vector2(u1, v2);
2516
+ tr = new import_three9.Vector2(u1, v1);
2517
+ bl = new import_three9.Vector2(u2, v2);
2518
+ br = new import_three9.Vector2(u2, v1);
2456
2519
  break;
2457
2520
  case 180:
2458
- tl = new import_three8.Vector2(u2, v2);
2459
- tr = new import_three8.Vector2(u1, v2);
2460
- bl = new import_three8.Vector2(u2, v1);
2461
- br = new import_three8.Vector2(u1, v1);
2521
+ tl = new import_three9.Vector2(u2, v2);
2522
+ tr = new import_three9.Vector2(u1, v2);
2523
+ bl = new import_three9.Vector2(u2, v1);
2524
+ br = new import_three9.Vector2(u1, v1);
2462
2525
  break;
2463
2526
  case 270:
2464
- tl = new import_three8.Vector2(u2, v1);
2465
- tr = new import_three8.Vector2(u2, v2);
2466
- bl = new import_three8.Vector2(u1, v1);
2467
- br = new import_three8.Vector2(u1, v2);
2527
+ tl = new import_three9.Vector2(u2, v1);
2528
+ tr = new import_three9.Vector2(u2, v2);
2529
+ bl = new import_three9.Vector2(u1, v1);
2530
+ br = new import_three9.Vector2(u1, v2);
2468
2531
  break;
2469
2532
  }
2470
2533
  return [tl, tr, bl, br];
@@ -2611,7 +2674,7 @@ var UVMapper = class {
2611
2674
  const faceTexture = face.texture.substr(1);
2612
2675
  const texPosition = positions[faceTexture] || [0, 0];
2613
2676
  const texSize = sizes[faceTexture] || [16, 16];
2614
- let texPosV = new import_three8.Vector2(texPosition[0], texPosition[1]);
2677
+ let texPosV = new import_three9.Vector2(texPosition[0], texPosition[1]);
2615
2678
  const [tl, tr, bl, br] = this.expandAndRotateMcUvs(face.uv, face.rotation, texSize[0], texSize[1]);
2616
2679
  tl.add(texPosV);
2617
2680
  tr.add(texPosV);
@@ -2845,7 +2908,7 @@ var BlockEntityModels = class {
2845
2908
  };
2846
2909
 
2847
2910
  // src/renderer/SceneObject.ts
2848
- var import_three9 = require("three");
2911
+ var import_three10 = require("three");
2849
2912
 
2850
2913
  // src/instance/InstanceReference.ts
2851
2914
  var InstanceReference = class {
@@ -2904,7 +2967,7 @@ var MineRenderError = class _MineRenderError extends Error {
2904
2967
  // src/renderer/SceneObject.ts
2905
2968
  var import_ts_deepmerge3 = __toESM(require_dist());
2906
2969
  var p6 = prefix("SceneObject");
2907
- var SceneObject = class _SceneObject extends import_three9.Object3D {
2970
+ var SceneObject = class _SceneObject extends import_three10.Object3D {
2908
2971
  constructor(options) {
2909
2972
  super();
2910
2973
  this.isSceneObject = true;
@@ -2950,7 +3013,7 @@ var SceneObject = class _SceneObject extends import_three9.Object3D {
2950
3013
  return group;
2951
3014
  }
2952
3015
  createGroup(name, x = 0, y = 0, z = 0, offsetAxis, offset = 0) {
2953
- const obj = new import_three9.Object3D();
3016
+ const obj = new import_three10.Object3D();
2954
3017
  if (name) {
2955
3018
  obj.name = `group:${name}`;
2956
3019
  }
@@ -3000,7 +3063,7 @@ var SceneObject = class _SceneObject extends import_three9.Object3D {
3000
3063
  return mesh;
3001
3064
  }
3002
3065
  createMesh(name, geometry, material, offsetAxis, offset = 0) {
3003
- const mesh = new import_three9.Mesh(geometry, material);
3066
+ const mesh = new import_three10.Mesh(geometry, material);
3004
3067
  if (name) {
3005
3068
  mesh.name = `mesh:${name}`;
3006
3069
  }
@@ -3012,7 +3075,7 @@ var SceneObject = class _SceneObject extends import_three9.Object3D {
3012
3075
  return mesh;
3013
3076
  }
3014
3077
  createInstancedMesh(name, geometry, material, count) {
3015
- const mesh = new import_three9.InstancedMesh(geometry, material, count);
3078
+ const mesh = new import_three10.InstancedMesh(geometry, material, count);
3016
3079
  mesh.count = 0;
3017
3080
  if (name) {
3018
3081
  mesh.name = `mesh:${name}`;
@@ -3090,7 +3153,7 @@ var SceneObject = class _SceneObject extends import_three9.Object3D {
3090
3153
  nextInstance() {
3091
3154
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3092
3155
  const i = this._instanceCounter++;
3093
- this.setMatrixAt(i, new import_three9.Matrix4());
3156
+ this.setMatrixAt(i, new import_three10.Matrix4());
3094
3157
  const mesh = this.children[0];
3095
3158
  if (mesh && isInstancedMesh(mesh)) {
3096
3159
  mesh.count = Math.min(this._instanceCounter, mesh.instanceMatrix.count);
@@ -3107,7 +3170,7 @@ var SceneObject = class _SceneObject extends import_three9.Object3D {
3107
3170
  }
3108
3171
  //</editor-fold>
3109
3172
  //<editor-fold desc="TRANSFORMATION">
3110
- getMatrixAt(index, matrix = new import_three9.Matrix4()) {
3173
+ getMatrixAt(index, matrix = new import_three10.Matrix4()) {
3111
3174
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3112
3175
  const child = this.children[0];
3113
3176
  if (child && isInstancedMesh(child)) {
@@ -3126,16 +3189,16 @@ var SceneObject = class _SceneObject extends import_three9.Object3D {
3126
3189
  }
3127
3190
  setPositionRotationScaleAt(index, position, rotation, scale) {
3128
3191
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3129
- const oldPosition = new import_three9.Vector3();
3130
- const oldRotation = new import_three9.Quaternion();
3131
- const oldScale = new import_three9.Vector3();
3132
- const matrix = new import_three9.Matrix4();
3192
+ const oldPosition = new import_three10.Vector3();
3193
+ const oldRotation = new import_three10.Quaternion();
3194
+ const oldScale = new import_three10.Vector3();
3195
+ const matrix = new import_three10.Matrix4();
3133
3196
  if (!scale || !rotation || !position) {
3134
3197
  this.getMatrixAt(index, matrix).decompose(oldPosition, oldRotation, oldScale);
3135
3198
  }
3136
3199
  matrix.compose(
3137
3200
  position ? position : oldPosition,
3138
- rotation ? new import_three9.Quaternion().setFromEuler(rotation) : oldRotation,
3201
+ rotation ? new import_three10.Quaternion().setFromEuler(rotation) : oldRotation,
3139
3202
  scale ? scale : oldScale
3140
3203
  );
3141
3204
  this.setMatrixAt(index, matrix);
@@ -3144,7 +3207,7 @@ var SceneObject = class _SceneObject extends import_three9.Object3D {
3144
3207
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3145
3208
  this.setPositionRotationScaleAt(index, position);
3146
3209
  }
3147
- getPositionAt(index, vector = new import_three9.Vector3()) {
3210
+ getPositionAt(index, vector = new import_three10.Vector3()) {
3148
3211
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3149
3212
  const matrix = this.getMatrixAt(index);
3150
3213
  vector.setFromMatrixPosition(matrix);
@@ -3154,7 +3217,7 @@ var SceneObject = class _SceneObject extends import_three9.Object3D {
3154
3217
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3155
3218
  this.setPositionRotationScaleAt(index, void 0, rotation, void 0);
3156
3219
  }
3157
- getRotationAt(index, euler = new import_three9.Euler()) {
3220
+ getRotationAt(index, euler = new import_three10.Euler()) {
3158
3221
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3159
3222
  const matrix = this.getMatrixAt(index);
3160
3223
  euler.setFromRotationMatrix(matrix);
@@ -3164,7 +3227,7 @@ var SceneObject = class _SceneObject extends import_three9.Object3D {
3164
3227
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3165
3228
  this.setPositionRotationScaleAt(index, void 0, void 0, scale);
3166
3229
  }
3167
- getScaleAt(index, vector = new import_three9.Vector3()) {
3230
+ getScaleAt(index, vector = new import_three10.Vector3()) {
3168
3231
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3169
3232
  const matrix = this.getMatrixAt(index);
3170
3233
  vector.setFromMatrixScale(matrix);
@@ -3279,7 +3342,7 @@ function isSceneObject(obj) {
3279
3342
 
3280
3343
  // src/entity/scene/EntityObject.ts
3281
3344
  var import_ts_deepmerge4 = __toESM(require_dist());
3282
- var import_three11 = require("three");
3345
+ var import_three12 = require("three");
3283
3346
  var THREE3 = __toESM(require("three"));
3284
3347
  var EntityObject = class extends SceneObject {
3285
3348
  constructor(entity, options) {
@@ -3320,7 +3383,7 @@ var EntityObject = class extends SceneObject {
3320
3383
  for (let partName in this.entity.parts) {
3321
3384
  const part = this.entity.parts[partName];
3322
3385
  const texture = new MinecraftCubeTexture(part.textureOffsetU, part.textureOffsetV, part.textureWidth, part.textureHeight);
3323
- const partAnchor = new import_three11.Object3D();
3386
+ const partAnchor = new import_three12.Object3D();
3324
3387
  partAnchor.position.x = part.pivotX;
3325
3388
  partAnchor.position.y = part.pivotY;
3326
3389
  partAnchor.position.z = part.pivotZ;
@@ -3373,16 +3436,16 @@ var GuiObject = class extends SceneObject {
3373
3436
  };
3374
3437
 
3375
3438
  // src/inspector/SceneInspector.ts
3376
- var import_three12 = require("three");
3439
+ var import_three13 = require("three");
3377
3440
  var p7 = prefix("SceneInspector");
3378
3441
  var help = "<span>Ctrl+Click to Select<br/></span><br/>";
3379
3442
  var SceneInspector = class {
3380
3443
  constructor(renderer) {
3381
3444
  this.renderer = renderer;
3382
- this.mouse = new import_three12.Vector2();
3445
+ this.mouse = new import_three13.Vector2();
3383
3446
  this.objectInfoContainer = document.createElement("div");
3384
3447
  this.objectControlsContainer = document.createElement("div");
3385
- this.raycaster = new import_three12.Raycaster();
3448
+ this.raycaster = new import_three13.Raycaster();
3386
3449
  this.init();
3387
3450
  }
3388
3451
  init() {
@@ -3785,20 +3848,6 @@ function isInstanceable(obj) {
3785
3848
  return "nextInstance" in obj;
3786
3849
  }
3787
3850
 
3788
- // src/model/DisplayPosition.ts
3789
- var DisplayPosition = /* @__PURE__ */ ((DisplayPosition2) => {
3790
- DisplayPosition2["THIRDPERSON_RIGHTHAND"] = "thirdperson_righthand";
3791
- DisplayPosition2["THIRDPERSON_LEFTHAND"] = "thirdperson_lefthand";
3792
- DisplayPosition2["FIRSTPERSON_RIGHTHAND"] = "firstperson_righthand";
3793
- DisplayPosition2["FIRSTPERSON_LEFTHAND"] = "firstperson_lefthand";
3794
- DisplayPosition2["GUI"] = "gui";
3795
- DisplayPosition2["HEAD"] = "head";
3796
- DisplayPosition2["GROUND"] = "ground";
3797
- DisplayPosition2["FIXED"] = "fixed";
3798
- return DisplayPosition2;
3799
- })(DisplayPosition || {});
3800
- var DISPLAY_POSITIONS = Object.values(DisplayPosition);
3801
-
3802
3851
  // src/model/GuiLight.ts
3803
3852
  var GuiLight = /* @__PURE__ */ ((GuiLight2) => {
3804
3853
  GuiLight2["FRONT"] = "front";
@@ -3907,10 +3956,10 @@ var BlockTints = class {
3907
3956
  };
3908
3957
 
3909
3958
  // src/model/scene/ModelObject.ts
3910
- var import_three15 = require("three");
3959
+ var import_three16 = require("three");
3911
3960
 
3912
3961
  // src/three/BufferGeometryUtils.js
3913
- var import_three14 = require("three");
3962
+ var import_three15 = require("three");
3914
3963
  function computeTangents(geometry) {
3915
3964
  geometry.computeTangents();
3916
3965
  console.warn("THREE.BufferGeometryUtils: .computeTangents() has been removed. Use BufferGeometry.computeTangents() instead.");
@@ -3922,7 +3971,7 @@ function mergeBufferGeometries(geometries, useGroups = false) {
3922
3971
  const attributes = {};
3923
3972
  const morphAttributes = {};
3924
3973
  const morphTargetsRelative = geometries[0].morphTargetsRelative;
3925
- const mergedGeometry = new import_three14.BufferGeometry();
3974
+ const mergedGeometry = new import_three15.BufferGeometry();
3926
3975
  let offset = 0;
3927
3976
  for (let i = 0; i < geometries.length; ++i) {
3928
3977
  const geometry = geometries[i];
@@ -4046,7 +4095,7 @@ function mergeBufferAttributes(attributes) {
4046
4095
  array.set(attributes[i].array, offset);
4047
4096
  offset += attributes[i].array.length;
4048
4097
  }
4049
- return new import_three14.BufferAttribute(array, itemSize, normalized);
4098
+ return new import_three15.BufferAttribute(array, itemSize, normalized);
4050
4099
  }
4051
4100
  function interleaveAttributes(attributes) {
4052
4101
  let TypedArray;
@@ -4062,7 +4111,7 @@ function interleaveAttributes(attributes) {
4062
4111
  arrayLength += attribute.array.length;
4063
4112
  stride += attribute.itemSize;
4064
4113
  }
4065
- const interleavedBuffer = new import_three14.InterleavedBuffer(new TypedArray(arrayLength), stride);
4114
+ const interleavedBuffer = new import_three15.InterleavedBuffer(new TypedArray(arrayLength), stride);
4066
4115
  let offset = 0;
4067
4116
  const res = [];
4068
4117
  const getters = ["getX", "getY", "getZ", "getW"];
@@ -4071,7 +4120,7 @@ function interleaveAttributes(attributes) {
4071
4120
  const attribute = attributes[j];
4072
4121
  const itemSize = attribute.itemSize;
4073
4122
  const count = attribute.count;
4074
- const iba = new import_three14.InterleavedBufferAttribute(interleavedBuffer, itemSize, offset, attribute.normalized);
4123
+ const iba = new import_three15.InterleavedBufferAttribute(interleavedBuffer, itemSize, offset, attribute.normalized);
4075
4124
  res.push(iba);
4076
4125
  offset += itemSize;
4077
4126
  for (let c = 0; c < count; c++) {
@@ -4155,13 +4204,13 @@ function mergeVertices(geometry, tolerance = 1e-4) {
4155
4204
  const name = attributeNames[i];
4156
4205
  const oldAttribute = geometry.getAttribute(name);
4157
4206
  const buffer = new oldAttribute.array.constructor(attrArrays[name]);
4158
- const attribute = new import_three14.BufferAttribute(buffer, oldAttribute.itemSize, oldAttribute.normalized);
4207
+ const attribute = new import_three15.BufferAttribute(buffer, oldAttribute.itemSize, oldAttribute.normalized);
4159
4208
  result.setAttribute(name, attribute);
4160
4209
  if (name in morphAttrsArrays) {
4161
4210
  for (let j = 0; j < morphAttrsArrays[name].length; j++) {
4162
4211
  const oldMorphAttribute = geometry.morphAttributes[name][j];
4163
4212
  const buffer2 = new oldMorphAttribute.array.constructor(morphAttrsArrays[name][j]);
4164
- const morphAttribute = new import_three14.BufferAttribute(buffer2, oldMorphAttribute.itemSize, oldMorphAttribute.normalized);
4213
+ const morphAttribute = new import_three15.BufferAttribute(buffer2, oldMorphAttribute.itemSize, oldMorphAttribute.normalized);
4165
4214
  result.morphAttributes[name][j] = morphAttribute;
4166
4215
  }
4167
4216
  }
@@ -4170,11 +4219,11 @@ function mergeVertices(geometry, tolerance = 1e-4) {
4170
4219
  return result;
4171
4220
  }
4172
4221
  function toTrianglesDrawMode(geometry, drawMode) {
4173
- if (drawMode === import_three14.TrianglesDrawMode) {
4222
+ if (drawMode === import_three15.TrianglesDrawMode) {
4174
4223
  console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.");
4175
4224
  return geometry;
4176
4225
  }
4177
- if (drawMode === import_three14.TriangleFanDrawMode || drawMode === import_three14.TriangleStripDrawMode) {
4226
+ if (drawMode === import_three15.TriangleFanDrawMode || drawMode === import_three15.TriangleStripDrawMode) {
4178
4227
  let index = geometry.getIndex();
4179
4228
  if (index === null) {
4180
4229
  const indices = [];
@@ -4192,7 +4241,7 @@ function toTrianglesDrawMode(geometry, drawMode) {
4192
4241
  }
4193
4242
  const numberOfTriangles = index.count - 2;
4194
4243
  const newIndices = [];
4195
- if (drawMode === import_three14.TriangleFanDrawMode) {
4244
+ if (drawMode === import_three15.TriangleFanDrawMode) {
4196
4245
  for (let i = 1; i <= numberOfTriangles; i++) {
4197
4246
  newIndices.push(index.getX(0));
4198
4247
  newIndices.push(index.getX(i));
@@ -4228,15 +4277,15 @@ function computeMorphedAttributes(object) {
4228
4277
  console.error("THREE.BufferGeometryUtils: Geometry is not of type BufferGeometry.");
4229
4278
  return null;
4230
4279
  }
4231
- const _vA = new import_three14.Vector3();
4232
- const _vB = new import_three14.Vector3();
4233
- const _vC = new import_three14.Vector3();
4234
- const _tempA = new import_three14.Vector3();
4235
- const _tempB = new import_three14.Vector3();
4236
- const _tempC = new import_three14.Vector3();
4237
- const _morphA = new import_three14.Vector3();
4238
- const _morphB = new import_three14.Vector3();
4239
- const _morphC = new import_three14.Vector3();
4280
+ const _vA = new import_three15.Vector3();
4281
+ const _vB = new import_three15.Vector3();
4282
+ const _vC = new import_three15.Vector3();
4283
+ const _tempA = new import_three15.Vector3();
4284
+ const _tempB = new import_three15.Vector3();
4285
+ const _tempC = new import_three15.Vector3();
4286
+ const _morphA = new import_three15.Vector3();
4287
+ const _morphB = new import_three15.Vector3();
4288
+ const _morphC = new import_three15.Vector3();
4240
4289
  function _calculateMorphedAttributeData(object2, material2, attribute, morphAttribute, morphTargetsRelative2, a2, b2, c2, modifiedAttributeArray) {
4241
4290
  _vA.fromBufferAttribute(attribute, a2);
4242
4291
  _vB.fromBufferAttribute(attribute, b2);
@@ -4431,8 +4480,8 @@ function computeMorphedAttributes(object) {
4431
4480
  }
4432
4481
  }
4433
4482
  }
4434
- const morphedPositionAttribute = new import_three14.Float32BufferAttribute(modifiedPosition, 3);
4435
- const morphedNormalAttribute = new import_three14.Float32BufferAttribute(modifiedNormal, 3);
4483
+ const morphedPositionAttribute = new import_three15.Float32BufferAttribute(modifiedPosition, 3);
4484
+ const morphedNormalAttribute = new import_three15.Float32BufferAttribute(modifiedNormal, 3);
4436
4485
  return {
4437
4486
  positionAttribute,
4438
4487
  normalAttribute,
@@ -4476,13 +4525,14 @@ var ModelObject = class _ModelObject extends SceneObject {
4476
4525
  createMeshes(force = false) {
4477
4526
  if (this.meshesCreated && !force) return;
4478
4527
  const mat = Materials.MISSING_TEXTURE;
4528
+ const displayTransform = this.options.displayPosition ? DisplayTransforms.getMatrix(this.originalModel.display, this.options.displayPosition) : void 0;
4479
4529
  let allGeos = [];
4480
4530
  if (this.atlas) {
4481
4531
  if (this.atlas.model.elements) {
4482
4532
  this.atlas.model.elements?.forEach((el) => {
4483
4533
  const elGeo = this._getBoxGeometryFromElement(el).clone();
4484
4534
  if (this.options.uvLockRotation) {
4485
- UVMapper.lockUvs(elGeo, el.faces, this.atlas, new import_three15.Euler(...this.options.uvLockRotation));
4535
+ UVMapper.lockUvs(elGeo, el.faces, this.atlas, new import_three16.Euler(...this.options.uvLockRotation));
4486
4536
  }
4487
4537
  if (this.options.tints) {
4488
4538
  const colors = new Float32Array(elGeo.getAttribute("position").count * 3).fill(1);
@@ -4491,19 +4541,20 @@ var ModelObject = class _ModelObject extends SceneObject {
4491
4541
  if (tintIndex === void 0 || tintIndex < 0) continue;
4492
4542
  const tint = this.options.tints[tintIndex];
4493
4543
  if (tint === void 0) continue;
4494
- const color = new import_three15.Color(tint);
4544
+ const color = new import_three16.Color(tint);
4495
4545
  for (let vertex = 0; vertex < 4; vertex++) {
4496
4546
  color.toArray(colors, (faceIndex * 4 + vertex) * 3);
4497
4547
  }
4498
4548
  }
4499
- elGeo.setAttribute("color", new import_three15.BufferAttribute(colors, 3));
4549
+ elGeo.setAttribute("color", new import_three16.BufferAttribute(colors, 3));
4500
4550
  }
4501
- 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));
4502
- elGeo.applyMatrix4(new import_three15.Matrix4().makeTranslation(el.from[0], el.from[1], el.from[2]));
4551
+ 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));
4552
+ elGeo.applyMatrix4(new import_three16.Matrix4().makeTranslation(el.from[0], el.from[1], el.from[2]));
4503
4553
  if (el.rotation) {
4504
4554
  applyElementRotation(el.rotation, elGeo);
4505
4555
  }
4506
- elGeo.applyMatrix4(new import_three15.Matrix4().makeTranslation(-8, -8, -8));
4556
+ elGeo.applyMatrix4(new import_three16.Matrix4().makeTranslation(-8, -8, -8));
4557
+ if (displayTransform) DisplayTransforms.apply(elGeo, displayTransform);
4507
4558
  if (this.options.mergeMeshes) {
4508
4559
  allGeos.push(elGeo);
4509
4560
  } else {
@@ -4524,7 +4575,8 @@ var ModelObject = class _ModelObject extends SceneObject {
4524
4575
  if (allGeos.length > 0) {
4525
4576
  combinedGeo = mergeBufferGeometries(allGeos);
4526
4577
  } else {
4527
- combinedGeo = new import_three15.BoxGeometry(16, 16, 16);
4578
+ combinedGeo = new import_three16.BoxGeometry(16, 16, 16);
4579
+ if (displayTransform) DisplayTransforms.apply(combinedGeo, displayTransform);
4528
4580
  }
4529
4581
  combinedGeo.computeBoundingBox();
4530
4582
  let mesh;
@@ -4576,7 +4628,7 @@ function isModelObject(obj) {
4576
4628
 
4577
4629
  // src/model/block/scene/BlockObject.ts
4578
4630
  var import_ts_deepmerge6 = __toESM(require_dist());
4579
- var import_three16 = require("three");
4631
+ var import_three17 = require("three");
4580
4632
  var p10 = prefix("BlockObject");
4581
4633
  function matchesCondition(condition, state) {
4582
4634
  return Object.entries(condition).every(([key, value]) => {
@@ -4638,7 +4690,7 @@ var BlockObject = class _BlockObject extends SceneObject {
4638
4690
  if (isModelObject(model)) {
4639
4691
  model.removeFromScene();
4640
4692
  } else if (isInstanceReference(model)) {
4641
- model.setScale(new import_three16.Vector3(0, 0, 0));
4693
+ model.setScale(new import_three17.Vector3(0, 0, 0));
4642
4694
  }
4643
4695
  }
4644
4696
  super.removeFromScene();
@@ -4699,7 +4751,7 @@ var BlockObject = class _BlockObject extends SceneObject {
4699
4751
  }
4700
4752
  for (let model of this._models) {
4701
4753
  if (isInstanceReference(model)) {
4702
- model.setScale(new import_three16.Vector3(0, 0, 0));
4754
+ model.setScale(new import_three17.Vector3(0, 0, 0));
4703
4755
  } else {
4704
4756
  model.dispose();
4705
4757
  }
@@ -4736,7 +4788,7 @@ var BlockObject = class _BlockObject extends SceneObject {
4736
4788
  await this.createVariant(variant);
4737
4789
  }
4738
4790
  async createVariant(variant) {
4739
- const rotation = new import_three16.Euler();
4791
+ const rotation = new import_three17.Euler();
4740
4792
  if (typeof variant.x !== "undefined") {
4741
4793
  rotation.x = toRadians(clampRotationDegrees(variant.x));
4742
4794
  }
@@ -4823,7 +4875,7 @@ var BlockObject = class _BlockObject extends SceneObject {
4823
4875
  setPositionRotationScaleAt(index, position, rotation, scale) {
4824
4876
  super.setPositionRotationScaleAt(index, position, rotation, scale);
4825
4877
  }
4826
- getMatrixAt(index, matrix = new import_three16.Matrix4()) {
4878
+ getMatrixAt(index, matrix = new import_three17.Matrix4()) {
4827
4879
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
4828
4880
  const child = this._models[0];
4829
4881
  if (child && isModelObject(child)) {
@@ -4898,7 +4950,7 @@ var StructureParser = class {
4898
4950
  };
4899
4951
 
4900
4952
  // src/renderer/MineRenderScene.ts
4901
- var import_three17 = require("three");
4953
+ var import_three18 = require("three");
4902
4954
  var import_ts_deepmerge8 = __toESM(require_dist());
4903
4955
 
4904
4956
  // src/skin/SkinPart.ts
@@ -5742,7 +5794,7 @@ var SkinObject = class extends SceneObject {
5742
5794
  };
5743
5795
 
5744
5796
  // src/renderer/MineRenderScene.ts
5745
- var MineRenderScene = class _MineRenderScene extends import_three17.Scene {
5797
+ var MineRenderScene = class _MineRenderScene extends import_three18.Scene {
5746
5798
  constructor(options) {
5747
5799
  super();
5748
5800
  this.isMineRenderScene = true;
@@ -5818,7 +5870,8 @@ var MineRenderScene = class _MineRenderScene extends import_three17.Scene {
5818
5870
  console.log("instanceMeshes + key");
5819
5871
  let key = asset.key.serialize();
5820
5872
  if (isModelObject(obj)) {
5821
- const { uvLockRotation, tints } = obj.options;
5873
+ const { displayPosition, uvLockRotation, tints } = obj.options;
5874
+ if (displayPosition) key += `|display:${displayPosition}`;
5822
5875
  if (uvLockRotation) key += `|uvlock:${uvLockRotation.join(",")}`;
5823
5876
  const palette = Object.entries(tints ?? {}).sort(([a], [b]) => Number(a) - Number(b));
5824
5877
  if (palette.length) key += `|tints:${JSON.stringify(palette)}`;
@@ -5865,17 +5918,17 @@ function isMineRenderScene(obj) {
5865
5918
  }
5866
5919
 
5867
5920
  // src/renderer/Renderer.ts
5868
- var import_three19 = require("three");
5921
+ var import_three20 = require("three");
5869
5922
  var import_ts_deepmerge9 = __toESM(require_dist());
5870
5923
  var import_stats = __toESM(require("stats.js"));
5871
5924
  var import_postprocessing = require("postprocessing");
5872
5925
 
5873
5926
  // src/three/OrbitControls.js
5874
- var import_three18 = require("three");
5927
+ var import_three19 = require("three");
5875
5928
  var _changeEvent = { type: "change" };
5876
5929
  var _startEvent = { type: "start" };
5877
5930
  var _endEvent = { type: "end" };
5878
- var OrbitControls = class extends import_three18.EventDispatcher {
5931
+ var OrbitControls = class extends import_three19.EventDispatcher {
5879
5932
  constructor(object, domElement) {
5880
5933
  super();
5881
5934
  if (domElement === void 0) console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.');
@@ -5884,7 +5937,7 @@ var OrbitControls = class extends import_three18.EventDispatcher {
5884
5937
  this.domElement = domElement;
5885
5938
  this.domElement.style.touchAction = "none";
5886
5939
  this.enabled = true;
5887
- this.target = new import_three18.Vector3();
5940
+ this.target = new import_three19.Vector3();
5888
5941
  this.minDistance = 0;
5889
5942
  this.maxDistance = Infinity;
5890
5943
  this.minZoom = 0;
@@ -5906,8 +5959,8 @@ var OrbitControls = class extends import_three18.EventDispatcher {
5906
5959
  this.autoRotate = false;
5907
5960
  this.autoRotateSpeed = 2;
5908
5961
  this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" };
5909
- this.mouseButtons = { LEFT: import_three18.MOUSE.ROTATE, MIDDLE: import_three18.MOUSE.DOLLY, RIGHT: import_three18.MOUSE.PAN };
5910
- this.touches = { ONE: import_three18.TOUCH.ROTATE, TWO: import_three18.TOUCH.DOLLY_PAN };
5962
+ this.mouseButtons = { LEFT: import_three19.MOUSE.ROTATE, MIDDLE: import_three19.MOUSE.DOLLY, RIGHT: import_three19.MOUSE.PAN };
5963
+ this.touches = { ONE: import_three19.TOUCH.ROTATE, TWO: import_three19.TOUCH.DOLLY_PAN };
5911
5964
  this.target0 = this.target.clone();
5912
5965
  this.position0 = this.object.position.clone();
5913
5966
  this.zoom0 = this.object.zoom;
@@ -5936,11 +5989,11 @@ var OrbitControls = class extends import_three18.EventDispatcher {
5936
5989
  state = STATE.NONE;
5937
5990
  };
5938
5991
  this.update = function() {
5939
- const offset = new import_three18.Vector3();
5940
- const quat = new import_three18.Quaternion().setFromUnitVectors(object.up, new import_three18.Vector3(0, 1, 0));
5992
+ const offset = new import_three19.Vector3();
5993
+ const quat = new import_three19.Quaternion().setFromUnitVectors(object.up, new import_three19.Vector3(0, 1, 0));
5941
5994
  const quatInverse = quat.clone().invert();
5942
- const lastPosition = new import_three18.Vector3();
5943
- const lastQuaternion = new import_three18.Quaternion();
5995
+ const lastPosition = new import_three19.Vector3();
5996
+ const lastQuaternion = new import_three19.Quaternion();
5944
5997
  const twoPI = 2 * Math.PI;
5945
5998
  return function update() {
5946
5999
  const position = scope.object.position;
@@ -6026,20 +6079,20 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6026
6079
  };
6027
6080
  let state = STATE.NONE;
6028
6081
  const EPS = 1e-6;
6029
- const spherical = new import_three18.Spherical();
6030
- const sphericalDelta = new import_three18.Spherical();
6082
+ const spherical = new import_three19.Spherical();
6083
+ const sphericalDelta = new import_three19.Spherical();
6031
6084
  let scale = 1;
6032
- const panOffset = new import_three18.Vector3();
6085
+ const panOffset = new import_three19.Vector3();
6033
6086
  let zoomChanged = false;
6034
- const rotateStart = new import_three18.Vector2();
6035
- const rotateEnd = new import_three18.Vector2();
6036
- const rotateDelta = new import_three18.Vector2();
6037
- const panStart = new import_three18.Vector2();
6038
- const panEnd = new import_three18.Vector2();
6039
- const panDelta = new import_three18.Vector2();
6040
- const dollyStart = new import_three18.Vector2();
6041
- const dollyEnd = new import_three18.Vector2();
6042
- const dollyDelta = new import_three18.Vector2();
6087
+ const rotateStart = new import_three19.Vector2();
6088
+ const rotateEnd = new import_three19.Vector2();
6089
+ const rotateDelta = new import_three19.Vector2();
6090
+ const panStart = new import_three19.Vector2();
6091
+ const panEnd = new import_three19.Vector2();
6092
+ const panDelta = new import_three19.Vector2();
6093
+ const dollyStart = new import_three19.Vector2();
6094
+ const dollyEnd = new import_three19.Vector2();
6095
+ const dollyDelta = new import_three19.Vector2();
6043
6096
  const pointers = [];
6044
6097
  const pointerPositions = {};
6045
6098
  function getAutoRotationAngle() {
@@ -6055,7 +6108,7 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6055
6108
  sphericalDelta.phi -= angle;
6056
6109
  }
6057
6110
  const panLeft = function() {
6058
- const v = new import_three18.Vector3();
6111
+ const v = new import_three19.Vector3();
6059
6112
  return function panLeft2(distance, objectMatrix) {
6060
6113
  v.setFromMatrixColumn(objectMatrix, 0);
6061
6114
  v.multiplyScalar(-distance);
@@ -6063,7 +6116,7 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6063
6116
  };
6064
6117
  }();
6065
6118
  const panUp = function() {
6066
- const v = new import_three18.Vector3();
6119
+ const v = new import_three19.Vector3();
6067
6120
  return function panUp2(distance, objectMatrix) {
6068
6121
  if (scope.screenSpacePanning === true) {
6069
6122
  v.setFromMatrixColumn(objectMatrix, 1);
@@ -6076,7 +6129,7 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6076
6129
  };
6077
6130
  }();
6078
6131
  const pan = function() {
6079
- const offset = new import_three18.Vector3();
6132
+ const offset = new import_three19.Vector3();
6080
6133
  return function pan2(deltaX, deltaY) {
6081
6134
  const element = scope.domElement;
6082
6135
  if (scope.object.isPerspectiveCamera) {
@@ -6325,12 +6378,12 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6325
6378
  mouseAction = -1;
6326
6379
  }
6327
6380
  switch (mouseAction) {
6328
- case import_three18.MOUSE.DOLLY:
6381
+ case import_three19.MOUSE.DOLLY:
6329
6382
  if (scope.enableZoom === false) return;
6330
6383
  handleMouseDownDolly(event);
6331
6384
  state = STATE.DOLLY;
6332
6385
  break;
6333
- case import_three18.MOUSE.ROTATE:
6386
+ case import_three19.MOUSE.ROTATE:
6334
6387
  if (event.ctrlKey || event.metaKey || event.shiftKey) {
6335
6388
  if (scope.enablePan === false) return;
6336
6389
  handleMouseDownPan(event);
@@ -6341,7 +6394,7 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6341
6394
  state = STATE.ROTATE;
6342
6395
  }
6343
6396
  break;
6344
- case import_three18.MOUSE.PAN:
6397
+ case import_three19.MOUSE.PAN:
6345
6398
  if (event.ctrlKey || event.metaKey || event.shiftKey) {
6346
6399
  if (scope.enableRotate === false) return;
6347
6400
  handleMouseDownRotate(event);
@@ -6397,12 +6450,12 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6397
6450
  switch (pointers.length) {
6398
6451
  case 1:
6399
6452
  switch (scope.touches.ONE) {
6400
- case import_three18.TOUCH.ROTATE:
6453
+ case import_three19.TOUCH.ROTATE:
6401
6454
  if (scope.enableRotate === false) return;
6402
6455
  handleTouchStartRotate();
6403
6456
  state = STATE.TOUCH_ROTATE;
6404
6457
  break;
6405
- case import_three18.TOUCH.PAN:
6458
+ case import_three19.TOUCH.PAN:
6406
6459
  if (scope.enablePan === false) return;
6407
6460
  handleTouchStartPan();
6408
6461
  state = STATE.TOUCH_PAN;
@@ -6413,12 +6466,12 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6413
6466
  break;
6414
6467
  case 2:
6415
6468
  switch (scope.touches.TWO) {
6416
- case import_three18.TOUCH.DOLLY_PAN:
6469
+ case import_three19.TOUCH.DOLLY_PAN:
6417
6470
  if (scope.enableZoom === false && scope.enablePan === false) return;
6418
6471
  handleTouchStartDollyPan();
6419
6472
  state = STATE.TOUCH_DOLLY_PAN;
6420
6473
  break;
6421
- case import_three18.TOUCH.DOLLY_ROTATE:
6474
+ case import_three19.TOUCH.DOLLY_ROTATE:
6422
6475
  if (scope.enableZoom === false && scope.enableRotate === false) return;
6423
6476
  handleTouchStartDollyRotate();
6424
6477
  state = STATE.TOUCH_DOLLY_ROTATE;
@@ -6485,7 +6538,7 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6485
6538
  function trackPointer(event) {
6486
6539
  let position = pointerPositions[event.pointerId];
6487
6540
  if (position === void 0) {
6488
- position = new import_three18.Vector2();
6541
+ position = new import_three19.Vector2();
6489
6542
  pointerPositions[event.pointerId] = position;
6490
6543
  }
6491
6544
  position.set(event.pageX, event.pageY);
@@ -6505,10 +6558,10 @@ var MapControls = class extends OrbitControls {
6505
6558
  constructor(object, domElement) {
6506
6559
  super(object, domElement);
6507
6560
  this.screenSpacePanning = false;
6508
- this.mouseButtons.LEFT = import_three18.MOUSE.PAN;
6509
- this.mouseButtons.RIGHT = import_three18.MOUSE.ROTATE;
6510
- this.touches.ONE = import_three18.TOUCH.PAN;
6511
- this.touches.TWO = import_three18.TOUCH.DOLLY_ROTATE;
6561
+ this.mouseButtons.LEFT = import_three19.MOUSE.PAN;
6562
+ this.mouseButtons.RIGHT = import_three19.MOUSE.ROTATE;
6563
+ this.touches.ONE = import_three19.TOUCH.PAN;
6564
+ this.touches.TWO = import_three19.TOUCH.DOLLY_ROTATE;
6512
6565
  }
6513
6566
  };
6514
6567
 
@@ -6553,8 +6606,8 @@ var Renderer = class _Renderer {
6553
6606
  top: void 0,
6554
6607
  bottom: void 0
6555
6608
  },
6556
- position: new import_three19.Vector3(50, 50, 50),
6557
- lookingAt: new import_three19.Vector3(0, 0, 0)
6609
+ position: new import_three20.Vector3(50, 50, 50),
6610
+ lookingAt: new import_three20.Vector3(0, 0, 0)
6558
6611
  },
6559
6612
  render: {
6560
6613
  fpsLimit: 60,
@@ -6584,14 +6637,14 @@ var Renderer = class _Renderer {
6584
6637
  switch (this.options.camera.type) {
6585
6638
  case "perspective":
6586
6639
  default:
6587
- return new import_three19.PerspectiveCamera(
6640
+ return new import_three20.PerspectiveCamera(
6588
6641
  this.options.camera.perspective.fov,
6589
6642
  this.options.camera.perspective.aspect ?? this.viewWidth / this.viewHeight,
6590
6643
  this.options.camera.near,
6591
6644
  this.options.camera.far
6592
6645
  );
6593
6646
  case "orthographic":
6594
- return new import_three19.OrthographicCamera(
6647
+ return new import_three20.OrthographicCamera(
6595
6648
  this.options.camera.orthographic.left ?? this.viewWidth / -2,
6596
6649
  this.options.camera.orthographic.right ?? this.viewWidth / 2,
6597
6650
  this.options.camera.orthographic.top ?? this.viewHeight / 2,
@@ -6602,7 +6655,7 @@ var Renderer = class _Renderer {
6602
6655
  }
6603
6656
  }
6604
6657
  createRenderer() {
6605
- const renderer = new import_three19.WebGLRenderer({
6658
+ const renderer = new import_three20.WebGLRenderer({
6606
6659
  antialias: this.options.render.antialias,
6607
6660
  alpha: true,
6608
6661
  powerPreference: "high-performance",
@@ -6610,8 +6663,8 @@ var Renderer = class _Renderer {
6610
6663
  });
6611
6664
  renderer.setClearColor(0, 0);
6612
6665
  renderer.shadowMap.enabled = true;
6613
- renderer.shadowMap.type = import_three19.PCFSoftShadowMap;
6614
- renderer.outputColorSpace = import_three19.SRGBColorSpace;
6666
+ renderer.shadowMap.type = import_three20.PCFSoftShadowMap;
6667
+ renderer.outputColorSpace = import_three20.SRGBColorSpace;
6615
6668
  renderer.setSize(this.viewWidth, this.viewHeight);
6616
6669
  return renderer;
6617
6670
  }
@@ -6645,20 +6698,20 @@ var Renderer = class _Renderer {
6645
6698
  window["__THREE_DEVTOOLS__"].dispatchEvent(new CustomEvent("observe", { detail: this.scene }));
6646
6699
  }
6647
6700
  if (this.options.debug.grid) {
6648
- const gridHelper = new import_three19.GridHelper(128, 16);
6701
+ const gridHelper = new import_three20.GridHelper(128, 16);
6649
6702
  this._debugHelpers.push(gridHelper);
6650
6703
  this.scene.add(gridHelper);
6651
- const gridHelper2 = new import_three19.GridHelper(128, 16);
6704
+ const gridHelper2 = new import_three20.GridHelper(128, 16);
6652
6705
  this._debugHelpers.push(gridHelper2);
6653
6706
  gridHelper2.rotation.x = 90 * (Math.PI / 180);
6654
6707
  this.scene.add(gridHelper2);
6655
- const gridHelper3 = new import_three19.GridHelper(128, 16);
6708
+ const gridHelper3 = new import_three20.GridHelper(128, 16);
6656
6709
  this._debugHelpers.push(gridHelper3);
6657
6710
  gridHelper3.rotation.z = 90 * (Math.PI / 180);
6658
6711
  this.scene.add(gridHelper3);
6659
6712
  }
6660
6713
  if (this.options.debug.axes) {
6661
- const axesHelper = new import_three19.AxesHelper(64);
6714
+ const axesHelper = new import_three20.AxesHelper(64);
6662
6715
  this._debugHelpers.push(axesHelper);
6663
6716
  this.scene.add(axesHelper);
6664
6717
  }
@@ -7019,10 +7072,10 @@ var Skins = class {
7019
7072
  };
7020
7073
 
7021
7074
  // src/world/Chunk.ts
7022
- var import_three22 = require("three");
7075
+ var import_three23 = require("three");
7023
7076
 
7024
7077
  // src/world/MineRenderWorld.ts
7025
- var import_three21 = require("three");
7078
+ var import_three22 = require("three");
7026
7079
  var MineRenderWorld = class {
7027
7080
  constructor(scene) {
7028
7081
  this._size = 4;
@@ -7033,10 +7086,10 @@ var MineRenderWorld = class {
7033
7086
  }
7034
7087
  getBlockAt(posOrX, y, z) {
7035
7088
  if (typeof posOrX == "number") {
7036
- return this.getBlockAt(new import_three21.Vector3(posOrX, y, z));
7089
+ return this.getBlockAt(new import_three22.Vector3(posOrX, y, z));
7037
7090
  }
7038
7091
  if (isTripleArray(posOrX)) {
7039
- return this.getBlockAt(new import_three21.Vector3(posOrX[0], posOrX[1], posOrX[2]));
7092
+ return this.getBlockAt(new import_three22.Vector3(posOrX[0], posOrX[1], posOrX[2]));
7040
7093
  }
7041
7094
  const chunk = this.getChunkAt(posOrX);
7042
7095
  if (typeof chunk === "undefined") {
@@ -7047,10 +7100,10 @@ var MineRenderWorld = class {
7047
7100
  }
7048
7101
  async setBlockAt(posOrX, yOrBlock, z, block) {
7049
7102
  if (typeof posOrX == "number") {
7050
- return this.setBlockAt(new import_three21.Vector3(posOrX, yOrBlock, z), block);
7103
+ return this.setBlockAt(new import_three22.Vector3(posOrX, yOrBlock, z), block);
7051
7104
  }
7052
7105
  if (isTripleArray(posOrX)) {
7053
- return this.setBlockAt(new import_three21.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
7106
+ return this.setBlockAt(new import_three22.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
7054
7107
  }
7055
7108
  this.validatePosBounds(posOrX);
7056
7109
  const chunk = this.getOrCreateChunkAt(posOrX);
@@ -7096,14 +7149,14 @@ var MineRenderWorld = class {
7096
7149
  return this._chunks[index];
7097
7150
  }
7098
7151
  static worldToScenePosition(pos) {
7099
- return new import_three21.Vector3(
7152
+ return new import_three22.Vector3(
7100
7153
  pos.x * 16,
7101
7154
  pos.y * 16,
7102
7155
  pos.z * 16
7103
7156
  );
7104
7157
  }
7105
7158
  static sceneToWorldPosition(pos) {
7106
- return new import_three21.Vector3(
7159
+ return new import_three22.Vector3(
7107
7160
  pos.x / 16,
7108
7161
  pos.y / 16,
7109
7162
  pos.z / 16
@@ -7140,12 +7193,12 @@ var Chunk = class _Chunk {
7140
7193
  this.x = x;
7141
7194
  this.y = y;
7142
7195
  this.z = z;
7143
- let anchor = new import_three22.Object3D();
7196
+ let anchor = new import_three23.Object3D();
7144
7197
  this._anchor = anchor;
7145
7198
  scene.add(anchor);
7146
7199
  anchor.position.set(this.x * 256 + 128 - 8, this.y * 256 + 128 - 8, this.z * 256 + 128 - 8);
7147
7200
  addBox3WireframeToObject(
7148
- new import_three22.Box3(new import_three22.Vector3(0, 0, 0), new import_three22.Vector3(256, 256, 256)),
7201
+ new import_three23.Box3(new import_three23.Vector3(0, 0, 0), new import_three23.Vector3(256, 256, 256)),
7149
7202
  anchor,
7150
7203
  16776960,
7151
7204
  4
@@ -7153,10 +7206,10 @@ var Chunk = class _Chunk {
7153
7206
  }
7154
7207
  getBlockAt(posOrX, y, z) {
7155
7208
  if (typeof posOrX == "number") {
7156
- return this.getBlockAt(new import_three22.Vector3(posOrX, y, z));
7209
+ return this.getBlockAt(new import_three23.Vector3(posOrX, y, z));
7157
7210
  }
7158
7211
  if (isTripleArray(posOrX)) {
7159
- return this.getBlockAt(new import_three22.Vector3(posOrX[0], posOrX[1], posOrX[2]));
7212
+ return this.getBlockAt(new import_three23.Vector3(posOrX[0], posOrX[1], posOrX[2]));
7160
7213
  }
7161
7214
  const pos = this.worldPosToChunkPos(posOrX);
7162
7215
  const index = _Chunk.chunkPosToBlockIndex(pos);
@@ -7164,10 +7217,10 @@ var Chunk = class _Chunk {
7164
7217
  }
7165
7218
  async setBlockAt(posOrX, yOrBlock, z, block) {
7166
7219
  if (typeof posOrX == "number") {
7167
- return this.setBlockAt(new import_three22.Vector3(posOrX, yOrBlock, z), block);
7220
+ return this.setBlockAt(new import_three23.Vector3(posOrX, yOrBlock, z), block);
7168
7221
  }
7169
7222
  if (isTripleArray(posOrX)) {
7170
- return this.setBlockAt(new import_three22.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
7223
+ return this.setBlockAt(new import_three23.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
7171
7224
  }
7172
7225
  const worldPos = posOrX;
7173
7226
  const pos = this.worldPosToChunkPos(worldPos);
@@ -7213,7 +7266,7 @@ var Chunk = class _Chunk {
7213
7266
  }
7214
7267
  async clear() {
7215
7268
  let promises = [];
7216
- let pos = new import_three22.Vector3();
7269
+ let pos = new import_three23.Vector3();
7217
7270
  for (let x = 0; x < 16; x++) {
7218
7271
  for (let z = 0; z < 16; z++) {
7219
7272
  for (let y = 0; y < 16; y++) {
@@ -7232,14 +7285,14 @@ var Chunk = class _Chunk {
7232
7285
  return pos.y * 16 * 16 + pos.z * 16 + pos.x;
7233
7286
  }
7234
7287
  worldPosToChunkPos(pos) {
7235
- return new import_three22.Vector3(
7288
+ return new import_three23.Vector3(
7236
7289
  pos.x - this.x * 16,
7237
7290
  pos.y - this.y * 16,
7238
7291
  pos.z - this.z * 16
7239
7292
  );
7240
7293
  }
7241
7294
  chunkPosToWorldPos(pos) {
7242
- return new import_three22.Vector3(
7295
+ return new import_three23.Vector3(
7243
7296
  this.x * 16 + pos.x,
7244
7297
  this.y * 16 + pos.y,
7245
7298
  this.z * 16 + pos.z
@@ -7279,6 +7332,7 @@ var Chunk = class _Chunk {
7279
7332
  DISPLAY_POSITIONS,
7280
7333
  DefaultBlockStates,
7281
7334
  DisplayPosition,
7335
+ DisplayTransforms,
7282
7336
  Entities,
7283
7337
  EntityModels,
7284
7338
  EntityObject,