minerender 2.1.0-alpha.36 → 2.1.0-alpha.37

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.
@@ -1680,7 +1680,8 @@ declare function toTrianglesDrawMode(geometry: BufferGeometry, drawMode: Triangl
1680
1680
  declare function computeMorphedAttributes(object: Mesh | Line | Points): object;
1681
1681
 
1682
1682
  interface BlockInfo {
1683
- block: Block;
1683
+ /** Detached block data; use world or chunk setters to update stored blocks. */
1684
+ readonly block: Block;
1684
1685
  object: BlockObject;
1685
1686
  }
1686
1687
 
@@ -1689,7 +1690,8 @@ declare class Chunk {
1689
1690
  readonly x: number;
1690
1691
  readonly y: number;
1691
1692
  readonly z: number;
1692
- private readonly _blocks;
1693
+ private readonly data;
1694
+ private readonly renderedBlocks;
1693
1695
  constructor(scene: MineRenderScene, x: number, y: number, z: number);
1694
1696
  getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo>;
1695
1697
  getBlockAt(pos: Vector3): Maybe<BlockInfo>;
@@ -1712,6 +1714,21 @@ declare class Chunk {
1712
1714
  chunkPosToWorldPos(pos: Vector3): Vector3;
1713
1715
  }
1714
1716
 
1717
+ declare class ChunkData {
1718
+ private readonly indices;
1719
+ private readonly palette;
1720
+ private readonly paletteIds;
1721
+ private readonly freeIds;
1722
+ private readonly nbt;
1723
+ get(index: number): Maybe<Block>;
1724
+ snapshot(index: number): Maybe<() => Block>;
1725
+ set(index: number, block?: Block): void;
1726
+ clear(): void;
1727
+ static isAir(block: Maybe<Block>): boolean;
1728
+ private static copyBlock;
1729
+ private static validateIndex;
1730
+ }
1731
+
1715
1732
  declare class MineRenderWorld {
1716
1733
  readonly scene: MineRenderScene;
1717
1734
  private readonly _chunks;
@@ -1770,4 +1787,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
1770
1787
  forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
1771
1788
  }
1772
1789
 
1773
- export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, ArchiveAssetSource, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Block, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type ElementFace, type ElementRotation, Entities, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FromTo, Geometries, GuiLight, GuiObject, type GuiObjectOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelTextures, type ListAsset, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResponseParser, SKIN_PARTS, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createImage, estimateBytesUsed, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, registerNodeEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
1790
+ export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, ArchiveAssetSource, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Block, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type ElementFace, type ElementRotation, Entities, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FromTo, Geometries, GuiLight, GuiObject, type GuiObjectOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelTextures, type ListAsset, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResponseParser, SKIN_PARTS, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createImage, estimateBytesUsed, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, registerNodeEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
@@ -1680,7 +1680,8 @@ declare function toTrianglesDrawMode(geometry: BufferGeometry, drawMode: Triangl
1680
1680
  declare function computeMorphedAttributes(object: Mesh | Line | Points): object;
1681
1681
 
1682
1682
  interface BlockInfo {
1683
- block: Block;
1683
+ /** Detached block data; use world or chunk setters to update stored blocks. */
1684
+ readonly block: Block;
1684
1685
  object: BlockObject;
1685
1686
  }
1686
1687
 
@@ -1689,7 +1690,8 @@ declare class Chunk {
1689
1690
  readonly x: number;
1690
1691
  readonly y: number;
1691
1692
  readonly z: number;
1692
- private readonly _blocks;
1693
+ private readonly data;
1694
+ private readonly renderedBlocks;
1693
1695
  constructor(scene: MineRenderScene, x: number, y: number, z: number);
1694
1696
  getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo>;
1695
1697
  getBlockAt(pos: Vector3): Maybe<BlockInfo>;
@@ -1712,6 +1714,21 @@ declare class Chunk {
1712
1714
  chunkPosToWorldPos(pos: Vector3): Vector3;
1713
1715
  }
1714
1716
 
1717
+ declare class ChunkData {
1718
+ private readonly indices;
1719
+ private readonly palette;
1720
+ private readonly paletteIds;
1721
+ private readonly freeIds;
1722
+ private readonly nbt;
1723
+ get(index: number): Maybe<Block>;
1724
+ snapshot(index: number): Maybe<() => Block>;
1725
+ set(index: number, block?: Block): void;
1726
+ clear(): void;
1727
+ static isAir(block: Maybe<Block>): boolean;
1728
+ private static copyBlock;
1729
+ private static validateIndex;
1730
+ }
1731
+
1715
1732
  declare class MineRenderWorld {
1716
1733
  readonly scene: MineRenderScene;
1717
1734
  private readonly _chunks;
@@ -1770,4 +1787,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
1770
1787
  forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
1771
1788
  }
1772
1789
 
1773
- export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, ArchiveAssetSource, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Block, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type ElementFace, type ElementRotation, Entities, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FromTo, Geometries, GuiLight, GuiObject, type GuiObjectOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelTextures, type ListAsset, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResponseParser, SKIN_PARTS, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createImage, estimateBytesUsed, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, registerNodeEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
1790
+ export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, ArchiveAssetSource, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Block, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type ElementFace, type ElementRotation, Entities, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FromTo, Geometries, GuiLight, GuiObject, type GuiObjectOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelTextures, type ListAsset, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResponseParser, SKIN_PARTS, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createImage, estimateBytesUsed, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, registerNodeEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
@@ -37,8 +37,8 @@ var require_dist = __commonJS({
37
37
  __assign = Object.assign || function(t) {
38
38
  for (var s, i = 1, n = arguments.length; i < n; i++) {
39
39
  s = arguments[i];
40
- for (var p12 in s) if (Object.prototype.hasOwnProperty.call(s, p12))
41
- t[p12] = s[p12];
40
+ for (var p11 in s) if (Object.prototype.hasOwnProperty.call(s, p11))
41
+ t[p11] = s[p11];
42
42
  }
43
43
  return t;
44
44
  };
@@ -145,6 +145,7 @@ __export(index_node_exports, {
145
145
  Caching: () => Caching,
146
146
  CanvasImage: () => CanvasImage,
147
147
  Chunk: () => Chunk,
148
+ ChunkData: () => ChunkData,
148
149
  CubeFace: () => CubeFace,
149
150
  CubeFaceIndex: () => CubeFaceIndex,
150
151
  DEFAULT_ELEMENTS: () => DEFAULT_ELEMENTS,
@@ -1329,12 +1330,12 @@ var AssetKey = class _AssetKey extends BasicAssetKey {
1329
1330
  return a.join("/");
1330
1331
  }
1331
1332
  getFullPath() {
1332
- let p12 = [];
1333
+ let p11 = [];
1333
1334
  if (this.type) {
1334
- p12.push(this.type);
1335
+ p11.push(this.type);
1335
1336
  }
1336
- p12.push(this.path);
1337
- return p12.join("/");
1337
+ p11.push(this.path);
1338
+ return p11.join("/");
1338
1339
  }
1339
1340
  toNamespacedString() {
1340
1341
  return this.namespace + ":" + this.getFullPath();
@@ -1421,7 +1422,7 @@ var ModelMerger = class {
1421
1422
  merged.display = { ...inheritedDisplay, ...DisplayTransforms.withHandFallbacks(source.display) };
1422
1423
  }
1423
1424
  }
1424
- merged.hierarchy = models.map((m) => m.parent).filter((p12) => `${p12}`);
1425
+ merged.hierarchy = models.map((m) => m.parent).filter((p11) => `${p11}`);
1425
1426
  merged.hierarchy.push(`${merged.parent}`);
1426
1427
  return merged;
1427
1428
  }
@@ -7380,6 +7381,87 @@ var Skins = class {
7380
7381
  // src/world/Chunk.ts
7381
7382
  var import_three25 = require("three");
7382
7383
 
7384
+ // src/world/ChunkData.ts
7385
+ var ChunkData = class _ChunkData {
7386
+ constructor() {
7387
+ this.indices = new Uint16Array(4096);
7388
+ this.palette = [void 0];
7389
+ this.paletteIds = /* @__PURE__ */ new Map();
7390
+ this.freeIds = [];
7391
+ this.nbt = /* @__PURE__ */ new Map();
7392
+ }
7393
+ get(index) {
7394
+ _ChunkData.validateIndex(index);
7395
+ const entry = this.palette[this.indices[index]];
7396
+ return entry ? _ChunkData.copyBlock(entry.state, this.nbt.get(index)) : void 0;
7397
+ }
7398
+ snapshot(index) {
7399
+ _ChunkData.validateIndex(index);
7400
+ const entry = this.palette[this.indices[index]];
7401
+ return entry ? _ChunkData.copyBlock.bind(void 0, entry.state, this.nbt.get(index)) : void 0;
7402
+ }
7403
+ set(index, block) {
7404
+ _ChunkData.validateIndex(index);
7405
+ let state;
7406
+ let key;
7407
+ let nbt;
7408
+ if (block && !_ChunkData.isAir(block)) {
7409
+ const type = AssetKey.parse("blockstates", block.type).toNamespacedString();
7410
+ const properties = Object.fromEntries(Object.keys(block.properties ?? {}).sort().map((name) => [name, block.properties[name]]));
7411
+ state = Object.freeze(Object.keys(properties).length ? { type, properties: Object.freeze(properties) } : { type });
7412
+ key = JSON.stringify([type, properties]);
7413
+ if (block.nbt !== void 0) nbt = structuredClone(block.nbt);
7414
+ }
7415
+ const previousId = this.indices[index];
7416
+ if (previousId !== 0) {
7417
+ const previous = this.palette[previousId];
7418
+ if (--previous.references === 0) {
7419
+ this.paletteIds.delete(previous.key);
7420
+ this.palette[previousId] = void 0;
7421
+ this.freeIds.push(previousId);
7422
+ }
7423
+ }
7424
+ let id = 0;
7425
+ if (state && key !== void 0) {
7426
+ const existingId = this.paletteIds.get(key);
7427
+ if (existingId !== void 0) {
7428
+ id = existingId;
7429
+ this.palette[id].references++;
7430
+ } else {
7431
+ id = this.freeIds.pop() ?? this.palette.length;
7432
+ this.palette[id] = { key, state, references: 1 };
7433
+ this.paletteIds.set(key, id);
7434
+ }
7435
+ }
7436
+ this.indices[index] = id;
7437
+ if (nbt !== void 0) this.nbt.set(index, nbt);
7438
+ else this.nbt.delete(index);
7439
+ }
7440
+ clear() {
7441
+ this.indices.fill(0);
7442
+ this.palette.length = 1;
7443
+ this.paletteIds.clear();
7444
+ this.freeIds.length = 0;
7445
+ this.nbt.clear();
7446
+ }
7447
+ static isAir(block) {
7448
+ if (typeof block === "undefined" || typeof block.type === "undefined") return true;
7449
+ const key = AssetKey.parse("blockstates", block.type);
7450
+ return key.namespace === "minecraft" && !key.type && ["air", "cave_air", "void_air"].includes(key.path);
7451
+ }
7452
+ static copyBlock(state, nbt) {
7453
+ const block = { type: state.type };
7454
+ if (state.properties) block.properties = { ...state.properties };
7455
+ if (nbt !== void 0) block.nbt = structuredClone(nbt);
7456
+ return block;
7457
+ }
7458
+ static validateIndex(index) {
7459
+ if (!Number.isInteger(index) || index < 0 || index >= 4096) {
7460
+ throw new RangeError("Block index must be an integer from 0 to 4095");
7461
+ }
7462
+ }
7463
+ };
7464
+
7383
7465
  // src/world/MineRenderWorld.ts
7384
7466
  var import_three24 = require("three");
7385
7467
  var MineRenderWorld = class {
@@ -7490,10 +7572,10 @@ var MineRenderWorld = class {
7490
7572
  };
7491
7573
 
7492
7574
  // src/world/Chunk.ts
7493
- var p11 = prefix("Chunk");
7494
7575
  var Chunk = class _Chunk {
7495
7576
  constructor(scene, x, y, z) {
7496
- this._blocks = [];
7577
+ this.data = new ChunkData();
7578
+ this.renderedBlocks = /* @__PURE__ */ new Map();
7497
7579
  this.scene = scene;
7498
7580
  this.x = x;
7499
7581
  this.y = y;
@@ -7508,7 +7590,7 @@ var Chunk = class _Chunk {
7508
7590
  }
7509
7591
  const pos = this.worldPosToChunkPos(posOrX);
7510
7592
  const index = _Chunk.chunkPosToBlockIndex(pos);
7511
- return this._blocks[index];
7593
+ return this.renderedBlocks.get(index);
7512
7594
  }
7513
7595
  async setBlockAt(posOrX, yOrBlock, z, block) {
7514
7596
  if (typeof posOrX == "number") {
@@ -7530,44 +7612,47 @@ var Chunk = class _Chunk {
7530
7612
  worldPos = this.chunkPosToWorldPos(pos);
7531
7613
  }
7532
7614
  const index = _Chunk.chunkPosToBlockIndex(pos);
7533
- const current = this._blocks[index];
7534
- if (typeof current !== "undefined") {
7535
- console.debug(p11, "deleting existing block at", pos, worldPos, index);
7536
- current.object.removeFromScene();
7537
- delete this._blocks[index];
7538
- }
7539
- if (!block || _Chunk.isAir(block)) return void 0;
7540
- const blockState = await BlockStates.get(AssetKey.parse("blockstates", block.type));
7541
- if (blockState) {
7542
- const blockObject = await this.scene.addBlock(blockState, {
7615
+ this.data.set(index, block);
7616
+ const readBlock = this.data.snapshot(index);
7617
+ this.renderedBlocks.get(index)?.object.removeFromScene();
7618
+ this.renderedBlocks.delete(index);
7619
+ if (!readBlock) return void 0;
7620
+ const stored = readBlock();
7621
+ let object;
7622
+ try {
7623
+ const blockState = await BlockStates.get(AssetKey.parse("blockstates", stored.type));
7624
+ if (!blockState) {
7625
+ this.data.set(index, void 0);
7626
+ return void 0;
7627
+ }
7628
+ object = await this.scene.addBlock(blockState, {
7543
7629
  mergeMeshes: true,
7544
7630
  instanceMeshes: true,
7545
7631
  maxInstanceCount: 2e3
7546
7632
  });
7547
- if (block.properties) {
7548
- await blockObject.setState(block.properties);
7549
- }
7550
- const scenePos = MineRenderWorld.worldToScenePosition(worldPos);
7551
- blockObject.setPosition(scenePos);
7552
- this._blocks[index] = {
7553
- block,
7554
- object: blockObject
7555
- };
7556
- return this._blocks[index];
7633
+ if (stored.properties) await object.setState(stored.properties);
7634
+ object.setPosition(MineRenderWorld.worldToScenePosition(worldPos));
7635
+ const info = { get block() {
7636
+ return readBlock();
7637
+ }, object };
7638
+ this.renderedBlocks.set(index, info);
7639
+ return info;
7640
+ } catch (error) {
7641
+ this.data.set(index, void 0);
7642
+ object?.removeFromScene();
7643
+ throw error;
7557
7644
  }
7558
- return void 0;
7559
7645
  }
7560
7646
  async clear() {
7561
- this._blocks.forEach((block) => block.object.removeFromScene());
7562
- this._blocks.length = 0;
7647
+ for (const info of this.renderedBlocks.values()) info.object.removeFromScene();
7648
+ this.renderedBlocks.clear();
7649
+ this.data.clear();
7563
7650
  }
7564
7651
  async dispose() {
7565
7652
  await this.clear();
7566
7653
  }
7567
7654
  static isAir(block) {
7568
- if (typeof block === "undefined" || typeof block.type === "undefined") return true;
7569
- const key = AssetKey.parse("blockstates", block.type);
7570
- return key.namespace === "minecraft" && !key.type && ["air", "cave_air", "void_air"].includes(key.path);
7655
+ return ChunkData.isAir(block);
7571
7656
  }
7572
7657
  static chunkPosToBlockIndex(pos) {
7573
7658
  if ([pos.x, pos.y, pos.z].some((value) => !Number.isInteger(value) || value < 0 || value >= 16)) {
@@ -7613,6 +7698,7 @@ var Chunk = class _Chunk {
7613
7698
  Caching,
7614
7699
  CanvasImage,
7615
7700
  Chunk,
7701
+ ChunkData,
7616
7702
  CubeFace,
7617
7703
  CubeFaceIndex,
7618
7704
  DEFAULT_ELEMENTS,