Skip to main content

@voxelize/core

Enumerations

Core Classes

Effects Classes

Other Classes

Utils Classes

Interfaces

Type Aliases

ArgMetadata

Ƭ ArgMetadata: Object

Metadata extracted from a Zod schema for UI purposes.

Type declaration

NameType
defaultValue?string | number | boolean
namestring
options?string[]
requiredboolean
tabComplete?(currentValue: string, context: TabCompleteContext) => string[]
type"string" | "number" | "enum" | "boolean"

ArmOptions

Ƭ ArmOptions: Object

Type declaration

NameType
armColor?string | THREE.Color
armObject?THREE.Object3D
armObjectOptionsArmObjectOptions
armTexture?THREE.Texture
blockObjectOptions?ArmObjectOptions
customObjectOptions?Record<string, ArmObjectOptions>
minOccluderDepth?number
receiveHeldObjectShadows?boolean
receiveShadows?boolean

ArmsOptions

Ƭ ArmsOptions: ColorCanvasBoxOptions & { shoulderDrop?: number ; shoulderGap?: number }

Parameters to create a character's arms. Defaults to:

{
gap: 0.1 * CHARACTER_SCALE,
layers: 1,
side: THREE.DoubleSide,
width: 0.25 * CHARACTER_SCALE,
widthSegments: 8,
height: 0.5 * CHARACTER_SCALE,
heightSegments: 16,
depth: 0.25 * CHARACTER_SCALE,
depthSegments: 8,
shoulderGap: 0.05 * CHARACTER_SCALE,
shoulderDrop: 0.25 * CHARACTER_SCALE,
}

ArrowOptions

Ƭ ArrowOptions: Object

Parameters to create an arrow.

Type declaration

NameTypeDescription
colorstring | ColorThe color of the arrow. Defaults to red.
coneHeightnumberThe height of the head of the arrow. Defaults to 0.2.
coneRadiusnumberThe radius of the head of the arrow. Defaults to 0.2.
heightnumberThe height of the body of the arrow. Defaults to 0.8.
radiusnumberThe radius of the body of the arrow. Defaults to 0.1.

ArtFunction

Ƭ ArtFunction: (context: CanvasRenderingContext2D, canvas: HTMLCanvasElement) => void

A function to programmatically draw on a canvas.

Type declaration

▸ (context, canvas): void

Parameters
NameType
contextCanvasRenderingContext2D
canvasHTMLCanvasElement
Returns

void


Block

Ƭ Block: Object

A block type in the world. This is defined by the server.

Type declaration

NameTypeDescription
aabbsAABB[]A list of axis-aligned bounding boxes that this block has.
blueLightLevelnumberThe blue light level of the block.
dynamicFn(pos: Coords3) => { aabbs: Block["aabbs"] ; faces: Block["faces"] ; isTransparent: Block["isTransparent"] }-
dynamicPatternsBlockDynamicPattern[]-
faces{ corners: { pos: [number, number, number] ; uv: number[] }[] ; dir: [number, number, number] ; independent: boolean ; isolated: boolean ; name: string ; range: UV ; textureGroup: string | null }[]A list of block face data that this block has.
fluidFlowForcenumberThe force applied to entities in this fluid, pushing them in the flow direction.
greenLightLevelnumberThe green light level of the block.
groundFrictionMultipliernumberMultiplier applied to entity ground friction while standing on this block. 1 is normal grip; lower values are slipperier.
idnumberThe block id.
independentFacesSet<string>A set of block face names that are independent (high resolution or animated). This is generated on the client side.
isClimbablebooleanWhether or not can entities climb this block.
isDynamicbooleanWhether or not does the block generate dynamic faces or AABB's. If this is true, the block will use dynamicFn to generate the faces and AABB's.
isEmptybooleanWhether or not is this block empty. By default, only "air" is empty.
isEntityboolean-
isFluidbooleanWhether or not is the block a fluid block.
isLightbooleanWhether or not is this block a light source.
isOpaquebooleanWhether or not is this block opaque (not transparent).
isPassablebooleanWhether or not should physics ignore this block.
isPlantbooleanWhether this block is plant decoration — a grass tuft, a flower, a crop. The mesher uses it to jitter diagonal faces; the renderer uses it to decide what WorldClientOptions.plantDetailDistance may stop drawing.
isSeeThroughbooleanWhether or not is this block see-through (can be opaque and see-through at the same time).
isTransparent[boolean, boolean, boolean, boolean, boolean, boolean]Whether or not is this block transparent viewing from all six sides. The sides are defined as PX, PY, PZ, NX, NY, NZ.
isWaterloggablebooleanWhether this block can hold the world's waterlogging fluid alongside itself. Whether a given voxel actually does is per-voxel state, read with World.getVoxelWaterloggedAt.
isWaterloggingFluidbooleanWhether this is the fluid that waterlogging fills voxels with.
isolatedFacesSet<string>-
lightAttenuationnumberOptical density for Beer-Lambert light transmission through this block. 0 keeps normal air rules. 1 is leaves-scale. 2 is water-scale.
namestringThe name of the block.
redLightLevelnumberThe red light level of the block.
rotatablebooleanWhether or not is the block rotatable.
transparentStandaloneboolean-
yRotatablebooleanWhether or not the block is rotatable around the y-axis (has to face either PX or NX).
yRotatableSegments"All" | "Eight" | "Four"-

BlockEntityUpdateData

Ƭ BlockEntityUpdateData<T>: Object

Type parameters

Name
T

Type declaration

NameType
etypestring
idstring
newValueT | null
oldValueT | null
operationEntityOperation
voxelCoords3

BlockEntityUpdateListener

Ƭ BlockEntityUpdateListener<T>: (args: BlockEntityUpdateData<T>) => void

Type parameters

Name
T

Type declaration

▸ (args): void

Parameters
NameType
argsBlockEntityUpdateData<T>
Returns

void


BlockRule

Ƭ BlockRule: { type: "none" } | { type: "simple" } & BlockSimpleRule | { logic: BlockRuleLogic ; rules: BlockRule[] ; type: "combination" }


BlockSimpleRule

Ƭ BlockSimpleRule: Object

Type declaration

NameType
id?number
offsetCoords3
rotation?BlockRotation | SerializedBlockRotation
stage?number

BlockUpdate

Ƭ BlockUpdate: Object

A block update to make on the server.

Type declaration

NameTypeDescription
isWaterlogged?booleanWhether the updated voxel holds the world's waterlogging fluid alongside its block.
rotation?numberThe optional rotation of the updated block.
stage?numberThe optional stage of the updated block.
typenumberThe voxel type.
vxnumberThe voxel x-coordinate.
vynumberThe voxel y-coordinate.
vznumberThe voxel z-coordinate.
waterlogLevel?numberThe level of the waterlogging fluid the updated voxel holds, 0 through 7.
yRotation?numberThe optional y-rotation of the updated block.

BlockUpdateListener

Ƭ BlockUpdateListener: (args: { newValue: number ; oldValue: number ; source: "client" | "server" ; voxel: Coords3 }) => void

Type declaration

▸ (args): void

Parameters
NameType
argsObject
args.newValuenumber
args.oldValuenumber
args.source"client" | "server"
args.voxelCoords3
Returns

void


BlockUpdateWithSource

Ƭ BlockUpdateWithSource: Object

Type declaration

NameType
source"client" | "server"
updateBlockUpdate

BodyOptions

Ƭ BodyOptions: ColorCanvasBoxOptions

Parameters to create a character's body. Defaults to:

{
gap: 0.1 * CHARACTER_SCALE,
layers: 1,
side: THREE.DoubleSide,
width: 1 * CHARACTER_SCALE,
widthSegments: 16,
}

where CHARACTER_SCALE is 0.9.


BoundingBox

Ƭ BoundingBox: Object

Type declaration

NameType
minCoords3
shapeCoords3

BoxSides

Ƭ BoxSides: "back" | "front" | "top" | "bottom" | "left" | "right" | "sides" | "all"

The sides of a canvas box.

"all" means all six sides, and "sides" means all the sides except the top and bottom.


CSSMeasurement

Ƭ CSSMeasurement: `${number}${string}`

A CSS measurement. E.g. "30px", "51em"


CameraPerspective

Ƭ CameraPerspective: "px" | "nx" | "py" | "ny" | "pz" | "nz" | "pxy" | "nxy" | "pxz" | "nxz" | "pyz" | "nyz" | "pxyz" | "nxyz"


CanvasBoxOptions

Ƭ CanvasBoxOptions: Object

Parameters to create a canvas box.

Type declaration

NameTypeDescription
depth?numberThe depth of the box. Defaults to whatever width is.
depthSegments?numberThe depth segments of the box, which is the number of pixels of the canvases along the depth. Defaults to whatever widthSegments is.
gapnumberThe gap between the layers of the box. Defaults to 0.
height?numberThe height of the box. Defaults to whatever width is.
heightSegments?numberThe height segments of the box, which is the number of pixels of the canvases along the height. Defaults to whatever widthSegments is.
layersnumberThe number of layers of this box. Defaults to 1.
receiveShadows?booleanWhether this canvas box should receive shadows. Defaults to false.
sideSideThe side of the box to render. Defaults to THREE.FrontSide.
transparent?booleanWhether or not should this canvas box be rendered as transparent. Defaults to false.
underwaterFog?booleanWhether this canvas box tints toward the ambient water color while the camera is submerged, matching the underwater look of instanced entities. Defaults to false.
widthnumberTHe width of the box. Defaults to 1.
widthSegmentsnumberThe width segments of the box, which is the number of pixels of the canvases along the width. Defaults to 8.

CharacterOptions

Ƭ CharacterOptions: Object

Parameters to create a character.

Type declaration

NameTypeDescription
arms?Partial<ArmsOptions>Parameters to create the character's arms.
body?Partial<BodyOptions>Parameters to create the character's body.
head?Partial<HeadOptions>Parameters to create the character's head.
idleArmSwing?numberThe speed at which the arms swing when the character is idle. Defaults to 0.06.
legs?Partial<LegOptions>Parameters to create the character's legs.
nameTagOptions?Partial<NameTagOptions>-
positionLerp?numberThe lerp factor of the character's position change, expressed per frame at 60 FPS and renormalized to the real frame delta. Defaults to 0.7.
receiveShadows?booleanWhether this character should receive shadows. Defaults to false.
rotationLerp?numberThe lerp factor of the character's rotation change, expressed per frame at 60 FPS and renormalized to the real frame delta. Defaults to 0.2.
swimEnterLerp?numberLerp factor when entering the swimming pose. Defaults to 0.12.
swimExitLerp?numberLerp factor when exiting the swimming pose. Defaults to 0.05.
swimmingSpeed?numberThe speed at which the arms stroke when the character is swimming. Defaults to 1.8.
swingLerp?numberThe lerp factor of the swinging motion of the arms and legs. Defaults to 0.8.
walkingSpeed?numberThe speed at which the arms swing when the character is moving. Defaults to 1.4.

ChunkDataEventData

Ƭ ChunkDataEventData: Object

Type declaration

NameType
chunkChunk
coordsCoords2

ChunkEventData

Ƭ ChunkEventData: Object

Type declaration

NameType
allMeshesMap<number, Mesh[]>
chunkChunk
coordsCoords2

ChunkMeshEventData

Ƭ ChunkMeshEventData: Object

Type declaration

NameType
chunkChunk
coordsCoords2
levelnumber
meshesMesh[]

ChunkMeshUpdateEventData

Ƭ ChunkMeshUpdateEventData: ChunkMeshEventData & { reason: ChunkUpdateReason }


ChunkRegionArenasOptions

Ƭ ChunkRegionArenasOptions: Object

Tunables for the per-region BatchedMesh arenas that batch every shared-opaque chunk section into one multi-draw call per region.

Type declaration

NameTypeDescription
growthFactornumberFactor a full arena's capacity is multiplied by when it grows. Growth re-uploads the region's buffers, so it should be rare: geometric growth bounds the number of growth events logarithmically.
indexPerVertexRationumberIndex capacity per vertex of capacity. Quad geometry uses six indices for every four vertices, hence the 1.5 default.
initialVertexCapacitynumberVertex capacity a region arena is created with. Arenas grow geometrically from here, so this is a floor, not a limit.
regionSizeInChunksnumberThe width and depth of a region, in chunk columns. Every section whose chunk falls inside the same region shares one BatchedMesh.
slotSlacknumberMultiplier applied to a section's vertex/index count when reserving its arena slot, so small remeshes update in place instead of reallocating.

ChunkRequestCandidate

Ƭ ChunkRequestCandidate: Object

Type declaration

NameType
cxnumber
cznumber
distanceSquarednumber
isInViewboolean

ChunkSharedPoolStats

Ƭ ChunkSharedPoolStats: Object

Type declaration

NameType
bytesAllocatednumber
isActiveboolean
maxSlotsnumber
usedSlotsnumber

ChunkStage

Ƭ ChunkStage: { requestedAt: number ; stage: "requested" } | { data: ChunkProtocol ; source: "update" | "load" ; stage: "processing" } | { chunk: Chunk ; stage: "loaded" }


ChunkUpdateEventData

Ƭ ChunkUpdateEventData: ChunkEventData & { reason: ChunkUpdateReason }


ChunkUpdateReason

