Skip to content

Class: WorldStreamer ​

Defined in: packages/minerender/src/world/WorldStreamer.ts:35

Loads nearby chunk columns in distance order and unloads distant columns. Updates coalesce to the latest center and serialize world mutations. Use a dedicated world: the streamer replaces columns it loads, and callers must await disposal before editing that world. The source remains caller-owned. Lighting, biome tint, and LOD are not added by streaming.

Constructors ​

Constructor ​

ts
new WorldStreamer(
   world, 
   source, 
   options?
): WorldStreamer;

Defined in: packages/minerender/src/world/WorldStreamer.ts:50

Parameters ​

ParameterType
worldPick<MineRenderWorld<boolean>, "placeChunk" | "unloadChunkColumns"> & Partial<Pick<MineRenderWorld<boolean>, "placeChunks">>
sourceWorldChunkSource
optionsWorldStreamerOptions

Returns ​

WorldStreamer

Accessors ​

failedChunks ​

Get Signature ​

ts
get failedChunks(): readonly object[];

Defined in: packages/minerender/src/world/WorldStreamer.ts:70

Returns source failures retained within the unload radius. Failed columns do not block other loads.

Returns ​

readonly object[]


loadedChunks ​

Get Signature ​

ts
get loadedChunks(): readonly object[];

Defined in: packages/minerender/src/world/WorldStreamer.ts:65

Returns absolute coordinates of successfully placed columns, including retained columns.

Returns ​

readonly object[]


pendingChunks ​

Get Signature ​

ts
get pendingChunks(): number;

Defined in: packages/minerender/src/world/WorldStreamer.ts:75

Counts desired columns still waiting for a source read or placement, including the active column.

Returns ​

number

Methods ​

dispose() ​

ts
dispose(): Promise<void>;

Defined in: packages/minerender/src/world/WorldStreamer.ts:129

Aborts source reads, waits for active work, then unloads owned columns. The world and source remain caller-owned.

Returns ​

Promise<void>


retryFailedChunks() ​

ts
retryFailedChunks(): Promise<void>;

Defined in: packages/minerender/src/world/WorldStreamer.ts:122

Forgets recorded source failures and retries desired columns at the latest center.

Returns ​

Promise<void>


update() ​

ts
update(x, z): Promise<void>;

Defined in: packages/minerender/src/world/WorldStreamer.ts:87

Updates the center in absolute chunk coordinates. Repeated calls share the active drain. Source failures are recorded in failedChunks; other columns continue loading. Missing and failed columns are remembered within the retention radius. Call retryFailedChunks to retry source failures. Placement and unload failures reject the drain; call update again to retry those operations. Reads outside the latest load radius receive an abort signal; placement finishes before unloading. Sources should represent an unchanged world during streaming.

Parameters ​

ParameterType
xnumber
znumber

Returns ​

Promise<void>


updatePosition() ​

ts
updatePosition(position): Promise<void>;

Defined in: packages/minerender/src/world/WorldStreamer.ts:116

Updates from a camera or view-center position in scene units. One chunk spans 256 scene units.

Parameters ​

ParameterType
position{ x: number; z: number; }
position.xnumber
position.znumber

Returns ​

Promise<void>