minerender 2.1.0-alpha.122 → 2.1.0-alpha.124

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.
@@ -3964,11 +3964,14 @@ var init_UVMapper = __esm({
3964
3964
  });
3965
3965
  }
3966
3966
  static fillMissingTextureKeys(textures, target) {
3967
- for (let faceName of CUBE_FACES) {
3968
- let v = textures[faceName];
3969
- if (v && v.startsWith("#")) {
3970
- target[faceName] = target[v.substr(1)];
3967
+ for (const key in textures) {
3968
+ let name = key;
3969
+ const seen = /* @__PURE__ */ new Set();
3970
+ while (textures[name]?.startsWith("#") && !seen.has(name)) {
3971
+ seen.add(name);
3972
+ name = textures[name].substr(1);
3971
3973
  }
3974
+ if (name !== key) target[key] = target[name];
3972
3975
  }
3973
3976
  return target;
3974
3977
  }
@@ -17228,14 +17231,14 @@ var AnvilWorldSource = class {
17228
17231
  };
17229
17232
 
17230
17233
  // src/world/Chunk.ts
17231
- import { Color as Color13, Matrix3 as Matrix33, Matrix4 as Matrix413, Vector3 as Vector318 } from "three";
17234
+ import { Color as Color13, Vector3 as Vector320 } from "three";
17232
17235
  init_BlockStates();
17233
17236
  init_AssetKey();
17234
17237
 
17235
17238
  // src/world/MineRenderWorld.ts
17236
17239
  init_Model();
17237
17240
  init_util();
17238
- import { Vector3 as Vector317 } from "three";
17241
+ import { Vector3 as Vector319 } from "three";
17239
17242
  init_AssetKey();
17240
17243
  init_BlockStates();
17241
17244
  init_CubeFace();
@@ -17498,11 +17501,74 @@ function resolveSavedEntity(entity) {
17498
17501
 
17499
17502
  // src/world/_entities/WorldEntities.ts
17500
17503
  init_BannerPatterns();
17504
+ import { Vector3 as Vector318 } from "three";
17505
+
17506
+ // src/world/_picking/Picking.ts
17507
+ init_three();
17508
+ import { Matrix3 as Matrix33, Matrix4 as Matrix413 } from "three";
17509
+ function pickableMeshes(root, scene, raycaster) {
17510
+ const result = [];
17511
+ let attached = false;
17512
+ for (let parent = root; parent; parent = parent.parent) {
17513
+ if (!parent.visible) return result;
17514
+ if (parent === scene) attached = true;
17515
+ }
17516
+ if (!attached) return result;
17517
+ root.updateWorldMatrix(true, true);
17518
+ root.traverseVisible((object4) => {
17519
+ if (isMesh(object4) && raycaster.layers.test(object4.layers)) result.push(object4);
17520
+ });
17521
+ return result;
17522
+ }
17523
+ function visibleHits(raycaster, meshes) {
17524
+ return raycaster.intersectObjects(meshes, false).filter((hit) => {
17525
+ if (!hit.face) return false;
17526
+ const mesh = hit.object;
17527
+ const material = Array.isArray(mesh.material) ? mesh.material[hit.face.materialIndex] : mesh.material;
17528
+ return material?.visible;
17529
+ });
17530
+ }
17531
+ function hitNormal(hit) {
17532
+ const mesh = hit.object;
17533
+ const matrix = mesh.matrixWorld.clone();
17534
+ if (isInstancedMesh(mesh) && hit.instanceId !== void 0) {
17535
+ const instance = new Matrix413();
17536
+ mesh.getMatrixAt(hit.instanceId, instance);
17537
+ matrix.multiply(instance);
17538
+ }
17539
+ return hit.face.normal.clone().applyNormalMatrix(new Matrix33().getNormalMatrix(matrix));
17540
+ }
17541
+
17542
+ // src/world/_entities/WorldEntities.ts
17501
17543
  var WorldEntities = class {
17502
17544
  constructor(scene) {
17503
17545
  this.scene = scene;
17504
17546
  this.columns = /* @__PURE__ */ new Map();
17505
17547
  }
17548
+ /** Finds the nearest visible triangle belonging to an entity owned by this world. */
17549
+ raycast(raycaster) {
17550
+ const owners = /* @__PURE__ */ new Map();
17551
+ for (const column of this.columns.values()) {
17552
+ for (const [object4, placement] of column) {
17553
+ for (const mesh of pickableMeshes(object4, this.scene, raycaster)) {
17554
+ owners.set(mesh, { object: object4, ...placement });
17555
+ }
17556
+ }
17557
+ }
17558
+ for (const hit of visibleHits(raycaster, [...owners.keys()])) {
17559
+ const mesh = hit.object;
17560
+ const owner = owners.get(mesh);
17561
+ return {
17562
+ type: owner.type,
17563
+ position: new Vector318(...owner.position),
17564
+ object: owner.object,
17565
+ point: hit.point.clone(),
17566
+ normal: hitNormal(hit),
17567
+ distance: hit.distance
17568
+ };
17569
+ }
17570
+ return void 0;
17571
+ }
17506
17572
  /** Captures column ownership before asynchronous block or asset loading starts. */
17507
17573
  prepare(entities = [], column) {
17508
17574
  const placements = entities.flatMap((entity) => {
@@ -17511,7 +17577,7 @@ var WorldEntities = class {
17511
17577
  const position = [...entity.position];
17512
17578
  const key = column?.join(",") ?? `${Math.floor(position[0] / 16)},${Math.floor(position[2] / 16)}`;
17513
17579
  let owner = this.columns.get(key);
17514
- if (!owner) this.columns.set(key, owner = /* @__PURE__ */ new Set());
17580
+ if (!owner) this.columns.set(key, owner = /* @__PURE__ */ new Map());
17515
17581
  return [{ ...resolved, position, column: key, owner }];
17516
17582
  });
17517
17583
  return async () => {
@@ -17537,7 +17603,7 @@ var WorldEntities = class {
17537
17603
  object4.rotation.y = placement.yaw;
17538
17604
  await object4.init();
17539
17605
  if (!current()) return;
17540
- placement.owner.add(object4);
17606
+ placement.owner.set(object4, { type: placement.key.toNamespacedString(), position: placement.position });
17541
17607
  this.scene.add(object4);
17542
17608
  } catch (error) {
17543
17609
  console.warn(`Could not draw saved entity ${placement.key.toNamespacedString()}, skipping it`, error);
@@ -17552,7 +17618,7 @@ var WorldEntities = class {
17552
17618
  const objects = this.columns.get(key);
17553
17619
  this.columns.delete(key);
17554
17620
  if (!objects) return;
17555
- for (const object4 of objects) {
17621
+ for (const object4 of objects.keys()) {
17556
17622
  object4.removeFromScene();
17557
17623
  object4.dispose();
17558
17624
  }
@@ -17620,6 +17686,14 @@ var MineRenderWorld = class {
17620
17686
  raycast(raycaster) {
17621
17687
  return Chunk.raycast(this._chunks.values(), raycaster);
17622
17688
  }
17689
+ /**
17690
+ * Returns the nearest visible mob geometry hit when renderEntities is enabled.
17691
+ * Respects layers and near/far; compare its distance with raycast() to account for blocks.
17692
+ * Texture alpha does not change triangle intersections.
17693
+ */
17694
+ raycastEntities(raycaster) {
17695
+ return this.entities?.raycast(raycaster);
17696
+ }
17623
17697
  /** Whether neighboring opaque cubes shade block-face corners. Defaults to false. */
17624
17698
  get ambientOcclusion() {
17625
17699
  return this._ambientOcclusion;
@@ -17640,25 +17714,25 @@ var MineRenderWorld = class {
17640
17714
  }
17641
17715
  getBlockAt(posOrX, y, z) {
17642
17716
  if (typeof posOrX == "number") {
17643
- return this.getBlockAt(new Vector317(posOrX, y, z));
17717
+ return this.getBlockAt(new Vector319(posOrX, y, z));
17644
17718
  }
17645
17719
  if (isTripleArray(posOrX)) {
17646
- return this.getBlockAt(new Vector317(posOrX[0], posOrX[1], posOrX[2]));
17720
+ return this.getBlockAt(new Vector319(posOrX[0], posOrX[1], posOrX[2]));
17647
17721
  }
17648
17722
  this.validatePosBounds(posOrX);
17649
17723
  return this.getChunkAt(posOrX)?.getBlockAt(posOrX);
17650
17724
  }
17651
17725
  getBiomeAt(posOrX, y, z) {
17652
- if (typeof posOrX === "number") return this.getBiomeAt(new Vector317(posOrX, y, z));
17653
- if (isTripleArray(posOrX)) return this.getBiomeAt(new Vector317(...posOrX));
17726
+ if (typeof posOrX === "number") return this.getBiomeAt(new Vector319(posOrX, y, z));
17727
+ if (isTripleArray(posOrX)) return this.getBiomeAt(new Vector319(...posOrX));
17654
17728
  this.validatePosBounds(posOrX);
17655
17729
  const cx = Math.floor(posOrX.x / 16), cy = Math.floor(posOrX.y / 16), cz = Math.floor(posOrX.z / 16);
17656
17730
  const lx = posOrX.x - cx * 16, ly = posOrX.y - cy * 16, lz = posOrX.z - cz * 16;
17657
17731
  return this.biomes.get(`${cx}_${cz}`)?.get(cy)?.[Math.floor(lx / 4) + Math.floor(lz / 4) * 4 + Math.floor(ly / 4) * 16];
17658
17732
  }
17659
17733
  getLightAt(posOrX, y, z) {
17660
- if (typeof posOrX === "number") return this.getLightAt(new Vector317(posOrX, y, z));
17661
- if (isTripleArray(posOrX)) return this.getLightAt(new Vector317(...posOrX));
17734
+ if (typeof posOrX === "number") return this.getLightAt(new Vector319(posOrX, y, z));
17735
+ if (isTripleArray(posOrX)) return this.getLightAt(new Vector319(...posOrX));
17662
17736
  this.validatePosBounds(posOrX);
17663
17737
  const { x, y: py, z: pz } = posOrX;
17664
17738
  const cx = Math.floor(x / 16), cy = Math.floor(py / 16), cz = Math.floor(pz / 16);
@@ -17676,10 +17750,10 @@ var MineRenderWorld = class {
17676
17750
  }
17677
17751
  async setBlockAt(posOrX, yOrBlock, z, block) {
17678
17752
  if (typeof posOrX == "number") {
17679
- return this.setBlockAt(new Vector317(posOrX, yOrBlock, z), block);
17753
+ return this.setBlockAt(new Vector319(posOrX, yOrBlock, z), block);
17680
17754
  }
17681
17755
  if (isTripleArray(posOrX)) {
17682
- return this.setBlockAt(new Vector317(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
17756
+ return this.setBlockAt(new Vector319(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
17683
17757
  }
17684
17758
  return this.placeBlock(posOrX, yOrBlock);
17685
17759
  }
@@ -17690,10 +17764,10 @@ var MineRenderWorld = class {
17690
17764
  }
17691
17765
  async setBlockVisibleAt(posOrX, yOrVisible, z, visible) {
17692
17766
  if (typeof posOrX === "number") {
17693
- return this.setBlockVisibleAt(new Vector317(posOrX, yOrVisible, z), visible);
17767
+ return this.setBlockVisibleAt(new Vector319(posOrX, yOrVisible, z), visible);
17694
17768
  }
17695
17769
  if (isTripleArray(posOrX)) {
17696
- return this.setBlockVisibleAt(new Vector317(...posOrX), yOrVisible);
17770
+ return this.setBlockVisibleAt(new Vector319(...posOrX), yOrVisible);
17697
17771
  }
17698
17772
  this.validatePosBounds(posOrX);
17699
17773
  await this.getChunkAt(posOrX)?.setBlockVisibleAt(posOrX, yOrVisible);
@@ -17719,7 +17793,7 @@ var MineRenderWorld = class {
17719
17793
  const collect = async (positions2) => {
17720
17794
  for (const pos of positions2) changes.set(pos.toArray().join(","), pos);
17721
17795
  };
17722
- const place = (block) => this.placeBlock(new Vector317(...block.position), block, collect);
17796
+ const place = (block) => this.placeBlock(new Vector319(...block.position), block, collect);
17723
17797
  const keys = /* @__PURE__ */ new Map();
17724
17798
  const types = /* @__PURE__ */ new Set();
17725
17799
  for (const block of multiblock.blocks) {
@@ -17735,7 +17809,7 @@ var MineRenderWorld = class {
17735
17809
  }
17736
17810
  if (!executor) {
17737
17811
  const groups2 = /* @__PURE__ */ new Map();
17738
- const position = new Vector317();
17812
+ const position = new Vector319();
17739
17813
  for (const block of multiblock.blocks) {
17740
17814
  const [x, y, z] = block.position;
17741
17815
  this.validatePosBounds(position.set(x, y, z));
@@ -17775,7 +17849,7 @@ var MineRenderWorld = class {
17775
17849
  try {
17776
17850
  positions = await chunk.placeBlocks(blocks);
17777
17851
  } finally {
17778
- positions ??= blocks.map(({ index }) => new Vector317(
17852
+ positions ??= blocks.map(({ index }) => new Vector319(
17779
17853
  chunk.x * 16 + index % 16,
17780
17854
  chunk.y * 16 + Math.floor(index / 256),
17781
17855
  chunk.z * 16 + Math.floor(index / 16) % 16
@@ -17827,7 +17901,7 @@ var MineRenderWorld = class {
17827
17901
  }
17828
17902
  for (const section of chunk.sections) {
17829
17903
  if (section.biomes) {
17830
- const position = new Vector317(chunk.x * 16, section.y * 16, chunk.z * 16);
17904
+ const position = new Vector319(chunk.x * 16, section.y * 16, chunk.z * 16);
17831
17905
  this.validatePosBounds(position);
17832
17906
  const copy = [...section.biomes];
17833
17907
  if (copy.length !== 64 || !copy.every((id) => typeof id === "string" && id.length > 0)) {
@@ -17843,7 +17917,7 @@ var MineRenderWorld = class {
17843
17917
  for (const section of chunk.sections) {
17844
17918
  if (!executor) {
17845
17919
  if (!occupiedSections.has(section.y)) continue;
17846
- const position = new Vector317(chunk.x * 16, section.y * 16, chunk.z * 16);
17920
+ const position = new Vector319(chunk.x * 16, section.y * 16, chunk.z * 16);
17847
17921
  this.validatePosBounds(position);
17848
17922
  const target = this.getOrCreateChunkAt(position);
17849
17923
  try {
@@ -17947,7 +18021,7 @@ var MineRenderWorld = class {
17947
18021
  this.sectionModels?.clear();
17948
18022
  }
17949
18023
  updateCulling(positions) {
17950
- const neighbor = new Vector317();
18024
+ const neighbor = new Vector319();
17951
18025
  for (const pos of positions) {
17952
18026
  const cx = Math.floor(pos.x / 16), cy = Math.floor(pos.y / 16), cz = Math.floor(pos.z / 16);
17953
18027
  const chunk = this._chunks.get(`${cx}_${cy}_${cz}`);
@@ -18078,7 +18152,7 @@ var MineRenderWorld = class {
18078
18152
  }
18079
18153
  /** Converts block coordinates to scene units by multiplying each component by 16. */
18080
18154
  static worldToScenePosition(pos) {
18081
- return new Vector317(
18155
+ return new Vector319(
18082
18156
  pos.x * 16,
18083
18157
  pos.y * 16,
18084
18158
  pos.z * 16
@@ -18086,7 +18160,7 @@ var MineRenderWorld = class {
18086
18160
  }
18087
18161
  /** Converts scene units to block coordinates without rounding to an integer block. */
18088
18162
  static sceneToWorldPosition(pos) {
18089
- return new Vector317(
18163
+ return new Vector319(
18090
18164
  pos.x / 16,
18091
18165
  pos.y / 16,
18092
18166
  pos.z / 16
@@ -18111,7 +18185,7 @@ init_Model();
18111
18185
  // src/world/SectionMesh.ts
18112
18186
  init_CanvasCompat();
18113
18187
  init_Materials();
18114
- import { BufferGeometry as BufferGeometry9, Color as Color12, DoubleSide as DoubleSide8, Float32BufferAttribute as Float32BufferAttribute10, FrontSide as FrontSide4, Group as Group3, Mesh as Mesh10, Uint32BufferAttribute } from "three";
18188
+ import { BufferGeometry as BufferGeometry9, Color as Color12, DoubleSide as DoubleSide8, Float32BufferAttribute as Float32BufferAttribute10, FrontSide as FrontSide4, Group as Group3, Mesh as Mesh12, Uint32BufferAttribute } from "three";
18115
18189
 
18116
18190
  // src/world/SectionGeometry.ts
18117
18191
  init_FluidQuads();
@@ -18582,7 +18656,7 @@ var SectionMesh = class _SectionMesh extends Group3 {
18582
18656
  }
18583
18657
  material.vertexColors = true;
18584
18658
  const texture = material.uniforms?.map?.value ?? material.map;
18585
- const mesh = new Mesh10(geometry, material);
18659
+ const mesh = new Mesh12(geometry, material);
18586
18660
  section.add(mesh);
18587
18661
  section.blockIndices.set(mesh, page.blockIndices);
18588
18662
  const unsubscribe = [];
@@ -18621,7 +18695,6 @@ init_FluidGeometry();
18621
18695
  init_FluidQuads();
18622
18696
  init_CubeFace();
18623
18697
  init_InstanceReference();
18624
- init_three();
18625
18698
  var WATER_TINT2 = new Color13(4159204).toArray();
18626
18699
  var Chunk = class _Chunk {
18627
18700
  constructor(scene, x, y, z, onBlocksChanged, sectionModels, neighborCell, biomeAt, onBiomesChanged, lightAt, onLightCleared, ambientLight = 0) {
@@ -18639,7 +18712,7 @@ var Chunk = class _Chunk {
18639
18712
  this.sectionBlocks = /* @__PURE__ */ new Map();
18640
18713
  this.hiddenBlocks = /* @__PURE__ */ new Set();
18641
18714
  this.fluidCells = new Uint8Array(4096);
18642
- this.blockPosition = new Vector318();
18715
+ this.blockPosition = new Vector320();
18643
18716
  this.meshDirty = false;
18644
18717
  this.meshGeneration = 0;
18645
18718
  this.scene = scene;
@@ -18654,18 +18727,8 @@ var Chunk = class _Chunk {
18654
18727
  const meshes = (root, scene) => {
18655
18728
  const cached2 = roots.get(root);
18656
18729
  if (cached2) return cached2;
18657
- const result = [];
18730
+ const result = pickableMeshes(root, scene, raycaster);
18658
18731
  roots.set(root, result);
18659
- let attached = false;
18660
- for (let parent = root; parent; parent = parent.parent) {
18661
- if (!parent.visible) return result;
18662
- if (parent === scene) attached = true;
18663
- }
18664
- if (!attached) return result;
18665
- root.updateWorldMatrix(true, true);
18666
- root.traverseVisible((object4) => {
18667
- if (isMesh(object4) && raycaster.layers.test(object4.layers)) result.push(object4);
18668
- });
18669
18732
  return result;
18670
18733
  };
18671
18734
  const add = (root, owner, reference) => {
@@ -18696,11 +18759,8 @@ var Chunk = class _Chunk {
18696
18759
  }
18697
18760
  }
18698
18761
  }
18699
- for (const hit of raycaster.intersectObjects([...targets.keys()], false)) {
18700
- if (!hit.face) continue;
18762
+ for (const hit of visibleHits(raycaster, [...targets.keys()])) {
18701
18763
  const mesh = hit.object;
18702
- const material = Array.isArray(mesh.material) ? mesh.material[hit.face.materialIndex] : mesh.material;
18703
- if (!material?.visible) continue;
18704
18764
  const entry = targets.get(mesh);
18705
18765
  let owner = entry.owners.get(hit.instanceId) ?? entry.owners.get(void 0);
18706
18766
  if (entry.section) {
@@ -18710,21 +18770,15 @@ var Chunk = class _Chunk {
18710
18770
  if (!owner || owner.chunk.hiddenBlocks.has(owner.index)) continue;
18711
18771
  const info = owner.chunk.renderedBlocks.get(owner.index);
18712
18772
  if (!info) continue;
18713
- const matrix = mesh.matrixWorld.clone();
18714
- if (isInstancedMesh(mesh) && hit.instanceId !== void 0) {
18715
- const instance = new Matrix413();
18716
- mesh.getMatrixAt(hit.instanceId, instance);
18717
- matrix.multiply(instance);
18718
- }
18719
18773
  return {
18720
- position: new Vector318(
18774
+ position: new Vector320(
18721
18775
  owner.chunk.x * 16 + owner.index % 16,
18722
18776
  owner.chunk.y * 16 + Math.floor(owner.index / 256),
18723
18777
  owner.chunk.z * 16 + Math.floor(owner.index / 16) % 16
18724
18778
  ),
18725
18779
  block: info.block,
18726
18780
  point: hit.point.clone(),
18727
- normal: hit.face.normal.clone().applyNormalMatrix(new Matrix33().getNormalMatrix(matrix)),
18781
+ normal: hitNormal(hit),
18728
18782
  distance: hit.distance
18729
18783
  };
18730
18784
  }
@@ -18732,18 +18786,18 @@ var Chunk = class _Chunk {
18732
18786
  }
18733
18787
  getBlockAt(posOrX, y, z) {
18734
18788
  if (typeof posOrX == "number") {
18735
- return this.getBlockAt(new Vector318(posOrX, y, z));
18789
+ return this.getBlockAt(new Vector320(posOrX, y, z));
18736
18790
  }
18737
18791
  if (isTripleArray(posOrX)) {
18738
- return this.getBlockAt(new Vector318(posOrX[0], posOrX[1], posOrX[2]));
18792
+ return this.getBlockAt(new Vector320(posOrX[0], posOrX[1], posOrX[2]));
18739
18793
  }
18740
18794
  const pos = this.blockPosition.set(posOrX.x - this.x * 16, posOrX.y - this.y * 16, posOrX.z - this.z * 16);
18741
18795
  const index = _Chunk.chunkPosToBlockIndex(pos);
18742
18796
  return this.renderedBlocks.get(index);
18743
18797
  }
18744
18798
  getBiomeAt(posOrX, y, z) {
18745
- if (typeof posOrX === "number") return this.getBiomeAt(new Vector318(posOrX, y, z));
18746
- if (isTripleArray(posOrX)) return this.getBiomeAt(new Vector318(...posOrX));
18799
+ if (typeof posOrX === "number") return this.getBiomeAt(new Vector320(posOrX, y, z));
18800
+ if (isTripleArray(posOrX)) return this.getBiomeAt(new Vector320(...posOrX));
18747
18801
  const pos = this.worldPosToChunkPos(posOrX);
18748
18802
  _Chunk.chunkPosToBlockIndex(pos);
18749
18803
  return this.biomeAt ? this.biomeAt(posOrX.x, posOrX.y, posOrX.z) : this.biomes?.[Math.floor(pos.x / 4) + Math.floor(pos.z / 4) * 4 + Math.floor(pos.y / 4) * 16];
@@ -18786,17 +18840,17 @@ var Chunk = class _Chunk {
18786
18840
  this.hiddenBlocks.add(index);
18787
18841
  this.renderedBlocks.get(index)?.object?.setVisible(false);
18788
18842
  }
18789
- const positions = blocks.map(({ index }) => new Vector318(...this.positionAt(index)));
18843
+ const positions = blocks.map(({ index }) => new Vector320(...this.positionAt(index)));
18790
18844
  if (this.onBlocksChanged) await this.onBlocksChanged(positions);
18791
18845
  else await this.rebuildSectionMesh();
18792
18846
  }
18793
18847
  }
18794
18848
  async setBlockAt(posOrX, yOrBlock, z, block) {
18795
18849
  if (typeof posOrX == "number") {
18796
- return this.setBlockAt(new Vector318(posOrX, yOrBlock, z), block);
18850
+ return this.setBlockAt(new Vector320(posOrX, yOrBlock, z), block);
18797
18851
  }
18798
18852
  if (isTripleArray(posOrX)) {
18799
- return this.setBlockAt(new Vector318(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
18853
+ return this.setBlockAt(new Vector320(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
18800
18854
  }
18801
18855
  const worldPos = posOrX;
18802
18856
  const pos = this.worldPosToChunkPos(worldPos);
@@ -18851,7 +18905,7 @@ var Chunk = class _Chunk {
18851
18905
  this.fluidCells[index] = 0;
18852
18906
  this.renderedBlocks.delete(index);
18853
18907
  this.objectBlocks.delete(index);
18854
- const worldPos = new Vector318(
18908
+ const worldPos = new Vector320(
18855
18909
  this.x * 16 + index % 16,
18856
18910
  this.y * 16 + Math.floor(index / 256),
18857
18911
  this.z * 16 + Math.floor(index / 16) % 16
@@ -18982,7 +19036,7 @@ var Chunk = class _Chunk {
18982
19036
  biome,
18983
19037
  biomePosition: this.biomePosition(index, blockState3, this.data.stateAt(this.data.idAt(index)))
18984
19038
  });
18985
- object4.setPosition(new Vector318(
19039
+ object4.setPosition(new Vector320(
18986
19040
  this.x * 256 + index % 16 * 16,
18987
19041
  this.y * 256 + Math.floor(index / 256) * 16,
18988
19042
  this.z * 256 + Math.floor(index / 16) % 16 * 16
@@ -19245,7 +19299,7 @@ var Chunk = class _Chunk {
19245
19299
  /** Removes stored blocks and render objects. Set `notify` to false to skip the owning world's update. */
19246
19300
  async clear(notify = true) {
19247
19301
  const positions = notify && this.onBlocksChanged ? [...this.renderedBlocks.keys()].map((index) => this.chunkPosToWorldPos(
19248
- new Vector318(index % 16, Math.floor(index / 256), Math.floor(index / 16) % 16)
19302
+ new Vector320(index % 16, Math.floor(index / 256), Math.floor(index / 16) % 16)
19249
19303
  )) : [];
19250
19304
  for (const info of this.renderedBlocks.values()) info.object?.removeFromScene();
19251
19305
  this.sectionBlocks.clear();
@@ -19281,14 +19335,14 @@ var Chunk = class _Chunk {
19281
19335
  return pos.y * 16 * 16 + pos.z * 16 + pos.x;
19282
19336
  }
19283
19337
  worldPosToChunkPos(pos) {
19284
- return new Vector318(
19338
+ return new Vector320(
19285
19339
  pos.x - this.x * 16,
19286
19340
  pos.y - this.y * 16,
19287
19341
  pos.z - this.z * 16
19288
19342
  );
19289
19343
  }
19290
19344
  chunkPosToWorldPos(pos) {
19291
- return new Vector318(
19345
+ return new Vector320(
19292
19346
  this.x * 16 + pos.x,
19293
19347
  this.y * 16 + pos.y,
19294
19348
  this.z * 16 + pos.z