Ƭ ChunkUpdateReason: "voxel" | "light"


ClickOccasion

Ƭ ClickOccasion: "mousedown" | "mouseup"

The occasion a mouse click listener fires on. Mirrors InputOccasion for the keyboard: press and release are separate lanes, so a listener can tell a tap from a hold.


ClickType

Ƭ ClickType: "left" | "middle" | "right"

Three types of clicking for mouse input listening.


CloudsOptions

Ƭ CloudsOptions: Object

Parameters used to create a new Clouds instance.

Type declaration

NameTypeDescription
alphanumberThe opacity of the clouds. Defaults to 0.8.
bottomShadenumberBrightness of the underside of a cloud block relative to its top, 0..1. Defaults to 0.7.
cloudHeightnumberThe y-height at which the clouds are generated. Defaults to 256.
colorstringThe color of the clouds. Defaults to #fff.
countnumberThe horizontal count of how many cloud blocks are along each edge of a cloud cell, count * count per cell. Defaults to 16. The whole cloud sheet therefore spans width * count * dimensions[0] blocks: it is width, not this, that adds cells.
dimensionsCoords3The dimension of each cloud block. Defaults to [20, 20, 20].
endFadeFarRationumber-
endFadeNearRationumber-
falloffnumberThe noise falloff factor used to generate the clouds. Defaults to 0.9.
heightnumberThe vertical count of how many cloud blocks are in a cloud cell. This is also used to determine the overall count of cloud blocks of all the clouds. Defaults to 3.
lerpFactornumberThe lerp factor used to translate cloud blocks from their original position to their new position. Defaults to 0.3.
noiseScalenumberThe scale of the noise used to generate the clouds. Defaults to 0.08.
octavesnumberThe number of octaves used to generate the noise. Defaults to 5.
seednumberThe seed used to generate the clouds. Defaults to -1.
sideShadenumberBrightness of the vertical faces of a cloud block relative to its top, 0..1. Defaults to 0.86.
speedFactornumberThe speed at which the clouds move. Defaults to 8.
sunTintnumberExtra brightness given to faces pointing at the sun, as a fraction. Defaults to 0.12.
thresholdnumberThe threshold at which noise values are considered to be "cloudy" and should generate a new cloud block. Defaults to 0.05.
uCameraSubmersion?ShaderUniform<number>-
uCameraWaterPlaneY?ShaderUniform<number>-
uCloudEndFadeFar?ShaderUniform<number>-
uCloudEndFadeNear?ShaderUniform<number>-
uCloudFogDistanceScale?ShaderUniform<number>-
uFogColor?ShaderUniform<Color>An object that is used as the uniform for the clouds fog color shader.
uFogFar?ShaderUniform<number>An object that is used as the uniform for the clouds fog far shader.
uFogHeightDensity?ShaderUniform<number>-
uFogHeightOrigin?ShaderUniform<number>-
uFogNear?ShaderUniform<number>An object that is used as the uniform for the clouds fog near shader.
uSkyFogBottomColor?ShaderUniform<Color>-
uSkyFogDimension?ShaderUniform<number>-
uSkyFogExponent?ShaderUniform<number>-
uSkyFogExponent2?ShaderUniform<number>-
uSkyFogMiddleColor?ShaderUniform<Color>-
uSkyFogOffset?ShaderUniform<number>-
uSkyFogStrength?ShaderUniform<number>-
uSkyFogTopColor?ShaderUniform<Color>-
uSkyFogVoidOffset?ShaderUniform<number>-
uSunColor?ShaderUniform<Color>-
uSunDirection?ShaderUniform<Vector3>-
uSunlightIntensity?ShaderUniform<number>-
uUnderwaterAmbient?ShaderUniform<Color>-
verticalNoiseScale?numberThe scale of the noise along the vertical axis. Defaults to noiseScale. Raise it above noiseScale for a shallow deck: a handful of layers span almost no noise at the horizontal scale, so every column fills to the same layer and the top comes out perfectly flat.
widthnumberThe number of cloud cells along each axis of the grid, width * width in total. Defaults to 8.

CommandInfo

Ƭ CommandInfo<T>: Object

Information about a command including its processor and documentation.

Type parameters

NameType
Textends ZodObject<Record<string, ZodTypeAny>> = ZodObject<Record<string, never>>

Type declaration

NameType
aliasesstring[]
argsT
category?string
descriptionstring
flagsstring[]
isHiddenboolean
isTabCompletePreFilteredboolean
process(args: z.infer<T>) => void
tabCompletePartial<Record<string, (currentValue: string, context: TabCompleteContext) => string[]>>

CommandOptions

Ƭ CommandOptions<T>: Object

Type parameters

NameType
Textends ZodObject<Record<string, ZodTypeAny>> = ZodObject<Record<string, never>>

Type declaration

NameType
aliases?string[]
args?T
category?string
descriptionstring
flags?string[]
isHidden?boolean
isTabCompletePreFiltered?boolean
tabComplete?Partial<Record<keyof z.infer<T>, (currentValue: string, context: TabCompleteContext) => string[]>>

Coords2

Ƭ Coords2: [number, number]


Coords3

Ƭ Coords3: [number, number, number]


CreatureBodyOptions

Ƭ CreatureBodyOptions: ColorCanvasBoxOptions


CreatureHeadOptions

Ƭ CreatureHeadOptions: ColorCanvasBoxOptions & { faceColor: Color | string ; neckGap?: number }


CreatureLegOptions

Ƭ CreatureLegOptions: ColorCanvasBoxOptions & { betweenLegsGap?: number ; frontBackGap?: number }


CreatureOptions

Ƭ CreatureOptions: Object

Type declaration

NameType
body?Partial<CreatureBodyOptions>
head?Partial<CreatureHeadOptions>
idleLegSwing?number
legs?Partial<CreatureLegOptions>
nameTagOptions?Partial<NameTagOptions>
positionLerp?number
rotationLerp?number
swingLerp?number
walkingSpeed?number

CullOptionsType

Ƭ CullOptionsType: Object

Type declaration

NameType
dimensionsCoords3
maxCoords3
minCoords3
realMaxCoords3
realMinCoords3

CustomChunkShaderMaterial

Ƭ CustomChunkShaderMaterial: ShaderMaterial & { map: Texture }

Custom shader material for chunks, simply a ShaderMaterial from ThreeJS with a map texture. Keep in mind that if you want to change its map, you also have to change its uniforms.map.


DebugOptions

Ƭ DebugOptions: Object

Type declaration

NameType
asyncPeriod?number
containerId?string
dataClass?string
dataStyles?StyleDecl
entriesClass?string
entriesStyles?StyleDecl
lineClass?string
lineStyles?StyleDecl
newLineStyles?StyleDecl
onByDefault?boolean
showVoxelize?boolean
stats?boolean
statsStyles?StyleDecl

DeepPartial

Ƭ DeepPartial<T>: { [P in keyof T]?: DeepPartial<T[P]> }

Type parameters

Name
T

EntitiesOptions

Ƭ EntitiesOptions: Object

Type declaration

NameTypeDescription
stalenessTimeoutSecondsnumberSeconds an entity may go without any server message before it is considered lost and released. Covers dropped out-of-range and delete notifications so no entity can stay frozen forever.
streamSilenceGraceSecondsnumberSeconds of total message silence after which staleness releases are suspended, so reconnects and tab suspensions do not purge live entities.

EntityLivenessOptions

Ƭ EntityLivenessOptions: Object

Type declaration

NameTypeDescription
stalenessTimeoutSecondsnumberSeconds an entity may go without any message before it is considered lost and released. The server keep-alive cadence is roughly one second, so this should comfortably exceed several missed keep-alives.
streamSilenceGraceSecondsnumberSeconds of total message silence after which staleness judgment is suspended. A quiet stream means the connection itself is degraded (disconnect, tab suspension), not that individual entities were lost.

EntityMetadata

Ƭ EntityMetadata: Object

Type declaration

NameType
rigidBody?EntityRigidBodyMetadata

EntityRigidBodyMetadata

Ƭ EntityRigidBodyMetadata: Object

Type declaration

NameType
fluidRationumber
isInFluidboolean

Event

Ƭ Event: Object

A Voxelize event from the server.

Type declaration

NameTypeDescription
namestringThe name to identify the event.
payload?EventPayloadAdditional information of the event.

EventHandler

Ƭ EventHandler<TPayload>: (payload: TPayload) => void

The handler for an event sent from the Voxelize server.

Type parameters

NameType
TPayloadEventPayload

Type declaration

▸ (payload): void

Parameters
NameType
payloadTPayload
Returns

void


EventPayload

Ƭ EventPayload: JsonPrimitive | { [key: string]: EventPayload | undefined; } | EventPayload[]


FindSimilarOptions

Ƭ FindSimilarOptions: Object

Type declaration

NameType
maxSuggestions?number

FluidQuery

Ƭ FluidQuery: (vx: number, vy: number, vz: number) => boolean

Type declaration

▸ (vx, vy, vz): boolean

Parameters
NameType
vxnumber
vynumber
vznumber
Returns

boolean


FormatSuggestionOptions

Ƭ FormatSuggestionOptions: Object

Type declaration

NameType
maxFallbackItems?number

HeadOptions

Ƭ HeadOptions: ColorCanvasBoxOptions & { faceColor: Color | string ; neckGap?: number }


HeapReader

Ƭ HeapReader: () => HeapSample | null

Reads the current heap, or returns null when the engine exposes no heap numbers at all (every non-Chromium browser).

Type declaration

▸ (): HeapSample | null

Returns

HeapSample | null


HeapSample

Ƭ HeapSample: Object

A single reading of the renderer's JavaScript heap.

Type declaration

NameType
limitBytesnumber
usedBytesnumber

ImageResolver

Ƭ ImageResolver: (name: string) => string

Type declaration

▸ (name): string

Parameters
NameType
namestring
Returns

string


InputOccasion

Ƭ InputOccasion: "keydown" | "keypress" | "keyup"

The occasion that the input should be fired.


InputSpecifics

Ƭ InputSpecifics: Object

The specific options of the key to listen to.

Type declaration

NameTypeDescription
checkType?"key" | "code"The type of key to check for. Defaults to key.
identifier?stringA special identifier to tag this input with. This is useful for removing specific inputs from the input listener later on.
occasion?InputOccasionThe occasion that the input should be fired. Defaults to keydown.

ItemRendererFactory

Ƭ ItemRendererFactory: (itemDef: ItemDef, world: World) => ItemRenderer

Type declaration

▸ (itemDef, world): ItemRenderer

Parameters
NameType
itemDefItemDef
worldWorld
Returns

ItemRenderer


ItemSlotsOptions

Ƭ ItemSlotsOptions: Object

Type declaration

NameType
activatedByDefaultboolean
focusFirstByDefaultboolean
horizontalCountnumber
perspectiveCameraPerspective
scrollable?boolean
slotClassstring
slotFocusClassstring
slotGapnumber
slotHeightnumber
slotHoverClassstring
slotMarginnumber
slotPaddingnumber
slotStylesPartial<CSSStyleDeclaration>
slotSubscriptClassstring
slotSubscriptStylesPartial<CSSStyleDeclaration>
slotWidthnumber
verticalCountnumber
wrapperClassstring
wrapperPaddingnumber
wrapperStylesPartial<CSSStyleDeclaration>
zoomnumber

LegOptions

Ƭ LegOptions: ColorCanvasBoxOptions & { betweenLegsGap?: number }

Parameters to create the legs of a character. Defaults to:

{
gap: 0.1 * CHARACTER_SCALE,
layers: 1,
side: THREE.DoubleSide,
width: 0.25 * CHARACTER_SCALE,
widthSegments: 3,
height: 0.25 * CHARACTER_SCALE,
heightSegments: 3,
depth: 0.25 * CHARACTER_SCALE,
depthSegments: 3,
betweenLegsGap: 0.2 * CHARACTER_SCALE,
}

where CHARACTER_SCALE is 0.9.


LightBatch

Ƭ LightBatch: Object

Type declaration

NameTypeDescription
batchIdnumber-
completedJobsnumber-
jobsLightJob[]-
pendingDispatchLightJob[]Jobs of this batch that have not been handed to a worker yet. Dispatch serializes every chunk the job's bounding box covers, so jobs wait here as cheap descriptors instead of as multi-megabyte copies.
resultsLightBatchResult[]-
startSequenceIdnumber-
totalJobsnumber-

LightBatchResult

Ƭ LightBatchResult: Object

Type declaration

NameType
boundingBoxBoundingBox
colorLightColor
modifiedChunksLightWorkerModifiedChunk[]

LightColor

Ƭ LightColor: "RED" | "GREEN" | "BLUE" | "SUNLIGHT"

Sunlight or the color of torch light.


LightConeInput

Ƭ LightConeInput: Object

Type declaration

NameTypeDescription
angleDegnumberFull outer cone angle in degrees.
colorColor-
directionVector3-
innerRationumberInner (full-brightness) cone angle as a fraction of the outer angle.
intensitynumber-
originVector3-
rangenumber-
scatterStrengthnumber-
submersionnumber0 above water to 1 submerged; drives extinction and beam glow.

LightConeUniformBinding

Ƭ LightConeUniformBinding: LightConeUniforms[keyof LightConeUniforms]


LightConeUniforms

