minerender 2.1.0-alpha.122 → 2.1.0-alpha.123

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.
@@ -17192,14 +17192,14 @@ var AnvilWorldSource = class {
17192
17192
  };
17193
17193
 
17194
17194
  // src/world/Chunk.ts
17195
- import { Color as Color13, Matrix3 as Matrix33, Matrix4 as Matrix413, Vector3 as Vector318 } from "three";
17195
+ import { Color as Color13, Vector3 as Vector320 } from "three";
17196
17196
  init_BlockStates();
17197
17197
  init_AssetKey();
17198
17198
 
17199
17199
  // src/world/MineRenderWorld.ts
17200
17200
  init_Model();
17201
17201
  init_util();
17202
- import { Vector3 as Vector317 } from "three";
17202
+ import { Vector3 as Vector319 } from "three";
17203
17203
  init_AssetKey();
17204
17204
  init_BlockStates();
17205
17205
  init_CubeFace();
@@ -17462,11 +17462,74 @@ function resolveSavedEntity(entity) {
17462
17462
 
17463
17463
  // src/world/_entities/WorldEntities.ts
17464
17464
  init_BannerPatterns();
17465
+ import { Vector3 as Vector318 } from "three";
17466
+
17467
+ // src/world/_picking/Picking.ts
17468
+ init_three();
17469
+ import { Matrix3 as Matrix33, Matrix4 as Matrix413 } from "three";
17470
+ function pickableMeshes(root, scene, raycaster) {
17471
+ const result = [];
17472
+ let attached = false;
17473
+ for (let parent = root; parent; parent = parent.parent) {
17474
+ if (!parent.visible) return result;
17475
+ if (parent === scene) attached = true;
17476
+ }
17477
+ if (!attached) return result;
17478
+ root.updateWorldMatrix(true, true);
17479
+ root.traverseVisible((object4) => {
17480
+ if (isMesh(object4) && raycaster.layers.test(object4.layers)) result.push(object4);
17481
+ });
17482
+ return result;
17483
+ }
17484
+ function visibleHits(raycaster, meshes) {
17485
+ return raycaster.intersectObjects(meshes, false).filter((hit) => {
17486
+ if (!hit.face) return false;
17487
+ const mesh = hit.object;
17488
+ const material = Array.isArray(mesh.material) ? mesh.material[hit.face.materialIndex] : mesh.material;
17489
+ return material?.visible;
17490
+ });
17491
+ }
17492
+ function hitNormal(hit) {
17493
+ const mesh = hit.object;
17494
+ const matrix = mesh.matrixWorld.clone();
17495
+ if (isInstancedMesh(mesh) && hit.instanceId !== void 0) {
17496
+ const instance = new Matrix413();
17497
+ mesh.getMatrixAt(hit.instanceId, instance);
17498
+ matrix.multiply(instance);
17499
+ }
17500
+ return hit.face.normal.clone().applyNormalMatrix(new Matrix33().getNormalMatrix(matrix));
17501
+ }
17502
+
17503
+ // src/world/_entities/WorldEntities.ts
17465
17504
  var WorldEntities = class {
17466
17505
  constructor(scene) {
17467
17506
  this.scene = scene;
17468
17507
  this.columns = /* @__PURE__ */ new Map();
17469
17508
  }
17509
+ /** Finds the nearest visible triangle belonging to an entity owned by this world. */
17510
+ raycast(raycaster) {
17511
+ const owners = /* @__PURE__ */ new Map();
17512
+ for (const column of this.columns.values()) {
17513
+ for (const [object4, placement] of column) {
17514
+ for (const mesh of pickableMeshes(object4, this.scene, raycaster)) {
17515
+ owners.set(mesh, { object: object4, ...placement });
17516
+ }
17517
+ }
17518
+ }
17519
+ for (const hit of visibleHits(raycaster, [...owners.keys()])) {
17520
+ const mesh = hit.object;
17521
+ const owner = owners.get(mesh);
17522
+ return {
17523
+ type: owner.type,
17524
+ position: new Vector318(...owner.position),
17525
+ object: owner.object,
17526
+ point: hit.point.clone(),
17527
+ normal: hitNormal(hit),
17528
+ distance: hit.distance
17529
+ };
17530
+ }
17531
+ return void 0;
17532
+ }
17470
17533
  /** Captures column ownership before asynchronous block or asset loading starts. */
17471
17534
  prepare(entities = [], column) {
17472
17535
  const placements = entities.flatMap((entity) => {
@@ -17475,7 +17538,7 @@ var WorldEntities = class {
17475
17538
  const position = [...entity.position];
17476
17539
  const key = column?.join(",") ?? `${Math.floor(position[0] / 16)},${Math.floor(position[2] / 16)}`;
17477
17540
  let owner = this.columns.get(key);
17478
- if (!owner) this.columns.set(key, owner = /* @__PURE__ */ new Set());
17541
+ if (!owner) this.columns.set(key, owner = /* @__PURE__ */ new Map());
17479
17542
  return [{ ...resolved, position, column: key, owner }];
17480
17543
  });
17481
17544
  return async () => {
@@ -17501,7 +17564,7 @@ var WorldEntities = class {
17501
17564
  object4.rotation.y = placement.yaw;
17502
17565
  await object4.init();
17503
17566
  if (!current()) return;
17504
- placement.owner.add(object4);
17567
+ placement.owner.set(object4, { type: placement.key.toNamespacedString(), position: placement.position });
17505
17568
  this.scene.add(object4);
17506
17569
  } catch (error) {
17507
17570
  console.warn(`Could not draw saved entity ${placement.key.toNamespacedString()}, skipping it`, error);
@@ -17516,7 +17579,7 @@ var WorldEntities = class {
17516
17579
  const objects = this.columns.get(key);
17517
17580
  this.columns.delete(key);
17518
17581
  if (!objects) return;
17519
- for (const object4 of objects) {
17582
+ for (const object4 of objects.keys()) {
17520
17583
  object4.removeFromScene();
17521
17584
  object4.dispose();
17522
17585
  }
@@ -17584,6 +17647,14 @@ var MineRenderWorld = class {
17584
17647
  raycast(raycaster) {
17585
17648
  return Chunk.raycast(this._chunks.values(), raycaster);
17586
17649
  }
17650
+ /**
17651
+ * Returns the nearest visible mob geometry hit when renderEntities is enabled.
17652
+ * Respects layers and near/far; compare its distance with raycast() to account for blocks.
17653
+ * Texture alpha does not change triangle intersections.
17654
+ */
17655
+ raycastEntities(raycaster) {
17656
+ return this.entities?.raycast(raycaster);
17657
+ }
17587
17658
  /** Whether neighboring opaque cubes shade block-face corners. Defaults to false. */
17588
17659
  get ambientOcclusion() {
17589
17660
  return this._ambientOcclusion;
@@ -17604,25 +17675,25 @@ var MineRenderWorld = class {
17604
17675
  }
17605
17676
  getBlockAt(posOrX, y, z) {
17606
17677
  if (typeof posOrX == "number") {
17607
- return this.getBlockAt(new Vector317(posOrX, y, z));
17678
+ return this.getBlockAt(new Vector319(posOrX, y, z));
17608
17679
  }
17609
17680
  if (isTripleArray(posOrX)) {
17610
- return this.getBlockAt(new Vector317(posOrX[0], posOrX[1], posOrX[2]));
17681
+ return this.getBlockAt(new Vector319(posOrX[0], posOrX[1], posOrX[2]));
17611
17682
  }
17612
17683
  this.validatePosBounds(posOrX);
17613
17684
  return this.getChunkAt(posOrX)?.getBlockAt(posOrX);
17614
17685
  }
17615
17686
  getBiomeAt(posOrX, y, z) {
17616
- if (typeof posOrX === "number") return this.getBiomeAt(new Vector317(posOrX, y, z));
17617
- if (isTripleArray(posOrX)) return this.getBiomeAt(new Vector317(...posOrX));
17687
+ if (typeof posOrX === "number") return this.getBiomeAt(new Vector319(posOrX, y, z));
17688
+ if (isTripleArray(posOrX)) return this.getBiomeAt(new Vector319(...posOrX));
17618
17689
  this.validatePosBounds(posOrX);
17619
17690
  const cx = Math.floor(posOrX.x / 16), cy = Math.floor(posOrX.y / 16), cz = Math.floor(posOrX.z / 16);
17620
17691
  const lx = posOrX.x - cx * 16, ly = posOrX.y - cy * 16, lz = posOrX.z - cz * 16;
17621
17692
  return this.biomes.get(`${cx}_${cz}`)?.get(cy)?.[Math.floor(lx / 4) + Math.floor(lz / 4) * 4 + Math.floor(ly / 4) * 16];
17622
17693
  }
17623
17694
  getLightAt(posOrX, y, z) {
17624
- if (typeof posOrX === "number") return this.getLightAt(new Vector317(posOrX, y, z));
17625
- if (isTripleArray(posOrX)) return this.getLightAt(new Vector317(...posOrX));
17695
+ if (typeof posOrX === "number") return this.getLightAt(new Vector319(posOrX, y, z));
17696
+ if (isTripleArray(posOrX)) return this.getLightAt(new Vector319(...posOrX));
17626
17697
  this.validatePosBounds(posOrX);
17627
17698
  const { x, y: py, z: pz } = posOrX;
17628
17699
  const cx = Math.floor(x / 16), cy = Math.floor(py / 16), cz = Math.floor(pz / 16);
@@ -17640,10 +17711,10 @@ var MineRenderWorld = class {
17640
17711
  }
17641
17712
  async setBlockAt(posOrX, yOrBlock, z, block) {
17642
17713
  if (typeof posOrX == "number") {
17643
- return this.setBlockAt(new Vector317(posOrX, yOrBlock, z), block);
17714
+ return this.setBlockAt(new Vector319(posOrX, yOrBlock, z), block);
17644
17715
  }
17645
17716
  if (isTripleArray(posOrX)) {
17646
- return this.setBlockAt(new Vector317(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
17717
+ return this.setBlockAt(new Vector319(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
17647
17718
  }
17648
17719
  return this.placeBlock(posOrX, yOrBlock);
17649
17720
  }
@@ -17654,10 +17725,10 @@ var MineRenderWorld = class {
17654
17725
  }
17655
17726
  async setBlockVisibleAt(posOrX, yOrVisible, z, visible) {
17656
17727
  if (typeof posOrX === "number") {
17657
- return this.setBlockVisibleAt(new Vector317(posOrX, yOrVisible, z), visible);
17728
+ return this.setBlockVisibleAt(new Vector319(posOrX, yOrVisible, z), visible);
17658
17729
  }
17659
17730
  if (isTripleArray(posOrX)) {
17660
- return this.setBlockVisibleAt(new Vector317(...posOrX), yOrVisible);
17731
+ return this.setBlockVisibleAt(new Vector319(...posOrX), yOrVisible);
17661
17732
  }
17662
17733
  this.validatePosBounds(posOrX);
17663
17734
  await this.getChunkAt(posOrX)?.setBlockVisibleAt(posOrX, yOrVisible);
@@ -17683,7 +17754,7 @@ var MineRenderWorld = class {
17683
17754
  const collect = async (positions2) => {
17684
17755
  for (const pos of positions2) changes.set(pos.toArray().join(","), pos);
17685
17756
  };
17686
- const place = (block) => this.placeBlock(new Vector317(...block.position), block, collect);
17757
+ const place = (block) => this.placeBlock(new Vector319(...block.position), block, collect);
17687
17758
  const keys = /* @__PURE__ */ new Map();
17688
17759
  const types = /* @__PURE__ */ new Set();
17689
17760
  for (const block of multiblock.blocks) {
@@ -17699,7 +17770,7 @@ var MineRenderWorld = class {
17699
17770
  }
17700
17771
  if (!executor) {
17701
17772
  const groups2 = /* @__PURE__ */ new Map();
17702
- const position = new Vector317();
17773
+ const position = new Vector319();
17703
17774
  for (const block of multiblock.blocks) {
17704
17775
  const [x, y, z] = block.position;
17705
17776
  this.validatePosBounds(position.set(x, y, z));
@@ -17739,7 +17810,7 @@ var MineRenderWorld = class {
17739
17810
  try {
17740
17811
  positions = await chunk.placeBlocks(blocks);
17741
17812
  } finally {
17742
- positions ?? (positions = blocks.map(({ index }) => new Vector317(
17813
+ positions ?? (positions = blocks.map(({ index }) => new Vector319(
17743
17814
  chunk.x * 16 + index % 16,
17744
17815
  chunk.y * 16 + Math.floor(index / 256),
17745
17816
  chunk.z * 16 + Math.floor(index / 16) % 16
@@ -17791,7 +17862,7 @@ var MineRenderWorld = class {
17791
17862
  }
17792
17863
  for (const section of chunk.sections) {
17793
17864
  if (section.biomes) {
17794
- const position = new Vector317(chunk.x * 16, section.y * 16, chunk.z * 16);
17865
+ const position = new Vector319(chunk.x * 16, section.y * 16, chunk.z * 16);
17795
17866
  this.validatePosBounds(position);
17796
17867
  const copy = [...section.biomes];
17797
17868
  if (copy.length !== 64 || !copy.every((id) => typeof id === "string" && id.length > 0)) {
@@ -17807,7 +17878,7 @@ var MineRenderWorld = class {
17807
17878
  for (const section of chunk.sections) {
17808
17879
  if (!executor) {
17809
17880
  if (!occupiedSections.has(section.y)) continue;
17810
- const position = new Vector317(chunk.x * 16, section.y * 16, chunk.z * 16);
17881
+ const position = new Vector319(chunk.x * 16, section.y * 16, chunk.z * 16);
17811
17882
  this.validatePosBounds(position);
17812
17883
  const target = this.getOrCreateChunkAt(position);
17813
17884
  try {
@@ -17911,7 +17982,7 @@ var MineRenderWorld = class {
17911
17982
  this.sectionModels?.clear();
17912
17983
  }
17913
17984
  updateCulling(positions) {
17914
- const neighbor = new Vector317();
17985
+ const neighbor = new Vector319();
17915
17986
  for (const pos of positions) {
17916
17987
  const cx = Math.floor(pos.x / 16), cy = Math.floor(pos.y / 16), cz = Math.floor(pos.z / 16);
17917
17988
  const chunk = this._chunks.get(`${cx}_${cy}_${cz}`);
@@ -18042,7 +18113,7 @@ var MineRenderWorld = class {
18042
18113
  }
18043
18114
  /** Converts block coordinates to scene units by multiplying each component by 16. */
18044
18115
  static worldToScenePosition(pos) {
18045
- return new Vector317(
18116
+ return new Vector319(
18046
18117
  pos.x * 16,
18047
18118
  pos.y * 16,
18048
18119
  pos.z * 16
@@ -18050,7 +18121,7 @@ var MineRenderWorld = class {
18050
18121
  }
18051
18122
  /** Converts scene units to block coordinates without rounding to an integer block. */
18052
18123
  static sceneToWorldPosition(pos) {
18053
- return new Vector317(
18124
+ return new Vector319(
18054
18125
  pos.x / 16,
18055
18126
  pos.y / 16,
18056
18127
  pos.z / 16
@@ -18075,7 +18146,7 @@ init_Model();
18075
18146
  // src/world/SectionMesh.ts
18076
18147
  init_CanvasCompat();
18077
18148
  init_Materials();
18078
- 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";
18149
+ 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";
18079
18150
 
18080
18151
  // src/world/SectionGeometry.ts
18081
18152
  init_FluidQuads();
@@ -18545,7 +18616,7 @@ var SectionMesh = class _SectionMesh extends Group3 {
18545
18616
  }
18546
18617
  material.vertexColors = true;
18547
18618
  const texture = material.uniforms?.map?.value ?? material.map;
18548
- const mesh = new Mesh10(geometry, material);
18619
+ const mesh = new Mesh12(geometry, material);
18549
18620
  section.add(mesh);
18550
18621
  section.blockIndices.set(mesh, page.blockIndices);
18551
18622
  const unsubscribe = [];
@@ -18584,7 +18655,6 @@ init_FluidGeometry();
18584
18655
  init_FluidQuads();
18585
18656
  init_CubeFace();
18586
18657
  init_InstanceReference();
18587
- init_three();
18588
18658
  var WATER_TINT2 = new Color13(4159204).toArray();
18589
18659
  var Chunk = class _Chunk {
18590
18660
  constructor(scene, x, y, z, onBlocksChanged, sectionModels, neighborCell, biomeAt, onBiomesChanged, lightAt, onLightCleared, ambientLight = 0) {
@@ -18602,7 +18672,7 @@ var Chunk = class _Chunk {
18602
18672
  this.sectionBlocks = /* @__PURE__ */ new Map();
18603
18673
  this.hiddenBlocks = /* @__PURE__ */ new Set();
18604
18674
  this.fluidCells = new Uint8Array(4096);
18605
- this.blockPosition = new Vector318();
18675
+ this.blockPosition = new Vector320();
18606
18676
  this.meshDirty = false;
18607
18677
  this.meshGeneration = 0;
18608
18678
  this.scene = scene;
@@ -18617,18 +18687,8 @@ var Chunk = class _Chunk {
18617
18687
  const meshes = (root, scene) => {
18618
18688
  const cached2 = roots.get(root);
18619
18689
  if (cached2) return cached2;
18620
- const result = [];
18690
+ const result = pickableMeshes(root, scene, raycaster);
18621
18691
  roots.set(root, result);
18622
- let attached = false;
18623
- for (let parent = root; parent; parent = parent.parent) {
18624
- if (!parent.visible) return result;
18625
- if (parent === scene) attached = true;
18626
- }
18627
- if (!attached) return result;
18628
- root.updateWorldMatrix(true, true);
18629
- root.traverseVisible((object4) => {
18630
- if (isMesh(object4) && raycaster.layers.test(object4.layers)) result.push(object4);
18631
- });
18632
18692
  return result;
18633
18693
  };
18634
18694
  const add = (root, owner, reference) => {
@@ -18659,11 +18719,8 @@ var Chunk = class _Chunk {
18659
18719
  }
18660
18720
  }
18661
18721
  }
18662
- for (const hit of raycaster.intersectObjects([...targets.keys()], false)) {
18663
- if (!hit.face) continue;
18722
+ for (const hit of visibleHits(raycaster, [...targets.keys()])) {
18664
18723
  const mesh = hit.object;
18665
- const material = Array.isArray(mesh.material) ? mesh.material[hit.face.materialIndex] : mesh.material;
18666
- if (!material?.visible) continue;
18667
18724
  const entry = targets.get(mesh);
18668
18725
  let owner = entry.owners.get(hit.instanceId) ?? entry.owners.get(void 0);
18669
18726
  if (entry.section) {
@@ -18673,21 +18730,15 @@ var Chunk = class _Chunk {
18673
18730
  if (!owner || owner.chunk.hiddenBlocks.has(owner.index)) continue;
18674
18731
  const info = owner.chunk.renderedBlocks.get(owner.index);
18675
18732
  if (!info) continue;
18676
- const matrix = mesh.matrixWorld.clone();
18677
- if (isInstancedMesh(mesh) && hit.instanceId !== void 0) {
18678
- const instance = new Matrix413();
18679
- mesh.getMatrixAt(hit.instanceId, instance);
18680
- matrix.multiply(instance);
18681
- }
18682
18733
  return {
18683
- position: new Vector318(
18734
+ position: new Vector320(
18684
18735
  owner.chunk.x * 16 + owner.index % 16,
18685
18736
  owner.chunk.y * 16 + Math.floor(owner.index / 256),
18686
18737
  owner.chunk.z * 16 + Math.floor(owner.index / 16) % 16
18687
18738
  ),
18688
18739
  block: info.block,
18689
18740
  point: hit.point.clone(),
18690
- normal: hit.face.normal.clone().applyNormalMatrix(new Matrix33().getNormalMatrix(matrix)),
18741
+ normal: hitNormal(hit),
18691
18742
  distance: hit.distance
18692
18743
  };
18693
18744
  }
@@ -18695,18 +18746,18 @@ var Chunk = class _Chunk {
18695
18746
  }
18696
18747
  getBlockAt(posOrX, y, z) {
18697
18748
  if (typeof posOrX == "number") {
18698
- return this.getBlockAt(new Vector318(posOrX, y, z));
18749
+ return this.getBlockAt(new Vector320(posOrX, y, z));
18699
18750
  }
18700
18751
  if (isTripleArray(posOrX)) {
18701
- return this.getBlockAt(new Vector318(posOrX[0], posOrX[1], posOrX[2]));
18752
+ return this.getBlockAt(new Vector320(posOrX[0], posOrX[1], posOrX[2]));
18702
18753
  }
18703
18754
  const pos = this.blockPosition.set(posOrX.x - this.x * 16, posOrX.y - this.y * 16, posOrX.z - this.z * 16);
18704
18755
  const index = _Chunk.chunkPosToBlockIndex(pos);
18705
18756
  return this.renderedBlocks.get(index);
18706
18757
  }
18707
18758
  getBiomeAt(posOrX, y, z) {
18708
- if (typeof posOrX === "number") return this.getBiomeAt(new Vector318(posOrX, y, z));
18709
- if (isTripleArray(posOrX)) return this.getBiomeAt(new Vector318(...posOrX));
18759
+ if (typeof posOrX === "number") return this.getBiomeAt(new Vector320(posOrX, y, z));
18760
+ if (isTripleArray(posOrX)) return this.getBiomeAt(new Vector320(...posOrX));
18710
18761
  const pos = this.worldPosToChunkPos(posOrX);
18711
18762
  _Chunk.chunkPosToBlockIndex(pos);
18712
18763
  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];
@@ -18749,17 +18800,17 @@ var Chunk = class _Chunk {
18749
18800
  this.hiddenBlocks.add(index);
18750
18801
  this.renderedBlocks.get(index)?.object?.setVisible(false);
18751
18802
  }
18752
- const positions = blocks.map(({ index }) => new Vector318(...this.positionAt(index)));
18803
+ const positions = blocks.map(({ index }) => new Vector320(...this.positionAt(index)));
18753
18804
  if (this.onBlocksChanged) await this.onBlocksChanged(positions);
18754
18805
  else await this.rebuildSectionMesh();
18755
18806
  }
18756
18807
  }
18757
18808
  async setBlockAt(posOrX, yOrBlock, z, block) {
18758
18809
  if (typeof posOrX == "number") {
18759
- return this.setBlockAt(new Vector318(posOrX, yOrBlock, z), block);
18810
+ return this.setBlockAt(new Vector320(posOrX, yOrBlock, z), block);
18760
18811
  }
18761
18812
  if (isTripleArray(posOrX)) {
18762
- return this.setBlockAt(new Vector318(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
18813
+ return this.setBlockAt(new Vector320(posOrX[0], posOrX[1], posOrX[2]), yOrBlock);
18763
18814
  }
18764
18815
  const worldPos = posOrX;
18765
18816
  const pos = this.worldPosToChunkPos(worldPos);
@@ -18814,7 +18865,7 @@ var Chunk = class _Chunk {
18814
18865
  this.fluidCells[index] = 0;
18815
18866
  this.renderedBlocks.delete(index);
18816
18867
  this.objectBlocks.delete(index);
18817
- const worldPos = new Vector318(
18868
+ const worldPos = new Vector320(
18818
18869
  this.x * 16 + index % 16,
18819
18870
  this.y * 16 + Math.floor(index / 256),
18820
18871
  this.z * 16 + Math.floor(index / 16) % 16
@@ -18945,7 +18996,7 @@ var Chunk = class _Chunk {
18945
18996
  biome,
18946
18997
  biomePosition: this.biomePosition(index, blockState3, this.data.stateAt(this.data.idAt(index)))
18947
18998
  });
18948
- object4.setPosition(new Vector318(
18999
+ object4.setPosition(new Vector320(
18949
19000
  this.x * 256 + index % 16 * 16,
18950
19001
  this.y * 256 + Math.floor(index / 256) * 16,
18951
19002
  this.z * 256 + Math.floor(index / 16) % 16 * 16
@@ -19208,7 +19259,7 @@ var Chunk = class _Chunk {
19208
19259
  /** Removes stored blocks and render objects. Set `notify` to false to skip the owning world's update. */
19209
19260
  async clear(notify = true) {
19210
19261
  const positions = notify && this.onBlocksChanged ? [...this.renderedBlocks.keys()].map((index) => this.chunkPosToWorldPos(
19211
- new Vector318(index % 16, Math.floor(index / 256), Math.floor(index / 16) % 16)
19262
+ new Vector320(index % 16, Math.floor(index / 256), Math.floor(index / 16) % 16)
19212
19263
  )) : [];
19213
19264
  for (const info of this.renderedBlocks.values()) info.object?.removeFromScene();
19214
19265
  this.sectionBlocks.clear();
@@ -19244,14 +19295,14 @@ var Chunk = class _Chunk {
19244
19295
  return pos.y * 16 * 16 + pos.z * 16 + pos.x;
19245
19296
  }
19246
19297
  worldPosToChunkPos(pos) {
19247
- return new Vector318(
19298
+ return new Vector320(
19248
19299
  pos.x - this.x * 16,
19249
19300
  pos.y - this.y * 16,
19250
19301
  pos.z - this.z * 16
19251
19302
  );
19252
19303
  }
19253
19304
  chunkPosToWorldPos(pos) {
19254
- return new Vector318(
19305
+ return new Vector320(
19255
19306
  this.x * 16 + pos.x,
19256
19307
  this.y * 16 + pos.y,
19257
19308
  this.z * 16 + pos.z