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