Ƭ LightConeUniforms: Object

Type declaration

NameType
coneColors{ value: Color[] }
coneColors.valueColor[]
coneCount{ value: number }
coneCount.valuenumber
coneDirections{ value: Vector3[] }
coneDirections.valueVector3[]
coneOrigins{ value: Vector4[] }
coneOrigins.valueVector4[]
coneShapes{ value: Vector4[] }
coneShapes.valueVector4[]

LightJob

Ƭ LightJob: Object

Type declaration

NameType
batchIdnumber
boundingBoxBoundingBox
colorLightColor
jobIdstring
lightOps{ floods: LightNode[] ; removals: Coords3[] }
lightOps.floodsLightNode[]
lightOps.removalsCoords3[]
retryCountnumber
startSequenceIdnumber

LightNode

Ƭ LightNode: Object

Type declaration

NameType
levelnumber
voxelCoords3

LightOperations

Ƭ LightOperations: Object

Type declaration

NameType
floods{ blue: LightNode[] ; green: LightNode[] ; red: LightNode[] ; sunlight: LightNode[] }
floods.blueLightNode[]
floods.greenLightNode[]
floods.redLightNode[]
floods.sunlightLightNode[]
hasOperationsboolean
removals{ blue: Coords3[] ; green: Coords3[] ; red: Coords3[] ; sunlight: Coords3[] }
removals.blueCoords3[]
removals.greenCoords3[]
removals.redCoords3[]
removals.sunlightCoords3[]

LightShinedOptions

Ƭ LightShinedOptions: Object

Type declaration

NameTypeDescription
lerpFactornumberThe lerping factor of the brightness of each mesh. Defaults to 0.1.
maxBrightnessnumberThe maximum brightness cap for the light effect. Defaults to 2.5.

LightWorkerModifiedChunk

Ƭ LightWorkerModifiedChunk: Object

Type declaration

NameType
coordsCoords2
lightsUint32Array
maxYnumber
minYnumber

LightWorkerResult

Ƭ LightWorkerResult: Object

Type declaration

NameType
appliedDeltas{ lastSequenceId: number }
appliedDeltas.lastSequenceIdnumber
jobIdstring
modifiedChunksLightWorkerModifiedChunk[]

MemoryPressureOptions

Ƭ MemoryPressureOptions: Object

Type declaration

NameTypeDescription
recoveryHeapRationumberRatio at or below which pressure is considered relieved. Kept under MemoryPressureOptions.sheddingHeapRatio so the monitor has hysteresis instead of flapping around a single threshold.
sampleIntervalMsnumberMilliseconds between heap samples. Zero or less disables the watchdog.
shedCooldownMsnumberMinimum milliseconds between two shed actions while pressure persists.
sheddingHeapRationumberusedJSHeapSize / jsHeapSizeLimit at or above which the renderer is treated as under pressure and load shedding begins. A worker that runs out of V8 heap takes the whole renderer process down with it, so this sits well below the limit rather than near it.
sheddingSampleCountnumberConsecutive over-threshold samples required before shedding engages, so one transient spike (a large chunk batch mid-flight) does not throw away work that was about to be collected anyway.

MemoryPressureStatus

Ƭ MemoryPressureStatus: Object

Type declaration

NameTypeDescription
heapLimitBytesnumber-
heapRationumber-
heapUsedBytesnumber-
isHeapReadablebooleanFalse on engines that expose no heap numbers; the monitor stays inert.
isUnderPressureboolean-
shedCountnumber-

MemoryPressureVerdict

Ƭ MemoryPressureVerdict: "steady" | "shed" | "relieved"

What a sample concluded: shed asks the owner to drop load now, relieved says pressure is over, steady means do nothing.


MeshApplyStats

Ƭ MeshApplyStats: Object

Cumulative cost of turning finished mesh results into live scene geometry (buildChunkMesh), the main-thread half of every remesh. bytes counts the geometry attribute payload applied, which is what the GPU upload scales with. Cumulative since world init so a caller can difference two reads.

Type declaration

NameType
bytesnumber
countnumber
maxMsnumber
totalMsnumber

MeshResultType

Ƭ MeshResultType: Object

Type declaration

NameType
indicesFloat32Array
normalsFloat32Array
positionsFloat32Array

MeshTransferBenchmarkIteration

Ƭ MeshTransferBenchmarkIteration: Object

Type declaration

NameType
inputBytesnumber
outputBytesnumber
serializeMsnumber
totalMsnumber
workerMsnumber

MeshTransferBenchmarkModeResult

Ƭ MeshTransferBenchmarkModeResult: Object

Type declaration

NameType
avgSerializeMsnumber
avgTotalMsnumber
avgWorkerMsnumber
isSharedArrayBufferAvailableboolean
iterationsMeshTransferBenchmarkIteration[]
measuredIterationsnumber
p50TotalMsnumber
p95TotalMsnumber
strategyWorkerTransferStrategy
totalInputBytesnumber
totalOutputBytesnumber
warmupIterationsnumber

MeshTransferBenchmarkOptions

Ƭ MeshTransferBenchmarkOptions: Object

Type declaration

NameType
cxnumber
cznumber
level?number
measuredIterations?number
warmupIterations?number

MeshTransferBenchmarkResult

Ƭ MeshTransferBenchmarkResult: Object

Type declaration

NameType
cxnumber
cznumber
levelnumber
serializeSpeedupnumber
sharedMeshTransferBenchmarkModeResult
speedupnumber
transferMeshTransferBenchmarkModeResult

MeshTransferDispatch

Ƭ MeshTransferDispatch: (cx: number, cz: number, level: number) => Promise<{ geometries: object[] ; inputBytes: number ; outputBytes: number ; serializeMs: number ; workerMs: number } | null>

Type declaration

▸ (cx, cz, level): Promise<{ geometries: object[] ; inputBytes: number ; outputBytes: number ; serializeMs: number ; workerMs: number } | null>

Parameters
NameType
cxnumber
cznumber
levelnumber
Returns

Promise<{ geometries: object[] ; inputBytes: number ; outputBytes: number ; serializeMs: number ; workerMs: number } | null>


MeshWorkerTransferSample

Ƭ MeshWorkerTransferSample: Object

Type declaration

NameType
atnumber
inputBytesnumber
outputBytesnumber
serializeMsnumber
strategyWorkerTransferStrategy
totalMsnumber
workerMsnumber

MeshWorkerTransferStats

Ƭ MeshWorkerTransferStats: Object

Type declaration

NameType
jobCountnumber
recentSamplesMeshWorkerTransferSample[]
strategyWorkerTransferStrategy
totalInputBytesnumber
totalOutputBytesnumber
totalSerializeMsnumber
totalWorkerMsnumber

NameTagOptions

Ƭ NameTagOptions: Object

Parameters to create a name tag.

Type declaration

NameTypeDescription
backgroundColor?stringThe background color of the name tag. Defaults to 0x00000077.
color?stringThe color of the name tag. Defaults to 0xffffff.
fontFace?stringThe font face to create the name tag. Defaults to "monospace".
fontSize?numberThe font size to create the name tag. Defaults to 0.1.
yOffset?numberThe y-offset of the nametag moved upwards. Defaults to 0.

NetworkConnectionOptions

Ƭ NetworkConnectionOptions: Object

Type declaration

NameTypeDescription
reconnectTimeout?numberMilliseconds between reconnection attempts after the socket drops. Defaults to DEFAULT_RECONNECT_TIMEOUT_MS; pass 0 to disable automatic reconnection.
secret?string-
useWebRTC?boolean-

NetworkOptions

Ƭ NetworkOptions: Object

Type declaration

NameTypeDescription
joinRetryTimeoutnumberMilliseconds a (re)join handshake may await its INIT before the join request is sent again.
maxBacklogFactornumber-
maxPacketsPerTicknumber-
maxPendingCommandPacketsnumberUpper bound on command packets (see COMMAND_PACKET_TYPES) held for retry after a send raced a closing socket. Beyond it the oldest are dropped loudly and counted in Network.droppedCommandCount: bounded loss beats unbounded buffering, but a command must never vanish in silence.
maxQueuedPacketsnumberUpper bound on buffered inbound packets. Beyond it the oldest packets are dropped: the interest/keep-alive protocol re-converges on fresh state, so bounded loss beats unbounded memory growth when processing stalls.

PartialRecord

Ƭ PartialRecord<K, T>: { [P in K]?: T }

Type parameters

NameType
Kextends keyof any
TT

PeersOptions

Ƭ PeersOptions: Object

Parameters to customize the peers manager.

Type declaration

NameTypeDescription
autoAddToSelfboolean-
countSelfbooleanWhether or not should the client themselves be counted as "updated". In other words, whether or not should the update function be called on the client's own data. Defaults to false.
updateChildrenbooleanWhether or not should the peers manager automatically call update on any children mesh. Defaults to true.

PerspectiveOptions

Ƭ PerspectiveOptions: Object

Parameters to create a new Perspective instance.

Type declaration

NameTypeDescription
blockMarginnumberThe margin between the camera and any block that the camera is colliding with. This prevents the camera from clipping into blocks. Defaults to 0.3.
ignoreFluidsbooleanWhether or not should the camera ignore fluid block collisions. Defaults to true.
ignoreSeeThroughbooleanWhether or not should the camera ignore see-through block collisions. Defaults to true.
lerpFactornumberThe lerping factor for the camera's position. Defaults to 0.5.
maxDistancenumberThe maximum distance the camera can go from the player's center. Defaults to 5.
swimDistanceBonusnumberExtra camera distance while swimming in second/third person. Defaults to 3.

PortraitOptions

Ƭ PortraitOptions: Object

Parameters to create a portrait with.

Type declaration

NameTypeDescription
heightnumberThe height of the portrait canvas. Defaults to 100 pixels.
lightRotationOffsetnumberThe rotation around the y axis about the camera. This is used to calculate the position of the light. Defaults to -Math.PI / 8.
perspectiveCameraPerspectiveThe position of where the camera should be looking at. Defaults to pxyz, which means that the camera will be looking at the center of the object from the positive x, y, and z axis scaled by the zoom.
renderOncebooleanWhether or not should this portrait only render once. Defaults to false.
widthnumberThe width of the portrait canvas. Defaults to 100 pixels.
zoomnumberThe arbitrary zoom from the camera to the object. This is used to calculate the zoom of the camera. Defaults to 1.

ProcessedUpdate

Ƭ ProcessedUpdate: Object

Type declaration

NameType
newBlockBlock
newIdnumber
newRotationBlockRotation
oldBlockBlock
oldIdnumber
oldRotationBlockRotation
oldStagenumber
stagenumber
voxelCoords3

ProtocolWS

Ƭ ProtocolWS: WebSocket & { sendEvent: (event: any) => boolean }


RigidControlState

Ƭ RigidControlState: Object

The state of which a Voxelize Controls is in.

Type declaration

NameTypeDescription
crouchingbooleanWhether if the client is attempting to crouch, if the crouch key is pressed. Defaults to false.
currentJumpTimenumberThe current amount of time spent in the air from jump. Defaults to 0.
headingnumberIn radians, the heading y-rotation of the client. Defaults to 0.
isJumpingbooleanWhether or not is the client jumping, in the air. Defaults to false.
jumpCountnumberHow many times has the client jumped. Defaults to 0.
jumpingbooleanWhether if the client is attempting to jump, if the jump key is pressed. Defaults to false.
runningbooleanWhether if the client is running. Defaults to false.
sprintingbooleanWhether if the client is attempting to sprint, if the sprint key is pressed. Defaults to false.

RigidControlsOptions

Ƭ RigidControlsOptions: Object

Parameters to initialize the Voxelize Controls.

Type declaration

