minerender 2.1.0-alpha.86 → 2.1.0-alpha.88
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 +194 -3
- package/dist/browser/index.d.ts +194 -3
- package/dist/browser/index.js +806 -184
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +806 -185
- package/dist/browser/index.mjs.map +1 -1
- package/dist/browser/section.worker.js +119 -0
- package/dist/browser/section.worker.js.map +1 -0
- package/dist/browser/section.worker.mjs +119 -0
- package/dist/browser/section.worker.mjs.map +1 -0
- package/dist/bundle.js +826 -187
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +193 -3
- package/dist/node/index.d.ts +193 -3
- package/dist/node/index.js +804 -184
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +798 -184
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.d.mts
CHANGED
|
@@ -106,6 +106,8 @@ interface EnvProvider {
|
|
|
106
106
|
/** Read width/height out of encoded image bytes without fully decoding them. */
|
|
107
107
|
imageSize(data: Uint8Array): ImageSizeInfo;
|
|
108
108
|
openCache(name: string, version: number): PersistentCache;
|
|
109
|
+
/** Optional worker support; returns undefined where unavailable. Only the browser ESM build ships worker files. */
|
|
110
|
+
createWorker?(name: "section"): Worker | undefined;
|
|
109
111
|
}
|
|
110
112
|
/**
|
|
111
113
|
* Registry holding the active {@link EnvProvider}.
|
|
@@ -767,6 +769,8 @@ declare function toRadians(degrees: number): number;
|
|
|
767
769
|
declare function toDegrees(radians: number): number;
|
|
768
770
|
/** Resolves after a delay in milliseconds. */
|
|
769
771
|
declare function sleep(timeout: number): Promise<void>;
|
|
772
|
+
/** Yields to the next macrotask without timer clamping when the platform supports it. */
|
|
773
|
+
declare function yieldToEventLoop(): Promise<void>;
|
|
770
774
|
/** Reduces an angle modulo 360, retaining a negative sign for negative inputs. */
|
|
771
775
|
declare function clampRotationDegrees(deg: number): number;
|
|
772
776
|
declare function isVector3(obj: any): obj is Vector3;
|
|
@@ -3112,6 +3116,8 @@ declare class ChunkData {
|
|
|
3112
3116
|
set(index: number, block?: Block): void;
|
|
3113
3117
|
clear(): void;
|
|
3114
3118
|
static isAir(block: Maybe<Block>): boolean;
|
|
3119
|
+
/** Identifies a normalized block type and its sorted properties, excluding per-cell NBT. */
|
|
3120
|
+
static paletteKey(block: Block): string;
|
|
3115
3121
|
private static copyBlock;
|
|
3116
3122
|
private static validateIndex;
|
|
3117
3123
|
}
|
|
@@ -3157,6 +3163,41 @@ declare class AnvilParser {
|
|
|
3157
3163
|
private static unpack;
|
|
3158
3164
|
}
|
|
3159
3165
|
|
|
3166
|
+
/** Loads chunk columns at absolute integer chunk coordinates. */
|
|
3167
|
+
interface WorldChunkSource {
|
|
3168
|
+
/** Returns the requested column, or `undefined` if absent. Honor signal to cancel discarded reads. */
|
|
3169
|
+
getChunk(x: number, z: number, signal?: AbortSignal): Promise<AnvilChunk | undefined>;
|
|
3170
|
+
}
|
|
3171
|
+
|
|
3172
|
+
/**
|
|
3173
|
+
* Reads `r.<x>.<z>.mca` at integer region coordinates, or returns `undefined` when absent.
|
|
3174
|
+
* Forward `signal` to file or network I/O; it aborts when every caller waiting for the region cancels.
|
|
3175
|
+
*/
|
|
3176
|
+
type AnvilRegionReader = (x: number, z: number, signal?: AbortSignal) => Promise<Uint8Array | ArrayBuffer | undefined>;
|
|
3177
|
+
/** Cache limits passed to `new AnvilWorldSource(readRegion, options)`. */
|
|
3178
|
+
interface AnvilWorldSourceOptions {
|
|
3179
|
+
/** Maximum cached regions, including missing regions. Defaults to 4; 0 disables caching. */
|
|
3180
|
+
maxCachedRegions?: number;
|
|
3181
|
+
/** Maximum retained region bytes. Defaults to 64 MiB; larger regions are read without caching. */
|
|
3182
|
+
maxCachedBytes?: number;
|
|
3183
|
+
}
|
|
3184
|
+
/** Reads selected Java Anvil chunk columns and caches raw regions within count and byte limits. */
|
|
3185
|
+
declare class AnvilWorldSource implements WorldChunkSource {
|
|
3186
|
+
private readonly readRegion;
|
|
3187
|
+
private readonly regions;
|
|
3188
|
+
private readonly pending;
|
|
3189
|
+
private readonly maxCachedRegions;
|
|
3190
|
+
private readonly maxCachedBytes;
|
|
3191
|
+
private cachedBytes;
|
|
3192
|
+
constructor(readRegion: AnvilRegionReader, options?: AnvilWorldSourceOptions);
|
|
3193
|
+
/** Decodes one column at absolute chunk coordinates. Aborting a caller leaves other shared readers active. */
|
|
3194
|
+
getChunk(x: number, z: number, signal?: AbortSignal): Promise<AnvilChunk | undefined>;
|
|
3195
|
+
/** Releases cached regions. Reads already in progress finish without repopulating this cache. */
|
|
3196
|
+
clearCache(): void;
|
|
3197
|
+
private getRegion;
|
|
3198
|
+
private cacheRegion;
|
|
3199
|
+
}
|
|
3200
|
+
|
|
3160
3201
|
/** A placed block's data snapshot and optional render object, returned by world and chunk accessors. */
|
|
3161
3202
|
interface BlockInfo<SectionMeshing extends boolean = false> {
|
|
3162
3203
|
/** Detached block data; use world or chunk setters to update stored blocks. */
|
|
@@ -3182,6 +3223,9 @@ declare class SectionMesh extends Group {
|
|
|
3182
3223
|
private readonly ownedMeshes;
|
|
3183
3224
|
/** Builds section-local meshes from visible cube faces. `maxAtlasSize` limits each atlas dimension in pixels. */
|
|
3184
3225
|
static build(entries: readonly SectionMeshEntry[], maxAtlasSize?: number): SectionMesh;
|
|
3226
|
+
/** Builds section-local meshes in a browser worker when available, with synchronous fallback. */
|
|
3227
|
+
static buildAsync(entries: readonly SectionMeshEntry[], maxAtlasSize?: number): Promise<SectionMesh>;
|
|
3228
|
+
private static fromPages;
|
|
3185
3229
|
dispose(): void;
|
|
3186
3230
|
}
|
|
3187
3231
|
|
|
@@ -3215,8 +3259,10 @@ declare class Chunk<SectionMeshing extends boolean = false> {
|
|
|
3215
3259
|
private readonly renderedBlocks;
|
|
3216
3260
|
private readonly sectionBlocks;
|
|
3217
3261
|
private readonly hiddenBlocks;
|
|
3262
|
+
private readonly blockPosition;
|
|
3218
3263
|
private sectionMesh?;
|
|
3219
3264
|
private meshDirty;
|
|
3265
|
+
private meshGeneration;
|
|
3220
3266
|
constructor(scene: MineRenderScene, x: number, y: number, z: number, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined, sectionModels?: SectionModels | undefined);
|
|
3221
3267
|
getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo<SectionMeshing>>;
|
|
3222
3268
|
getBlockAt(pos: Vector3): Maybe<BlockInfo<SectionMeshing>>;
|
|
@@ -3231,12 +3277,24 @@ declare class Chunk<SectionMeshing extends boolean = false> {
|
|
|
3231
3277
|
* Places a block at integer chunk-local coordinates from 0 to 15.
|
|
3232
3278
|
*/
|
|
3233
3279
|
setBlockInChunkAt(pos: Vector3, block?: Block, worldPos?: Vector3, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
3280
|
+
/** Places cells in input order and returns changed world positions without refreshing neighbors. */
|
|
3281
|
+
placeBlocks(blocks: readonly {
|
|
3282
|
+
index: number;
|
|
3283
|
+
block: Maybe<Block>;
|
|
3284
|
+
}[]): Promise<Vector3[]>;
|
|
3234
3285
|
/** Changes visibility at world block coordinates while preserving the block's data. */
|
|
3235
3286
|
setBlockVisibleAt(pos: Vector3, visible: boolean): Promise<void>;
|
|
3236
3287
|
isBlockVisibleAt(pos: Vector3): boolean;
|
|
3288
|
+
/** Reports whether a cell has a visible render object or section entry. */
|
|
3289
|
+
isBlockVisibleIndex(index: number): boolean;
|
|
3237
3290
|
isOccludingAt(pos: Vector3): boolean;
|
|
3291
|
+
/** Reports whether a visible cell hides neighboring cube faces. */
|
|
3292
|
+
isOccludingIndex(index: number): boolean;
|
|
3238
3293
|
setCullMaskAt(pos: Vector3, mask: number): Promise<void>;
|
|
3239
|
-
|
|
3294
|
+
/** Updates hidden faces for a cell's section entry or individual render object. */
|
|
3295
|
+
setCullMaskIndex(index: number, mask: number): Promise<void>;
|
|
3296
|
+
/** Rebuilds visible section geometry and discards results superseded by another rebuild or clear. */
|
|
3297
|
+
rebuildSectionMesh(): Promise<void>;
|
|
3240
3298
|
/** Removes stored blocks and their render objects, then notifies the owning world of changed positions. */
|
|
3241
3299
|
clear(onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined): Promise<void>;
|
|
3242
3300
|
dispose(): Promise<void>;
|
|
@@ -3282,11 +3340,12 @@ declare class MineRenderWorld<SectionMeshing extends boolean = false> {
|
|
|
3282
3340
|
* Places a structure's blocks at their stored positions, then refreshes neighboring faces.
|
|
3283
3341
|
* Entity NBT is retained by the structure but is not rendered.
|
|
3284
3342
|
*
|
|
3285
|
-
* @param useBatches -
|
|
3343
|
+
* @param useBatches - Yields between chunks by default. Set to `false` for sequential placement.
|
|
3286
3344
|
* @param executor - Optional queue for batched placement. The caller remains responsible for stopping it.
|
|
3287
3345
|
*/
|
|
3288
3346
|
placeMultiBlock(multiblock: MultiBlockStructure, useBatches?: boolean, executor?: BatchedExecutor): Promise<void>;
|
|
3289
3347
|
private placeBlocks;
|
|
3348
|
+
private placeChunkGroups;
|
|
3290
3349
|
/** Replaces one chunk column's blocks. Entity NBT remains available on the parsed chunk. */
|
|
3291
3350
|
placeChunk(chunk: AnvilChunk, executor?: BatchedExecutor): Promise<void>;
|
|
3292
3351
|
/**
|
|
@@ -3316,6 +3375,137 @@ interface MineRenderWorldOptions<SectionMeshing extends boolean = boolean> {
|
|
|
3316
3375
|
maxAtlasSize?: number;
|
|
3317
3376
|
}
|
|
3318
3377
|
|
|
3378
|
+
/** One cube template with four vertices per face in `CUBE_FACES` order. */
|
|
3379
|
+
interface SectionTemplateData {
|
|
3380
|
+
positions: Float32Array;
|
|
3381
|
+
normals: Float32Array;
|
|
3382
|
+
uvs: Float32Array;
|
|
3383
|
+
uvBounds: Float32Array;
|
|
3384
|
+
colors: Float32Array;
|
|
3385
|
+
indices: Uint16Array;
|
|
3386
|
+
cullFaces: Uint8Array;
|
|
3387
|
+
atlas: number;
|
|
3388
|
+
}
|
|
3389
|
+
/** The pixel dimensions of a template atlas. */
|
|
3390
|
+
interface SectionAtlasSize {
|
|
3391
|
+
width: number;
|
|
3392
|
+
height: number;
|
|
3393
|
+
}
|
|
3394
|
+
/** Section placements and their shared cube templates, ready for geometry building. */
|
|
3395
|
+
interface SectionGeometryInput {
|
|
3396
|
+
count: number;
|
|
3397
|
+
indices: Uint16Array;
|
|
3398
|
+
templates: Uint16Array;
|
|
3399
|
+
cullMasks: Uint8Array;
|
|
3400
|
+
templateData: SectionTemplateData[];
|
|
3401
|
+
atlases: SectionAtlasSize[];
|
|
3402
|
+
maxAtlasSize: number;
|
|
3403
|
+
}
|
|
3404
|
+
/** Merged cube faces and source-atlas placements for one atlas page. */
|
|
3405
|
+
interface SectionGeometryPage {
|
|
3406
|
+
width: number;
|
|
3407
|
+
height: number;
|
|
3408
|
+
placements: {
|
|
3409
|
+
atlas: number;
|
|
3410
|
+
x: number;
|
|
3411
|
+
y: number;
|
|
3412
|
+
}[];
|
|
3413
|
+
positions: Float32Array;
|
|
3414
|
+
normals: Float32Array;
|
|
3415
|
+
uvs: Float32Array;
|
|
3416
|
+
uvBounds: Float32Array;
|
|
3417
|
+
colors: Float32Array;
|
|
3418
|
+
indices: Uint32Array;
|
|
3419
|
+
}
|
|
3420
|
+
/** Builds section-local geometry from visible cube faces, with bounded atlas pages. */
|
|
3421
|
+
declare function buildSectionGeometry(input: SectionGeometryInput): SectionGeometryPage[];
|
|
3422
|
+
/** Returns the buffers behind each page's typed arrays for transfer to another thread. */
|
|
3423
|
+
declare function sectionGeometryTransferables(pages: readonly SectionGeometryPage[]): ArrayBuffer[];
|
|
3424
|
+
|
|
3425
|
+
/** Runs section geometry builds in the environment's shared worker. */
|
|
3426
|
+
declare class SectionWorker {
|
|
3427
|
+
private worker;
|
|
3428
|
+
private static initialized;
|
|
3429
|
+
private static instance;
|
|
3430
|
+
private nextId;
|
|
3431
|
+
private readonly pending;
|
|
3432
|
+
private constructor();
|
|
3433
|
+
/** The shared worker, or undefined when the environment has none or a previous worker failed. */
|
|
3434
|
+
static shared(): SectionWorker | undefined;
|
|
3435
|
+
/** Builds geometry without transferring the input buffers away from the caller. */
|
|
3436
|
+
build(input: SectionGeometryInput): Promise<SectionGeometryPage[]>;
|
|
3437
|
+
/** Rejects pending builds, terminates the worker, and makes shared() return undefined. */
|
|
3438
|
+
terminate(): void;
|
|
3439
|
+
private fail;
|
|
3440
|
+
}
|
|
3441
|
+
|
|
3442
|
+
interface WorldStreamerOptions {
|
|
3443
|
+
/** Loads a square of chunk columns around the center. Integer from 0 to 32; defaults to 2. */
|
|
3444
|
+
loadRadius?: number;
|
|
3445
|
+
/** Retains loaded columns within this radius. Defaults to loadRadius + 1, capped at 32. */
|
|
3446
|
+
unloadRadius?: number;
|
|
3447
|
+
}
|
|
3448
|
+
/**
|
|
3449
|
+
* Loads nearby chunk columns in distance order and unloads distant columns.
|
|
3450
|
+
* Updates coalesce to the latest center and serialize world mutations. Use a dedicated world:
|
|
3451
|
+
* the streamer replaces columns it loads, and callers must await disposal before editing that world.
|
|
3452
|
+
* The source remains caller-owned. Lighting, biome tint, and LOD are not added by streaming.
|
|
3453
|
+
*/
|
|
3454
|
+
declare class WorldStreamer {
|
|
3455
|
+
private readonly world;
|
|
3456
|
+
private readonly source;
|
|
3457
|
+
private readonly loadRadius;
|
|
3458
|
+
private readonly unloadRadius;
|
|
3459
|
+
private readonly loaded;
|
|
3460
|
+
private readonly owned;
|
|
3461
|
+
private readonly missing;
|
|
3462
|
+
private readonly failed;
|
|
3463
|
+
private desired;
|
|
3464
|
+
private center?;
|
|
3465
|
+
private loading?;
|
|
3466
|
+
private running?;
|
|
3467
|
+
private disposal?;
|
|
3468
|
+
private disposed;
|
|
3469
|
+
constructor(world: Pick<MineRenderWorld<boolean>, "placeChunk" | "unloadChunkColumn">, source: WorldChunkSource, options?: WorldStreamerOptions);
|
|
3470
|
+
/** Returns absolute coordinates of successfully placed columns, including retained columns. */
|
|
3471
|
+
get loadedChunks(): readonly {
|
|
3472
|
+
x: number;
|
|
3473
|
+
z: number;
|
|
3474
|
+
}[];
|
|
3475
|
+
/** Returns source failures retained within the unload radius. Failed columns do not block other loads. */
|
|
3476
|
+
get failedChunks(): readonly {
|
|
3477
|
+
x: number;
|
|
3478
|
+
z: number;
|
|
3479
|
+
error: unknown;
|
|
3480
|
+
}[];
|
|
3481
|
+
/** Counts desired columns still waiting for a source read or placement, including the active column. */
|
|
3482
|
+
get pendingChunks(): number;
|
|
3483
|
+
/**
|
|
3484
|
+
* Updates the center in absolute chunk coordinates. Repeated calls share the active drain.
|
|
3485
|
+
* Source failures are recorded in failedChunks; other columns continue loading. Missing and failed
|
|
3486
|
+
* columns are remembered within the retention radius. Call retryFailedChunks to retry source failures.
|
|
3487
|
+
* Placement and unload failures reject the drain; call update again to retry those operations.
|
|
3488
|
+
* Reads outside the latest load radius receive an abort signal; placement finishes before unloading.
|
|
3489
|
+
* Sources should represent an unchanged world during streaming.
|
|
3490
|
+
*/
|
|
3491
|
+
update(x: number, z: number): Promise<void>;
|
|
3492
|
+
/** Updates from a camera or view-center position in scene units. One chunk spans 256 scene units. */
|
|
3493
|
+
updatePosition(position: {
|
|
3494
|
+
x: number;
|
|
3495
|
+
z: number;
|
|
3496
|
+
}): Promise<void>;
|
|
3497
|
+
/** Forgets recorded source failures and retries desired columns at the latest center. */
|
|
3498
|
+
retryFailedChunks(): Promise<void>;
|
|
3499
|
+
/** Aborts source reads, waits for active work, then unloads owned columns. The world and source remain caller-owned. */
|
|
3500
|
+
dispose(): Promise<void>;
|
|
3501
|
+
private drain;
|
|
3502
|
+
private needsLoad;
|
|
3503
|
+
private unload;
|
|
3504
|
+
private validateChunk;
|
|
3505
|
+
private within;
|
|
3506
|
+
private key;
|
|
3507
|
+
}
|
|
3508
|
+
|
|
3319
3509
|
/**
|
|
3320
3510
|
* {@link EnvProvider} for headless Node.
|
|
3321
3511
|
*
|
|
@@ -3355,4 +3545,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
3355
3545
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
3356
3546
|
}
|
|
3357
3547
|
|
|
3358
|
-
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, 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, 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, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, type VideoExportOptions, VideoExporter, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, 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, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
|
3548
|
+
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, 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, 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
|
@@ -106,6 +106,8 @@ interface EnvProvider {
|
|
|
106
106
|
/** Read width/height out of encoded image bytes without fully decoding them. */
|
|
107
107
|
imageSize(data: Uint8Array): ImageSizeInfo;
|
|
108
108
|
openCache(name: string, version: number): PersistentCache;
|
|
109
|
+
/** Optional worker support; returns undefined where unavailable. Only the browser ESM build ships worker files. */
|
|
110
|
+
createWorker?(name: "section"): Worker | undefined;
|
|
109
111
|
}
|
|
110
112
|
/**
|
|
111
113
|
* Registry holding the active {@link EnvProvider}.
|
|
@@ -767,6 +769,8 @@ declare function toRadians(degrees: number): number;
|
|
|
767
769
|
declare function toDegrees(radians: number): number;
|
|
768
770
|
/** Resolves after a delay in milliseconds. */
|
|
769
771
|
declare function sleep(timeout: number): Promise<void>;
|
|
772
|
+
/** Yields to the next macrotask without timer clamping when the platform supports it. */
|
|
773
|
+
declare function yieldToEventLoop(): Promise<void>;
|
|
770
774
|
/** Reduces an angle modulo 360, retaining a negative sign for negative inputs. */
|
|
771
775
|
declare function clampRotationDegrees(deg: number): number;
|
|
772
776
|
declare function isVector3(obj: any): obj is Vector3;
|
|
@@ -3112,6 +3116,8 @@ declare class ChunkData {
|
|
|
3112
3116
|
set(index: number, block?: Block): void;
|
|
3113
3117
|
clear(): void;
|
|
3114
3118
|
static isAir(block: Maybe<Block>): boolean;
|
|
3119
|
+
/** Identifies a normalized block type and its sorted properties, excluding per-cell NBT. */
|
|
3120
|
+
static paletteKey(block: Block): string;
|
|
3115
3121
|
private static copyBlock;
|
|
3116
3122
|
private static validateIndex;
|
|
3117
3123
|
}
|
|
@@ -3157,6 +3163,41 @@ declare class AnvilParser {
|
|
|
3157
3163
|
private static unpack;
|
|
3158
3164
|
}
|
|
3159
3165
|
|
|
3166
|
+
/** Loads chunk columns at absolute integer chunk coordinates. */
|
|
3167
|
+
interface WorldChunkSource {
|
|
3168
|
+
/** Returns the requested column, or `undefined` if absent. Honor signal to cancel discarded reads. */
|
|
3169
|
+
getChunk(x: number, z: number, signal?: AbortSignal): Promise<AnvilChunk | undefined>;
|
|
3170
|
+
}
|
|
3171
|
+
|
|
3172
|
+
/**
|
|
3173
|
+
* Reads `r.<x>.<z>.mca` at integer region coordinates, or returns `undefined` when absent.
|
|
3174
|
+
* Forward `signal` to file or network I/O; it aborts when every caller waiting for the region cancels.
|
|
3175
|
+
*/
|
|
3176
|
+
type AnvilRegionReader = (x: number, z: number, signal?: AbortSignal) => Promise<Uint8Array | ArrayBuffer | undefined>;
|
|
3177
|
+
/** Cache limits passed to `new AnvilWorldSource(readRegion, options)`. */
|
|
3178
|
+
interface AnvilWorldSourceOptions {
|
|
3179
|
+
/** Maximum cached regions, including missing regions. Defaults to 4; 0 disables caching. */
|
|
3180
|
+
maxCachedRegions?: number;
|
|
3181
|
+
/** Maximum retained region bytes. Defaults to 64 MiB; larger regions are read without caching. */
|
|
3182
|
+
maxCachedBytes?: number;
|
|
3183
|
+
}
|
|
3184
|
+
/** Reads selected Java Anvil chunk columns and caches raw regions within count and byte limits. */
|
|
3185
|
+
declare class AnvilWorldSource implements WorldChunkSource {
|
|
3186
|
+
private readonly readRegion;
|
|
3187
|
+
private readonly regions;
|
|
3188
|
+
private readonly pending;
|
|
3189
|
+
private readonly maxCachedRegions;
|
|
3190
|
+
private readonly maxCachedBytes;
|
|
3191
|
+
private cachedBytes;
|
|
3192
|
+
constructor(readRegion: AnvilRegionReader, options?: AnvilWorldSourceOptions);
|
|
3193
|
+
/** Decodes one column at absolute chunk coordinates. Aborting a caller leaves other shared readers active. */
|
|
3194
|
+
getChunk(x: number, z: number, signal?: AbortSignal): Promise<AnvilChunk | undefined>;
|
|
3195
|
+
/** Releases cached regions. Reads already in progress finish without repopulating this cache. */
|
|
3196
|
+
clearCache(): void;
|
|
3197
|
+
private getRegion;
|
|
3198
|
+
private cacheRegion;
|
|
3199
|
+
}
|
|
3200
|
+
|
|
3160
3201
|
/** A placed block's data snapshot and optional render object, returned by world and chunk accessors. */
|
|
3161
3202
|
interface BlockInfo<SectionMeshing extends boolean = false> {
|
|
3162
3203
|
/** Detached block data; use world or chunk setters to update stored blocks. */
|
|
@@ -3182,6 +3223,9 @@ declare class SectionMesh extends Group {
|
|
|
3182
3223
|
private readonly ownedMeshes;
|
|
3183
3224
|
/** Builds section-local meshes from visible cube faces. `maxAtlasSize` limits each atlas dimension in pixels. */
|
|
3184
3225
|
static build(entries: readonly SectionMeshEntry[], maxAtlasSize?: number): SectionMesh;
|
|
3226
|
+
/** Builds section-local meshes in a browser worker when available, with synchronous fallback. */
|
|
3227
|
+
static buildAsync(entries: readonly SectionMeshEntry[], maxAtlasSize?: number): Promise<SectionMesh>;
|
|
3228
|
+
private static fromPages;
|
|
3185
3229
|
dispose(): void;
|
|
3186
3230
|
}
|
|
3187
3231
|
|
|
@@ -3215,8 +3259,10 @@ declare class Chunk<SectionMeshing extends boolean = false> {
|
|
|
3215
3259
|
private readonly renderedBlocks;
|
|
3216
3260
|
private readonly sectionBlocks;
|
|
3217
3261
|
private readonly hiddenBlocks;
|
|
3262
|
+
private readonly blockPosition;
|
|
3218
3263
|
private sectionMesh?;
|
|
3219
3264
|
private meshDirty;
|
|
3265
|
+
private meshGeneration;
|
|
3220
3266
|
constructor(scene: MineRenderScene, x: number, y: number, z: number, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined, sectionModels?: SectionModels | undefined);
|
|
3221
3267
|
getBlockAt(x: number, y: number, z: number): Maybe<BlockInfo<SectionMeshing>>;
|
|
3222
3268
|
getBlockAt(pos: Vector3): Maybe<BlockInfo<SectionMeshing>>;
|
|
@@ -3231,12 +3277,24 @@ declare class Chunk<SectionMeshing extends boolean = false> {
|
|
|
3231
3277
|
* Places a block at integer chunk-local coordinates from 0 to 15.
|
|
3232
3278
|
*/
|
|
3233
3279
|
setBlockInChunkAt(pos: Vector3, block?: Block, worldPos?: Vector3, onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined): Promise<Maybe<BlockInfo<SectionMeshing>>>;
|
|
3280
|
+
/** Places cells in input order and returns changed world positions without refreshing neighbors. */
|
|
3281
|
+
placeBlocks(blocks: readonly {
|
|
3282
|
+
index: number;
|
|
3283
|
+
block: Maybe<Block>;
|
|
3284
|
+
}[]): Promise<Vector3[]>;
|
|
3234
3285
|
/** Changes visibility at world block coordinates while preserving the block's data. */
|
|
3235
3286
|
setBlockVisibleAt(pos: Vector3, visible: boolean): Promise<void>;
|
|
3236
3287
|
isBlockVisibleAt(pos: Vector3): boolean;
|
|
3288
|
+
/** Reports whether a cell has a visible render object or section entry. */
|
|
3289
|
+
isBlockVisibleIndex(index: number): boolean;
|
|
3237
3290
|
isOccludingAt(pos: Vector3): boolean;
|
|
3291
|
+
/** Reports whether a visible cell hides neighboring cube faces. */
|
|
3292
|
+
isOccludingIndex(index: number): boolean;
|
|
3238
3293
|
setCullMaskAt(pos: Vector3, mask: number): Promise<void>;
|
|
3239
|
-
|
|
3294
|
+
/** Updates hidden faces for a cell's section entry or individual render object. */
|
|
3295
|
+
setCullMaskIndex(index: number, mask: number): Promise<void>;
|
|
3296
|
+
/** Rebuilds visible section geometry and discards results superseded by another rebuild or clear. */
|
|
3297
|
+
rebuildSectionMesh(): Promise<void>;
|
|
3240
3298
|
/** Removes stored blocks and their render objects, then notifies the owning world of changed positions. */
|
|
3241
3299
|
clear(onBlocksChanged?: ((positions: Vector3[]) => Promise<void>) | undefined): Promise<void>;
|
|
3242
3300
|
dispose(): Promise<void>;
|
|
@@ -3282,11 +3340,12 @@ declare class MineRenderWorld<SectionMeshing extends boolean = false> {
|
|
|
3282
3340
|
* Places a structure's blocks at their stored positions, then refreshes neighboring faces.
|
|
3283
3341
|
* Entity NBT is retained by the structure but is not rendered.
|
|
3284
3342
|
*
|
|
3285
|
-
* @param useBatches -
|
|
3343
|
+
* @param useBatches - Yields between chunks by default. Set to `false` for sequential placement.
|
|
3286
3344
|
* @param executor - Optional queue for batched placement. The caller remains responsible for stopping it.
|
|
3287
3345
|
*/
|
|
3288
3346
|
placeMultiBlock(multiblock: MultiBlockStructure, useBatches?: boolean, executor?: BatchedExecutor): Promise<void>;
|
|
3289
3347
|
private placeBlocks;
|
|
3348
|
+
private placeChunkGroups;
|
|
3290
3349
|
/** Replaces one chunk column's blocks. Entity NBT remains available on the parsed chunk. */
|
|
3291
3350
|
placeChunk(chunk: AnvilChunk, executor?: BatchedExecutor): Promise<void>;
|
|
3292
3351
|
/**
|
|
@@ -3316,6 +3375,137 @@ interface MineRenderWorldOptions<SectionMeshing extends boolean = boolean> {
|
|
|
3316
3375
|
maxAtlasSize?: number;
|
|
3317
3376
|
}
|
|
3318
3377
|
|
|
3378
|
+
/** One cube template with four vertices per face in `CUBE_FACES` order. */
|
|
3379
|
+
interface SectionTemplateData {
|
|
3380
|
+
positions: Float32Array;
|
|
3381
|
+
normals: Float32Array;
|
|
3382
|
+
uvs: Float32Array;
|
|
3383
|
+
uvBounds: Float32Array;
|
|
3384
|
+
colors: Float32Array;
|
|
3385
|
+
indices: Uint16Array;
|
|
3386
|
+
cullFaces: Uint8Array;
|
|
3387
|
+
atlas: number;
|
|
3388
|
+
}
|
|
3389
|
+
/** The pixel dimensions of a template atlas. */
|
|
3390
|
+
interface SectionAtlasSize {
|
|
3391
|
+
width: number;
|
|
3392
|
+
height: number;
|
|
3393
|
+
}
|
|
3394
|
+
/** Section placements and their shared cube templates, ready for geometry building. */
|
|
3395
|
+
interface SectionGeometryInput {
|
|
3396
|
+
count: number;
|
|
3397
|
+
indices: Uint16Array;
|
|
3398
|
+
templates: Uint16Array;
|
|
3399
|
+
cullMasks: Uint8Array;
|
|
3400
|
+
templateData: SectionTemplateData[];
|
|
3401
|
+
atlases: SectionAtlasSize[];
|
|
3402
|
+
maxAtlasSize: number;
|
|
3403
|
+
}
|
|
3404
|
+
/** Merged cube faces and source-atlas placements for one atlas page. */
|
|
3405
|
+
interface SectionGeometryPage {
|
|
3406
|
+
width: number;
|
|
3407
|
+
height: number;
|
|
3408
|
+
placements: {
|
|
3409
|
+
atlas: number;
|
|
3410
|
+
x: number;
|
|
3411
|
+
y: number;
|
|
3412
|
+
}[];
|
|
3413
|
+
positions: Float32Array;
|
|
3414
|
+
normals: Float32Array;
|
|
3415
|
+
uvs: Float32Array;
|
|
3416
|
+
uvBounds: Float32Array;
|
|
3417
|
+
colors: Float32Array;
|
|
3418
|
+
indices: Uint32Array;
|
|
3419
|
+
}
|
|
3420
|
+
/** Builds section-local geometry from visible cube faces, with bounded atlas pages. */
|
|
3421
|
+
declare function buildSectionGeometry(input: SectionGeometryInput): SectionGeometryPage[];
|
|
3422
|
+
/** Returns the buffers behind each page's typed arrays for transfer to another thread. */
|
|
3423
|
+
declare function sectionGeometryTransferables(pages: readonly SectionGeometryPage[]): ArrayBuffer[];
|
|
3424
|
+
|
|
3425
|
+
/** Runs section geometry builds in the environment's shared worker. */
|
|
3426
|
+
declare class SectionWorker {
|
|
3427
|
+
private worker;
|
|
3428
|
+
private static initialized;
|
|
3429
|
+
private static instance;
|
|
3430
|
+
private nextId;
|
|
3431
|
+
private readonly pending;
|
|
3432
|
+
private constructor();
|
|
3433
|
+
/** The shared worker, or undefined when the environment has none or a previous worker failed. */
|
|
3434
|
+
static shared(): SectionWorker | undefined;
|
|
3435
|
+
/** Builds geometry without transferring the input buffers away from the caller. */
|
|
3436
|
+
build(input: SectionGeometryInput): Promise<SectionGeometryPage[]>;
|
|
3437
|
+
/** Rejects pending builds, terminates the worker, and makes shared() return undefined. */
|
|
3438
|
+
terminate(): void;
|
|
3439
|
+
private fail;
|
|
3440
|
+
}
|
|
3441
|
+
|
|
3442
|
+
interface WorldStreamerOptions {
|
|
3443
|
+
/** Loads a square of chunk columns around the center. Integer from 0 to 32; defaults to 2. */
|
|
3444
|
+
loadRadius?: number;
|
|
3445
|
+
/** Retains loaded columns within this radius. Defaults to loadRadius + 1, capped at 32. */
|
|
3446
|
+
unloadRadius?: number;
|
|
3447
|
+
}
|
|
3448
|
+
/**
|
|
3449
|
+
* Loads nearby chunk columns in distance order and unloads distant columns.
|
|
3450
|
+
* Updates coalesce to the latest center and serialize world mutations. Use a dedicated world:
|
|
3451
|
+
* the streamer replaces columns it loads, and callers must await disposal before editing that world.
|
|
3452
|
+
* The source remains caller-owned. Lighting, biome tint, and LOD are not added by streaming.
|
|
3453
|
+
*/
|
|
3454
|
+
declare class WorldStreamer {
|
|
3455
|
+
private readonly world;
|
|
3456
|
+
private readonly source;
|
|
3457
|
+
private readonly loadRadius;
|
|
3458
|
+
private readonly unloadRadius;
|
|
3459
|
+
private readonly loaded;
|
|
3460
|
+
private readonly owned;
|
|
3461
|
+
private readonly missing;
|
|
3462
|
+
private readonly failed;
|
|
3463
|
+
private desired;
|
|
3464
|
+
private center?;
|
|
3465
|
+
private loading?;
|
|
3466
|
+
private running?;
|
|
3467
|
+
private disposal?;
|
|
3468
|
+
private disposed;
|
|
3469
|
+
constructor(world: Pick<MineRenderWorld<boolean>, "placeChunk" | "unloadChunkColumn">, source: WorldChunkSource, options?: WorldStreamerOptions);
|
|
3470
|
+
/** Returns absolute coordinates of successfully placed columns, including retained columns. */
|
|
3471
|
+
get loadedChunks(): readonly {
|
|
3472
|
+
x: number;
|
|
3473
|
+
z: number;
|
|
3474
|
+
}[];
|
|
3475
|
+
/** Returns source failures retained within the unload radius. Failed columns do not block other loads. */
|
|
3476
|
+
get failedChunks(): readonly {
|
|
3477
|
+
x: number;
|
|
3478
|
+
z: number;
|
|
3479
|
+
error: unknown;
|
|
3480
|
+
}[];
|
|
3481
|
+
/** Counts desired columns still waiting for a source read or placement, including the active column. */
|
|
3482
|
+
get pendingChunks(): number;
|
|
3483
|
+
/**
|
|
3484
|
+
* Updates the center in absolute chunk coordinates. Repeated calls share the active drain.
|
|
3485
|
+
* Source failures are recorded in failedChunks; other columns continue loading. Missing and failed
|
|
3486
|
+
* columns are remembered within the retention radius. Call retryFailedChunks to retry source failures.
|
|
3487
|
+
* Placement and unload failures reject the drain; call update again to retry those operations.
|
|
3488
|
+
* Reads outside the latest load radius receive an abort signal; placement finishes before unloading.
|
|
3489
|
+
* Sources should represent an unchanged world during streaming.
|
|
3490
|
+
*/
|
|
3491
|
+
update(x: number, z: number): Promise<void>;
|
|
3492
|
+
/** Updates from a camera or view-center position in scene units. One chunk spans 256 scene units. */
|
|
3493
|
+
updatePosition(position: {
|
|
3494
|
+
x: number;
|
|
3495
|
+
z: number;
|
|
3496
|
+
}): Promise<void>;
|
|
3497
|
+
/** Forgets recorded source failures and retries desired columns at the latest center. */
|
|
3498
|
+
retryFailedChunks(): Promise<void>;
|
|
3499
|
+
/** Aborts source reads, waits for active work, then unloads owned columns. The world and source remain caller-owned. */
|
|
3500
|
+
dispose(): Promise<void>;
|
|
3501
|
+
private drain;
|
|
3502
|
+
private needsLoad;
|
|
3503
|
+
private unload;
|
|
3504
|
+
private validateChunk;
|
|
3505
|
+
private within;
|
|
3506
|
+
private key;
|
|
3507
|
+
}
|
|
3508
|
+
|
|
3319
3509
|
/**
|
|
3320
3510
|
* {@link EnvProvider} for headless Node.
|
|
3321
3511
|
*
|
|
@@ -3355,4 +3545,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
3355
3545
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
3356
3546
|
}
|
|
3357
3547
|
|
|
3358
|
-
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, AnvilParser, type AnvilRegion, 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, 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, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, type VideoExportOptions, VideoExporter, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, 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, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas };
|
|
3548
|
+
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, 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, 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 };
|