minerender 2.1.0-alpha.91 → 2.1.0-alpha.92
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.
- package/dist/browser/index.d.mts +21 -4
- package/dist/browser/index.d.ts +21 -4
- package/dist/browser/index.js +56 -9
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +56 -9
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +56 -9
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +21 -4
- package/dist/node/index.d.ts +21 -4
- package/dist/node/index.js +56 -9
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +56 -9
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.d.mts
CHANGED
|
@@ -3156,6 +3156,19 @@ declare class ChunkData {
|
|
|
3156
3156
|
}
|
|
3157
3157
|
|
|
3158
3158
|
type RegionInput = Uint8Array | ArrayBuffer;
|
|
3159
|
+
/** Reads `c.<x>.<z>.mcc` at absolute chunk coordinates, or returns `undefined` when the file is missing. */
|
|
3160
|
+
type AnvilExternalChunkReader = (x: number, z: number, signal?: AbortSignal) => Promise<Uint8Array | ArrayBuffer | undefined>;
|
|
3161
|
+
interface AnvilParseOptions {
|
|
3162
|
+
/** Region coordinates from `r.<x>.<z>.mca`, required when reading external chunks. */
|
|
3163
|
+
region?: {
|
|
3164
|
+
x: number;
|
|
3165
|
+
z: number;
|
|
3166
|
+
};
|
|
3167
|
+
/** Reads external chunk payloads without their region-file header. */
|
|
3168
|
+
readExternalChunk?: AnvilExternalChunkReader;
|
|
3169
|
+
/** Cancels parsing and forwards the signal to external chunk reads. */
|
|
3170
|
+
signal?: AbortSignal;
|
|
3171
|
+
}
|
|
3159
3172
|
/** Chunk columns decoded from an Anvil region file. */
|
|
3160
3173
|
interface AnvilRegion {
|
|
3161
3174
|
chunks: AnvilChunk[];
|
|
@@ -3179,14 +3192,15 @@ declare class AnvilParser {
|
|
|
3179
3192
|
z: number;
|
|
3180
3193
|
}[];
|
|
3181
3194
|
/** Decodes all stored chunks. Gzip, zlib, LZ4, and uncompressed payloads are supported. */
|
|
3182
|
-
static parse(data: RegionInput): Promise<AnvilRegion>;
|
|
3195
|
+
static parse(data: RegionInput, options?: AnvilParseOptions): Promise<AnvilRegion>;
|
|
3183
3196
|
/**
|
|
3184
3197
|
* Decodes one chunk for {@link MineRenderWorld.placeChunk}.
|
|
3185
3198
|
* @param localX - Chunk x within the region, from 0 to 31.
|
|
3186
3199
|
* @param localZ - Chunk z within the region, from 0 to 31.
|
|
3187
3200
|
* @returns The chunk with absolute coordinates, or `undefined` if the region has no chunk there.
|
|
3188
3201
|
*/
|
|
3189
|
-
static parseChunk(data: RegionInput, localX: number, localZ: number): Promise<AnvilChunk | undefined>;
|
|
3202
|
+
static parseChunk(data: RegionInput, localX: number, localZ: number, options?: AnvilParseOptions): Promise<AnvilChunk | undefined>;
|
|
3203
|
+
private static abortable;
|
|
3190
3204
|
private static bytes;
|
|
3191
3205
|
private static locations;
|
|
3192
3206
|
private static readChunk;
|
|
@@ -3207,8 +3221,10 @@ interface WorldChunkSource {
|
|
|
3207
3221
|
* Forward `signal` to file or network I/O; it aborts when every caller waiting for the region cancels.
|
|
3208
3222
|
*/
|
|
3209
3223
|
type AnvilRegionReader = (x: number, z: number, signal?: AbortSignal) => Promise<Uint8Array | ArrayBuffer | undefined>;
|
|
3210
|
-
/**
|
|
3224
|
+
/** Readers and cache limits passed to `new AnvilWorldSource(readRegion, options)`. */
|
|
3211
3225
|
interface AnvilWorldSourceOptions {
|
|
3226
|
+
/** Reads external `c.<x>.<z>.mcc` payloads at absolute chunk coordinates in the same dimension. */
|
|
3227
|
+
readExternalChunk?: AnvilExternalChunkReader;
|
|
3212
3228
|
/** Maximum cached regions, including missing regions. Defaults to 4; 0 disables caching. */
|
|
3213
3229
|
maxCachedRegions?: number;
|
|
3214
3230
|
/** Maximum retained region bytes. Defaults to 64 MiB; larger regions are read without caching. */
|
|
@@ -3221,6 +3237,7 @@ declare class AnvilWorldSource implements WorldChunkSource {
|
|
|
3221
3237
|
private readonly pending;
|
|
3222
3238
|
private readonly maxCachedRegions;
|
|
3223
3239
|
private readonly maxCachedBytes;
|
|
3240
|
+
private readonly readExternalChunk?;
|
|
3224
3241
|
private cachedBytes;
|
|
3225
3242
|
constructor(readRegion: AnvilRegionReader, options?: AnvilWorldSourceOptions);
|
|
3226
3243
|
/** Decodes one column at absolute chunk coordinates. Aborting a caller leaves other shared readers active. */
|
|
@@ -3578,4 +3595,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
3578
3595
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
3579
3596
|
}
|
|
3580
3597
|
|
|
3581
|
-
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, type AnvilRegionReader, AnvilWorldSource, type AnvilWorldSourceOptions, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, type BannerPattern, type BannerPatternDraw, BannerPatterns, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, LitematicaParser, type LitematicaRegion, type LitematicaStructure, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, OrbitControls, type PackFormat, PackFormats, PackMetadata, PersistentCache, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResponseParser, SKIN_PARTS, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, type SectionAtlasSize, type SectionGeometryInput, type SectionGeometryPage, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type SectionTemplateData, SectionWorker, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, SpongeSchematicParser, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, type VideoExportOptions, VideoExporter, type WorldChunkSource, WorldStreamer, type WorldStreamerOptions, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, buildSectionGeometry, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, entityAnimationTime, estimateBytesUsed, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, registerNodeEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, sectionGeometryTransferables, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas, yieldToEventLoop };
|
|
3598
|
+
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, type AnvilExternalChunkReader, type AnvilParseOptions, AnvilParser, type AnvilRegion, type AnvilRegionReader, AnvilWorldSource, type AnvilWorldSourceOptions, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, type BannerPattern, type BannerPatternDraw, BannerPatterns, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, LitematicaParser, type LitematicaRegion, type LitematicaStructure, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, OrbitControls, type PackFormat, PackFormats, PackMetadata, PersistentCache, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResponseParser, SKIN_PARTS, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, type SectionAtlasSize, type SectionGeometryInput, type SectionGeometryPage, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type SectionTemplateData, SectionWorker, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, SpongeSchematicParser, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, type VideoExportOptions, VideoExporter, type WorldChunkSource, WorldStreamer, type WorldStreamerOptions, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, buildSectionGeometry, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, entityAnimationTime, estimateBytesUsed, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, registerNodeEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, sectionGeometryTransferables, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas, yieldToEventLoop };
|
package/dist/node/index.d.ts
CHANGED
|
@@ -3156,6 +3156,19 @@ declare class ChunkData {
|
|
|
3156
3156
|
}
|
|
3157
3157
|
|
|
3158
3158
|
type RegionInput = Uint8Array | ArrayBuffer;
|
|
3159
|
+
/** Reads `c.<x>.<z>.mcc` at absolute chunk coordinates, or returns `undefined` when the file is missing. */
|
|
3160
|
+
type AnvilExternalChunkReader = (x: number, z: number, signal?: AbortSignal) => Promise<Uint8Array | ArrayBuffer | undefined>;
|
|
3161
|
+
interface AnvilParseOptions {
|
|
3162
|
+
/** Region coordinates from `r.<x>.<z>.mca`, required when reading external chunks. */
|
|
3163
|
+
region?: {
|
|
3164
|
+
x: number;
|
|
3165
|
+
z: number;
|
|
3166
|
+
};
|
|
3167
|
+
/** Reads external chunk payloads without their region-file header. */
|
|
3168
|
+
readExternalChunk?: AnvilExternalChunkReader;
|
|
3169
|
+
/** Cancels parsing and forwards the signal to external chunk reads. */
|
|
3170
|
+
signal?: AbortSignal;
|
|
3171
|
+
}
|
|
3159
3172
|
/** Chunk columns decoded from an Anvil region file. */
|
|
3160
3173
|
interface AnvilRegion {
|
|
3161
3174
|
chunks: AnvilChunk[];
|
|
@@ -3179,14 +3192,15 @@ declare class AnvilParser {
|
|
|
3179
3192
|
z: number;
|
|
3180
3193
|
}[];
|
|
3181
3194
|
/** Decodes all stored chunks. Gzip, zlib, LZ4, and uncompressed payloads are supported. */
|
|
3182
|
-
static parse(data: RegionInput): Promise<AnvilRegion>;
|
|
3195
|
+
static parse(data: RegionInput, options?: AnvilParseOptions): Promise<AnvilRegion>;
|
|
3183
3196
|
/**
|
|
3184
3197
|
* Decodes one chunk for {@link MineRenderWorld.placeChunk}.
|
|
3185
3198
|
* @param localX - Chunk x within the region, from 0 to 31.
|
|
3186
3199
|
* @param localZ - Chunk z within the region, from 0 to 31.
|
|
3187
3200
|
* @returns The chunk with absolute coordinates, or `undefined` if the region has no chunk there.
|
|
3188
3201
|
*/
|
|
3189
|
-
static parseChunk(data: RegionInput, localX: number, localZ: number): Promise<AnvilChunk | undefined>;
|
|
3202
|
+
static parseChunk(data: RegionInput, localX: number, localZ: number, options?: AnvilParseOptions): Promise<AnvilChunk | undefined>;
|
|
3203
|
+
private static abortable;
|
|
3190
3204
|
private static bytes;
|
|
3191
3205
|
private static locations;
|
|
3192
3206
|
private static readChunk;
|
|
@@ -3207,8 +3221,10 @@ interface WorldChunkSource {
|
|
|
3207
3221
|
* Forward `signal` to file or network I/O; it aborts when every caller waiting for the region cancels.
|
|
3208
3222
|
*/
|
|
3209
3223
|
type AnvilRegionReader = (x: number, z: number, signal?: AbortSignal) => Promise<Uint8Array | ArrayBuffer | undefined>;
|
|
3210
|
-
/**
|
|
3224
|
+
/** Readers and cache limits passed to `new AnvilWorldSource(readRegion, options)`. */
|
|
3211
3225
|
interface AnvilWorldSourceOptions {
|
|
3226
|
+
/** Reads external `c.<x>.<z>.mcc` payloads at absolute chunk coordinates in the same dimension. */
|
|
3227
|
+
readExternalChunk?: AnvilExternalChunkReader;
|
|
3212
3228
|
/** Maximum cached regions, including missing regions. Defaults to 4; 0 disables caching. */
|
|
3213
3229
|
maxCachedRegions?: number;
|
|
3214
3230
|
/** Maximum retained region bytes. Defaults to 64 MiB; larger regions are read without caching. */
|
|
@@ -3221,6 +3237,7 @@ declare class AnvilWorldSource implements WorldChunkSource {
|
|
|
3221
3237
|
private readonly pending;
|
|
3222
3238
|
private readonly maxCachedRegions;
|
|
3223
3239
|
private readonly maxCachedBytes;
|
|
3240
|
+
private readonly readExternalChunk?;
|
|
3224
3241
|
private cachedBytes;
|
|
3225
3242
|
constructor(readRegion: AnvilRegionReader, options?: AnvilWorldSourceOptions);
|
|
3226
3243
|
/** Decodes one column at absolute chunk coordinates. Aborting a caller leaves other shared readers active. */
|
|
@@ -3578,4 +3595,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
3578
3595
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
3579
3596
|
}
|
|
3580
3597
|
|
|
3581
|
-
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, type AnvilRegionReader, AnvilWorldSource, type AnvilWorldSourceOptions, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, type BannerPattern, type BannerPatternDraw, BannerPatterns, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, LitematicaParser, type LitematicaRegion, type LitematicaStructure, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, OrbitControls, type PackFormat, PackFormats, PackMetadata, PersistentCache, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResponseParser, SKIN_PARTS, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, type SectionAtlasSize, type SectionGeometryInput, type SectionGeometryPage, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type SectionTemplateData, SectionWorker, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, SpongeSchematicParser, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, type VideoExportOptions, VideoExporter, type WorldChunkSource, WorldStreamer, type WorldStreamerOptions, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, buildSectionGeometry, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, entityAnimationTime, estimateBytesUsed, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, registerNodeEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, sectionGeometryTransferables, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas, yieldToEventLoop };
|
|
3598
|
+
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, type AnvilExternalChunkReader, type AnvilParseOptions, AnvilParser, type AnvilRegion, type AnvilRegionReader, AnvilWorldSource, type AnvilWorldSourceOptions, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, type BannerPattern, type BannerPatternDraw, BannerPatterns, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidSample, type FluidSampler, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, LitematicaParser, type LitematicaRegion, type LitematicaStructure, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, OrbitControls, type PackFormat, PackFormats, PackMetadata, PersistentCache, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererFrame, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResponseParser, SKIN_PARTS, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, type SectionAtlasSize, type SectionGeometryInput, type SectionGeometryPage, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type SectionTemplateData, SectionWorker, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, SpongeSchematicParser, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, type VideoExportOptions, VideoExporter, type WorldChunkSource, WorldStreamer, type WorldStreamerOptions, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, buildSectionGeometry, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, entityAnimationTime, estimateBytesUsed, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, registerNodeEnv, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, sectionGeometryTransferables, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas, yieldToEventLoop };
|
package/dist/node/index.js
CHANGED
|
@@ -29238,10 +29238,13 @@ var AnvilParser = class {
|
|
|
29238
29238
|
return this.locations(this.bytes(data)).map(({ x, z }) => ({ x, z }));
|
|
29239
29239
|
}
|
|
29240
29240
|
/** Decodes all stored chunks. Gzip, zlib, LZ4, and uncompressed payloads are supported. */
|
|
29241
|
-
static async parse(data) {
|
|
29241
|
+
static async parse(data, options = {}) {
|
|
29242
|
+
options.signal?.throwIfAborted();
|
|
29242
29243
|
const bytes = this.bytes(data);
|
|
29243
29244
|
const chunks = [];
|
|
29244
|
-
for (const location of this.locations(bytes))
|
|
29245
|
+
for (const location of this.locations(bytes)) {
|
|
29246
|
+
chunks.push(await this.abortable(this.readChunk(bytes, location, options), options.signal));
|
|
29247
|
+
}
|
|
29245
29248
|
return { chunks };
|
|
29246
29249
|
}
|
|
29247
29250
|
/**
|
|
@@ -29250,13 +29253,28 @@ var AnvilParser = class {
|
|
|
29250
29253
|
* @param localZ - Chunk z within the region, from 0 to 31.
|
|
29251
29254
|
* @returns The chunk with absolute coordinates, or `undefined` if the region has no chunk there.
|
|
29252
29255
|
*/
|
|
29253
|
-
static async parseChunk(data, localX, localZ) {
|
|
29256
|
+
static async parseChunk(data, localX, localZ, options = {}) {
|
|
29257
|
+
options.signal?.throwIfAborted();
|
|
29254
29258
|
if (![localX, localZ].every((value) => Number.isInteger(value) && value >= 0 && value < 32)) {
|
|
29255
29259
|
throw new RangeError("Region-local chunk coordinates must be integers from 0 to 31");
|
|
29256
29260
|
}
|
|
29257
29261
|
const bytes = this.bytes(data);
|
|
29258
29262
|
const location = this.locations(bytes).find(({ x, z }) => x === localX && z === localZ);
|
|
29259
|
-
return location ? this.readChunk(bytes, location) : void 0;
|
|
29263
|
+
return location ? this.abortable(this.readChunk(bytes, location, options), options.signal) : void 0;
|
|
29264
|
+
}
|
|
29265
|
+
static async abortable(promise, signal) {
|
|
29266
|
+
if (!signal) return promise;
|
|
29267
|
+
let abort;
|
|
29268
|
+
const cancelled = new Promise((_, reject) => {
|
|
29269
|
+
abort = () => reject(signal.reason);
|
|
29270
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
29271
|
+
if (signal.aborted) abort();
|
|
29272
|
+
});
|
|
29273
|
+
try {
|
|
29274
|
+
return await Promise.race([promise, cancelled]);
|
|
29275
|
+
} finally {
|
|
29276
|
+
signal.removeEventListener("abort", abort);
|
|
29277
|
+
}
|
|
29260
29278
|
}
|
|
29261
29279
|
static bytes(data) {
|
|
29262
29280
|
return data instanceof Uint8Array ? data : new Uint8Array(data);
|
|
@@ -29282,20 +29300,41 @@ var AnvilParser = class {
|
|
|
29282
29300
|
}
|
|
29283
29301
|
return locations;
|
|
29284
29302
|
}
|
|
29285
|
-
static async readChunk(data, location) {
|
|
29286
|
-
|
|
29287
|
-
|
|
29303
|
+
static async readChunk(data, location, options) {
|
|
29304
|
+
options.signal?.throwIfAborted();
|
|
29305
|
+
const format2 = data[location.offset + 4];
|
|
29306
|
+
const external = (format2 & 128) !== 0;
|
|
29307
|
+
const compression = format2 & 127;
|
|
29288
29308
|
if (compression !== 1 && compression !== 2 && compression !== 3 && compression !== 4) {
|
|
29289
29309
|
throw new MineRenderError(`Unsupported Anvil compression ${compression}`);
|
|
29290
29310
|
}
|
|
29291
29311
|
let payload = data.subarray(location.offset + 5, location.offset + 4 + location.length);
|
|
29312
|
+
let expected;
|
|
29313
|
+
if (external) {
|
|
29314
|
+
if (!options.region || !options.readExternalChunk) {
|
|
29315
|
+
throw new MineRenderError("External Anvil .mcc chunks require region coordinates and readExternalChunk");
|
|
29316
|
+
}
|
|
29317
|
+
if (![options.region.x, options.region.z].every(Number.isSafeInteger)) {
|
|
29318
|
+
throw new RangeError("Anvil region coordinates must be safe integers");
|
|
29319
|
+
}
|
|
29320
|
+
expected = { x: options.region.x * 32 + location.x, z: options.region.z * 32 + location.z };
|
|
29321
|
+
if (![expected.x, expected.z].every(Number.isSafeInteger)) {
|
|
29322
|
+
throw new RangeError("External Anvil chunk coordinates must be safe integers");
|
|
29323
|
+
}
|
|
29324
|
+
const externalData = await options.readExternalChunk(expected.x, expected.z, options.signal);
|
|
29325
|
+
options.signal?.throwIfAborted();
|
|
29326
|
+
if (externalData === void 0) throw new MineRenderError(`External Anvil chunk c.${expected.x}.${expected.z}.mcc is missing`);
|
|
29327
|
+
payload = this.bytes(externalData);
|
|
29328
|
+
}
|
|
29292
29329
|
if (compression === 4) {
|
|
29293
29330
|
payload = decodeAnvilLz4(payload);
|
|
29294
29331
|
} else if (compression !== 3) {
|
|
29295
29332
|
const stream = new Blob([payload]).stream().pipeThrough(new DecompressionStream(compression === 1 ? "gzip" : "deflate"));
|
|
29296
29333
|
payload = new Uint8Array(await new Response(stream).arrayBuffer());
|
|
29297
29334
|
}
|
|
29335
|
+
options.signal?.throwIfAborted();
|
|
29298
29336
|
const nbt = await NBTHelper.fromBuffer(payload, "big");
|
|
29337
|
+
options.signal?.throwIfAborted();
|
|
29299
29338
|
const root = nbt.value;
|
|
29300
29339
|
const level = root.Level?.type === "compound" ? root.Level.value : root;
|
|
29301
29340
|
const dataVersion = root.DataVersion?.type === "int" ? root.DataVersion.value : void 0;
|
|
@@ -29308,6 +29347,9 @@ var AnvilParser = class {
|
|
|
29308
29347
|
if ((chunk.x % 32 + 32) % 32 !== location.x || (chunk.z % 32 + 32) % 32 !== location.z) {
|
|
29309
29348
|
throw new MineRenderError("Anvil chunk coordinates do not match its region location");
|
|
29310
29349
|
}
|
|
29350
|
+
if (expected && (chunk.x !== expected.x || chunk.z !== expected.z)) {
|
|
29351
|
+
throw new MineRenderError(`Anvil chunk coordinates do not match external file c.${expected.x}.${expected.z}.mcc`);
|
|
29352
|
+
}
|
|
29311
29353
|
for (const section of this.compounds(level.sections ?? level.Sections, "sections")) {
|
|
29312
29354
|
const y = this.integer(section.Y, "section Y");
|
|
29313
29355
|
if (section.Blocks || section.Data || section.Add) {
|
|
@@ -29439,6 +29481,7 @@ var AnvilWorldSource = class {
|
|
|
29439
29481
|
this.cachedBytes = 0;
|
|
29440
29482
|
this.maxCachedRegions = options.maxCachedRegions ?? 4;
|
|
29441
29483
|
this.maxCachedBytes = options.maxCachedBytes ?? 64 * 1024 * 1024;
|
|
29484
|
+
this.readExternalChunk = options.readExternalChunk;
|
|
29442
29485
|
for (const [name, value] of Object.entries({ maxCachedRegions: this.maxCachedRegions, maxCachedBytes: this.maxCachedBytes })) {
|
|
29443
29486
|
if (!Number.isSafeInteger(value) || value < 0) throw new RangeError(`${name} must be a nonnegative safe integer`);
|
|
29444
29487
|
}
|
|
@@ -29452,7 +29495,11 @@ var AnvilWorldSource = class {
|
|
|
29452
29495
|
const data = await this.getRegion(regionX, regionZ, signal);
|
|
29453
29496
|
signal?.throwIfAborted();
|
|
29454
29497
|
if (!data) return void 0;
|
|
29455
|
-
const chunk = await
|
|
29498
|
+
const chunk = await AnvilParser.parseChunk(data, x - regionX * 32, z - regionZ * 32, {
|
|
29499
|
+
region: { x: regionX, z: regionZ },
|
|
29500
|
+
readExternalChunk: this.readExternalChunk,
|
|
29501
|
+
signal
|
|
29502
|
+
});
|
|
29456
29503
|
signal?.throwIfAborted();
|
|
29457
29504
|
if (chunk && (chunk.x !== x || chunk.z !== z)) {
|
|
29458
29505
|
throw new MineRenderError(`Anvil chunk coordinates ${chunk.x},${chunk.z} do not match requested column ${x},${z}`);
|
|
@@ -29483,7 +29530,7 @@ var AnvilWorldSource = class {
|
|
|
29483
29530
|
settled: false,
|
|
29484
29531
|
promise: Promise.resolve().then(() => {
|
|
29485
29532
|
controller.signal.throwIfAborted();
|
|
29486
|
-
return this.readRegion(x, z, controller.signal);
|
|
29533
|
+
return abortable2(this.readRegion(x, z, controller.signal), controller.signal);
|
|
29487
29534
|
}).then((data) => {
|
|
29488
29535
|
controller.signal.throwIfAborted();
|
|
29489
29536
|
let bytes = data instanceof Uint8Array ? data : data === void 0 ? void 0 : new Uint8Array(data);
|