NameTypeDescription
airJumpsnumberHow many times can a client jump in the air. Defaults to 0.
airMoveMultnumberThe factor applied to the movements of the client in air, such as while half-jump. Defaults to 0.7.
alwaysSprintbooleanSprint factor would be on always. Defaults to false.
bodyDepthnumberThe depth of the client's avatar. Defaults to 0.8 blocks.
bodyHeightnumberThe height of the client's avatar. Defaults to 1.55 blocks.
bodyWidthnumberThe width of the client's avatar. Defaults to 0.8 blocks.
crouchBodyHeightnumberThe height of the client's avatar when crouching. Defaults to bodyHeight * 0.83.
crouchFactornumberThe factor to the movement speed when crouch is applied. Defaults to 0.6.
eyeHeightnumberThe ratio to bodyHeight at which the camera is placed from the ground. Defaults at 0.9193548387096774.
fluidPushForcenumberThe force upwards when a client tries to jump in water. Defaults to 0.3.
flyClimbSpeedPenaltynumberFraction of fly speed lost at a straight-up climb when pitch steering is active, trading speed for altitude. Defaults to 0.
flyDiveSpeedBoostnumberExtra speed multiplier granted at a straight-down dive when pitch steering is active. 1.2 means a vertical dive flies at 2.2x the base fly speed. Scales quadratically with dive steepness. Defaults to 0.
flyForcenumberThe level of force at which a client flies at. Defaults to 80.
flyImpulsenumberThe level impulse of which a client flies at. Defaults to 2.5.
flyInertianumberThe inertia of a client when they're flying. Defaults to 6.
flyPitchSteeringnumberHow much the camera pitch steers fly movement, from 0 (movement stays horizontal) to 1 (movement follows the full look vector, elytra-style). Defaults to 0.
flySpeednumberThe level of speed at which a client flies at. Defaults to 40.
initialDirectionCoords3-
initialPositionCoords3Initial position of the client. Defaults to (0, 80, 10).
jumpForcenumberThe level of force applied to the client when jumping. Defaults to 1.
jumpImpulsenumberThe level of impulse at which the client jumps upwards. Defaults to 8.
jumpTimenumberThe time, in milliseconds, that a client can be jumping. Defaults to 50ms.
maxPolarAnglenumberMaximum polar angle that camera can look up to. Defaults to Math.PI * 0.99
maxSpeednumberThe maximum level of speed of a client. Default is 6 .
minPolarAnglenumberMinimum polar angle that camera can look down to. Defaults to Math.PI * 0.01.
moveForcenumberThe level of force of which the client can move at. Default is 30.
positionLerpnumberThe interpolation factor of the client's position. Defaults to 1.0.
responsivenessnumberThe level of responsiveness of a client to movements. Default is 240.
restoreFootSnapEpsilonnumber-
rotationLerpnumberThe interpolation factor of the client's rotation. Defaults to 0.9.
runningFrictionnumberDefault running friction of a client. Defaults to 0.1.
sensitivitynumberThe mouse sensitivity. Defaults to 100.
sprintFactornumberThe factor to the movement speed when sprint is applied. Defaults to 1.4.
standingFrictionnumberDefault standing friction of a client. Defaults to 4.
stepHeightnumberHow tall a client can step up. Defaults to 0.5.
stepLerpnumberThe interpolation factor when the client is auto-stepping. Defaults to 0.6.
swimAABBLerpnumberLerp factor for the swim hitbox height transition. Defaults to 0.08.
swimBodyHeightnumberCollision height while swimming. Defaults to 0.4.
swimForcenumberForce applied while swimming. Defaults to 28.
swimFrictionnumberFriction while swimming and moving. Defaults to 0.05.
swimIdleStandDelaynumberTime without swim movement input before returning to an upright pose. Defaults to 3000.
swimRestoreGraceFramesnumberFrames to keep the swim AABB after restoring a saved swimming session. Defaults to 2.
swimSpeednumberTarget speed while swimming. Defaults to 4.5.
swimSubmersionRationumberMinimum ratio of the body submerged before swimming mechanics activate. Defaults to 0.95.

SectionExtentOptions

Ƭ SectionExtentOptions: Object

Type declaration

NameType
chunkSizenumber
maxHeightnumber
subChunksnumber

SectionVisibilityGraphOptions

Ƭ SectionVisibilityGraphOptions: Object

Type declaration

NameType
chunkSizenumber
maxHeightnumber
subChunksnumber

SerializedBlockRotation

Ƭ SerializedBlockRotation: { [K in "PX" | "NX" | "PY" | "NY" | "PZ" | "NZ"]?: number }

The wire shape of a block rotation inside server-authored block rules: the Rust BlockRotation enum serializes as a single-key object mapping the axis to the y-rotation angle in radians, e.g. { "PX": 0 }.


SkyOptions

Ƭ SkyOptions: Object

Type declaration

NameTypeDescription
dimensionnumberThe dimension of the dodecahedron sky. The inner canvas box is 0.8 times this dimension.
lerpFactornumberThe lerp factor for the sky gradient. The sky gradient is updated every frame by lerping the current color to the target color. set by the setTopColor, setMiddleColor, and setBottomColor methods.
textureBloomIntensitynumberThe emissive boost applied to painted sky texels above textureBloomThreshold. Defaults to 2.0.
textureBloomThresholdnumberThe luminance at which painted sky textures begin to feed bloom. Defaults to 0.72.
transitionSpannumber-

SkyShadingCycleData

Ƭ SkyShadingCycleData: Object

Type declaration

NameType
color{ bottom: Color | string ; middle: Color | string ; top: Color | string }
color.bottomColor | string
color.middleColor | string
color.topColor | string
namestring
skyOffsetnumber
startnumber
voidOffsetnumber

SlotContent

Ƭ SlotContent: { type: "empty" } | { count: number ; id: number ; type: "block" } | { count: number ; data?: Record<string, unknown> ; id: number ; type: "item" }


SoundEffectEventHandler

Ƭ SoundEffectEventHandler: (payload: SoundEffectEventPayload) => void

Type declaration

▸ (payload): void

Parameters
NameType
payloadSoundEffectEventPayload
Returns

void


SoundEffectEventPayload

Ƭ SoundEffectEventPayload: Object

Type declaration

NameType
idstring
pitch?number
position?[number, number, number]
radius?number
sourceClientId?string
volume?number

TabCompleteContext

Ƭ TabCompleteContext: Object

Options for adding a command.

Type declaration

NameType
argsRecord<string, string>

TargetType

Ƭ TargetType: "All" | "Player" | "Entity"


TextureInfo

Ƭ TextureInfo: Object

Type declaration

NameType
blockIdnumber
blockNamestring
canvasHTMLCanvasElement | null
faceNamestring
materialKeystring
rangeUV | null
type"shared" | "independent" | "isolated"

TransparencyFlags

Ƭ TransparencyFlags: Object

Type declaration

NameType
isFluidboolean
isSeeThroughboolean
lightAttenuationnumber
transparentStandaloneboolean

TransparentSortClassification

Ƭ TransparentSortClassification: "single-plane" | "plane-triggers" | "distance"

