@voxelize/core
Enumerations
Core Classes
Effects Classes
Other Classes
- AnimationUtils
- Arm
- Arrow
- AtlasTexture
- BlockRotation
- BoundedLruMap
- BoxLayer
- CSMRenderer
- CanvasBox
- Character
- Chunk
- ChunkPipeline
- ChunkRegionArenas
- ChunkRenderer
- ChunkSharedPool
- Clouds
- Creature
- Debug
- Entity
- EntityLivenessTracker
- Events
- FaceAnimation
- ImageItemRenderer
- ItemRegistry
- ItemRenderer
- ItemSlot
- ItemSlots
- LightCones
- MemoryPressureMonitor
- MeshPipeline
- Method
- NameTag
- Network
- Perspective
- Portrait
- Registry
- SectionVisibilityGraph
- Sky
- SpriteText
- StaticGroup
- ThreeUtils
- VoxelInteract
- WaterOptics
- WebRTCConnection
- WorkerPool
- WorkerTransfer
Utils Classes
Interfaces
- BlockConditionalPart
- BlockDynamicPattern
- CSMConfig
- ChunkMaterialHost
- EntityShadowUniforms
- ImageComp
- ImageItemMeshData
- ItemDef
- NetIntercept
- ShaderLightingUniforms
- TransparentMeshData
- UnderwaterFogSource
- UnderwaterFogUniforms
- VoxelLightVolume
Type Aliases
ArgMetadata
Ƭ ArgMetadata: Object
Metadata extracted from a Zod schema for UI purposes.
Type declaration
| Name | Type |
|---|---|
defaultValue? | string | number | boolean |
name | string |
options? | string[] |
required | boolean |
tabComplete? | (currentValue: string, context: TabCompleteContext) => string[] |
type | "string" | "number" | "enum" | "boolean" |
ArmOptions
Ƭ ArmOptions: Object
Type declaration
| Name | Type |
|---|---|
armColor? | string | THREE.Color |
armObject? | THREE.Object3D |
armObjectOptions | ArmObjectOptions |
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
| Name | Type | Description |
|---|---|---|
color | string | Color | The color of the arrow. Defaults to red. |
coneHeight | number | The height of the head of the arrow. Defaults to 0.2. |
coneRadius | number | The radius of the head of the arrow. Defaults to 0.2. |
height | number | The height of the body of the arrow. Defaults to 0.8. |
radius | number | The 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
| Name | Type |
|---|---|
context | CanvasRenderingContext2D |
canvas | HTMLCanvasElement |
Returns
void
Block
Ƭ Block: Object
A block type in the world. This is defined by the server.
Type declaration
| Name | Type | Description |
|---|---|---|
aabbs | AABB[] | A list of axis-aligned bounding boxes that this block has. |
blueLightLevel | number | The blue light level of the block. |
dynamicFn | (pos: Coords3) => { aabbs: Block["aabbs"] ; faces: Block["faces"] ; isTransparent: Block["isTransparent"] } | - |
dynamicPatterns | BlockDynamicPattern[] | - |
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. |
fluidFlowForce | number | The force applied to entities in this fluid, pushing them in the flow direction. |
greenLightLevel | number | The green light level of the block. |
groundFrictionMultiplier | number | Multiplier applied to entity ground friction while standing on this block. 1 is normal grip; lower values are slipperier. |
id | number | The block id. |
independentFaces | Set<string> | A set of block face names that are independent (high resolution or animated). This is generated on the client side. |
isClimbable | boolean | Whether or not can entities climb this block. |
isDynamic | boolean | Whether 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. |
isEmpty | boolean | Whether or not is this block empty. By default, only "air" is empty. |
isEntity | boolean | - |
isFluid | boolean | Whether or not is the block a fluid block. |
isLight | boolean | Whether or not is this block a light source. |
isOpaque | boolean | Whether or not is this block opaque (not transparent). |
isPassable | boolean | Whether or not should physics ignore this block. |
isPlant | boolean | Whether 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. |
isSeeThrough | boolean | Whether 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. |
isWaterloggable | boolean | Whether 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. |
isWaterloggingFluid | boolean | Whether this is the fluid that waterlogging fills voxels with. |
isolatedFaces | Set<string> | - |
lightAttenuation | number | Optical density for Beer-Lambert light transmission through this block. 0 keeps normal air rules. 1 is leaves-scale. 2 is water-scale. |
name | string | The name of the block. |
redLightLevel | number | The red light level of the block. |
rotatable | boolean | Whether or not is the block rotatable. |
transparentStandalone | boolean | - |
yRotatable | boolean | Whether 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
| Name | Type |
|---|---|
etype | string |
id | string |
newValue | T | null |
oldValue | T | null |
operation | EntityOperation |
voxel | Coords3 |
BlockEntityUpdateListener
Ƭ BlockEntityUpdateListener<T>: (args: BlockEntityUpdateData<T>) => void
Type parameters
| Name |
|---|
T |
Type declaration
▸ (args): void
Parameters
| Name | Type |
|---|---|
args | BlockEntityUpdateData<T> |
Returns
void
BlockRule
Ƭ BlockRule: { type: "none" } | { type: "simple" } & BlockSimpleRule | { logic: BlockRuleLogic ; rules: BlockRule[] ; type: "combination" }
BlockSimpleRule
Ƭ BlockSimpleRule: Object
Type declaration
| Name | Type |
|---|---|
id? | number |
offset | Coords3 |
rotation? | BlockRotation | SerializedBlockRotation |
stage? | number |
BlockUpdate
Ƭ BlockUpdate: Object
A block update to make on the server.
Type declaration
| Name | Type | Description |
|---|---|---|
isWaterlogged? | boolean | Whether the updated voxel holds the world's waterlogging fluid alongside its block. |
rotation? | number | The optional rotation of the updated block. |
stage? | number | The optional stage of the updated block. |
type | number | The voxel type. |
vx | number | The voxel x-coordinate. |
vy | number | The voxel y-coordinate. |
vz | number | The voxel z-coordinate. |
waterlogLevel? | number | The level of the waterlogging fluid the updated voxel holds, 0 through 7. |
yRotation? | number | The 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
| Name | Type |
|---|---|
args | Object |
args.newValue | number |
args.oldValue | number |
args.source | "client" | "server" |
args.voxel | Coords3 |
Returns
void
BlockUpdateWithSource
Ƭ BlockUpdateWithSource: Object
Type declaration
| Name | Type |
|---|---|
source | "client" | "server" |
update | BlockUpdate |
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
| Name | Type |
|---|---|
min | Coords3 |
shape | Coords3 |
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
| Name | Type | Description |
|---|---|---|
depth? | number | The depth of the box. Defaults to whatever width is. |
depthSegments? | number | The depth segments of the box, which is the number of pixels of the canvases along the depth. Defaults to whatever widthSegments is. |
gap | number | The gap between the layers of the box. Defaults to 0. |
height? | number | The height of the box. Defaults to whatever width is. |
heightSegments? | number | The height segments of the box, which is the number of pixels of the canvases along the height. Defaults to whatever widthSegments is. |
layers | number | The number of layers of this box. Defaults to 1. |
receiveShadows? | boolean | Whether this canvas box should receive shadows. Defaults to false. |
side | Side | The side of the box to render. Defaults to THREE.FrontSide. |
transparent? | boolean | Whether or not should this canvas box be rendered as transparent. Defaults to false. |
underwaterFog? | boolean | Whether this canvas box tints toward the ambient water color while the camera is submerged, matching the underwater look of instanced entities. Defaults to false. |
width | number | THe width of the box. Defaults to 1. |
widthSegments | number | The 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
| Name | Type | Description |
|---|---|---|
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? | number | The 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? | number | The 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? | boolean | Whether this character should receive shadows. Defaults to false. |
rotationLerp? | number | The 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? | number | Lerp factor when entering the swimming pose. Defaults to 0.12. |
swimExitLerp? | number | Lerp factor when exiting the swimming pose. Defaults to 0.05. |
swimmingSpeed? | number | The speed at which the arms stroke when the character is swimming. Defaults to 1.8. |
swingLerp? | number | The lerp factor of the swinging motion of the arms and legs. Defaults to 0.8. |
walkingSpeed? | number | The speed at which the arms swing when the character is moving. Defaults to 1.4. |
ChunkDataEventData
Ƭ ChunkDataEventData: Object
Type declaration
| Name | Type |
|---|---|
chunk | Chunk |
coords | Coords2 |
ChunkEventData
Ƭ ChunkEventData: Object
Type declaration
| Name | Type |
|---|---|
allMeshes | Map<number, Mesh[]> |
chunk | Chunk |
coords | Coords2 |
ChunkMeshEventData
Ƭ ChunkMeshEventData: Object
Type declaration
| Name | Type |
|---|---|
chunk | Chunk |
coords | Coords2 |
level | number |
meshes | Mesh[] |
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
| Name | Type | Description |
|---|---|---|
growthFactor | number | Factor 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. |
indexPerVertexRatio | number | Index capacity per vertex of capacity. Quad geometry uses six indices for every four vertices, hence the 1.5 default. |
initialVertexCapacity | number | Vertex capacity a region arena is created with. Arenas grow geometrically from here, so this is a floor, not a limit. |
regionSizeInChunks | number | The width and depth of a region, in chunk columns. Every section whose chunk falls inside the same region shares one BatchedMesh. |
slotSlack | number | Multiplier 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
| Name | Type |
|---|---|
cx | number |
cz | number |
distanceSquared | number |
isInView | boolean |
ChunkSharedPoolStats
Ƭ ChunkSharedPoolStats: Object
Type declaration
| Name | Type |
|---|---|
bytesAllocated | number |
isActive | boolean |
maxSlots | number |
usedSlots | number |
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
| Name | Type | Description |
|---|---|---|
alpha | number | The opacity of the clouds. Defaults to 0.8. |
bottomShade | number | Brightness of the underside of a cloud block relative to its top, 0..1. Defaults to 0.7. |
cloudHeight | number | The y-height at which the clouds are generated. Defaults to 256. |
color | string | The color of the clouds. Defaults to #fff. |
count | number | The 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. |
dimensions | Coords3 | The dimension of each cloud block. Defaults to [20, 20, 20]. |
endFadeFarRatio | number | - |
endFadeNearRatio | number | - |
falloff | number | The noise falloff factor used to generate the clouds. Defaults to 0.9. |
height | number | The 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. |
lerpFactor | number | The lerp factor used to translate cloud blocks from their original position to their new position. Defaults to 0.3. |
noiseScale | number | The scale of the noise used to generate the clouds. Defaults to 0.08. |
octaves | number | The number of octaves used to generate the noise. Defaults to 5. |
seed | number | The seed used to generate the clouds. Defaults to -1. |
sideShade | number | Brightness of the vertical faces of a cloud block relative to its top, 0..1. Defaults to 0.86. |
speedFactor | number | The speed at which the clouds move. Defaults to 8. |
sunTint | number | Extra brightness given to faces pointing at the sun, as a fraction. Defaults to 0.12. |
threshold | number | The 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? | number | The 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. |
width | number | The 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
| Name | Type |
|---|---|
T | extends ZodObject<Record<string, ZodTypeAny>> = ZodObject<Record<string, never>> |
Type declaration
| Name | Type |
|---|---|
aliases | string[] |
args | T |
category? | string |
description | string |
flags | string[] |
isHidden | boolean |
isTabCompletePreFiltered | boolean |
process | (args: z.infer<T>) => void |
tabComplete | Partial<Record<string, (currentValue: string, context: TabCompleteContext) => string[]>> |
CommandOptions
Ƭ CommandOptions<T>: Object
Type parameters
| Name | Type |
|---|---|
T | extends ZodObject<Record<string, ZodTypeAny>> = ZodObject<Record<string, never>> |
Type declaration
| Name | Type |
|---|---|
aliases? | string[] |
args? | T |
category? | string |
description | string |
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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
dimensions | Coords3 |
max | Coords3 |
min | Coords3 |
realMax | Coords3 |
realMin | Coords3 |
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
| Name | Type |
|---|---|
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
| Name | Type | Description |
|---|---|---|
stalenessTimeoutSeconds | number | Seconds 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. |
streamSilenceGraceSeconds | number | Seconds 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
| Name | Type | Description |
|---|---|---|
stalenessTimeoutSeconds | number | Seconds 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. |
streamSilenceGraceSeconds | number | Seconds 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
| Name | Type |
|---|---|
rigidBody? | EntityRigidBodyMetadata |
EntityRigidBodyMetadata
Ƭ EntityRigidBodyMetadata: Object
Type declaration
| Name | Type |
|---|---|
fluidRatio | number |
isInFluid | boolean |
Event
Ƭ Event: Object
A Voxelize event from the server.
Type declaration
| Name | Type | Description |
|---|---|---|
name | string | The name to identify the event. |
payload? | EventPayload | Additional information of the event. |
EventHandler
Ƭ EventHandler<TPayload>: (payload: TPayload) => void
The handler for an event sent from the Voxelize server.
Type parameters
| Name | Type |
|---|---|
TPayload | EventPayload |
Type declaration
▸ (payload): void
Parameters
| Name | Type |
|---|---|
payload | TPayload |
Returns
void
EventPayload
Ƭ EventPayload: JsonPrimitive | { [key: string]: EventPayload | undefined; } | EventPayload[]
FindSimilarOptions
Ƭ FindSimilarOptions: Object
Type declaration
| Name | Type |
|---|---|
maxSuggestions? | number |
FluidQuery
Ƭ FluidQuery: (vx: number, vy: number, vz: number) => boolean
Type declaration
▸ (vx, vy, vz): boolean
Parameters
| Name | Type |
|---|---|
vx | number |
vy | number |
vz | number |
Returns
boolean
FormatSuggestionOptions
Ƭ FormatSuggestionOptions: Object
Type declaration
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
limitBytes | number |
usedBytes | number |
ImageResolver
Ƭ ImageResolver: (name: string) => string
Type declaration
▸ (name): string
Parameters
| Name | Type |
|---|---|
name | string |
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
| Name | Type | Description |
|---|---|---|
checkType? | "key" | "code" | The type of key to check for. Defaults to key. |
identifier? | string | A special identifier to tag this input with. This is useful for removing specific inputs from the input listener later on. |
occasion? | InputOccasion | The occasion that the input should be fired. Defaults to keydown. |
ItemRendererFactory
Ƭ ItemRendererFactory: (itemDef: ItemDef, world: World) => ItemRenderer
Type declaration
▸ (itemDef, world): ItemRenderer
Parameters
| Name | Type |
|---|---|
itemDef | ItemDef |
world | World |
Returns
ItemSlotsOptions
Ƭ ItemSlotsOptions: Object
Type declaration
| Name | Type |
|---|---|
activatedByDefault | boolean |
focusFirstByDefault | boolean |
horizontalCount | number |
perspective | CameraPerspective |
scrollable? | boolean |
slotClass | string |
slotFocusClass | string |
slotGap | number |
slotHeight | number |
slotHoverClass | string |
slotMargin | number |
slotPadding | number |
slotStyles | Partial<CSSStyleDeclaration> |
slotSubscriptClass | string |
slotSubscriptStyles | Partial<CSSStyleDeclaration> |
slotWidth | number |
verticalCount | number |
wrapperClass | string |
wrapperPadding | number |
wrapperStyles | Partial<CSSStyleDeclaration> |
zoom | number |
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
| Name | Type | Description |
|---|---|---|
batchId | number | - |
completedJobs | number | - |
jobs | LightJob[] | - |
pendingDispatch | LightJob[] | 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. |
results | LightBatchResult[] | - |
startSequenceId | number | - |
totalJobs | number | - |
LightBatchResult
Ƭ LightBatchResult: Object
Type declaration
| Name | Type |
|---|---|
boundingBox | BoundingBox |
color | LightColor |
modifiedChunks | LightWorkerModifiedChunk[] |
LightColor
Ƭ LightColor: "RED" | "GREEN" | "BLUE" | "SUNLIGHT"
Sunlight or the color of torch light.
LightConeInput
Ƭ LightConeInput: Object
Type declaration
| Name | Type | Description |
|---|---|---|
angleDeg | number | Full outer cone angle in degrees. |
color | Color | - |
direction | Vector3 | - |
innerRatio | number | Inner (full-brightness) cone angle as a fraction of the outer angle. |
intensity | number | - |
origin | Vector3 | - |
range | number | - |
scatterStrength | number | - |
submersion | number | 0 above water to 1 submerged; drives extinction and beam glow. |
LightConeUniformBinding
Ƭ LightConeUniformBinding: LightConeUniforms[keyof LightConeUniforms]
LightConeUniforms
Ƭ LightConeUniforms: Object
Type declaration
| Name | Type |
|---|---|
coneColors | { value: Color[] } |
coneColors.value | Color[] |
coneCount | { value: number } |
coneCount.value | number |
coneDirections | { value: Vector3[] } |
coneDirections.value | Vector3[] |
coneOrigins | { value: Vector4[] } |
coneOrigins.value | Vector4[] |
coneShapes | { value: Vector4[] } |
coneShapes.value | Vector4[] |
LightJob
Ƭ LightJob: Object
Type declaration
| Name | Type |
|---|---|
batchId | number |
boundingBox | BoundingBox |
color | LightColor |
jobId | string |
lightOps | { floods: LightNode[] ; removals: Coords3[] } |
lightOps.floods | LightNode[] |
lightOps.removals | Coords3[] |
retryCount | number |
startSequenceId | number |
LightNode
Ƭ LightNode: Object
Type declaration
| Name | Type |
|---|---|
level | number |
voxel | Coords3 |
LightOperations
Ƭ LightOperations: Object
Type declaration
| Name | Type |
|---|---|
floods | { blue: LightNode[] ; green: LightNode[] ; red: LightNode[] ; sunlight: LightNode[] } |
floods.blue | LightNode[] |
floods.green | LightNode[] |
floods.red | LightNode[] |
floods.sunlight | LightNode[] |
hasOperations | boolean |
removals | { blue: Coords3[] ; green: Coords3[] ; red: Coords3[] ; sunlight: Coords3[] } |
removals.blue | Coords3[] |
removals.green | Coords3[] |
removals.red | Coords3[] |
removals.sunlight | Coords3[] |
LightShinedOptions
Ƭ LightShinedOptions: Object
Type declaration
| Name | Type | Description |
|---|---|---|
lerpFactor | number | The lerping factor of the brightness of each mesh. Defaults to 0.1. |
maxBrightness | number | The maximum brightness cap for the light effect. Defaults to 2.5. |
LightWorkerModifiedChunk
Ƭ LightWorkerModifiedChunk: Object
Type declaration
| Name | Type |
|---|---|
coords | Coords2 |
lights | Uint32Array |
maxY | number |
minY | number |
LightWorkerResult
Ƭ LightWorkerResult: Object
Type declaration
| Name | Type |
|---|---|
appliedDeltas | { lastSequenceId: number } |
appliedDeltas.lastSequenceId | number |
jobId | string |
modifiedChunks | LightWorkerModifiedChunk[] |
MemoryPressureOptions
Ƭ MemoryPressureOptions: Object
Type declaration
| Name | Type | Description |
|---|---|---|
recoveryHeapRatio | number | Ratio at or below which pressure is considered relieved. Kept under MemoryPressureOptions.sheddingHeapRatio so the monitor has hysteresis instead of flapping around a single threshold. |
sampleIntervalMs | number | Milliseconds between heap samples. Zero or less disables the watchdog. |
shedCooldownMs | number | Minimum milliseconds between two shed actions while pressure persists. |
sheddingHeapRatio | number | usedJSHeapSize / 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. |
sheddingSampleCount | number | Consecutive 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
| Name | Type | Description |
|---|---|---|
heapLimitBytes | number | - |
heapRatio | number | - |
heapUsedBytes | number | - |
isHeapReadable | boolean | False on engines that expose no heap numbers; the monitor stays inert. |
isUnderPressure | boolean | - |
shedCount | number | - |
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
| Name | Type |
|---|---|
bytes | number |
count | number |
maxMs | number |
totalMs | number |
MeshResultType
Ƭ MeshResultType: Object
Type declaration
| Name | Type |
|---|---|
indices | Float32Array |
normals | Float32Array |
positions | Float32Array |
MeshTransferBenchmarkIteration
Ƭ MeshTransferBenchmarkIteration: Object
Type declaration
| Name | Type |
|---|---|
inputBytes | number |
outputBytes | number |
serializeMs | number |
totalMs | number |
workerMs | number |
MeshTransferBenchmarkModeResult
Ƭ MeshTransferBenchmarkModeResult: Object
Type declaration
| Name | Type |
|---|---|
avgSerializeMs | number |
avgTotalMs | number |
avgWorkerMs | number |
isSharedArrayBufferAvailable | boolean |
iterations | MeshTransferBenchmarkIteration[] |
measuredIterations | number |
p50TotalMs | number |
p95TotalMs | number |
strategy | WorkerTransferStrategy |
totalInputBytes | number |
totalOutputBytes | number |
warmupIterations | number |
MeshTransferBenchmarkOptions
Ƭ MeshTransferBenchmarkOptions: Object
Type declaration
| Name | Type |
|---|---|
cx | number |
cz | number |
level? | number |
measuredIterations? | number |
warmupIterations? | number |
MeshTransferBenchmarkResult
Ƭ MeshTransferBenchmarkResult: Object
Type declaration
| Name | Type |
|---|---|
cx | number |
cz | number |
level | number |
serializeSpeedup | number |
shared | MeshTransferBenchmarkModeResult |
speedup | number |
transfer | MeshTransferBenchmarkModeResult |
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
| Name | Type |
|---|---|
cx | number |
cz | number |
level | number |
Returns
Promise<{ geometries: object[] ; inputBytes: number ; outputBytes: number ; serializeMs: number ; workerMs: number } | null>
MeshWorkerTransferSample
Ƭ MeshWorkerTransferSample: Object
Type declaration
| Name | Type |
|---|---|
at | number |
inputBytes | number |
outputBytes | number |
serializeMs | number |
strategy | WorkerTransferStrategy |
totalMs | number |
workerMs | number |
MeshWorkerTransferStats
Ƭ MeshWorkerTransferStats: Object
Type declaration
| Name | Type |
|---|---|
jobCount | number |
recentSamples | MeshWorkerTransferSample[] |
strategy | WorkerTransferStrategy |
totalInputBytes | number |
totalOutputBytes | number |
totalSerializeMs | number |
totalWorkerMs | number |
NameTagOptions
Ƭ NameTagOptions: Object
Parameters to create a name tag.
Type declaration
| Name | Type | Description |
|---|---|---|
backgroundColor? | string | The background color of the name tag. Defaults to 0x00000077. |
color? | string | The color of the name tag. Defaults to 0xffffff. |
fontFace? | string | The font face to create the name tag. Defaults to "monospace". |
fontSize? | number | The font size to create the name tag. Defaults to 0.1. |
yOffset? | number | The y-offset of the nametag moved upwards. Defaults to 0. |
NetworkConnectionOptions
Ƭ NetworkConnectionOptions: Object
Type declaration
| Name | Type | Description |
|---|---|---|
reconnectTimeout? | number | Milliseconds 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
| Name | Type | Description |
|---|---|---|
joinRetryTimeout | number | Milliseconds a (re)join handshake may await its INIT before the join request is sent again. |
maxBacklogFactor | number | - |
maxPacketsPerTick | number | - |
maxPendingCommandPackets | number | Upper 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. |
maxQueuedPackets | number | Upper 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
| Name | Type |
|---|---|
K | extends keyof any |
T | T |
PeersOptions
Ƭ PeersOptions: Object
Parameters to customize the peers manager.
Type declaration
| Name | Type | Description |
|---|---|---|
autoAddToSelf | boolean | - |
countSelf | boolean | Whether 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. |
updateChildren | boolean | Whether 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
| Name | Type | Description |
|---|---|---|
blockMargin | number | The 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. |
ignoreFluids | boolean | Whether or not should the camera ignore fluid block collisions. Defaults to true. |
ignoreSeeThrough | boolean | Whether or not should the camera ignore see-through block collisions. Defaults to true. |
lerpFactor | number | The lerping factor for the camera's position. Defaults to 0.5. |
maxDistance | number | The maximum distance the camera can go from the player's center. Defaults to 5. |
swimDistanceBonus | number | Extra camera distance while swimming in second/third person. Defaults to 3. |
PortraitOptions
Ƭ PortraitOptions: Object
Parameters to create a portrait with.
Type declaration
| Name | Type | Description |
|---|---|---|
height | number | The height of the portrait canvas. Defaults to 100 pixels. |
lightRotationOffset | number | The rotation around the y axis about the camera. This is used to calculate the position of the light. Defaults to -Math.PI / 8. |
perspective | CameraPerspective | The 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. |
renderOnce | boolean | Whether or not should this portrait only render once. Defaults to false. |
width | number | The width of the portrait canvas. Defaults to 100 pixels. |
zoom | number | The 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
| Name | Type |
|---|---|
newBlock | Block |
newId | number |
newRotation | BlockRotation |
oldBlock | Block |
oldId | number |
oldRotation | BlockRotation |
oldStage | number |
stage | number |
voxel | Coords3 |
ProtocolWS
Ƭ ProtocolWS: WebSocket & { sendEvent: (event: any) => boolean }
RigidControlState
Ƭ RigidControlState: Object
The state of which a Voxelize Controls is in.
Type declaration
| Name | Type | Description |
|---|---|---|
crouching | boolean | Whether if the client is attempting to crouch, if the crouch key is pressed. Defaults to false. |
currentJumpTime | number | The current amount of time spent in the air from jump. Defaults to 0. |
heading | number | In radians, the heading y-rotation of the client. Defaults to 0. |
isJumping | boolean | Whether or not is the client jumping, in the air. Defaults to false. |
jumpCount | number | How many times has the client jumped. Defaults to 0. |
jumping | boolean | Whether if the client is attempting to jump, if the jump key is pressed. Defaults to false. |
running | boolean | Whether if the client is running. Defaults to false. |
sprinting | boolean | Whether 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
| Name | Type | Description |
|---|---|---|
airJumps | number | How many times can a client jump in the air. Defaults to 0. |
airMoveMult | number | The factor applied to the movements of the client in air, such as while half-jump. Defaults to 0.7. |
alwaysSprint | boolean | Sprint factor would be on always. Defaults to false. |
bodyDepth | number | The depth of the client's avatar. Defaults to 0.8 blocks. |
bodyHeight | number | The height of the client's avatar. Defaults to 1.55 blocks. |
bodyWidth | number | The width of the client's avatar. Defaults to 0.8 blocks. |
crouchBodyHeight | number | The height of the client's avatar when crouching. Defaults to bodyHeight * 0.83. |
crouchFactor | number | The factor to the movement speed when crouch is applied. Defaults to 0.6. |
eyeHeight | number | The ratio to bodyHeight at which the camera is placed from the ground. Defaults at 0.9193548387096774. |
fluidPushForce | number | The force upwards when a client tries to jump in water. Defaults to 0.3. |
flyClimbSpeedPenalty | number | Fraction of fly speed lost at a straight-up climb when pitch steering is active, trading speed for altitude. Defaults to 0. |
flyDiveSpeedBoost | number | Extra 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. |
flyForce | number | The level of force at which a client flies at. Defaults to 80. |
flyImpulse | number | The level impulse of which a client flies at. Defaults to 2.5. |
flyInertia | number | The inertia of a client when they're flying. Defaults to 6. |
flyPitchSteering | number | How 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. |
flySpeed | number | The level of speed at which a client flies at. Defaults to 40. |
initialDirection | Coords3 | - |
initialPosition | Coords3 | Initial position of the client. Defaults to (0, 80, 10). |
jumpForce | number | The level of force applied to the client when jumping. Defaults to 1. |
jumpImpulse | number | The level of impulse at which the client jumps upwards. Defaults to 8. |
jumpTime | number | The time, in milliseconds, that a client can be jumping. Defaults to 50ms. |
maxPolarAngle | number | Maximum polar angle that camera can look up to. Defaults to Math.PI * 0.99 |
maxSpeed | number | The maximum level of speed of a client. Default is 6 . |
minPolarAngle | number | Minimum polar angle that camera can look down to. Defaults to Math.PI * 0.01. |
moveForce | number | The level of force of which the client can move at. Default is 30. |
positionLerp | number | The interpolation factor of the client's position. Defaults to 1.0. |
responsiveness | number | The level of responsiveness of a client to movements. Default is 240. |
restoreFootSnapEpsilon | number | - |
rotationLerp | number | The interpolation factor of the client's rotation. Defaults to 0.9. |
runningFriction | number | Default running friction of a client. Defaults to 0.1. |
sensitivity | number | The mouse sensitivity. Defaults to 100. |
sprintFactor | number | The factor to the movement speed when sprint is applied. Defaults to 1.4. |
standingFriction | number | Default standing friction of a client. Defaults to 4. |
stepHeight | number | How tall a client can step up. Defaults to 0.5. |
stepLerp | number | The interpolation factor when the client is auto-stepping. Defaults to 0.6. |
swimAABBLerp | number | Lerp factor for the swim hitbox height transition. Defaults to 0.08. |
swimBodyHeight | number | Collision height while swimming. Defaults to 0.4. |
swimForce | number | Force applied while swimming. Defaults to 28. |
swimFriction | number | Friction while swimming and moving. Defaults to 0.05. |
swimIdleStandDelay | number | Time without swim movement input before returning to an upright pose. Defaults to 3000. |
swimRestoreGraceFrames | number | Frames to keep the swim AABB after restoring a saved swimming session. Defaults to 2. |
swimSpeed | number | Target speed while swimming. Defaults to 4.5. |
swimSubmersionRatio | number | Minimum ratio of the body submerged before swimming mechanics activate. Defaults to 0.95. |
SectionExtentOptions
Ƭ SectionExtentOptions: Object
Type declaration
| Name | Type |
|---|---|
chunkSize | number |
maxHeight | number |
subChunks | number |
SectionVisibilityGraphOptions
Ƭ SectionVisibilityGraphOptions: Object
Type declaration
| Name | Type |
|---|---|
chunkSize | number |
maxHeight | number |
subChunks | number |
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
| Name | Type | Description |
|---|---|---|
dimension | number | The dimension of the dodecahedron sky. The inner canvas box is 0.8 times this dimension. |
lerpFactor | number | The 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. |
textureBloomIntensity | number | The emissive boost applied to painted sky texels above textureBloomThreshold. Defaults to 2.0. |
textureBloomThreshold | number | The luminance at which painted sky textures begin to feed bloom. Defaults to 0.72. |
transitionSpan | number | - |
SkyShadingCycleData
Ƭ SkyShadingCycleData: Object
Type declaration
| Name | Type |
|---|---|
color | { bottom: Color | string ; middle: Color | string ; top: Color | string } |
color.bottom | Color | string |
color.middle | Color | string |
color.top | Color | string |
name | string |
skyOffset | number |
start | number |
voidOffset | number |
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
| Name | Type |
|---|---|
payload | SoundEffectEventPayload |
Returns
void
SoundEffectEventPayload
Ƭ SoundEffectEventPayload: Object
Type declaration
| Name | Type |
|---|---|
id | string |
pitch? | number |
position? | [number, number, number] |
radius? | number |
sourceClientId? | string |
volume? | number |
TabCompleteContext
Ƭ TabCompleteContext: Object
Options for adding a command.
Type declaration
| Name | Type |
|---|---|
args | Record<string, string> |
TargetType
Ƭ TargetType: "All" | "Player" | "Entity"
TextureInfo
Ƭ TextureInfo: Object
Type declaration
| Name | Type |
|---|---|
blockId | number |
blockName | string |
canvas | HTMLCanvasElement | null |
faceName | string |
materialKey | string |
range | UV | null |
type | "shared" | "independent" | "isolated" |
TransparencyFlags
Ƭ TransparencyFlags: Object
Type declaration
| Name | Type |
|---|---|
isFluid | boolean |
isSeeThrough | boolean |
lightAttenuation | number |
transparentStandalone | boolean |
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
| Name | Type |
|---|---|
count | number |
faces | number |
maxMs | number |
totalMs | number |
UV
Ƭ UV: Object
The UV range of a texture on the texture atlas.
Type declaration
| Name | Type | Description |
|---|---|---|
endU | number | The ending U coordinate of the texture. |
endV | number | The ending V coordinate of the texture. |
startU | number | The starting U coordinate of the texture. |
startV | number | The starting V coordinate of the texture. |
VoxelDelta
Ƭ VoxelDelta: Object
Type declaration
| Name | Type |
|---|---|
coords | Coords3 |
newRotation? | BlockRotation |
newStage? | number |
newVoxel | number |
oldRotation? | BlockRotation |
oldStage? | number |
oldVoxel | number |
sequenceId | number |
timestamp | number |
VoxelInteractOptions
Ƭ VoxelInteractOptions: Object
Parameters to customize the VoxelInteract instance.
Type declaration
| Name | Type | Description |
|---|---|---|
highlightColor | Color | The color of the highlight. Defaults to 0xffffff. |
highlightLerp | number | The lerping factor of the highlight. Defaults to 0.8. |
highlightOpacity | number | The opacity of the highlight. Defaults to 0.8. |
highlightScale | number | The 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". |
ignoreFluids | boolean | Whether or not should the VoxelInteract instance ignore fluids when raycasting. Defaults to true. |
inverseDirection | boolean | Whether or not should the VoxelInteract instance reverse the raycasting direction. Defaults to false. |
potentialVisuals | boolean | Debug Whether or not should there be arrows indicating the potential block placement's orientations. Defaults to false. |
reachDistance | number | The maximum distance of reach for the VoxelInteract instance. Defaults to 32. |
VoxelLightVolumeOptions
Ƭ VoxelLightVolumeOptions: Object
Type declaration
| Name | Type |
|---|---|
chunkSize | number |
maxChunk | [number, number] |
maxHeight | number |
maxLightLevel | number |
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
| Name | Type |
|---|---|
blue | number |
green | number |
red | number |
WaterColumnSample
Ƭ WaterColumnSample: Object
Type declaration
| Name | Type |
|---|---|
depth | number |
surfaceY | number |
WaterOpticsFrameInput
Ƭ WaterOpticsFrameInput: Object
Type declaration
| Name | Type |
|---|---|
cameraX | number |
cameraY | number |
cameraZ | number |
deltaSeconds | number |
isFluidAt | FluidQuery |
sunStrength | number |
WorkerPoolJob
Ƭ WorkerPoolJob: Object
A worker pool job is queued to a worker pool and is executed by a worker.
Type declaration
| Name | Type | Description |
|---|---|---|
buffers? | Transferable[] | Any array buffers (transferable) that are passed to the worker. |
message | any | A JSON serializable object that is passed to the worker. |
resolve | (value: any) => void | - |
timeoutMs? | number | Milliseconds 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
| Name | Type | Description |
|---|---|---|
maxQueuedJobs? | number | Jobs 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. |
maxWorker | number | The maximum number of workers to create. Defaults to 8. |
name? | string | The 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
| Name | Type |
|---|---|
maxRecentSamples | number |
mode | WorkerTransferMode |
WorkerTransferMode
Ƭ WorkerTransferMode: "auto" | WorkerTransferStrategy
WorkerTransferStrategy
Ƭ WorkerTransferStrategy: "transfer" | "shared"
WorldChunkEvents
Ƭ WorldChunkEvents: Object
Type declaration
| Name | Type |
|---|---|
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
| Name | Type | Description |
|---|---|---|
chunkCullShadowSafeDistance | number | Blocks 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. |
chunkLoadExponent | number | The 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. |
chunkRerequestIntervalMs | number | How long a requested chunk may go unanswered before the request is presumed lost and reissued, in milliseconds. Defaults to 5000ms. |
chunkUniformsOverwrite | Partial<ChunkRenderer["uniforms"]> | The uniforms to overwrite the default chunk material uniforms. Defaults to {}. |
clientOnlyMeshing | boolean | Whether 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. |
cloudsOptions | Partial<CloudsOptions> | The options to create the clouds. Defaults to {}. |
defaultRenderRadius | number | The default render radius of the world, in chunks. Change this through world.renderRadius. Defaults to 8 chunks. |
deltaRetentionTime | number | How long to retain delta history in milliseconds. Defaults to 5000ms. |
distantDetailCullBelowY | number | null | World 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. |
distantDetailCullHysteresis | number | How 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. |
fogCullSlack | number | Blocks 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. |
fogFarRenderRatio | number | Fraction of render distance where horizon fog fully hides terrain. Defaults to 0.78. |
fogNearRenderRatio | number | Fraction of render distance where horizon fog starts. Defaults to 0.45. |
isCullingChunksByFog | boolean | Whether the occlusion walk also prunes sections past the fog's far edge, where every fragment already resolves to pure fog color. |
isCullingChunksByFrustum | boolean | Whether 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. |
isCullingChunksByOcclusion | boolean | Whether 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. |
lightJobRetryLimit | number | Maximum number of retries for stale light jobs before falling back to sync. Defaults to 3. |
lightJobTimeoutMs | number | Milliseconds 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. |
maxChunkRequestsPerUpdate | number | The maximum chunk requests this world can request from the server per world update. Defaults to 12 chunks. |
maxDetailRefinementsPerUpdate | number | How 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. |
maxImmediateServerUpdates | number | Server 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. |
maxLightWorkers | number | Maximum concurrent light workers. Defaults to 2. |
maxLightsUpdateTime | number | - |
maxMeshesPerUpdate | number | - |
maxOptimisticClientUpdates | number | Client 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. |
maxProcessesPerUpdate | number | The 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. |
maxQueuedWorkerJobs | number | Jobs 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. |
maxUpdatesPerUpdate | number | The maximum voxel updates that can be sent to the server per world update. Defaults to 1000 updates. |
maxUrgentMeshWorkers | number | Dedicated mesh workers reserved for client-originated voxel edits. |
maxVoxelHistoryPerVoxel | number | Previous values retained per voxel. Defaults to 4. |
maxVoxelHistoryVoxels | number | Distinct 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. |
memoryPressure | Partial<MemoryPressureOptions> | Renderer heap watchdog thresholds. See MemoryPressureOptions. |
mergeChunkGeometries | boolean | Whether to merge chunk geometries to reduce draw calls. Useful for mobile. Defaults to false. |
meshApplyBudgetMs | number | Per-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. |
meshJobTimeoutMs | number | Milliseconds a mesh worker job may run before its worker is presumed dead and replaced. Defaults to 30000. |
minLightLevel | number | The minimum light level even when sunlight and torch light levels are at zero. Defaults to 0.04. |
nearDetailRadius | number | Chunk radius within which every sub-chunk level is meshed regardless of distantDetailCullBelowY. Defaults to 10 chunks. |
plantDetailDistance | number | null | Block 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. |
regionArenas | ChunkRegionArenasOptions | null | Region buffer arenas for the shared-opaque chunk bucket. See ChunkRegionArenasOptions. null disables batching and keeps per-section meshes. |
skyOptions | Partial<SkyOptions> | The options to create the sky. Defaults to {}. |
statsSyncInterval | number | The interval between each time the world requests the server for its stats. Defaults to 500ms. |
sunlightChangeSpan | number | The fraction of the day that sunlight takes to change from appearing to disappearing or disappearing to appearing. Defaults to 0.1. |
sunlightEndTimeFrac | number | The fraction of the day that sunlight starts to disappear. Defaults to 0.7. |
sunlightStartTimeFrac | number | The fraction of the day that sunlight starts to appear. Defaults to 0.25. |
swayProfileCapacity | number | Slots 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. |
textureUnitDimension | number | The 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. |
timeForceThreshold | number | The threshold to force the server's time to the client's time. Defaults to 0.1. |
useLightWorkers | boolean | Whether to use web workers for light calculations. Defaults to true. |
WorldFogRange
Ƭ WorldFogRange: Object
Type declaration
| Name | Type |
|---|---|
far | number |
near | number |
WorldMemoryCounters
Ƭ WorldMemoryCounters: Object
A snapshot of every queue and in-flight set in the voxel update -> relight -> remesh pipeline. See World.getMemoryCounters.
Type declaration
| Name | Type |
|---|---|
activeLightBatchPendingJobs | number |
activeLightBatchUndispatchedJobs | number |
blockUpdatesQueue | number |
blockUpdatesToEmit | number |
lightJobHighWaterChunks | number |
lightJobQueue | number |
lightQueue | number |
lightQueuedBytes | number |
lightWorking | number |
loadedChunks | number |
memoryPressure | MemoryPressureStatus |
meshDirtyKeys | number |
meshInFlightJobs | number |
meshQueue | number |
meshQueuedBytes | number |
meshWorking | number |
urgentMeshQueue | number |
urgentMeshQueuedBytes | number |
urgentMeshWorking | number |
voxelDeltaChunks | number |
voxelDeltaTotal | number |
voxelHistoryVoxels | number |
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
| Name | Type | Description |
|---|---|---|
airDrag | number | The air drag of everything physical. |
chunkSize | number | The width and depth of a chunk, in blocks. |
doesTickTime | boolean | - |
fluidDensity | number | The density of the fluid in this world. |
fluidDrag | number | The fluid drag of everything physical. |
gravity | number[] | The gravity of everything physical in this world. |
maxChunk | [number, number] | The maximum chunk coordinate of this world, inclusive. |
maxHeight | number | The height of a chunk, in blocks. |
maxLightLevel | number | The maximum light level that propagates in this world, including sunlight and torch light. |
minBounceImpulse | number | The minimum bouncing impulse of everything physical in this world. |
minChunk | [number, number] | The minimum chunk coordinate of this world, inclusive. |
subChunks | number | The number of sub-chunks that divides a chunk vertically. |
timePerDay | number | The time per day in seconds. |
waterLevel | number | The 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
| Name | Type |
|---|---|
fragment | string |
vertex | string |
SHADER_LIGHTING_CROSS_CHUNK_SHADERS
• Const SHADER_LIGHTING_CROSS_CHUNK_SHADERS: Object
Type declaration
| Name | Type |
|---|---|
fragment | string |
vertex | string |
SHADER_LIGHTING_FLUID_CHUNK_SHADERS
• Const SHADER_LIGHTING_FLUID_CHUNK_SHADERS: Object
Type declaration
| Name | Type |
|---|---|
fragment | string |
vertex | string |
SHADER_LIGHTING_SEE_THROUGH_CHUNK_SHADERS
• Const SHADER_LIGHTING_SEE_THROUGH_CHUNK_SHADERS: Object
Type declaration
| Name | Type |
|---|---|
fragment | string |
vertex | string |
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
| Name | Type |
|---|---|
drawCrown | ArtFunction |
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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
object | Object3D<Object3DEventMap> |
Returns
fn
▸ (a, b): number
Parameters
| Name | Type |
|---|---|
a | TransparentSortItem |
b | TransparentSortItem |
Returns
number
analyzeLightOperations
▸ analyzeLightOperations(world, processedUpdates): LightOperations
Parameters
| Name | Type |
|---|---|
world | VoxelLightVolume |
processedUpdates | ProcessedUpdate[] |
Returns
annotateIncomingMessages
▸ annotateIncomingMessages(messages, byteSizes): void
Parameters
| Name | Type |
|---|---|
messages | MessageProtocol[] |
byteSizes | number[] |
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
| Name | Type |
|---|---|
material | ShaderMaterial |
unitsPerBlock | number |
Returns
void
blockSlot
▸ blockSlot(id, count): SlotContent
Parameters
| Name | Type |
|---|---|
id | number |
count | number |
Returns
buildLightJobs
▸ buildLightJobs(lightOps, startSequenceId, batchId, options, allocateJobId): LightJob[]
Parameters
| Name | Type |
|---|---|
lightOps | LightOperations |
startSequenceId | number |
batchId | number |
options | VoxelLightVolumeOptions |
allocateJobId | (color: LightColor) => string |
Returns
LightJob[]
compareChunkRequestPriority
▸ compareChunkRequestPriority(a, b): number
Parameters
| Name | Type |
|---|---|
a | ChunkRequestCandidate |
b | ChunkRequestCandidate |
Returns
number
configurePerfLogging
▸ configurePerfLogging(isEnabled): void
Parameters
| Name | Type |
|---|---|
isEnabled | boolean |
Returns
void
createEntityShadowUniforms
▸ createEntityShadowUniforms(): EntityShadowUniforms
Returns
createPerfTraceId
▸ createPerfTraceId(): string
Returns
string
createSkyFogFragment
▸ createSkyFogFragment(depthExpression?): string
Parameters
| Name | Type | Default value |
|---|---|---|
depthExpression | string | "sqrt(dot(fogDiff, fogDiff))" |
Returns
string
createSwayShader
▸ createSwayShader(baseShaders, options?): Object
Parameters
| Name | Type |
|---|---|
baseShaders | Object |
baseShaders.fragment | string |
baseShaders.vertex | string |
options | Partial<{ amplitude: number ; rooted: boolean ; scale: number ; speed: number ; yScale: number }> |
Returns
Object
| Name | Type |
|---|---|
fragmentShader | string |
vertexShader | string |
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
| Name | Type |
|---|---|
baseShaders | Object |
baseShaders.fragment | string |
baseShaders.vertex | string |
profileCapacity | number |
Returns
Object
| Name | Type |
|---|---|
fragmentShader | string |
vertexShader | string |
createUnderwaterFogUniforms
▸ createUnderwaterFogUniforms(): UnderwaterFogUniforms
Returns
cull
▸ cull(array, options): Promise<MeshResultType>
Parameters
| Name | Type |
|---|---|
array | NdArray<number[] | TypedArray | GenericArray<number>> |
options | CullOptionsType |
Returns
Promise<MeshResultType>
decodeHeldObject
▸ decodeHeldObject(raw): SlotContent
Parameters
| Name | Type |
|---|---|
raw | number |
Returns
emptySlot
▸ emptySlot(): SlotContent
Returns
encodeHeldObject
▸ encodeHeldObject(slot): number
Parameters
| Name | Type |
|---|---|
slot | SlotContent |
Returns
number
findSimilar
▸ findSimilar(target, available, options?): string[]
Parameters
| Name | Type |
|---|---|
target | string |
available | string[] |
options | FindSimilarOptions |
Returns
string[]
floodLight
▸ floodLight(world, queue, color, min?, max?): void
Parameters
| Name | Type |
|---|---|
world | VoxelLightVolume |
queue | LightNode[] |
color | LightColor |
min? | Coords3 |
max? | Coords3 |
Returns
void
formatSuggestion
▸ formatSuggestion(suggestions, allAvailable, options?): string
Parameters
| Name | Type |
|---|---|
suggestions | string[] |
allAvailable | string[] |
options | FormatSuggestionOptions |
Returns
string
getDownwellingTransmittance
▸ getDownwellingTransmittance(depth, out): Color
Parameters
| Name | Type |
|---|---|
depth | number |
out | Color |
Returns
Color
getEffectiveScatterStrength
▸ getEffectiveScatterStrength(sunStrength): number
Parameters
| Name | Type |
|---|---|
sunStrength | number |
Returns
number
getImageComp
▸ getImageComp(item): ImageComp | undefined
Parameters
| Name | Type |
|---|---|
item | ItemDef |
Returns
ImageComp | undefined
getItemComponent
▸ getItemComponent<T>(item, key): T | undefined
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
item | ItemDef |
key | string |
Returns
T | undefined
getLightColorMask
▸ getLightColorMask(color): number
Parameters
| Name | Type |
|---|---|
color | LightColor |
Returns
number
getMeshTransferStatus
▸ getMeshTransferStatus(): Object
Returns
Object
| Name | Type |
|---|---|
isCrossOriginIsolated | boolean |
isSharedArrayBufferAvailable | boolean |
mode | WorkerTransferMode |
pool | ChunkSharedPoolStats |
stats | MeshWorkerTransferStats | Record<WorkerTransferStrategy, MeshWorkerTransferStats> |
strategy | WorkerTransferStrategy |
getSlotData
▸ getSlotData<T>(slot, key): T | undefined
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
slot | SlotContent |
key | string |
Returns
T | undefined
getSlotDurability
▸ getSlotDurability(slot): number | undefined
Parameters
| Name | Type |
|---|---|
slot | SlotContent |
Returns
number | undefined
getUnderwaterAmbientColor
▸ getUnderwaterAmbientColor(depth, sunStrength, out): Color
Parameters
| Name | Type |
|---|---|
depth | number |
sunStrength | number |
out | Color |
Returns
Color
hasItemComponent
▸ hasItemComponent(item, key): boolean
Parameters
| Name | Type |
|---|---|
item | ItemDef |
key | string |
Returns
boolean
hasSlotData
▸ hasSlotData(slot, key): boolean
Parameters
| Name | Type |
|---|---|
slot | SlotContent |
key | string |
Returns
boolean
isEntityMetadataFrozen
▸ isEntityMetadataFrozen(metadata): boolean
Parameters
| Name | Type |
|---|---|
metadata | MutableMetadata |
Returns
boolean
isMainThreadSortedBlock
▸ isMainThreadSortedBlock(block): boolean
Parameters
| Name | Type |
|---|---|
block | TransparencyFlags |
Returns
boolean
isPerfLogging
▸ isPerfLogging(): boolean
Returns
boolean
isSelfIlluminated
▸ isSelfIlluminated(material): boolean
Parameters
| Name | Type |
|---|---|
material | Material |
Returns
boolean
isSharedOpaqueMaterialBlock
▸ isSharedOpaqueMaterialBlock(block): boolean
Parameters
| Name | Type |
|---|---|
block | Block |
Returns
boolean
itemSlot
▸ itemSlot(id, count, data?): SlotContent
Parameters
| Name | Type |
|---|---|
id | number |
count | number |
data | Record<string, unknown> |
Returns
itemSlotWithDurability
▸ itemSlotWithDurability(id, count, durability): SlotContent
Parameters
| Name | Type |
|---|---|
id | number |
count | number |
durability | number |
Returns
loadChunkMaterials
▸ loadChunkMaterials(world): Promise<void>
Parameters
| Name | Type |
|---|---|
world | ChunkMaterialHost & { getBlockById: (id: number) => Block ; registry: Registry } |
Returns
Promise<void>
logChatRendered
▸ logChatRendered(chat): void
Parameters
| Name | Type |
|---|---|
chat | ChatProtocol |
Returns
void
logChatWireSend
▸ logChatWireSend(message, byteSize): void
Parameters
| Name | Type |
|---|---|
message | MessageProtocol |
byteSize | number |
Returns
void
logIncomingMessage
▸ logIncomingMessage(message): void
Parameters
| Name | Type |
|---|---|
message | MessageProtocol |
Returns
void
logPerf
▸ logPerf(event, fields?): void
Parameters
| Name | Type |
|---|---|
event | string |
fields | Record<string, PerfField> |
Returns
void
makeChunkMaterialKey
▸ makeChunkMaterialKey(world, id, faceName?, voxel?): string
Parameters
| Name | Type |
|---|---|
world | Object |
world.getBlockById | (id: number) => Block |
world.hasCustomBlockMaterial | (id: number) => boolean |
id | number |
faceName? | string |
voxel? | Coords3 |
Returns
string
makeChunkShaderMaterial
▸ makeChunkShaderMaterial(world, fragmentShader?, vertexShader?, uniforms?): CustomChunkShaderMaterial
Parameters
| Name | Type |
|---|---|
world | ChunkMaterialHost |
fragmentShader? | string |
vertexShader? | string |
uniforms | Record<string, Uniform<any>> |
Returns
makeSceneColorTexture
▸ makeSceneColorTexture(width?, height?, isSRGB?): FramebufferTexture
Parameters
| Name | Type | Default value |
|---|---|---|
width | number | 1 |
height | number | 1 |
isSRGB | boolean | false |
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
| Name | Type |
|---|---|
material | Material |
Returns
void
measureWaterColumn
▸ measureWaterColumn(isFluidAt, x, y, z): WaterColumnSample | null
Parameters
| Name | Type |
|---|---|
isFluidAt | FluidQuery |
x | number |
y | number |
z | number |
Returns
WaterColumnSample | null
mergeLightOperations
▸ mergeLightOperations(existing, newOps): LightOperations
Parameters
| Name | Type |
|---|---|
existing | LightOperations |
newOps | LightOperations |
Returns
mergeSingleColorResult
▸ mergeSingleColorResult(chunk, lights, color, boundingBox): void
Parameters
| Name | Type |
|---|---|
chunk | Chunk |
lights | Uint32Array<ArrayBufferLike> |
color | LightColor |
boundingBox | BoundingBox |
Returns
void
positionUnitsPerBlock
▸ positionUnitsPerBlock(options): number
Parameters
| Name | Type |
|---|---|
options | SectionExtentOptions |
Returns
number
prepareTransparentMesh
▸ prepareTransparentMesh(mesh): TransparentMeshData | null
Parameters
| Name | Type |
|---|---|
mesh | Mesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, Material | Material[], Object3DEventMap> |
Returns
TransparentMeshData | null
quantizeNormals
▸ quantizeNormals(normals): Int8Array
Parameters
| Name | Type |
|---|---|
normals | Float32Array<ArrayBufferLike> |
Returns
Int8Array
quantizePositions
▸ quantizePositions(positions, unitsPerBlock): Uint16Array
Parameters
| Name | Type |
|---|---|
positions | number[] | Float32Array<ArrayBufferLike> |
unitsPerBlock | number |
Returns
Uint16Array
quantizeUvs
▸ quantizeUvs(uvs): Uint16Array
Parameters
| Name | Type |
|---|---|
uvs | number[] | Float32Array<ArrayBufferLike> |
Returns
Uint16Array
readChromiumHeap
▸ readChromiumHeap(): HeapSample
Returns
removeLight
▸ removeLight(world, voxel, color): void
Parameters
| Name | Type |
|---|---|
world | VoxelLightVolume |
voxel | Coords3 |
color | LightColor |
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
| Name | Type |
|---|---|
world | VoxelLightVolume |
voxels | Coords3[] |
color | LightColor |
Returns
void
requestWorkerAnimationFrame
▸ requestWorkerAnimationFrame(callback): number
Parameters
| Name | Type |
|---|---|
callback | () => void |
Returns
number
runMeshTransferBenchmark
▸ runMeshTransferBenchmark(dispatch, getChunk, options): Promise<MeshTransferBenchmarkResult>
Parameters
| Name | Type |
|---|---|
dispatch | MeshTransferDispatch |
getChunk | (cx: number, cz: number) => Chunk |
options | MeshTransferBenchmarkOptions |
Returns
Promise<MeshTransferBenchmarkResult>
setPerfWorld
▸ setPerfWorld(world): void
Parameters
| Name | Type |
|---|---|
world | string |
Returns
void
setSlotData
▸ setSlotData<T>(slot, key, value): SlotContent
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
slot | SlotContent |
key | string |
value | T |
Returns
setWorkerInterval
▸ setWorkerInterval(func, interval): () => void
Parameters
| Name | Type |
|---|---|
func | () => void |
interval | number |
Returns
fn
▸ (): void
Returns
void
setupTransparentSorting
▸ setupTransparentSorting(object): void
Parameters
| Name | Type |
|---|---|
object | Object3D<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
| Name | Type |
|---|---|
block | Block |
Returns
string | null
sortTransparentMesh
▸ sortTransparentMesh(mesh, data, camera): void
Parameters
| Name | Type |
|---|---|
mesh | Mesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, Material | Material[], Object3DEventMap> |
data | TransparentMeshData |
camera | Camera |
Returns
void
stampChatPerf
▸ stampChatPerf(chat): void
Parameters
| Name | Type |
|---|---|
chat | ChatProtocol |
Returns
void
updateEntityShadowUniforms
▸ updateEntityShadowUniforms(target, source): void
Parameters
| Name | Type |
|---|---|
target | EntityShadowUniforms |
source | ShaderLightingUniforms |
Returns
void
updateUnderwaterFogUniforms
▸ updateUnderwaterFogUniforms(target, source): void
Parameters
| Name | Type |
|---|---|
target | UnderwaterFogUniforms |
source | UnderwaterFogSource |
Returns
void