minerender 2.1.0-alpha.21 → 2.1.0-alpha.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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;
@@ -1499,7 +1562,7 @@ var BlockStates = class {
1499
1562
  void 0,
1500
1563
  "assets",
1501
1564
  ".json",
1502
- DEFAULT_ROOT
1565
+ AssetLoader.ROOT
1503
1566
  );
1504
1567
  return Caching.listAssetCache.get(key.serialize(), () => {
1505
1568
  return AssetLoader.get(key, "list" /* LIST */);
@@ -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
 
@@ -1816,17 +1879,17 @@ var HostedAssetSource = class _HostedAssetSource extends AssetSource {
1816
1879
  if (typeof namespaced !== "undefined") {
1817
1880
  return namespaced;
1818
1881
  }
1819
- if (typeof key.root !== "undefined" && key.root !== DEFAULT_ROOT || typeof this.root !== "undefined" && this.root !== DEFAULT_ROOT) {
1882
+ if (typeof key.root !== "undefined" && key.root !== AssetLoader.ROOT || typeof this.root !== "undefined" && this.root !== AssetLoader.ROOT) {
1820
1883
  console.info(p3, "Retrying", key, "with default root+namespace");
1821
- const namespacedRootedKey = new AssetKey(DEFAULT_NAMESPACE, key.path, key.assetType, key.type, key.rootType, key.extension, DEFAULT_ROOT);
1884
+ const namespacedRootedKey = new AssetKey(DEFAULT_NAMESPACE, key.path, key.assetType, key.type, key.rootType, key.extension, AssetLoader.ROOT);
1822
1885
  const namespacedRooted = await this.load(namespacedRootedKey, parser);
1823
1886
  if (typeof namespacedRooted !== "undefined") {
1824
1887
  return namespacedRooted;
1825
1888
  }
1826
1889
  }
1827
- } else if (typeof key.root !== "undefined" && key.root !== DEFAULT_ROOT || typeof this.root !== "undefined" && this.root !== DEFAULT_ROOT) {
1890
+ } else if (typeof key.root !== "undefined" && key.root !== AssetLoader.ROOT || typeof this.root !== "undefined" && this.root !== AssetLoader.ROOT) {
1828
1891
  console.info(p3, "Retrying", key, "with default root");
1829
- const rootKey = new AssetKey(key.namespace, key.path, key.assetType, key.type, key.rootType, key.extension, DEFAULT_ROOT);
1892
+ const rootKey = new AssetKey(key.namespace, key.path, key.assetType, key.type, key.rootType, key.extension, AssetLoader.ROOT);
1830
1893
  const rooted = await this.load(rootKey, parser);
1831
1894
  if (typeof rooted !== "undefined") {
1832
1895
  return rooted;
@@ -1960,6 +2023,20 @@ var AssetLoader = class {
1960
2023
  static {
1961
2024
  this._SOURCES = [];
1962
2025
  }
2026
+ static get version() {
2027
+ return this.ROOT.substring(this.ROOT.lastIndexOf("/") + 1);
2028
+ }
2029
+ static setVersion(version) {
2030
+ this.ROOT = `https://assets.mcasset.cloud/${version}`;
2031
+ const source = new HostedAssetSource(this.ROOT, { retryDefaults: false });
2032
+ const index = this._SOURCES.findIndex((s) => s.key === "mcassets");
2033
+ if (index !== -1) {
2034
+ this._SOURCES[index] = { key: "mcassets", source };
2035
+ } else {
2036
+ this.addSource("mcassets", source);
2037
+ }
2038
+ Caching.clear();
2039
+ }
1963
2040
  static addSource(key, source, override = true) {
1964
2041
  if (override) {
1965
2042
  const existing = this.removeSource(key);
@@ -1982,7 +2059,7 @@ var AssetLoader = class {
1982
2059
  }
1983
2060
  static {
1984
2061
  this.addSource("mcassets-fallback", new HostedAssetSource("https://raw.githubusercontent.com/InventivetalentDev/minerender-fallback-assets/master", { retryDefaults: false }));
1985
- this.addSource("mcassets", new HostedAssetSource(DEFAULT_ROOT, { retryDefaults: false }));
2062
+ this.addSource("mcassets", new HostedAssetSource(this.ROOT, { retryDefaults: false }));
1986
2063
  }
1987
2064
  static async getAll(key, parser) {
1988
2065
  let promises = [];
@@ -2259,12 +2336,12 @@ var X = 0;
2259
2336
  var Y = 1;
2260
2337
  var Z = 2;
2261
2338
  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)]
2339
+ east: [new import_three9.Vector3(0, 0, -1), new import_three9.Vector3(0, -1, 0)],
2340
+ west: [new import_three9.Vector3(0, 0, 1), new import_three9.Vector3(0, -1, 0)],
2341
+ up: [new import_three9.Vector3(1, 0, 0), new import_three9.Vector3(0, 0, 1)],
2342
+ down: [new import_three9.Vector3(1, 0, 0), new import_three9.Vector3(0, 0, -1)],
2343
+ south: [new import_three9.Vector3(1, 0, 0), new import_three9.Vector3(0, -1, 0)],
2344
+ north: [new import_three9.Vector3(-1, 0, 0), new import_three9.Vector3(0, -1, 0)]
2268
2345
  };
2269
2346
  var UVMapper = class {
2270
2347
  static makeUv(uvCoord, originalTextureSize, actualTextureSize) {
@@ -2361,7 +2438,7 @@ var UVMapper = class {
2361
2438
  return array;
2362
2439
  }
2363
2440
  static facesToUv(faces, originalTextureSize, actualTextureSize) {
2364
- return new import_three8.Float32BufferAttribute(this.facesToUvArray(faces, originalTextureSize, actualTextureSize), 2);
2441
+ return new import_three9.Float32BufferAttribute(this.facesToUvArray(faces, originalTextureSize, actualTextureSize), 2);
2365
2442
  }
2366
2443
  static lockUvs(geometry, faces, atlas, rotation) {
2367
2444
  const uv = geometry.getAttribute("uv");
@@ -2439,32 +2516,32 @@ var UVMapper = class {
2439
2516
  v1 *= scaleV;
2440
2517
  u2 *= scaleU;
2441
2518
  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);
2519
+ let tl = new import_three9.Vector2(u1, v1);
2520
+ let tr = new import_three9.Vector2(u2, v1);
2521
+ let bl = new import_three9.Vector2(u1, v2);
2522
+ let br = new import_three9.Vector2(u2, v2);
2446
2523
  switch (rotation) {
2447
2524
  case 0:
2448
2525
  case 360:
2449
2526
  default:
2450
2527
  break;
2451
2528
  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);
2529
+ tl = new import_three9.Vector2(u1, v2);
2530
+ tr = new import_three9.Vector2(u1, v1);
2531
+ bl = new import_three9.Vector2(u2, v2);
2532
+ br = new import_three9.Vector2(u2, v1);
2456
2533
  break;
2457
2534
  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);
2535
+ tl = new import_three9.Vector2(u2, v2);
2536
+ tr = new import_three9.Vector2(u1, v2);
2537
+ bl = new import_three9.Vector2(u2, v1);
2538
+ br = new import_three9.Vector2(u1, v1);
2462
2539
  break;
2463
2540
  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);
2541
+ tl = new import_three9.Vector2(u2, v1);
2542
+ tr = new import_three9.Vector2(u2, v2);
2543
+ bl = new import_three9.Vector2(u1, v1);
2544
+ br = new import_three9.Vector2(u1, v2);
2468
2545
  break;
2469
2546
  }
2470
2547
  return [tl, tr, bl, br];
@@ -2611,7 +2688,7 @@ var UVMapper = class {
2611
2688
  const faceTexture = face.texture.substr(1);
2612
2689
  const texPosition = positions[faceTexture] || [0, 0];
2613
2690
  const texSize = sizes[faceTexture] || [16, 16];
2614
- let texPosV = new import_three8.Vector2(texPosition[0], texPosition[1]);
2691
+ let texPosV = new import_three9.Vector2(texPosition[0], texPosition[1]);
2615
2692
  const [tl, tr, bl, br] = this.expandAndRotateMcUvs(face.uv, face.rotation, texSize[0], texSize[1]);
2616
2693
  tl.add(texPosV);
2617
2694
  tr.add(texPosV);
@@ -2845,7 +2922,7 @@ var BlockEntityModels = class {
2845
2922
  };
2846
2923
 
2847
2924
  // src/renderer/SceneObject.ts
2848
- var import_three9 = require("three");
2925
+ var import_three10 = require("three");
2849
2926
 
2850
2927
  // src/instance/InstanceReference.ts
2851
2928
  var InstanceReference = class {
@@ -2904,7 +2981,7 @@ var MineRenderError = class _MineRenderError extends Error {
2904
2981
  // src/renderer/SceneObject.ts
2905
2982
  var import_ts_deepmerge3 = __toESM(require_dist());
2906
2983
  var p6 = prefix("SceneObject");
2907
- var SceneObject = class _SceneObject extends import_three9.Object3D {
2984
+ var SceneObject = class _SceneObject extends import_three10.Object3D {
2908
2985
  constructor(options) {
2909
2986
  super();
2910
2987
  this.isSceneObject = true;
@@ -2950,7 +3027,7 @@ var SceneObject = class _SceneObject extends import_three9.Object3D {
2950
3027
  return group;
2951
3028
  }
2952
3029
  createGroup(name, x = 0, y = 0, z = 0, offsetAxis, offset = 0) {
2953
- const obj = new import_three9.Object3D();
3030
+ const obj = new import_three10.Object3D();
2954
3031
  if (name) {
2955
3032
  obj.name = `group:${name}`;
2956
3033
  }
@@ -3000,7 +3077,7 @@ var SceneObject = class _SceneObject extends import_three9.Object3D {
3000
3077
  return mesh;
3001
3078
  }
3002
3079
  createMesh(name, geometry, material, offsetAxis, offset = 0) {
3003
- const mesh = new import_three9.Mesh(geometry, material);
3080
+ const mesh = new import_three10.Mesh(geometry, material);
3004
3081
  if (name) {
3005
3082
  mesh.name = `mesh:${name}`;
3006
3083
  }
@@ -3012,7 +3089,7 @@ var SceneObject = class _SceneObject extends import_three9.Object3D {
3012
3089
  return mesh;
3013
3090
  }
3014
3091
  createInstancedMesh(name, geometry, material, count) {
3015
- const mesh = new import_three9.InstancedMesh(geometry, material, count);
3092
+ const mesh = new import_three10.InstancedMesh(geometry, material, count);
3016
3093
  mesh.count = 0;
3017
3094
  if (name) {
3018
3095
  mesh.name = `mesh:${name}`;
@@ -3090,7 +3167,7 @@ var SceneObject = class _SceneObject extends import_three9.Object3D {
3090
3167
  nextInstance() {
3091
3168
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3092
3169
  const i = this._instanceCounter++;
3093
- this.setMatrixAt(i, new import_three9.Matrix4());
3170
+ this.setMatrixAt(i, new import_three10.Matrix4());
3094
3171
  const mesh = this.children[0];
3095
3172
  if (mesh && isInstancedMesh(mesh)) {
3096
3173
  mesh.count = Math.min(this._instanceCounter, mesh.instanceMatrix.count);
@@ -3107,7 +3184,7 @@ var SceneObject = class _SceneObject extends import_three9.Object3D {
3107
3184
  }
3108
3185
  //</editor-fold>
3109
3186
  //<editor-fold desc="TRANSFORMATION">
3110
- getMatrixAt(index, matrix = new import_three9.Matrix4()) {
3187
+ getMatrixAt(index, matrix = new import_three10.Matrix4()) {
3111
3188
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3112
3189
  const child = this.children[0];
3113
3190
  if (child && isInstancedMesh(child)) {
@@ -3126,16 +3203,16 @@ var SceneObject = class _SceneObject extends import_three9.Object3D {
3126
3203
  }
3127
3204
  setPositionRotationScaleAt(index, position, rotation, scale) {
3128
3205
  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();
3206
+ const oldPosition = new import_three10.Vector3();
3207
+ const oldRotation = new import_three10.Quaternion();
3208
+ const oldScale = new import_three10.Vector3();
3209
+ const matrix = new import_three10.Matrix4();
3133
3210
  if (!scale || !rotation || !position) {
3134
3211
  this.getMatrixAt(index, matrix).decompose(oldPosition, oldRotation, oldScale);
3135
3212
  }
3136
3213
  matrix.compose(
3137
3214
  position ? position : oldPosition,
3138
- rotation ? new import_three9.Quaternion().setFromEuler(rotation) : oldRotation,
3215
+ rotation ? new import_three10.Quaternion().setFromEuler(rotation) : oldRotation,
3139
3216
  scale ? scale : oldScale
3140
3217
  );
3141
3218
  this.setMatrixAt(index, matrix);
@@ -3144,7 +3221,7 @@ var SceneObject = class _SceneObject extends import_three9.Object3D {
3144
3221
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3145
3222
  this.setPositionRotationScaleAt(index, position);
3146
3223
  }
3147
- getPositionAt(index, vector = new import_three9.Vector3()) {
3224
+ getPositionAt(index, vector = new import_three10.Vector3()) {
3148
3225
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3149
3226
  const matrix = this.getMatrixAt(index);
3150
3227
  vector.setFromMatrixPosition(matrix);
@@ -3154,7 +3231,7 @@ var SceneObject = class _SceneObject extends import_three9.Object3D {
3154
3231
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3155
3232
  this.setPositionRotationScaleAt(index, void 0, rotation, void 0);
3156
3233
  }
3157
- getRotationAt(index, euler = new import_three9.Euler()) {
3234
+ getRotationAt(index, euler = new import_three10.Euler()) {
3158
3235
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3159
3236
  const matrix = this.getMatrixAt(index);
3160
3237
  euler.setFromRotationMatrix(matrix);
@@ -3164,7 +3241,7 @@ var SceneObject = class _SceneObject extends import_three9.Object3D {
3164
3241
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3165
3242
  this.setPositionRotationScaleAt(index, void 0, void 0, scale);
3166
3243
  }
3167
- getScaleAt(index, vector = new import_three9.Vector3()) {
3244
+ getScaleAt(index, vector = new import_three10.Vector3()) {
3168
3245
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
3169
3246
  const matrix = this.getMatrixAt(index);
3170
3247
  vector.setFromMatrixScale(matrix);
@@ -3279,7 +3356,7 @@ function isSceneObject(obj) {
3279
3356
 
3280
3357
  // src/entity/scene/EntityObject.ts
3281
3358
  var import_ts_deepmerge4 = __toESM(require_dist());
3282
- var import_three11 = require("three");
3359
+ var import_three12 = require("three");
3283
3360
  var THREE3 = __toESM(require("three"));
3284
3361
  var EntityObject = class extends SceneObject {
3285
3362
  constructor(entity, options) {
@@ -3320,7 +3397,7 @@ var EntityObject = class extends SceneObject {
3320
3397
  for (let partName in this.entity.parts) {
3321
3398
  const part = this.entity.parts[partName];
3322
3399
  const texture = new MinecraftCubeTexture(part.textureOffsetU, part.textureOffsetV, part.textureWidth, part.textureHeight);
3323
- const partAnchor = new import_three11.Object3D();
3400
+ const partAnchor = new import_three12.Object3D();
3324
3401
  partAnchor.position.x = part.pivotX;
3325
3402
  partAnchor.position.y = part.pivotY;
3326
3403
  partAnchor.position.z = part.pivotZ;
@@ -3373,16 +3450,16 @@ var GuiObject = class extends SceneObject {
3373
3450
  };
3374
3451
 
3375
3452
  // src/inspector/SceneInspector.ts
3376
- var import_three12 = require("three");
3453
+ var import_three13 = require("three");
3377
3454
  var p7 = prefix("SceneInspector");
3378
3455
  var help = "<span>Ctrl+Click to Select<br/></span><br/>";
3379
3456
  var SceneInspector = class {
3380
3457
  constructor(renderer) {
3381
3458
  this.renderer = renderer;
3382
- this.mouse = new import_three12.Vector2();
3459
+ this.mouse = new import_three13.Vector2();
3383
3460
  this.objectInfoContainer = document.createElement("div");
3384
3461
  this.objectControlsContainer = document.createElement("div");
3385
- this.raycaster = new import_three12.Raycaster();
3462
+ this.raycaster = new import_three13.Raycaster();
3386
3463
  this.init();
3387
3464
  }
3388
3465
  init() {
@@ -3785,20 +3862,6 @@ function isInstanceable(obj) {
3785
3862
  return "nextInstance" in obj;
3786
3863
  }
3787
3864
 
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
3865
  // src/model/GuiLight.ts
3803
3866
  var GuiLight = /* @__PURE__ */ ((GuiLight2) => {
3804
3867
  GuiLight2["FRONT"] = "front";
@@ -3907,10 +3970,10 @@ var BlockTints = class {
3907
3970
  };
3908
3971
 
3909
3972
  // src/model/scene/ModelObject.ts
3910
- var import_three15 = require("three");
3973
+ var import_three16 = require("three");
3911
3974
 
3912
3975
  // src/three/BufferGeometryUtils.js
3913
- var import_three14 = require("three");
3976
+ var import_three15 = require("three");
3914
3977
  function computeTangents(geometry) {
3915
3978
  geometry.computeTangents();
3916
3979
  console.warn("THREE.BufferGeometryUtils: .computeTangents() has been removed. Use BufferGeometry.computeTangents() instead.");
@@ -3922,7 +3985,7 @@ function mergeBufferGeometries(geometries, useGroups = false) {
3922
3985
  const attributes = {};
3923
3986
  const morphAttributes = {};
3924
3987
  const morphTargetsRelative = geometries[0].morphTargetsRelative;
3925
- const mergedGeometry = new import_three14.BufferGeometry();
3988
+ const mergedGeometry = new import_three15.BufferGeometry();
3926
3989
  let offset = 0;
3927
3990
  for (let i = 0; i < geometries.length; ++i) {
3928
3991
  const geometry = geometries[i];
@@ -4046,7 +4109,7 @@ function mergeBufferAttributes(attributes) {
4046
4109
  array.set(attributes[i].array, offset);
4047
4110
  offset += attributes[i].array.length;
4048
4111
  }
4049
- return new import_three14.BufferAttribute(array, itemSize, normalized);
4112
+ return new import_three15.BufferAttribute(array, itemSize, normalized);
4050
4113
  }
4051
4114
  function interleaveAttributes(attributes) {
4052
4115
  let TypedArray;
@@ -4062,7 +4125,7 @@ function interleaveAttributes(attributes) {
4062
4125
  arrayLength += attribute.array.length;
4063
4126
  stride += attribute.itemSize;
4064
4127
  }
4065
- const interleavedBuffer = new import_three14.InterleavedBuffer(new TypedArray(arrayLength), stride);
4128
+ const interleavedBuffer = new import_three15.InterleavedBuffer(new TypedArray(arrayLength), stride);
4066
4129
  let offset = 0;
4067
4130
  const res = [];
4068
4131
  const getters = ["getX", "getY", "getZ", "getW"];
@@ -4071,7 +4134,7 @@ function interleaveAttributes(attributes) {
4071
4134
  const attribute = attributes[j];
4072
4135
  const itemSize = attribute.itemSize;
4073
4136
  const count = attribute.count;
4074
- const iba = new import_three14.InterleavedBufferAttribute(interleavedBuffer, itemSize, offset, attribute.normalized);
4137
+ const iba = new import_three15.InterleavedBufferAttribute(interleavedBuffer, itemSize, offset, attribute.normalized);
4075
4138
  res.push(iba);
4076
4139
  offset += itemSize;
4077
4140
  for (let c = 0; c < count; c++) {
@@ -4155,13 +4218,13 @@ function mergeVertices(geometry, tolerance = 1e-4) {
4155
4218
  const name = attributeNames[i];
4156
4219
  const oldAttribute = geometry.getAttribute(name);
4157
4220
  const buffer = new oldAttribute.array.constructor(attrArrays[name]);
4158
- const attribute = new import_three14.BufferAttribute(buffer, oldAttribute.itemSize, oldAttribute.normalized);
4221
+ const attribute = new import_three15.BufferAttribute(buffer, oldAttribute.itemSize, oldAttribute.normalized);
4159
4222
  result.setAttribute(name, attribute);
4160
4223
  if (name in morphAttrsArrays) {
4161
4224
  for (let j = 0; j < morphAttrsArrays[name].length; j++) {
4162
4225
  const oldMorphAttribute = geometry.morphAttributes[name][j];
4163
4226
  const buffer2 = new oldMorphAttribute.array.constructor(morphAttrsArrays[name][j]);
4164
- const morphAttribute = new import_three14.BufferAttribute(buffer2, oldMorphAttribute.itemSize, oldMorphAttribute.normalized);
4227
+ const morphAttribute = new import_three15.BufferAttribute(buffer2, oldMorphAttribute.itemSize, oldMorphAttribute.normalized);
4165
4228
  result.morphAttributes[name][j] = morphAttribute;
4166
4229
  }
4167
4230
  }
@@ -4170,11 +4233,11 @@ function mergeVertices(geometry, tolerance = 1e-4) {
4170
4233
  return result;
4171
4234
  }
4172
4235
  function toTrianglesDrawMode(geometry, drawMode) {
4173
- if (drawMode === import_three14.TrianglesDrawMode) {
4236
+ if (drawMode === import_three15.TrianglesDrawMode) {
4174
4237
  console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.");
4175
4238
  return geometry;
4176
4239
  }
4177
- if (drawMode === import_three14.TriangleFanDrawMode || drawMode === import_three14.TriangleStripDrawMode) {
4240
+ if (drawMode === import_three15.TriangleFanDrawMode || drawMode === import_three15.TriangleStripDrawMode) {
4178
4241
  let index = geometry.getIndex();
4179
4242
  if (index === null) {
4180
4243
  const indices = [];
@@ -4192,7 +4255,7 @@ function toTrianglesDrawMode(geometry, drawMode) {
4192
4255
  }
4193
4256
  const numberOfTriangles = index.count - 2;
4194
4257
  const newIndices = [];
4195
- if (drawMode === import_three14.TriangleFanDrawMode) {
4258
+ if (drawMode === import_three15.TriangleFanDrawMode) {
4196
4259
  for (let i = 1; i <= numberOfTriangles; i++) {
4197
4260
  newIndices.push(index.getX(0));
4198
4261
  newIndices.push(index.getX(i));
@@ -4228,15 +4291,15 @@ function computeMorphedAttributes(object) {
4228
4291
  console.error("THREE.BufferGeometryUtils: Geometry is not of type BufferGeometry.");
4229
4292
  return null;
4230
4293
  }
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();
4294
+ const _vA = new import_three15.Vector3();
4295
+ const _vB = new import_three15.Vector3();
4296
+ const _vC = new import_three15.Vector3();
4297
+ const _tempA = new import_three15.Vector3();
4298
+ const _tempB = new import_three15.Vector3();
4299
+ const _tempC = new import_three15.Vector3();
4300
+ const _morphA = new import_three15.Vector3();
4301
+ const _morphB = new import_three15.Vector3();
4302
+ const _morphC = new import_three15.Vector3();
4240
4303
  function _calculateMorphedAttributeData(object2, material2, attribute, morphAttribute, morphTargetsRelative2, a2, b2, c2, modifiedAttributeArray) {
4241
4304
  _vA.fromBufferAttribute(attribute, a2);
4242
4305
  _vB.fromBufferAttribute(attribute, b2);
@@ -4431,8 +4494,8 @@ function computeMorphedAttributes(object) {
4431
4494
  }
4432
4495
  }
4433
4496
  }
4434
- const morphedPositionAttribute = new import_three14.Float32BufferAttribute(modifiedPosition, 3);
4435
- const morphedNormalAttribute = new import_three14.Float32BufferAttribute(modifiedNormal, 3);
4497
+ const morphedPositionAttribute = new import_three15.Float32BufferAttribute(modifiedPosition, 3);
4498
+ const morphedNormalAttribute = new import_three15.Float32BufferAttribute(modifiedNormal, 3);
4436
4499
  return {
4437
4500
  positionAttribute,
4438
4501
  normalAttribute,
@@ -4476,13 +4539,14 @@ var ModelObject = class _ModelObject extends SceneObject {
4476
4539
  createMeshes(force = false) {
4477
4540
  if (this.meshesCreated && !force) return;
4478
4541
  const mat = Materials.MISSING_TEXTURE;
4542
+ const displayTransform = this.options.displayPosition ? DisplayTransforms.getMatrix(this.originalModel.display, this.options.displayPosition) : void 0;
4479
4543
  let allGeos = [];
4480
4544
  if (this.atlas) {
4481
4545
  if (this.atlas.model.elements) {
4482
4546
  this.atlas.model.elements?.forEach((el) => {
4483
4547
  const elGeo = this._getBoxGeometryFromElement(el).clone();
4484
4548
  if (this.options.uvLockRotation) {
4485
- UVMapper.lockUvs(elGeo, el.faces, this.atlas, new import_three15.Euler(...this.options.uvLockRotation));
4549
+ UVMapper.lockUvs(elGeo, el.faces, this.atlas, new import_three16.Euler(...this.options.uvLockRotation));
4486
4550
  }
4487
4551
  if (this.options.tints) {
4488
4552
  const colors = new Float32Array(elGeo.getAttribute("position").count * 3).fill(1);
@@ -4491,19 +4555,20 @@ var ModelObject = class _ModelObject extends SceneObject {
4491
4555
  if (tintIndex === void 0 || tintIndex < 0) continue;
4492
4556
  const tint = this.options.tints[tintIndex];
4493
4557
  if (tint === void 0) continue;
4494
- const color = new import_three15.Color(tint);
4558
+ const color = new import_three16.Color(tint);
4495
4559
  for (let vertex = 0; vertex < 4; vertex++) {
4496
4560
  color.toArray(colors, (faceIndex * 4 + vertex) * 3);
4497
4561
  }
4498
4562
  }
4499
- elGeo.setAttribute("color", new import_three15.BufferAttribute(colors, 3));
4563
+ elGeo.setAttribute("color", new import_three16.BufferAttribute(colors, 3));
4500
4564
  }
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]));
4565
+ 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));
4566
+ elGeo.applyMatrix4(new import_three16.Matrix4().makeTranslation(el.from[0], el.from[1], el.from[2]));
4503
4567
  if (el.rotation) {
4504
4568
  applyElementRotation(el.rotation, elGeo);
4505
4569
  }
4506
- elGeo.applyMatrix4(new import_three15.Matrix4().makeTranslation(-8, -8, -8));
4570
+ elGeo.applyMatrix4(new import_three16.Matrix4().makeTranslation(-8, -8, -8));
4571
+ if (displayTransform) DisplayTransforms.apply(elGeo, displayTransform);
4507
4572
  if (this.options.mergeMeshes) {
4508
4573
  allGeos.push(elGeo);
4509
4574
  } else {
@@ -4524,7 +4589,8 @@ var ModelObject = class _ModelObject extends SceneObject {
4524
4589
  if (allGeos.length > 0) {
4525
4590
  combinedGeo = mergeBufferGeometries(allGeos);
4526
4591
  } else {
4527
- combinedGeo = new import_three15.BoxGeometry(16, 16, 16);
4592
+ combinedGeo = new import_three16.BoxGeometry(16, 16, 16);
4593
+ if (displayTransform) DisplayTransforms.apply(combinedGeo, displayTransform);
4528
4594
  }
4529
4595
  combinedGeo.computeBoundingBox();
4530
4596
  let mesh;
@@ -4576,7 +4642,7 @@ function isModelObject(obj) {
4576
4642
 
4577
4643
  // src/model/block/scene/BlockObject.ts
4578
4644
  var import_ts_deepmerge6 = __toESM(require_dist());
4579
- var import_three16 = require("three");
4645
+ var import_three17 = require("three");
4580
4646
  var p10 = prefix("BlockObject");
4581
4647
  function matchesCondition(condition, state) {
4582
4648
  return Object.entries(condition).every(([key, value]) => {
@@ -4638,7 +4704,7 @@ var BlockObject = class _BlockObject extends SceneObject {
4638
4704
  if (isModelObject(model)) {
4639
4705
  model.removeFromScene();
4640
4706
  } else if (isInstanceReference(model)) {
4641
- model.setScale(new import_three16.Vector3(0, 0, 0));
4707
+ model.setScale(new import_three17.Vector3(0, 0, 0));
4642
4708
  }
4643
4709
  }
4644
4710
  super.removeFromScene();
@@ -4699,7 +4765,7 @@ var BlockObject = class _BlockObject extends SceneObject {
4699
4765
  }
4700
4766
  for (let model of this._models) {
4701
4767
  if (isInstanceReference(model)) {
4702
- model.setScale(new import_three16.Vector3(0, 0, 0));
4768
+ model.setScale(new import_three17.Vector3(0, 0, 0));
4703
4769
  } else {
4704
4770
  model.dispose();
4705
4771
  }
@@ -4736,7 +4802,7 @@ var BlockObject = class _BlockObject extends SceneObject {
4736
4802
  await this.createVariant(variant);
4737
4803
  }
4738
4804
  async createVariant(variant) {
4739
- const rotation = new import_three16.Euler();
4805
+ const rotation = new import_three17.Euler();
4740
4806
  if (typeof variant.x !== "undefined") {
4741
4807
  rotation.x = toRadians(clampRotationDegrees(variant.x));
4742
4808
  }
@@ -4823,7 +4889,7 @@ var BlockObject = class _BlockObject extends SceneObject {
4823
4889
  setPositionRotationScaleAt(index, position, rotation, scale) {
4824
4890
  super.setPositionRotationScaleAt(index, position, rotation, scale);
4825
4891
  }
4826
- getMatrixAt(index, matrix = new import_three16.Matrix4()) {
4892
+ getMatrixAt(index, matrix = new import_three17.Matrix4()) {
4827
4893
  if (!this.isInstanced) throw new MineRenderError("Object is not instanced");
4828
4894
  const child = this._models[0];
4829
4895
  if (child && isModelObject(child)) {
@@ -4898,7 +4964,7 @@ var StructureParser = class {
4898
4964
  };
4899
4965
 
4900
4966
  // src/renderer/MineRenderScene.ts
4901
- var import_three17 = require("three");
4967
+ var import_three18 = require("three");
4902
4968
  var import_ts_deepmerge8 = __toESM(require_dist());
4903
4969
 
4904
4970
  // src/skin/SkinPart.ts
@@ -5742,7 +5808,7 @@ var SkinObject = class extends SceneObject {
5742
5808
  };
5743
5809
 
5744
5810
  // src/renderer/MineRenderScene.ts
5745
- var MineRenderScene = class _MineRenderScene extends import_three17.Scene {
5811
+ var MineRenderScene = class _MineRenderScene extends import_three18.Scene {
5746
5812
  constructor(options) {
5747
5813
  super();
5748
5814
  this.isMineRenderScene = true;
@@ -5818,7 +5884,8 @@ var MineRenderScene = class _MineRenderScene extends import_three17.Scene {
5818
5884
  console.log("instanceMeshes + key");
5819
5885
  let key = asset.key.serialize();
5820
5886
  if (isModelObject(obj)) {
5821
- const { uvLockRotation, tints } = obj.options;
5887
+ const { displayPosition, uvLockRotation, tints } = obj.options;
5888
+ if (displayPosition) key += `|display:${displayPosition}`;
5822
5889
  if (uvLockRotation) key += `|uvlock:${uvLockRotation.join(",")}`;
5823
5890
  const palette = Object.entries(tints ?? {}).sort(([a], [b]) => Number(a) - Number(b));
5824
5891
  if (palette.length) key += `|tints:${JSON.stringify(palette)}`;
@@ -5865,17 +5932,17 @@ function isMineRenderScene(obj) {
5865
5932
  }
5866
5933
 
5867
5934
  // src/renderer/Renderer.ts
5868
- var import_three19 = require("three");
5935
+ var import_three20 = require("three");
5869
5936
  var import_ts_deepmerge9 = __toESM(require_dist());
5870
5937
  var import_stats = __toESM(require("stats.js"));
5871
5938
  var import_postprocessing = require("postprocessing");
5872
5939
 
5873
5940
  // src/three/OrbitControls.js
5874
- var import_three18 = require("three");
5941
+ var import_three19 = require("three");
5875
5942
  var _changeEvent = { type: "change" };
5876
5943
  var _startEvent = { type: "start" };
5877
5944
  var _endEvent = { type: "end" };
5878
- var OrbitControls = class extends import_three18.EventDispatcher {
5945
+ var OrbitControls = class extends import_three19.EventDispatcher {
5879
5946
  constructor(object, domElement) {
5880
5947
  super();
5881
5948
  if (domElement === void 0) console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.');
@@ -5884,7 +5951,7 @@ var OrbitControls = class extends import_three18.EventDispatcher {
5884
5951
  this.domElement = domElement;
5885
5952
  this.domElement.style.touchAction = "none";
5886
5953
  this.enabled = true;
5887
- this.target = new import_three18.Vector3();
5954
+ this.target = new import_three19.Vector3();
5888
5955
  this.minDistance = 0;
5889
5956
  this.maxDistance = Infinity;
5890
5957
  this.minZoom = 0;
@@ -5906,8 +5973,8 @@ var OrbitControls = class extends import_three18.EventDispatcher {
5906
5973
  this.autoRotate = false;
5907
5974
  this.autoRotateSpeed = 2;
5908
5975
  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 };
5976
+ this.mouseButtons = { LEFT: import_three19.MOUSE.ROTATE, MIDDLE: import_three19.MOUSE.DOLLY, RIGHT: import_three19.MOUSE.PAN };
5977
+ this.touches = { ONE: import_three19.TOUCH.ROTATE, TWO: import_three19.TOUCH.DOLLY_PAN };
5911
5978
  this.target0 = this.target.clone();
5912
5979
  this.position0 = this.object.position.clone();
5913
5980
  this.zoom0 = this.object.zoom;
@@ -5936,11 +6003,11 @@ var OrbitControls = class extends import_three18.EventDispatcher {
5936
6003
  state = STATE.NONE;
5937
6004
  };
5938
6005
  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));
6006
+ const offset = new import_three19.Vector3();
6007
+ const quat = new import_three19.Quaternion().setFromUnitVectors(object.up, new import_three19.Vector3(0, 1, 0));
5941
6008
  const quatInverse = quat.clone().invert();
5942
- const lastPosition = new import_three18.Vector3();
5943
- const lastQuaternion = new import_three18.Quaternion();
6009
+ const lastPosition = new import_three19.Vector3();
6010
+ const lastQuaternion = new import_three19.Quaternion();
5944
6011
  const twoPI = 2 * Math.PI;
5945
6012
  return function update() {
5946
6013
  const position = scope.object.position;
@@ -6026,20 +6093,20 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6026
6093
  };
6027
6094
  let state = STATE.NONE;
6028
6095
  const EPS = 1e-6;
6029
- const spherical = new import_three18.Spherical();
6030
- const sphericalDelta = new import_three18.Spherical();
6096
+ const spherical = new import_three19.Spherical();
6097
+ const sphericalDelta = new import_three19.Spherical();
6031
6098
  let scale = 1;
6032
- const panOffset = new import_three18.Vector3();
6099
+ const panOffset = new import_three19.Vector3();
6033
6100
  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();
6101
+ const rotateStart = new import_three19.Vector2();
6102
+ const rotateEnd = new import_three19.Vector2();
6103
+ const rotateDelta = new import_three19.Vector2();
6104
+ const panStart = new import_three19.Vector2();
6105
+ const panEnd = new import_three19.Vector2();
6106
+ const panDelta = new import_three19.Vector2();
6107
+ const dollyStart = new import_three19.Vector2();
6108
+ const dollyEnd = new import_three19.Vector2();
6109
+ const dollyDelta = new import_three19.Vector2();
6043
6110
  const pointers = [];
6044
6111
  const pointerPositions = {};
6045
6112
  function getAutoRotationAngle() {
@@ -6055,7 +6122,7 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6055
6122
  sphericalDelta.phi -= angle;
6056
6123
  }
6057
6124
  const panLeft = function() {
6058
- const v = new import_three18.Vector3();
6125
+ const v = new import_three19.Vector3();
6059
6126
  return function panLeft2(distance, objectMatrix) {
6060
6127
  v.setFromMatrixColumn(objectMatrix, 0);
6061
6128
  v.multiplyScalar(-distance);
@@ -6063,7 +6130,7 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6063
6130
  };
6064
6131
  }();
6065
6132
  const panUp = function() {
6066
- const v = new import_three18.Vector3();
6133
+ const v = new import_three19.Vector3();
6067
6134
  return function panUp2(distance, objectMatrix) {
6068
6135
  if (scope.screenSpacePanning === true) {
6069
6136
  v.setFromMatrixColumn(objectMatrix, 1);
@@ -6076,7 +6143,7 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6076
6143
  };
6077
6144
  }();
6078
6145
  const pan = function() {
6079
- const offset = new import_three18.Vector3();
6146
+ const offset = new import_three19.Vector3();
6080
6147
  return function pan2(deltaX, deltaY) {
6081
6148
  const element = scope.domElement;
6082
6149
  if (scope.object.isPerspectiveCamera) {
@@ -6325,12 +6392,12 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6325
6392
  mouseAction = -1;
6326
6393
  }
6327
6394
  switch (mouseAction) {
6328
- case import_three18.MOUSE.DOLLY:
6395
+ case import_three19.MOUSE.DOLLY:
6329
6396
  if (scope.enableZoom === false) return;
6330
6397
  handleMouseDownDolly(event);
6331
6398
  state = STATE.DOLLY;
6332
6399
  break;
6333
- case import_three18.MOUSE.ROTATE:
6400
+ case import_three19.MOUSE.ROTATE:
6334
6401
  if (event.ctrlKey || event.metaKey || event.shiftKey) {
6335
6402
  if (scope.enablePan === false) return;
6336
6403
  handleMouseDownPan(event);
@@ -6341,7 +6408,7 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6341
6408
  state = STATE.ROTATE;
6342
6409
  }
6343
6410
  break;
6344
- case import_three18.MOUSE.PAN:
6411
+ case import_three19.MOUSE.PAN:
6345
6412
  if (event.ctrlKey || event.metaKey || event.shiftKey) {
6346
6413
  if (scope.enableRotate === false) return;
6347
6414
  handleMouseDownRotate(event);
@@ -6397,12 +6464,12 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6397
6464
  switch (pointers.length) {
6398
6465
  case 1:
6399
6466
  switch (scope.touches.ONE) {
6400
- case import_three18.TOUCH.ROTATE:
6467
+ case import_three19.TOUCH.ROTATE:
6401
6468
  if (scope.enableRotate === false) return;
6402
6469
  handleTouchStartRotate();
6403
6470
  state = STATE.TOUCH_ROTATE;
6404
6471
  break;
6405
- case import_three18.TOUCH.PAN:
6472
+ case import_three19.TOUCH.PAN:
6406
6473
  if (scope.enablePan === false) return;
6407
6474
  handleTouchStartPan();
6408
6475
  state = STATE.TOUCH_PAN;
@@ -6413,12 +6480,12 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6413
6480
  break;
6414
6481
  case 2:
6415
6482
  switch (scope.touches.TWO) {
6416
- case import_three18.TOUCH.DOLLY_PAN:
6483
+ case import_three19.TOUCH.DOLLY_PAN:
6417
6484
  if (scope.enableZoom === false && scope.enablePan === false) return;
6418
6485
  handleTouchStartDollyPan();
6419
6486
  state = STATE.TOUCH_DOLLY_PAN;
6420
6487
  break;
6421
- case import_three18.TOUCH.DOLLY_ROTATE:
6488
+ case import_three19.TOUCH.DOLLY_ROTATE:
6422
6489
  if (scope.enableZoom === false && scope.enableRotate === false) return;
6423
6490
  handleTouchStartDollyRotate();
6424
6491
  state = STATE.TOUCH_DOLLY_ROTATE;
@@ -6485,7 +6552,7 @@ var OrbitControls = class extends import_three18.EventDispatcher {
6485
6552
  function trackPointer(event) {
6486
6553
  let position = pointerPositions[event.pointerId];
6487
6554
  if (position === void 0) {
6488
- position = new import_three18.Vector2();
6555
+ position = new import_three19.Vector2();
6489
6556
  pointerPositions[event.pointerId] = position;
6490
6557
  }
6491
6558
  position.set(event.pageX, event.pageY);
@@ -6505,10 +6572,10 @@ var MapControls = class extends OrbitControls {
6505
6572
  constructor(object, domElement) {
6506
6573
  super(object, domElement);
6507
6574
  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;
6575
+ this.mouseButtons.LEFT = import_three19.MOUSE.PAN;
6576
+ this.mouseButtons.RIGHT = import_three19.MOUSE.ROTATE;
6577
+ this.touches.ONE = import_three19.TOUCH.PAN;
6578
+ this.touches.TWO = import_three19.TOUCH.DOLLY_ROTATE;
6512
6579
  }
6513
6580
  };
6514
6581
 
@@ -6553,8 +6620,8 @@ var Renderer = class _Renderer {
6553
6620
  top: void 0,
6554
6621
  bottom: void 0
6555
6622
  },
6556
- position: new import_three19.Vector3(50, 50, 50),
6557
- lookingAt: new import_three19.Vector3(0, 0, 0)
6623
+ position: new import_three20.Vector3(50, 50, 50),
6624
+ lookingAt: new import_three20.Vector3(0, 0, 0)
6558
6625
  },
6559
6626
  render: {
6560
6627
  fpsLimit: 60,
@@ -6584,14 +6651,14 @@ var Renderer = class _Renderer {
6584
6651
  switch (this.options.camera.type) {
6585
6652
  case "perspective":
6586
6653
  default:
6587
- return new import_three19.PerspectiveCamera(
6654
+ return new import_three20.PerspectiveCamera(
6588
6655
  this.options.camera.perspective.fov,
6589
6656
  this.options.camera.perspective.aspect ?? this.viewWidth / this.viewHeight,
6590
6657
  this.options.camera.near,
6591
6658
  this.options.camera.far
6592
6659
  );
6593
6660
  case "orthographic":
6594
- return new import_three19.OrthographicCamera(
6661
+ return new import_three20.OrthographicCamera(
6595
6662
  this.options.camera.orthographic.left ?? this.viewWidth / -2,
6596
6663
  this.options.camera.orthographic.right ?? this.viewWidth / 2,
6597
6664
  this.options.camera.orthographic.top ?? this.viewHeight / 2,
@@ -6602,7 +6669,7 @@ var Renderer = class _Renderer {
6602
6669
  }
6603
6670
  }
6604
6671
  createRenderer() {
6605
- const renderer = new import_three19.WebGLRenderer({
6672
+ const renderer = new import_three20.WebGLRenderer({
6606
6673
  antialias: this.options.render.antialias,
6607
6674
  alpha: true,
6608
6675
  powerPreference: "high-performance",
@@ -6610,8 +6677,8 @@ var Renderer = class _Renderer {
6610
6677
  });
6611
6678
  renderer.setClearColor(0, 0);
6612
6679
  renderer.shadowMap.enabled = true;
6613
- renderer.shadowMap.type = import_three19.PCFSoftShadowMap;
6614
- renderer.outputColorSpace = import_three19.SRGBColorSpace;
6680
+ renderer.shadowMap.type = import_three20.PCFSoftShadowMap;
6681
+ renderer.outputColorSpace = import_three20.SRGBColorSpace;
6615
6682
  renderer.setSize(this.viewWidth, this.viewHeight);
6616
6683
  return renderer;
6617
6684
  }
@@ -6645,20 +6712,20 @@ var Renderer = class _Renderer {
6645
6712
  window["__THREE_DEVTOOLS__"].dispatchEvent(new CustomEvent("observe", { detail: this.scene }));
6646
6713
  }
6647
6714
  if (this.options.debug.grid) {
6648
- const gridHelper = new import_three19.GridHelper(128, 16);
6715
+ const gridHelper = new import_three20.GridHelper(128, 16);
6649
6716
  this._debugHelpers.push(gridHelper);
6650
6717
  this.scene.add(gridHelper);
6651
- const gridHelper2 = new import_three19.GridHelper(128, 16);
6718
+ const gridHelper2 = new import_three20.GridHelper(128, 16);
6652
6719
  this._debugHelpers.push(gridHelper2);
6653
6720
  gridHelper2.rotation.x = 90 * (Math.PI / 180);
6654
6721
  this.scene.add(gridHelper2);
6655
- const gridHelper3 = new import_three19.GridHelper(128, 16);
6722
+ const gridHelper3 = new import_three20.GridHelper(128, 16);
6656
6723
  this._debugHelpers.push(gridHelper3);
6657
6724
  gridHelper3.rotation.z = 90 * (Math.PI / 180);
6658
6725
  this.scene.add(gridHelper3);
6659
6726
  }
6660
6727
  if (this.options.debug.axes) {
6661
- const axesHelper = new import_three19.AxesHelper(64);
6728
+ const axesHelper = new import_three20.AxesHelper(64);
6662
6729
  this._debugHelpers.push(axesHelper);
6663
6730
  this.scene.add(axesHelper);
6664
6731
  }
@@ -7019,10 +7086,10 @@ var Skins = class {
7019
7086
  };
7020
7087
 
7021
7088
  // src/world/Chunk.ts
7022
- var import_three22 = require("three");
7089
+ var import_three23 = require("three");
7023
7090
 
7024
7091
  // src/world/MineRenderWorld.ts
7025
- var import_three21 = require("three");
7092
+ var import_three22 = require("three");
7026
7093
  var MineRenderWorld = class {
7027
7094
  constructor(scene) {
7028
7095
  this._size = 4;
@@ -7033,10 +7100,10 @@ var MineRenderWorld = class {
7033
7100
  }
7034
7101
  getBlockAt(posOrX, y, z) {
7035
7102
  if (typeof posOrX == "number") {
7036
- return this.getBlockAt(new import_three21.Vector3(posOrX, y, z));
7103
+ return this.getBlockAt(new import_three22.Vector3(posOrX, y, z));
7037
7104
  }
7038
7105
  if (isTripleArray(posOrX)) {
7039
- return this.getBlockAt(new import_three21.Vector3(posOrX[0], posOrX[1], posOrX[2]));
7106
+ return this.getBlockAt(new import_three22.Vector3(posOrX[0], posOrX[1], posOrX[2]));
7040
7107
  }
7041
7108
  const chunk = this.getChunkAt(posOrX);
7042
7109
  if (typeof chunk === "undefined") {
@@ -7047,10 +7114,10 @@ var MineRenderWorld = class {
7047
7114
  }
7048
7115
  async setBlockAt(posOrX, yOrBlock, z, block) {
7049
7116
  if (typeof posOrX == "number") {
7050
- return this.setBlockAt(new import_three21.Vector3(posOrX, yOrBlock, z), block);
7117
+ return this.setBlockAt(new import_three22.Vector3(posOrX, yOrBlock, z), block);
7051
7118
  }
7052
7119
  if (isTripleArray(posOrX)) {
7053
- return this.setBlockAt(new import_three21.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
7120
+ return this.setBlockAt(new import_three22.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
7054
7121
  }
7055
7122
  this.validatePosBounds(posOrX);
7056
7123
  const chunk = this.getOrCreateChunkAt(posOrX);
@@ -7096,14 +7163,14 @@ var MineRenderWorld = class {
7096
7163
  return this._chunks[index];
7097
7164
  }
7098
7165
  static worldToScenePosition(pos) {
7099
- return new import_three21.Vector3(
7166
+ return new import_three22.Vector3(
7100
7167
  pos.x * 16,
7101
7168
  pos.y * 16,
7102
7169
  pos.z * 16
7103
7170
  );
7104
7171
  }
7105
7172
  static sceneToWorldPosition(pos) {
7106
- return new import_three21.Vector3(
7173
+ return new import_three22.Vector3(
7107
7174
  pos.x / 16,
7108
7175
  pos.y / 16,
7109
7176
  pos.z / 16
@@ -7140,12 +7207,12 @@ var Chunk = class _Chunk {
7140
7207
  this.x = x;
7141
7208
  this.y = y;
7142
7209
  this.z = z;
7143
- let anchor = new import_three22.Object3D();
7210
+ let anchor = new import_three23.Object3D();
7144
7211
  this._anchor = anchor;
7145
7212
  scene.add(anchor);
7146
7213
  anchor.position.set(this.x * 256 + 128 - 8, this.y * 256 + 128 - 8, this.z * 256 + 128 - 8);
7147
7214
  addBox3WireframeToObject(
7148
- new import_three22.Box3(new import_three22.Vector3(0, 0, 0), new import_three22.Vector3(256, 256, 256)),
7215
+ new import_three23.Box3(new import_three23.Vector3(0, 0, 0), new import_three23.Vector3(256, 256, 256)),
7149
7216
  anchor,
7150
7217
  16776960,
7151
7218
  4
@@ -7153,10 +7220,10 @@ var Chunk = class _Chunk {
7153
7220
  }
7154
7221
  getBlockAt(posOrX, y, z) {
7155
7222
  if (typeof posOrX == "number") {
7156
- return this.getBlockAt(new import_three22.Vector3(posOrX, y, z));
7223
+ return this.getBlockAt(new import_three23.Vector3(posOrX, y, z));
7157
7224
  }
7158
7225
  if (isTripleArray(posOrX)) {
7159
- return this.getBlockAt(new import_three22.Vector3(posOrX[0], posOrX[1], posOrX[2]));
7226
+ return this.getBlockAt(new import_three23.Vector3(posOrX[0], posOrX[1], posOrX[2]));
7160
7227
  }
7161
7228
  const pos = this.worldPosToChunkPos(posOrX);
7162
7229
  const index = _Chunk.chunkPosToBlockIndex(pos);
@@ -7164,10 +7231,10 @@ var Chunk = class _Chunk {
7164
7231
  }
7165
7232
  async setBlockAt(posOrX, yOrBlock, z, block) {
7166
7233
  if (typeof posOrX == "number") {
7167
- return this.setBlockAt(new import_three22.Vector3(posOrX, yOrBlock, z), block);
7234
+ return this.setBlockAt(new import_three23.Vector3(posOrX, yOrBlock, z), block);
7168
7235
  }
7169
7236
  if (isTripleArray(posOrX)) {
7170
- return this.setBlockAt(new import_three22.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
7237
+ return this.setBlockAt(new import_three23.Vector3(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
7171
7238
  }
7172
7239
  const worldPos = posOrX;
7173
7240
  const pos = this.worldPosToChunkPos(worldPos);
@@ -7213,7 +7280,7 @@ var Chunk = class _Chunk {
7213
7280
  }
7214
7281
  async clear() {
7215
7282
  let promises = [];
7216
- let pos = new import_three22.Vector3();
7283
+ let pos = new import_three23.Vector3();
7217
7284
  for (let x = 0; x < 16; x++) {
7218
7285
  for (let z = 0; z < 16; z++) {
7219
7286
  for (let y = 0; y < 16; y++) {
@@ -7232,14 +7299,14 @@ var Chunk = class _Chunk {
7232
7299
  return pos.y * 16 * 16 + pos.z * 16 + pos.x;
7233
7300
  }
7234
7301
  worldPosToChunkPos(pos) {
7235
- return new import_three22.Vector3(
7302
+ return new import_three23.Vector3(
7236
7303
  pos.x - this.x * 16,
7237
7304
  pos.y - this.y * 16,
7238
7305
  pos.z - this.z * 16
7239
7306
  );
7240
7307
  }
7241
7308
  chunkPosToWorldPos(pos) {
7242
- return new import_three22.Vector3(
7309
+ return new import_three23.Vector3(
7243
7310
  this.x * 16 + pos.x,
7244
7311
  this.y * 16 + pos.y,
7245
7312
  this.z * 16 + pos.z
@@ -7279,6 +7346,7 @@ var Chunk = class _Chunk {
7279
7346
  DISPLAY_POSITIONS,
7280
7347
  DefaultBlockStates,
7281
7348
  DisplayPosition,
7349
+ DisplayTransforms,
7282
7350
  Entities,
7283
7351
  EntityModels,
7284
7352
  EntityObject,