How a translucent mesh decides when to re-sort:

  • "single-plane" — every face lies in one plane, so no camera ray can ever hit two faces; the mesh never needs sorting.
  • "plane-triggers" — all faces are axis-aligned quads. A valid painter's order can only change when the camera crosses one of the mesh's distinct face planes, so re-sorts fire on plane crossings instead of distance moved (Sodium's trigger model).
  • "distance" — geometry with non-axis-aligned faces falls back to the original re-sort-every-half-block behavior.

TransparentSortStats

Ƭ TransparentSortStats: Object

Cumulative main-thread cost of per-face translucency sorting across all meshes since page load: how many sorts ran, their total/max milliseconds, and the number of faces pushed through the radix sort. Difference two reads for a window; a camera strafe re-sorts every mesh each time it crosses the movement threshold, which is exactly the cost this exists to expose.

Type declaration

NameType
countnumber
facesnumber
maxMsnumber
totalMsnumber

UV

Ƭ UV: Object

The UV range of a texture on the texture atlas.

Type declaration

NameTypeDescription
endUnumberThe ending U coordinate of the texture.
endVnumberThe ending V coordinate of the texture.
startUnumberThe starting U coordinate of the texture.
startVnumberThe starting V coordinate of the texture.

VoxelDelta

Ƭ VoxelDelta: Object

Type declaration

NameType
coordsCoords3
newRotation?BlockRotation
newStage?number
newVoxelnumber
oldRotation?BlockRotation
oldStage?number
oldVoxelnumber
sequenceIdnumber
timestampnumber

VoxelInteractOptions

Ƭ VoxelInteractOptions: Object

Parameters to customize the VoxelInteract instance.

Type declaration

NameTypeDescription
highlightColorColorThe color of the highlight. Defaults to 0xffffff.
highlightLerpnumberThe lerping factor of the highlight. Defaults to 0.8.
highlightOpacitynumberThe opacity of the highlight. Defaults to 0.8.
highlightScalenumberThe scale of the block highlight. Defaults to 1.002.
highlightType"box" | "outline"The type of the block highlight. Box would be a semi-transparent box, while outline would be 12 lines that outline the block's AABB union. Defaults to "box".
ignoreFluidsbooleanWhether or not should the VoxelInteract instance ignore fluids when raycasting. Defaults to true.
inverseDirectionbooleanWhether or not should the VoxelInteract instance reverse the raycasting direction. Defaults to false.
potentialVisualsbooleanDebug Whether or not should there be arrows indicating the potential block placement's orientations. Defaults to false.
reachDistancenumberThe maximum distance of reach for the VoxelInteract instance. Defaults to 32.

VoxelLightVolumeOptions

Ƭ VoxelLightVolumeOptions: Object

Type declaration

NameType
chunkSizenumber
maxChunk[number, number]
maxHeightnumber
maxLightLevelnumber
minChunk[number, number]

WaterChannelCoefficients

Ƭ WaterChannelCoefficients: Object

Per-channel coefficients for Beer-Lambert water extinction, expressed per block (~meter) of water. All water rendering derives from this one table.

Type declaration

NameType
bluenumber
greennumber
rednumber

WaterColumnSample

Ƭ WaterColumnSample: Object

Type declaration

NameType
depthnumber
surfaceYnumber

WaterOpticsFrameInput

Ƭ WaterOpticsFrameInput: Object

Type declaration

NameType
cameraXnumber
cameraYnumber
cameraZnumber
deltaSecondsnumber
isFluidAtFluidQuery
sunStrengthnumber

WorkerPoolJob

Ƭ WorkerPoolJob: Object

A worker pool job is queued to a worker pool and is executed by a worker.

Type declaration

NameTypeDescription
buffers?Transferable[]Any array buffers (transferable) that are passed to the worker.
messageanyA JSON serializable object that is passed to the worker.
resolve(value: any) => void-
timeoutMs?numberMilliseconds this job may run before its worker is presumed dead. A worker that OOMs mid-job dies without any error event, which used to leave the slot occupied and the job unresolved forever (frozen lighting/meshing). On timeout the worker is replaced and the job resolves null.

WorkerPoolOptions

Ƭ WorkerPoolOptions: Object

Parameters to create a worker pool.

Type declaration

NameTypeDescription
maxQueuedJobs?numberJobs allowed to wait for a free worker before the oldest are shed (resolved null, exactly like a dead worker). Left undefined the queue is unbounded, which is only safe when the caller gates dispatch on WorkerPool.availableCount: every queued job holds its serialized payload alive, so a caller that enqueues faster than workers drain turns the queue into an unbounded allocation. Opt in only from callers that treat a null result as a retryable failure.
maxWorkernumberThe maximum number of workers to create. Defaults to 8.
name?stringThe name prefix for workers in this pool. Workers will be named {name}-0, {name}-1, etc. Shows up in DevTools for debugging.

WorkerTransferConfig

Ƭ WorkerTransferConfig: Object

Type declaration

NameType
maxRecentSamplesnumber
modeWorkerTransferMode

WorkerTransferMode

Ƭ WorkerTransferMode: "auto" | WorkerTransferStrategy


WorkerTransferStrategy

Ƭ WorkerTransferStrategy: "transfer" | "shared"


WorldChunkEvents

Ƭ WorldChunkEvents: Object

Type declaration

NameType
chunk-data-loaded(data: ChunkDataEventData) => void
chunk-loaded(data: ChunkEventData) => void
chunk-mesh-loaded(data: ChunkMeshEventData) => void
chunk-mesh-unloaded(data: ChunkMeshEventData) => void
chunk-mesh-updated(data: ChunkMeshUpdateEventData) => void
chunk-unloaded(data: ChunkEventData) => void
chunk-updated(data: ChunkUpdateEventData) => void

WorldClientOptions

Ƭ WorldClientOptions: Object

The client-side options to create a world. These are client-side only and can be customized to specific use.

Type declaration

NameTypeDescription
chunkCullShadowSafeDistancenumberBlocks within which chunks stay visible even when the camera is looking away from them, because geometry behind the camera still casts shadows into the view. Defaults to 160 blocks, comfortably past the shadow cascades' 128-block reach; shorten it below that and near shadows start vanishing as the player turns. In blocks rather than chunks so that a world choosing a coarser chunk size does not silently pin hundreds of chunks visible.
chunkLoadExponentnumberThe exponent applied to the ratio that chunks are loaded, which would then be used to determine whether an angle to a chunk is worth loading. Defaults to 8.
chunkRerequestIntervalMsnumberHow long a requested chunk may go unanswered before the request is presumed lost and reissued, in milliseconds. Defaults to 5000ms.
chunkUniformsOverwritePartial<ChunkRenderer["uniforms"]>The uniforms to overwrite the default chunk material uniforms. Defaults to {}.
clientOnlyMeshingbooleanWhether to use client-only meshing. When true, chunks are always meshed locally. When false, server-provided meshes are used for initial chunk load. Defaults to true.
cloudsOptionsPartial<CloudsOptions>The options to create the clouds. Defaults to {}.
defaultRenderRadiusnumberThe default render radius of the world, in chunks. Change this through world.renderRadius. Defaults to 8 chunks.
deltaRetentionTimenumberHow long to retain delta history in milliseconds. Defaults to 5000ms.
distantDetailCullBelowYnumber | nullWorld Y under which distant chunks are left unmeshed, trading the terrain below it for a much larger render radius. Only chunks farther away than nearDetailRadius are culled; the ones around the player always mesh to the ground, and a chunk fills in the rest as the player approaches. null (the default) meshes everything everywhere. Culling leaves the underside of distant terrain open, so this is only invisible when something opaque sits over the cut — a cloud deck whose lowest surface is above the cut line. Set it above that and distant mountains read as hollow shells. For the same reason the cull applies only while the player is above this line. Underneath it the deck is no longer in the way, so the world meshes in full and gives up the range until they climb back over it. Only applies under clientOnlyMeshing; server-meshed worlds render what they are sent.
distantDetailCullHysteresisnumberHow far above distantDetailCullBelowY the player must climb before culling resumes, having dropped below it. Falling below the line always suspends culling immediately — the gap only delays switching it back on, so that standing at the line does not flip the two states frame by frame. Defaults to 8 blocks.
fogCullSlacknumberBlocks past the fog far edge a section may reach before fog culling hides it, absorbing the difference between a section's center distance and the nearest fragment the fog actually shades.
fogFarRenderRationumberFraction of render distance where horizon fog fully hides terrain. Defaults to 0.78.
fogNearRenderRationumberFraction of render distance where horizon fog starts. Defaults to 0.45.
isCullingChunksByFogbooleanWhether the occlusion walk also prunes sections past the fog's far edge, where every fragment already resolves to pure fog color.
isCullingChunksByFrustumbooleanWhether whole chunk subtrees are hidden while the camera cannot see them. three.js culls per mesh, but it pays to walk the scene graph first: every node is visited by the matrix pass and the culling pass whether or not it ends up drawn, and a wide render radius is tens of thousands of visits per frame. Testing one box per chunk and hiding the ones that miss lets the renderer skip those branches outright. Requires a camera to be passed to World.update; without one there is nothing to cull against and every chunk stays visible.
isCullingChunksByOcclusionbooleanWhether to hide chunk sections the camera provably cannot see through the terrain, walking the mesher-reported face-connectivity graph outward from the camera's own section (Sodium-style occlusion culling). An enclosed interior stops drawing the world around it. Requires WorldClientOptions.isCullingChunksByFrustum, since the walk also carries the frustum test.
lightJobRetryLimitnumberMaximum number of retries for stale light jobs before falling back to sync. Defaults to 3.
lightJobTimeoutMsnumberMilliseconds a light worker job may run before its worker is presumed dead (an OOMed worker dies without any error event) and replaced. Defaults to 20000.
maxChunkRequestsPerUpdatenumberThe maximum chunk requests this world can request from the server per world update. Defaults to 12 chunks.
maxDetailRefinementsPerUpdatenumberHow many chunks may have their culled levels queued for meshing per world update. Refinement is spread over frames and ordered nearest-first so walking into a region never lands as one burst of mesh jobs. Defaults to 4 chunks.
maxImmediateServerUpdatesnumberServer update batches larger than this are drained through the incremental per-frame update queue instead of being applied (and relit) synchronously in one shot. Defaults to 500 updates.
maxLightWorkersnumberMaximum concurrent light workers. Defaults to 2.
maxLightsUpdateTimenumber-
maxMeshesPerUpdatenumber-
maxOptimisticClientUpdatesnumberClient batches larger than this skip the optimistic local apply (with its per-frame relight) and stream straight to the server; the world catches up from the server's tick-batched echo. Keeps bulk edits (WorldEdit) from freezing the tab and guarantees the whole batch is on the wire before any reload. Defaults to 4000 updates.
maxProcessesPerUpdatenumberThe maximum amount of chunks received from the server that can be processed per world update. By process, it means to be turned into a Chunk instance. Defaults to 8 chunks.
maxQueuedWorkerJobsnumberJobs allowed to wait for a free mesh or light worker before the oldest are shed. Dispatch is already gated on free worker slots, so this is the backstop that keeps a future caller from parking unbounded serialized chunk payloads in a pool queue. Defaults to 8.
maxUpdatesPerUpdatenumberThe maximum voxel updates that can be sent to the server per world update. Defaults to 1000 updates.
maxUrgentMeshWorkersnumberDedicated mesh workers reserved for client-originated voxel edits.
maxVoxelHistoryPerVoxelnumberPrevious values retained per voxel. Defaults to 4.
maxVoxelHistoryVoxelsnumberDistinct voxels tracked by World.getPreviousValueAt. The history is a debugging convenience, not gameplay state, so it evicts oldest-first instead of growing with every voxel a session ever edits. Defaults to 4096.
memoryPressurePartial<MemoryPressureOptions>Renderer heap watchdog thresholds. See MemoryPressureOptions.
mergeChunkGeometriesbooleanWhether to merge chunk geometries to reduce draw calls. Useful for mobile. Defaults to false.
meshApplyBudgetMsnumberPer-frame time budget for applying completed regular mesh results on the main thread, in milliseconds. At least one result always applies per frame; the budget is checked after each apply. Urgent (player-edit) results and the initial join flow bypass the budget entirely. Defaults to 3.
meshJobTimeoutMsnumberMilliseconds a mesh worker job may run before its worker is presumed dead and replaced. Defaults to 30000.
minLightLevelnumberThe minimum light level even when sunlight and torch light levels are at zero. Defaults to 0.04.
nearDetailRadiusnumberChunk radius within which every sub-chunk level is meshed regardless of distantDetailCullBelowY. Defaults to 10 chunks.
plantDetailDistancenumber | nullBlock distance out to which plant decoration (grass tufts, flowers — any block the registry marks isPlant) is drawn. Beyond it those meshes are hidden. null (the default) draws them everywhere. Plants cannot share a mesh with the terrain: each species is its own double-sided alpha-tested material, so a chunk with grass and two flower species costs three extra draw calls no matter how few blocks are in them. Across a wide render disc that is most of the frame's draw calls spent on geometry a metre wide, which past a couple of hundred blocks covers well under a pixel. This hides whole meshes rather than fading them, so set it past the point where a tuft is still resolvable or the boundary reads as a moving edge in the ground cover.
regionArenasChunkRegionArenasOptions | nullRegion buffer arenas for the shared-opaque chunk bucket. See ChunkRegionArenasOptions. null disables batching and keeps per-section meshes.
skyOptionsPartial<SkyOptions>The options to create the sky. Defaults to {}.
statsSyncIntervalnumberThe interval between each time the world requests the server for its stats. Defaults to 500ms.
sunlightChangeSpannumberThe fraction of the day that sunlight takes to change from appearing to disappearing or disappearing to appearing. Defaults to 0.1.
sunlightEndTimeFracnumberThe fraction of the day that sunlight starts to disappear. Defaults to 0.7.
sunlightStartTimeFracnumberThe fraction of the day that sunlight starts to appear. Defaults to 0.25.
swayProfileCapacitynumberSlots in the shared cutout buckets' sway-profile uniform table (one vec4 pair each). Slot 0 is reserved for "no sway", so a world can register one fewer distinct profile than this. Defaults to 16.
textureUnitDimensionnumberThe default dimension to a single unit of a block face texture. If any texture loaded is greater, it will be downscaled to this resolution. Defaults to 8 pixels.
timeForceThresholdnumberThe threshold to force the server's time to the client's time. Defaults to 0.1.
useLightWorkersbooleanWhether to use web workers for light calculations. Defaults to true.

WorldFogRange

Ƭ WorldFogRange: Object

Type declaration

NameType
farnumber
nearnumber

WorldMemoryCounters

Ƭ WorldMemoryCounters: Object

A snapshot of every queue and in-flight set in the voxel update -> relight -> remesh pipeline. See World.getMemoryCounters.

Type declaration

NameType
activeLightBatchPendingJobsnumber
activeLightBatchUndispatchedJobsnumber
blockUpdatesQueuenumber
blockUpdatesToEmitnumber
lightJobHighWaterChunksnumber
lightJobQueuenumber
lightQueuenumber
lightQueuedBytesnumber
lightWorkingnumber
loadedChunksnumber
memoryPressureMemoryPressureStatus
meshDirtyKeysnumber
meshInFlightJobsnumber
meshQueuenumber
meshQueuedBytesnumber
meshWorkingnumber
urgentMeshQueuenumber
urgentMeshQueuedBytesnumber
urgentMeshWorkingnumber
voxelDeltaChunksnumber
voxelDeltaTotalnumber
voxelHistoryVoxelsnumber

WorldOptions

Ƭ WorldOptions: WorldClientOptions & WorldServerOptions

The options to create a world. This consists of WorldClientOptions and WorldServerOptions.


WorldServerOptions

Ƭ WorldServerOptions: Object

The options defined on the server-side, passed to the client on network joining.

Type declaration

NameTypeDescription
airDragnumberThe air drag of everything physical.
chunkSizenumberThe width and depth of a chunk, in blocks.
doesTickTimeboolean-
fluidDensitynumberThe density of the fluid in this world.
fluidDragnumberThe fluid drag of everything physical.
gravitynumber[]The gravity of everything physical in this world.
maxChunk[number, number]The maximum chunk coordinate of this world, inclusive.
maxHeightnumberThe height of a chunk, in blocks.
maxLightLevelnumberThe maximum light level that propagates in this world, including sunlight and torch light.
minBounceImpulsenumberThe minimum bouncing impulse of everything physical in this world.
minChunk[number, number]The minimum chunk coordinate of this world, inclusive.
subChunksnumberThe number of sub-chunks that divides a chunk vertically.
timePerDaynumberThe time per day in seconds.
waterLevelnumberThe nominal water level of this world, in blocks.

Variables

ABOVE_SURFACE_WATER_FOG_FRAGMENT

Const ABOVE_SURFACE_WATER_FOG_FRAGMENT: string

The above-surface counterpart of UNDERWATER_FOG_FRAGMENT: the same Beer-Lambert in-scattering fog, but for water-exposed terrain seen from outside the surface. It fades a submerged fragment toward the water's own in-scattered color along the sub-surface segment of the view ray, so deep or steeply-viewed bottoms go murky while shallow water stays readable — reusing WATER_VIEW_EXTINCTION and uUnderwaterAmbient so the view from above matches the view from below.

Expects outgoingLight, vWorldPosition, cameraPosition, uWaterLevel, uCameraSubmersion, uUnderwaterAmbient, and a vWaterExposed varying (1.0 on faces in contact with fluid) in scope. uWaterLevel stands in for the surface plane, matching the global waterline the rest of the chunk shader assumes. Runs before sky/height fog so nearer air fog layers on top.


BLUE_LIGHT

Const BLUE_LIGHT: "BLUE"

The string representation of blue light.


BOX_SIDES

Const BOX_SIDES: BoxSides[]

The six default faces of a canvas box.


CONNECTIVITY_FULL

Const CONNECTIVITY_FULL: 32767

All fifteen unordered face pairs connected — the encoding for a section the eye passes straight through (all air, or not yet meshed).


DEFAULT_BLOCK_MAX_STACK

Const DEFAULT_BLOCK_MAX_STACK: 64


ENTITY_SHADOW_DISTANCE

Const ENTITY_SHADOW_DISTANCE: 32

Blocks from the player within which entities cast dynamic shadows. The cascade entity refresh and the caller's decision of whether any entity is worth a refresh at all must agree on this number, or entities outside it trigger full cascade re-renders for shadows that are then distance-culled before drawing.


ENTITY_SHADOW_FRAGMENT_PARS

Const ENTITY_SHADOW_FRAGMENT_PARS: "\nuniform sampler2D uShadowMap0;\nuniform sampler2D uShadowMap1;\nuniform sampler2D uShadowMap2;\nuniform float uCascadeSplit0;\nuniform float uCascadeSplit1;\nuniform float uCascadeSplit2;\nuniform float uShadowBias;\nuniform float uShadowNormalBias;\nuniform float uShadowStrength;\nuniform float uSunlightIntensity;\nuniform vec3 uSunDirection;\nuniform vec3 uSunColor;\nuniform float uMinOccluderDepth;\n\nvarying vec4 vShadowCoord0;\nvarying vec4 vShadowCoord1;\nvarying vec4 vShadowCoord2;\nvarying float vViewDepth;\n\n\nconst vec2 SHADOW_POISSON_DISK[8] = vec2[8](\n vec2(-0.94201624, -0.39906216),\n vec2(0.94558609, -0.76890725),\n vec2(-0.094184101, -0.92938870),\n vec2(0.34495938, 0.29387760),\n vec2(-0.91588581, 0.45771432),\n vec2(-0.81544232, -0.87912464),\n vec2(0.97484398, 0.75648379),\n vec2(0.44323325, -0.97511554)\n);\n\n\n\nfloat shadowMapEdgeFade(vec3 coord) {\n float fadeWidth = 0.08;\n float fx = smoothstep(0.0, fadeWidth, coord.x) * smoothstep(0.0, fadeWidth, 1.0 - coord.x);\n float fy = smoothstep(0.0, fadeWidth, coord.y) * smoothstep(0.0, fadeWidth, 1.0 - coord.y);\n return fx * fy;\n}\n\nfloat sampleShadowMapFast(sampler2D shadowMap, vec4 shadowCoord, float bias) {\n vec3 coord = shadowCoord.xyz / shadowCoord.w;\n coord = coord * 0.5 + 0.5;\n\n if (coord.x < 0.0 || coord.x > 1.0 || coord.y < 0.0 || coord.y > 1.0 || coord.z < 0.0 || coord.z > 1.0) {\n return 1.0;\n }\n\n vec2 texelSize = vec2(1.0) / vec2(textureSize(shadowMap, 0));\n\n float shadow = (coord.z - bias > texture(shadowMap, coord.xy).r) ? 0.0 : 1.0;\n shadow += (coord.z - bias > texture(shadowMap, coord.xy + texelSize * vec2(-1.0, -1.0)).r) ? 0.0 : 1.0;\n shadow += (coord.z - bias > texture(shadowMap, coord.xy + texelSize * vec2(1.0, -1.0)).r) ? 0.0 : 1.0;\n shadow += (coord.z - bias > texture(shadowMap, coord.xy + texelSize * vec2(-1.0, 1.0)).r) ? 0.0 : 1.0;\n shadow += (coord.z - bias > texture(shadowMap, coord.xy + texelSize * vec2(1.0, 1.0)).r) ? 0.0 : 1.0;\n\n shadow /= 5.0;\n return mix(1.0, shadow, shadowMapEdgeFade(coord));\n}\n\nfloat sampleShadowMapPCSS(sampler2D shadowMap, vec4 shadowCoord, float bias) {\n vec3 coord = shadowCoord.xyz / shadowCoord.w;\n coord = coord * 0.5 + 0.5;\n\n if (coord.x < 0.0 || coord.x > 1.0 || coord.y < 0.0 || coord.y > 1.0 || coord.z < 0.0 || coord.z > 1.0) {\n return 1.0;\n }\n\n vec2 texelSize = vec2(1.0) / vec2(textureSize(shadowMap, 0));\n\n float blockerSum = 0.0;\n float blockerCount = 0.0;\n float searchRadius = 3.0;\n for (int i = 0; i < 4; i++) {\n vec2 offset = SHADOW_POISSON_DISK[i * 2] * texelSize * searchRadius;\n float sampleDepth = texture(shadowMap, coord.xy + offset).r;\n float blockerDiff = coord.z - sampleDepth;\n if (blockerDiff > bias && blockerDiff >= uMinOccluderDepth) {\n blockerSum += sampleDepth;\n blockerCount += 1.0;\n }\n }\n\n if (blockerCount < 0.5) {\n return 1.0;\n }\n\n float avgBlockerDepth = blockerSum / blockerCount;\n float penumbraSize = (coord.z - avgBlockerDepth) / avgBlockerDepth;\n float filterRadius = clamp(penumbraSize * 2.0, 1.0, 3.0);\n\n float spatialNoise = fract(sin(dot(coord.xy, vec2(12.9898, 78.233))) * 43758.5453);\n float angle = spatialNoise * 6.283185;\n float s = sin(angle);\n float c = cos(angle);\n mat2 rotation = mat2(c, -s, s, c);\n\n float centerDepth = texture(shadowMap, coord.xy).r;\n float centerDiff = coord.z - centerDepth;\n float shadow = (centerDiff > bias && centerDiff >= uMinOccluderDepth) ? 0.0 : 1.0;\n for (int i = 0; i < 8; i++) {\n vec2 offset = rotation * SHADOW_POISSON_DISK[i] * texelSize * filterRadius;\n float depth = texture(shadowMap, coord.xy + offset).r;\n float depthDiff = coord.z - depth;\n shadow += (depthDiff > bias && depthDiff >= uMinOccluderDepth) ? 0.0 : 1.0;\n }\n\n shadow /= 9.0;\n return mix(1.0, shadow, shadowMapEdgeFade(coord));\n}\n\n\nfloat getEntityShadow(vec3 worldNormal) {\n float effectiveStrength = uShadowStrength * uSunlightIntensity;\n \n if (effectiveStrength < 0.01) {\n return 1.0;\n }\n\n float cosTheta = clamp(dot(worldNormal, uSunDirection), 0.0, 1.0);\n float bias = uShadowBias + uShadowNormalBias * (1.0 - cosTheta);\n\n float rawShadow = sampleShadowMapPCSS(uShadowMap0, vShadowCoord0, bias);\n\n float maxEntityDist = uCascadeSplit1;\n if (vViewDepth > maxEntityDist) {\n return 1.0;\n }\n float fadeStart = maxEntityDist * 0.7;\n if (vViewDepth > fadeStart) {\n float t = (vViewDepth - fadeStart) / (maxEntityDist - fadeStart);\n rawShadow = mix(rawShadow, 1.0, t);\n }\n\n float shadow = mix(1.0, rawShadow, effectiveStrength * 0.65);\n return max(shadow, 0.6);\n}\n"


ENTITY_SHADOW_VERTEX_MAIN

Const ENTITY_SHADOW_VERTEX_MAIN: "\nvec4 shadowWorldPos = vec4(worldPosition.xyz + uWorldOffset, 1.0);\nvShadowCoord0 = uShadowMatrix0 * shadowWorldPos;\nvShadowCoord1 = uShadowMatrix1 * shadowWorldPos;\nvShadowCoord2 = uShadowMatrix2 * shadowWorldPos;\nvec4 viewPos = viewMatrix * vec4(worldPosition.xyz, 1.0);\nvViewDepth = -viewPos.z;\n"


ENTITY_SHADOW_VERTEX_PARS

Const ENTITY_SHADOW_VERTEX_PARS: "\nuniform mat4 uShadowMatrix0;\nuniform mat4 uShadowMatrix1;\nuniform mat4 uShadowMatrix2;\nuniform vec3 uWorldOffset;\n\nvarying vec4 vShadowCoord0;\nvarying vec4 vShadowCoord1;\nvarying vec4 vShadowCoord2;\nvarying float vViewDepth;\n"


FROZEN_METADATA_KEY

Const FROZEN_METADATA_KEY: "frozen"

Metadata key the server sets on entities pinned by the freeze mechanic. While true, the client must hold the entity's pose: its class update (animation clocks, interpolation) is skipped entirely.


GREEN_LIGHT

Const GREEN_LIGHT: "GREEN"

The string representation of green light.


LIGHT_CONES

Const LIGHT_CONES: Readonly<{ lambertWrap: 0.25 = 0.25; maxCones: 8 = 8; minCosDelta: 0.001 = 1e-3; scatterSamples: 4 = 4 }>

Engine-side budget and falloff shaping for dynamic spot-light cones (flashlights, vehicle headlights). The cone list is rebuilt every frame by the game; shaders iterate a small fixed array so the cost stays flat.


LIGHT_CONES_FUNCTIONS

Const LIGHT_CONES_FUNCTIONS: string

Shared per-cone response: quadratic angular falloff between the inner and outer cone, squared-quadratic distance falloff to zero at range, and Beer-Lambert extinction from the cone origin scaled by the origin's submersion so underwater beams die out physically while dry beams carry.

uConeOrigins[i] = (origin.xyz, submersion); uConeShapes[i] = (cosOuter, 1/(cosInner-cosOuter), range, scatterStrength).


LIGHT_CONES_SCATTER_FRAGMENT

Const LIGHT_CONES_SCATTER_FRAGMENT: "\nif (uConeCount > 0) {\n vec3 lcViewRay = vWorldPosition.xyz - cameraPosition;\n float lcViewDist = max(length(lcViewRay), 1e-4);\n gl_FragColor.rgb += lightConeScatter(cameraPosition, lcViewRay / lcViewDist, lcViewDist);\n}\n"

Adds the in-scattered beam glow after fog. Expects vWorldPosition, cameraPosition, and gl_FragColor in scope. Scatter strength is the game's per-cone knob: this is how a beam is seen in air — real spotlights are invisible between lens and surface unless the air itself scatters some light toward the eye (dust, haze), which this term estimates. Submersion additionally applies water extinction along the path, so underwater beams bloom hard and die short.


LIGHT_CONES_UNIFORM_DECLARATIONS

Const LIGHT_CONES_UNIFORM_DECLARATIONS: string


NX_ROTATION

Const NX_ROTATION: 3

The numerical representation of the negative X rotation.


NY_ROTATION

Const NY_ROTATION: 1

The numerical representation of the negative Y rotation.


NZ_ROTATION

Const NZ_ROTATION: 5

The numerical representation of the negative Z rotation.


OPAQUE_RENDER_ORDER

Const OPAQUE_RENDER_ORDER: 100


POSITION_BLOCK_BIAS

Const POSITION_BLOCK_BIAS: 32

Compact vertex format for chunk geometry, adapted from Sodium's compact vertex layout. Positions store as unsigned 16-bit fixed point in 1/positionUnitsPerBlock block units, biased by POSITION_BLOCK_BIAS blocks so face geometry that pokes slightly outside its section (rotated plant crosses, dynamic-pattern parts) stays representable. The scale is derived per world from its section extent — Sodium can hardcode one scale because its sections are always 16 blocks tall, but a world here may run a single 352-block sub-chunk, and a fixed scale wide enough for the small case silently wraps every vertex above the u16 ceiling in the tall one. UVs store as normalized u16 (the atlas keeps every vertex UV inside [0, 1]; greedy tiling reconstructs its repeat from world position in the fragment shader). Normals store as normalized i8. Together with the i32 packed light this is 17 bytes of attributes per vertex, down from 36.

The dequantization scale and bias live in the mesh (or arena instance) matrix, never in the shader: the CSM depth pass renders the whole scene through one scene.overrideMaterial and can only be correct if the transform carries the mapping back to block space. Chunk materials still receive POSITION_UNITS_PER_BLOCK as a define because sway and wave displacement math reads the raw position attribute before any matrix applies.

Geometry that the transparent sorter rewrites on the main thread (fluids and depth-non-writing see-through blocks such as glass) keeps full f32 attributes: the sorter's per-face keys read positions directly, and those buckets are a small fraction of the scene. isMainThreadSortedBlock mirrors the depthWrite rule in chunk-materials.ts exactly — every material therefore serves either only quantized or only float meshes.


PX_ROTATION

Const PX_ROTATION: 2

The numerical representation of the positive X rotation.


PY_ROTATION

Const PY_ROTATION: 0

The numerical representation of the positive Y rotation.


PZ_ROTATION

Const PZ_ROTATION: 4

The numerical representation of the positive Z rotation.


RED_LIGHT

Const RED_LIGHT: "RED"

The string representation of red light.


SCENE_OVERLAY_LAYER

Const SCENE_OVERLAY_LAYER: 30

The dedicated render layer that all in-world overlay objects (sprite texts, nametags, and other HUD-like scene decorations) live on. Cameras that should display overlays must call camera.layers.enable(SCENE_OVERLAY_LAYER); disabling the layer on a camera renders a clean frame with no overlays, which is how pure screenshots are captured.


SHADER_LIGHTING_CHUNK_SHADERS

Const SHADER_LIGHTING_CHUNK_SHADERS: Object

Type declaration

NameType
fragmentstring
vertexstring

SHADER_LIGHTING_CROSS_CHUNK_SHADERS

Const SHADER_LIGHTING_CROSS_CHUNK_SHADERS: Object

Type declaration

NameType
fragmentstring
vertexstring

SHADER_LIGHTING_FLUID_CHUNK_SHADERS

Const SHADER_LIGHTING_FLUID_CHUNK_SHADERS: Object

Type declaration

NameType
fragmentstring
vertexstring

SHADER_LIGHTING_SEE_THROUGH_CHUNK_SHADERS

Const SHADER_LIGHTING_SEE_THROUGH_CHUNK_SHADERS: Object

Type declaration

NameType
fragmentstring
vertexstring

SHADOW_POISSON_DISK

Const SHADOW_POISSON_DISK: "\nconst vec2 SHADOW_POISSON_DISK[8] = vec2[8](\n vec2(-0.94201624, -0.39906216),\n vec2(0.94558609, -0.76890725),\n vec2(-0.094184101, -0.92938870),\n vec2(0.34495938, 0.29387760),\n vec2(-0.91588581, 0.45771432),\n vec2(-0.81544232, -0.87912464),\n vec2(0.97484398, 0.75648379),\n vec2(0.44323325, -0.97511554)\n);\n"


SHADOW_SAMPLE_FUNCTIONS

Const SHADOW_SAMPLE_FUNCTIONS: "\nfloat shadowMapEdgeFade(vec3 coord) {\n float fadeWidth = 0.08;\n float fx = smoothstep(0.0, fadeWidth, coord.x) * smoothstep(0.0, fadeWidth, 1.0 - coord.x);\n float fy = smoothstep(0.0, fadeWidth, coord.y) * smoothstep(0.0, fadeWidth, 1.0 - coord.y);\n return fx * fy;\n}\n\nfloat sampleShadowMapFast(sampler2D shadowMap, vec4 shadowCoord, float bias) {\n vec3 coord = shadowCoord.xyz / shadowCoord.w;\n coord = coord * 0.5 + 0.5;\n\n if (coord.x < 0.0 || coord.x > 1.0 || coord.y < 0.0 || coord.y > 1.0 || coord.z < 0.0 || coord.z > 1.0) {\n return 1.0;\n }\n\n vec2 texelSize = vec2(1.0) / vec2(textureSize(shadowMap, 0));\n\n float shadow = (coord.z - bias > texture(shadowMap, coord.xy).r) ? 0.0 : 1.0;\n shadow += (coord.z - bias > texture(shadowMap, coord.xy + texelSize * vec2(-1.0, -1.0)).r) ? 0.0 : 1.0;\n shadow += (coord.z - bias > texture(shadowMap, coord.xy + texelSize * vec2(1.0, -1.0)).r) ? 0.0 : 1.0;\n shadow += (coord.z - bias > texture(shadowMap, coord.xy + texelSize * vec2(-1.0, 1.0)).r) ? 0.0 : 1.0;\n shadow += (coord.z - bias > texture(shadowMap, coord.xy + texelSize * vec2(1.0, 1.0)).r) ? 0.0 : 1.0;\n\n shadow /= 5.0;\n return mix(1.0, shadow, shadowMapEdgeFade(coord));\n}\n\nfloat sampleShadowMapPCSS(sampler2D shadowMap, vec4 shadowCoord, float bias) {\n vec3 coord = shadowCoord.xyz / shadowCoord.w;\n coord = coord * 0.5 + 0.5;\n\n if (coord.x < 0.0 || coord.x > 1.0 || coord.y < 0.0 || coord.y > 1.0 || coord.z < 0.0 || coord.z > 1.0) {\n return 1.0;\n }\n\n vec2 texelSize = vec2(1.0) / vec2(textureSize(shadowMap, 0));\n\n float blockerSum = 0.0;\n float blockerCount = 0.0;\n float searchRadius = 3.0;\n for (int i = 0; i < 4; i++) {\n vec2 offset = SHADOW_POISSON_DISK[i * 2] * texelSize * searchRadius;\n float sampleDepth = texture(shadowMap, coord.xy + offset).r;\n float blockerDiff = coord.z - sampleDepth;\n if (blockerDiff > bias && blockerDiff >= uMinOccluderDepth) {\n blockerSum += sampleDepth;\n blockerCount += 1.0;\n }\n }\n\n if (blockerCount < 0.5) {\n return 1.0;\n }\n\n float avgBlockerDepth = blockerSum / blockerCount;\n float penumbraSize = (coord.z - avgBlockerDepth) / avgBlockerDepth;\n float filterRadius = clamp(penumbraSize * 2.0, 1.0, 3.0);\n\n float spatialNoise = fract(sin(dot(coord.xy, vec2(12.9898, 78.233))) * 43758.5453);\n float angle = spatialNoise * 6.283185;\n float s = sin(angle);\n float c = cos(angle);\n mat2 rotation = mat2(c, -s, s, c);\n\n float centerDepth = texture(shadowMap, coord.xy).r;\n float centerDiff = coord.z - centerDepth;\n float shadow = (centerDiff > bias && centerDiff >= uMinOccluderDepth) ? 0.0 : 1.0;\n for (int i = 0; i < 8; i++) {\n vec2 offset = rotation * SHADOW_POISSON_DISK[i] * texelSize * filterRadius;\n float depth = texture(shadowMap, coord.xy + offset).r;\n float depthDiff = coord.z - depth;\n shadow += (depthDiff > bias && depthDiff >= uMinOccluderDepth) ? 0.0 : 1.0;\n }\n\n shadow /= 9.0;\n return mix(1.0, shadow, shadowMapEdgeFade(coord));\n}\n"


SHARED_CUTOUT_MATERIAL_KEY

Const SHARED_CUTOUT_MATERIAL_KEY: "shared-cutout"


SHARED_CUTOUT_PLANT_MATERIAL_KEY

Const SHARED_CUTOUT_PLANT_MATERIAL_KEY: "shared-cutout-plant"


SHARED_OPAQUE_MATERIAL_KEY

Const SHARED_OPAQUE_MATERIAL_KEY: "shared-opaque"


SKY_FOG_COMMON_UNIFORM_DECLARATIONS

Const SKY_FOG_COMMON_UNIFORM_DECLARATIONS: "\nuniform vec3 uFogColor;\nuniform float uFogNear;\nuniform float uFogFar;\nuniform float uFogHeightOrigin;\nuniform float uFogHeightDensity;\nuniform vec3 uSkyFogTopColor;\nuniform vec3 uSkyFogMiddleColor;\nuniform vec3 uSkyFogBottomColor;\nuniform float uSkyFogOffset;\nuniform float uSkyFogVoidOffset;\nuniform float uSkyFogExponent;\nuniform float uSkyFogExponent2;\nuniform float uSkyFogDimension;\nuniform float uSkyFogStrength;\nuniform float uChunkReveal;\n\nuniform float uCameraSubmersion;\nuniform float uCameraWaterPlaneY;\nuniform vec3 uUnderwaterAmbient;\n\n"

Sky-fog uniforms minus the sun trio, for shaders whose lighting chunk already declares uSunDirection, uSunColor, and uSunlightIntensity (e.g. entity materials composing this alongside their shadow chunk).


SKY_FOG_FRAGMENT

Const SKY_FOG_FRAGMENT: string


SKY_FOG_SUN_UNIFORM_DECLARATIONS

Const SKY_FOG_SUN_UNIFORM_DECLARATIONS: "\nuniform vec3 uSunDirection;\nuniform vec3 uSunColor;\nuniform float uSunlightIntensity;\n"


SKY_FOG_UNIFORM_DECLARATIONS

Const SKY_FOG_UNIFORM_DECLARATIONS: "\n\nuniform vec3 uFogColor;\nuniform float uFogNear;\nuniform float uFogFar;\nuniform float uFogHeightOrigin;\nuniform float uFogHeightDensity;\nuniform vec3 uSkyFogTopColor;\nuniform vec3 uSkyFogMiddleColor;\nuniform vec3 uSkyFogBottomColor;\nuniform float uSkyFogOffset;\nuniform float uSkyFogVoidOffset;\nuniform float uSkyFogExponent;\nuniform float uSkyFogExponent2;\nuniform float uSkyFogDimension;\nuniform float uSkyFogStrength;\nuniform float uChunkReveal;\n\nuniform float uCameraSubmersion;\nuniform float uCameraWaterPlaneY;\nuniform vec3 uUnderwaterAmbient;\n\n\n\nuniform vec3 uSunDirection;\nuniform vec3 uSunColor;\nuniform float uSunlightIntensity;\n\n"


SUNLIGHT

Const SUNLIGHT: "SUNLIGHT"

The string representation of sunlight.


TRANSPARENT_FLUID_RENDER_ORDER

Const TRANSPARENT_FLUID_RENDER_ORDER: 100001


TRANSPARENT_RENDER_ORDER

Const TRANSPARENT_RENDER_ORDER: 100000


UNDERWATER_FOG_FRAGMENT

Const UNDERWATER_FOG_FRAGMENT: string

Per-channel exponential (Beer-Lambert) fog along the camera's underwater view path. Expects vWorldPosition, cameraPosition, and gl_FragColor in scope. The path is clamped at the waterline plane so geometry above the surface only receives fog for the submerged segment of the ray.


UNDERWATER_FOG_UNIFORM_DECLARATIONS

Const UNDERWATER_FOG_UNIFORM_DECLARATIONS: "\nuniform float uCameraSubmersion;\nuniform float uCameraWaterPlaneY;\nuniform vec3 uUnderwaterAmbient;\n"


VOXELIZE_BUILTIN_SOUND_EFFECT_EVENT

Const VOXELIZE_BUILTIN_SOUND_EFFECT_EVENT: "vox-builtin:sound-effect"


VOXEL_NEIGHBORS

Const VOXEL_NEIGHBORS: number[][]


VOXEL_SUNLIGHT_EXTINCTION_PER_WATER_BLOCK

Const VOXEL_SUNLIGHT_EXTINCTION_PER_WATER_BLOCK: number = -Math.log( LightUtils.BEER_LAMBERT_TRANSMITTANCE_NUM / LightUtils.BEER_LAMBERT_TRANSMITTANCE_DEN,)

Extinction of the voxel sunlight encoding per water block, matching the Beer-Lambert transmittance used by the light engine. The chunk shader uses it to tell genuinely submerged fragments apart from dry ground that merely sits below the nominal water level.


WATER_DOWNWELLING_EXTINCTION_GLSL

Const WATER_DOWNWELLING_EXTINCTION_GLSL: string


WATER_OPTICS

Const WATER_OPTICS: Readonly<{ baseWaveFadeEndBlocks: 256 = 256; baseWaveFadeStartBlocks: 144 = 144; depthSmoothingSpeed: 7 = 7; distantFresnelFactor: 0.55 = 0.55; downwellingExtinction: { blue: number = 0.048; green: number = 0.1; red: number = 0.38 } ; fluidSurfaceHeight: 0.875 = 0.875; lightFilterFloor: 0.04 = 0.04; maxSurfaceScanBlocks: 96 = 96; mediumWaveFadeEndBlocks: 128 = 128; mediumWaveFadeStartBlocks: 64 = 64; nightScatterFloor: 0.06 = 0.06; refractionFullStrengthCos: 0.85 = 0.85; refractionGrazingCutoffCos: 0.3 = 0.3; refractionMaxDrawingBufferPixels: 10000000 = 10_000_000; rippleFadeEndBlocks: 96 = 96; rippleFadeStartBlocks: 48 = 48; scatterFillBase: 0.03 = 0.03; scatterFillSunStrength: 0.2 = 0.2; skyFadeExtinction: 0.1 = 0.1; submersionFallSpeed: 11 = 11; submersionRiseSpeed: 16 = 16; surfaceAbsorptionScale: 0.55 = 0.55; surfaceScatterColor: "#37b6c5" = "#37b6c5"; viewExtinctionScale: 0.85 = 0.85; waterlineFadeDepth: 0.12 = 0.12 }>

The single source of truth for how water absorbs and scatters light.

Every underwater visual — fog color and density, terrain and entity light attenuation, sky dome fading, first-person prop tinting — is derived from these values so the whole scene stays physically coherent.


WATER_SURFACE_SCATTER_COLOR

Const WATER_SURFACE_SCATTER_COLOR: Color


WATER_SURFACE_SCATTER_GLSL

Const WATER_SURFACE_SCATTER_GLSL: string


WATER_VIEW_EXTINCTION

Const WATER_VIEW_EXTINCTION: WaterChannelCoefficients


WATER_VIEW_EXTINCTION_GLSL

Const WATER_VIEW_EXTINCTION_GLSL: string


Y_ROT_MAP

Const Y_ROT_MAP: [number, number][] = []

A rotational map used to get the closest y-rotation representation to a y-rotation value.

Rotation value -> index


Y_ROT_MAP_EIGHT

Const Y_ROT_MAP_EIGHT: [number, number][] = []


Y_ROT_MAP_FOUR

Const Y_ROT_MAP_FOUR: [number, number][] = []


Y_ROT_SEGMENTS

Const Y_ROT_SEGMENTS: 16

The amount of Y-rotation segments should be allowed for y-rotatable blocks. In other words, the amount of times the block can be rotated around the y-axis within 360 degrees.

The accepted Y-rotation values will be from 0 to Y_ROTATION_SEGMENTS - 1.


artFunctions

Const artFunctions: Object

A preset of art functions to draw on canvas boxes.

Type declaration

NameType
drawCrownArtFunction
drawMoon(moonRadius: number, moonColor: string, phase: number) => (context: CanvasRenderingContext2D, canvas: HTMLCanvasElement) => void
drawStars(starCount: number, starColors: string[]) => (context: CanvasRenderingContext2D, canvas: HTMLCanvasElement) => void
drawSun(sunRadius: number, sunColor: string) => (context: CanvasRenderingContext2D, canvas: HTMLCanvasElement) => void

customShaders

Const customShaders: Object

Type declaration

NameType
sway(options: Partial<{ amplitude: number ; rooted: boolean ; scale: number ; speed: number ; yScale: number }>) => { fragmentShader: string = baseShaders.fragment; vertexShader: string }
swayCross(options: Partial<{ amplitude: number ; rooted: boolean ; scale: number ; speed: number ; yScale: number }>) => { fragmentShader: string = baseShaders.fragment; vertexShader: string }

defaultArmsOptions

Const defaultArmsOptions: ArmsOptions


defaultBodyOptions

Const defaultBodyOptions: BodyOptions


defaultCharacterOptions

Const defaultCharacterOptions: CharacterOptions


defaultCreatureBodyOptions

Const defaultCreatureBodyOptions: CreatureBodyOptions


defaultCreatureHeadOptions

Const defaultCreatureHeadOptions: CreatureHeadOptions


defaultCreatureLegOptions

Const defaultCreatureLegOptions: CreatureLegOptions


defaultCreatureOptions

Const defaultCreatureOptions: CreatureOptions


defaultHeadOptions

Const defaultHeadOptions: HeadOptions


defaultLegsOptions

Const defaultLegsOptions: LegOptions


defaultMemoryPressureOptions

Const defaultMemoryPressureOptions: MemoryPressureOptions


defaultWorldClientOptions

Const defaultWorldClientOptions: WorldClientOptions


restArgsSchema

Const restArgsSchema: ZodObject<{ rest: ZodOptional<ZodString> }, "strip", ZodTypeAny, { rest?: string }, { rest?: string }>

Schema for commands that take a free-form string input. Use this for commands that need the raw rest string.


transparentSortStats

Const transparentSortStats: TransparentSortStats

Functions

TRANSPARENT_SORT

TRANSPARENT_SORT(object): (a: TransparentSortItem, b: TransparentSortItem) => number

Parameters

NameType
objectObject3D<Object3DEventMap>

Returns

fn

▸ (a, b): number

Parameters
NameType
aTransparentSortItem
bTransparentSortItem
Returns

number


analyzeLightOperations

analyzeLightOperations(world, processedUpdates): LightOperations

Parameters

NameType
worldVoxelLightVolume
processedUpdatesProcessedUpdate[]

Returns

LightOperations


annotateIncomingMessages

annotateIncomingMessages(messages, byteSizes): void

Parameters

NameType
messagesMessageProtocol[]
byteSizesnumber[]

Returns

void


applyQuantizedPositionDefine

applyQuantizedPositionDefine(material, unitsPerBlock): void

Chunk geometry that is not main-thread sorted arrives with fixed-point positions whose dequantization lives in the mesh matrix. The shader still needs the scale for displacement math (sway, waves) that reads the raw position attribute before any matrix applies; without the define the shader's fallback of 1.0 treats positions as block-space floats.

Parameters

NameType
materialShaderMaterial
unitsPerBlocknumber

Returns

void


blockSlot

blockSlot(id, count): SlotContent

Parameters

NameType
idnumber
countnumber

Returns

SlotContent


buildLightJobs

buildLightJobs(lightOps, startSequenceId, batchId, options, allocateJobId): LightJob[]

Parameters

NameType
lightOpsLightOperations
startSequenceIdnumber
batchIdnumber
optionsVoxelLightVolumeOptions
allocateJobId(color: LightColor) => string

Returns

LightJob[]


compareChunkRequestPriority

compareChunkRequestPriority(a, b): number

Parameters

NameType
aChunkRequestCandidate
bChunkRequestCandidate

Returns

number


configurePerfLogging

configurePerfLogging(isEnabled): void

Parameters

NameType
isEnabledboolean

Returns

void


createEntityShadowUniforms

createEntityShadowUniforms(): EntityShadowUniforms

Returns

EntityShadowUniforms


createPerfTraceId

createPerfTraceId(): string

Returns

string


createSkyFogFragment

createSkyFogFragment(depthExpression?): string

Parameters

NameTypeDefault value
depthExpressionstring"sqrt(dot(fogDiff, fogDiff))"

Returns

string


createSwayShader

createSwayShader(baseShaders, options?): Object

Parameters

NameType
baseShadersObject
baseShaders.fragmentstring
baseShaders.vertexstring
optionsPartial<{ amplitude: number ; rooted: boolean ; scale: number ; speed: number ; yScale: number }>

Returns

Object

NameType
fragmentShaderstring
vertexShaderstring

createSwayTableShader

createSwayTableShader(baseShaders, profileCapacity): Object

Table-driven variant of createSwayShader for the shared cutout buckets: instead of compiling one material per species with its sway constants baked into the source, every quad carries a swayProfile attribute indexing a vec4-pair uniform table (params: speed, amplitude, scale, yScale; flags: rooted, cross shading). Profile 0 is reserved as "no sway" so geometry without a registered profile — and geometry whose material never binds the attribute, which WebGL defaults to 0 — stays still.

Cross-quad plants historically used a separate fragment (fixed sun incidence, no face shade); that difference rides the profile's cross flag through the vCrossShading varying so one program serves both shapes.

Parameters

NameType
baseShadersObject
baseShaders.fragmentstring
baseShaders.vertexstring
profileCapacitynumber

Returns

Object

NameType
fragmentShaderstring
vertexShaderstring

createUnderwaterFogUniforms

createUnderwaterFogUniforms(): UnderwaterFogUniforms

Returns

UnderwaterFogUniforms


cull

cull(array, options): Promise<MeshResultType>

Parameters

NameType
arrayNdArray<number[] | TypedArray | GenericArray<number>>
optionsCullOptionsType

Returns

Promise<MeshResultType>


decodeHeldObject

decodeHeldObject(raw): SlotContent

Parameters

NameType
rawnumber

Returns

SlotContent


emptySlot

emptySlot(): SlotContent

Returns

SlotContent


encodeHeldObject

encodeHeldObject(slot): number

Parameters

NameType
slotSlotContent

Returns

number


findSimilar

findSimilar(target, available, options?): string[]

Parameters

NameType
targetstring
availablestring[]
optionsFindSimilarOptions

Returns

string[]


floodLight

floodLight(world, queue, color, min?, max?): void

Parameters

NameType
worldVoxelLightVolume
queueLightNode[]
colorLightColor
min?Coords3
max?Coords3

Returns

void


formatSuggestion

formatSuggestion(suggestions, allAvailable, options?): string

Parameters

NameType
suggestionsstring[]
allAvailablestring[]
optionsFormatSuggestionOptions

Returns

string


getDownwellingTransmittance

getDownwellingTransmittance(depth, out): Color

Parameters

NameType
depthnumber
outColor

Returns

Color


getEffectiveScatterStrength

getEffectiveScatterStrength(sunStrength): number

Parameters

NameType
sunStrengthnumber

Returns

number


getImageComp

getImageComp(item): ImageComp | undefined

Parameters

NameType
itemItemDef

Returns

ImageComp | undefined


getItemComponent

getItemComponent<T>(item, key): T | undefined

Type parameters

Name
T

Parameters

NameType
itemItemDef
keystring

Returns

T | undefined


getLightColorMask

getLightColorMask(color): number

Parameters

NameType
colorLightColor

Returns

number


getMeshTransferStatus

getMeshTransferStatus(): Object

Returns

Object

NameType
isCrossOriginIsolatedboolean
isSharedArrayBufferAvailableboolean
modeWorkerTransferMode
poolChunkSharedPoolStats
statsMeshWorkerTransferStats | Record<WorkerTransferStrategy, MeshWorkerTransferStats>
strategyWorkerTransferStrategy

getSlotData

getSlotData<T>(slot, key): T | undefined

Type parameters

Name
T

Parameters

NameType
slotSlotContent
keystring

Returns

T | undefined


getSlotDurability

getSlotDurability(slot): number | undefined

Parameters

NameType
slotSlotContent

Returns

number | undefined


getUnderwaterAmbientColor

getUnderwaterAmbientColor(depth, sunStrength, out): Color

Parameters

NameType
depthnumber
sunStrengthnumber
outColor

Returns

Color


hasItemComponent

hasItemComponent(item, key): boolean

Parameters

NameType
itemItemDef
keystring

Returns

boolean


hasSlotData

hasSlotData(slot, key): boolean

Parameters

NameType
slotSlotContent
keystring

Returns

boolean


isEntityMetadataFrozen

isEntityMetadataFrozen(metadata): boolean

Parameters

NameType
metadataMutableMetadata

Returns

boolean


isMainThreadSortedBlock

isMainThreadSortedBlock(block): boolean

Parameters

NameType
blockTransparencyFlags

Returns

boolean


isPerfLogging

isPerfLogging(): boolean

Returns

boolean


isSelfIlluminated

isSelfIlluminated(material): boolean

Parameters

NameType
materialMaterial

Returns

boolean


isSharedOpaqueMaterialBlock

isSharedOpaqueMaterialBlock(block): boolean

Parameters

NameType
blockBlock

Returns

boolean


itemSlot

itemSlot(id, count, data?): SlotContent

Parameters

NameType
idnumber
countnumber
dataRecord<string, unknown>

Returns

SlotContent


itemSlotWithDurability

itemSlotWithDurability(id, count, durability): SlotContent

Parameters

NameType
idnumber
countnumber
durabilitynumber

Returns

SlotContent


loadChunkMaterials

loadChunkMaterials(world): Promise<void>

Parameters

NameType
worldChunkMaterialHost & { getBlockById: (id: number) => Block ; registry: Registry }

Returns

Promise<void>


logChatRendered

logChatRendered(chat): void

Parameters

NameType
chatChatProtocol

Returns

void


logChatWireSend

logChatWireSend(message, byteSize): void

Parameters

NameType
messageMessageProtocol
byteSizenumber

Returns

void


logIncomingMessage

logIncomingMessage(message): void

Parameters

NameType
messageMessageProtocol

Returns

void


logPerf

logPerf(event, fields?): void

Parameters

NameType
eventstring
fieldsRecord<string, PerfField>

Returns

void


makeChunkMaterialKey

makeChunkMaterialKey(world, id, faceName?, voxel?): string

Parameters

NameType
worldObject
world.getBlockById(id: number) => Block
world.hasCustomBlockMaterial(id: number) => boolean
idnumber
faceName?string
voxel?Coords3

Returns

string


makeChunkShaderMaterial

makeChunkShaderMaterial(world, fragmentShader?, vertexShader?, uniforms?): CustomChunkShaderMaterial

Parameters

NameType
worldChunkMaterialHost
fragmentShader?string
vertexShader?string
uniformsRecord<string, Uniform<any>>

Returns

CustomChunkShaderMaterial


makeSceneColorTexture

makeSceneColorTexture(width?, height?, isSRGB?): FramebufferTexture

Parameters

NameTypeDefault value
widthnumber1
heightnumber1
isSRGBbooleanfalse

Returns

FramebufferTexture


markSelfIlluminated

markSelfIlluminated(material): void

Mark a material as its own light source, so the voxel-light effects leave it alone. A lamp lens, a screen, or a glowing sign must not be multiplied by the light around it: that would put the emitter out in exactly the dark it was lit for. Honored by LightShined and by the Arm's held-object lighting and shadow shaders.

Parameters

NameType
materialMaterial

Returns

void


measureWaterColumn

measureWaterColumn(isFluidAt, x, y, z): WaterColumnSample | null

Parameters

NameType
isFluidAtFluidQuery
xnumber
ynumber
znumber

Returns

WaterColumnSample | null


mergeLightOperations

mergeLightOperations(existing, newOps): LightOperations

Parameters

NameType
existingLightOperations
newOpsLightOperations

Returns

LightOperations


mergeSingleColorResult

mergeSingleColorResult(chunk, lights, color, boundingBox): void

Parameters

NameType
chunkChunk
lightsUint32Array<ArrayBufferLike>
colorLightColor
boundingBoxBoundingBox

Returns

void


positionUnitsPerBlock

positionUnitsPerBlock(options): number

Parameters

NameType
optionsSectionExtentOptions

Returns

number


prepareTransparentMesh

prepareTransparentMesh(mesh): TransparentMeshData | null

Parameters

NameType
meshMesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, Material | Material[], Object3DEventMap>

Returns

TransparentMeshData | null


quantizeNormals

quantizeNormals(normals): Int8Array

Parameters

NameType
normalsFloat32Array<ArrayBufferLike>

Returns

Int8Array


quantizePositions

quantizePositions(positions, unitsPerBlock): Uint16Array

Parameters

NameType
positionsnumber[] | Float32Array<ArrayBufferLike>
unitsPerBlocknumber

Returns

Uint16Array


quantizeUvs

quantizeUvs(uvs): Uint16Array

Parameters

NameType
uvsnumber[] | Float32Array<ArrayBufferLike>

Returns

Uint16Array


readChromiumHeap

readChromiumHeap(): HeapSample

Returns

HeapSample


removeLight

removeLight(world, voxel, color): void

Parameters

NameType
worldVoxelLightVolume
voxelCoords3
colorLightColor

Returns

void


removeLightsBatch

removeLightsBatch(world, voxels, color): void

Batch remove light from multiple voxels that previously emitted the same light color. This drastically improves performance when many contiguous light sources are removed at once.

Parameters

NameType
worldVoxelLightVolume
voxelsCoords3[]
colorLightColor

Returns

void


requestWorkerAnimationFrame

requestWorkerAnimationFrame(callback): number

Parameters

NameType
callback() => void

Returns

number


runMeshTransferBenchmark

runMeshTransferBenchmark(dispatch, getChunk, options): Promise<MeshTransferBenchmarkResult>

Parameters

NameType
dispatchMeshTransferDispatch
getChunk(cx: number, cz: number) => Chunk
optionsMeshTransferBenchmarkOptions

Returns

Promise<MeshTransferBenchmarkResult>


setPerfWorld

setPerfWorld(world): void

Parameters

NameType
worldstring

Returns

void


setSlotData

setSlotData<T>(slot, key, value): SlotContent

Type parameters

Name
T

Parameters

NameType
slotSlotContent
keystring
valueT

Returns

SlotContent


setWorkerInterval

setWorkerInterval(func, interval): () => void

Parameters

NameType
func() => void
intervalnumber

Returns

fn

▸ (): void

Returns

void


setupTransparentSorting

setupTransparentSorting(object): void

Parameters

NameType
objectObject3D<Object3DEventMap>

Returns

void


sharedCutoutMaterialKeyFor

sharedCutoutMaterialKeyFor(block): string | null

The shared bucket a depth-writing cutout block collapses into, or null for blocks that keep a per-id material. Plants live apart from leaves so the plant-radius culling can hide a section's plants without taking its canopy down, and because the two halves disagree on shadow casting (skipShadow is a material property). Standalone cutouts that neither sway nor attenuate light — doors, decor — stay per-id: folding them in would silently change their shadow behavior.

Parameters

NameType
blockBlock

Returns

string | null


sortTransparentMesh

sortTransparentMesh(mesh, data, camera): void

Parameters

NameType
meshMesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, Material | Material[], Object3DEventMap>
dataTransparentMeshData
cameraCamera

Returns

void


stampChatPerf

stampChatPerf(chat): void

Parameters

NameType
chatChatProtocol

Returns

void


updateEntityShadowUniforms

updateEntityShadowUniforms(target, source): void

Parameters

NameType
targetEntityShadowUniforms
sourceShaderLightingUniforms

Returns

void


updateUnderwaterFogUniforms

updateUnderwaterFogUniforms(target, source): void

Parameters

NameType
targetUnderwaterFogUniforms
sourceUnderwaterFogSource

Returns

void