Skip to main content

@voxelize/core

Enumerations

Core Classes

Effects Classes

Other Classes

Utils Classes

Interfaces

Type Aliases

ArgMetadata

Ƭ ArgMetadata: Object

Metadata extracted from a Zod schema for UI purposes.

Type declaration

NameType
defaultValue?string | number | boolean
namestring
options?string[]
requiredboolean
type"string" | "number" | "enum" | "boolean"

ArmOptions

Ƭ ArmOptions: Object

Type declaration

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

ArmsOptions

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

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

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

ArrowOptions

Ƭ ArrowOptions: Object

Parameters to create an arrow.

Type declaration

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

ArtFunction

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

A function to programmatically draw on a canvas.

Type declaration

▸ (context, canvas): void

Parameters
NameType
contextCanvasRenderingContext2D
canvasHTMLCanvasElement
Returns

void


Block

Ƭ Block: Object

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

Type declaration

NameTypeDescription
aabbsAABB[]A list of axis-aligned bounding boxes that this block has.
blueLightLevelnumberThe blue light level of the block.
dynamicFn(pos: Coords3) => { aabbs: Block["aabbs"] ; faces: Block["faces"] ; isTransparent: Block["isTransparent"] }-
dynamicPatternsBlockDynamicPattern[]-
faces{ corners: { pos: [number, number, number] ; uv: number[] }[] ; dir: [number, number, number] ; independent: boolean ; isolated: boolean ; name: string ; range: UV ; textureGroup: string | null }[]A list of block face data that this block has.
fluidFlowForcenumberThe force applied to entities in this fluid, pushing them in the flow direction.
greenLightLevelnumberThe green light level of the block.
idnumberThe block id.
independentFacesSet<string>A set of block face names that are independent (high resolution or animated). This is generated on the client side.
isClimbablebooleanWhether or not can entities climb this block.
isDynamicbooleanWhether or not does the block generate dynamic faces or AABB's. If this is true, the block will use dynamicFn to generate the faces and AABB's.
isEmptybooleanWhether or not is this block empty. By default, only "air" is empty.
isEntityboolean-
isFluidbooleanWhether or not is the block a fluid block.
isLightbooleanWhether or not is this block a light source.
isOpaquebooleanWhether or not is this block opaque (not transparent).
isPassablebooleanWhether or not should physics ignore this block.
isSeeThroughbooleanWhether or not is this block see-through (can be opaque and see-through at the same time).
isTransparent[boolean, boolean, boolean, boolean, boolean, boolean]Whether or not is this block transparent viewing from all six sides. The sides are defined as PX, PY, PZ, NX, NY, NZ.
isWaterloggedbooleanWhether or not is the block waterlogged (exists inside water).
isolatedFacesSet<string>-
lightReducebooleanWhether or not should light reduce by 1 going through this block.
namestringThe name of the block.
redLightLevelnumberThe red light level of the block.
rotatablebooleanWhether or not is the block rotatable.
transparentStandaloneboolean-
yRotatablebooleanWhether or not the block is rotatable around the y-axis (has to face either PX or NX).
yRotatableSegments"All" | "Eight" | "Four"-

BlockEntityUpdateData

Ƭ BlockEntityUpdateData<T>: Object

Type parameters

Name
T

Type declaration

NameType
etypestring
idstring
newValueT | null
oldValueT | null
operationEntityOperation
voxelCoords3

BlockEntityUpdateListener

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

Type parameters

Name
T

Type declaration

▸ (args): void

Parameters
NameType
argsBlockEntityUpdateData<T>
Returns

void


BlockRule

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


BlockSimpleRule

Ƭ BlockSimpleRule: Object

Type declaration

NameType
id?number
offsetCoords3
rotation?BlockRotation
stage?number

BlockUpdate

Ƭ BlockUpdate: Object

A block update to make on the server.

Type declaration

NameTypeDescription
rotation?numberThe optional rotation of the updated block.
stage?numberThe optional stage of the updated block.
typenumberThe voxel type.
vxnumberThe voxel x-coordinate.
vynumberThe voxel y-coordinate.
vznumberThe voxel z-coordinate.
yRotation?numberThe optional y-rotation of the updated block.

BlockUpdateListener

Ƭ BlockUpdateListener: (args: { newValue: number ; oldValue: number ; voxel: Coords3 }) => void

Type declaration

▸ (args): void

Parameters
NameType
argsObject
args.newValuenumber
args.oldValuenumber
args.voxelCoords3
Returns

void


BlockUpdateWithSource

Ƭ BlockUpdateWithSource: Object

Type declaration

NameType
source"client" | "server"
updateBlockUpdate

BodyOptions

Ƭ BodyOptions: ColorCanvasBoxOptions

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

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

where CHARACTER_SCALE is 0.9.


BoundingBox

Ƭ BoundingBox: Object

Type declaration

NameType
minCoords3
shapeCoords3

BoxSides

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

The sides of a canvas box.

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


CSSMeasurement

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

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


CameraPerspective

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


CanvasBoxOptions

Ƭ CanvasBoxOptions: Object

Parameters to create a canvas box.

Type declaration

NameTypeDescription
depth?numberThe depth of the box. Defaults to whatever width is.
depthSegments?numberThe depth segments of the box, which is the number of pixels of the canvases along the depth. Defaults to whatever widthSegments is.
gapnumberThe gap between the layers of the box. Defaults to 0.
height?numberThe height of the box. Defaults to whatever width is.
heightSegments?numberThe height segments of the box, which is the number of pixels of the canvases along the height. Defaults to whatever widthSegments is.
layersnumberThe number of layers of this box. Defaults to 1.
receiveShadows?booleanWhether this canvas box should receive shadows. Defaults to false.
sideSideThe side of the box to render. Defaults to THREE.FrontSide.
transparent?booleanWhether or not should this canvas box be rendered as transparent. Defaults to false.
widthnumberTHe width of the box. Defaults to 1.
widthSegmentsnumberThe width segments of the box, which is the number of pixels of the canvases along the width. Defaults to 8.

CharacterOptions

Ƭ CharacterOptions: Object

Parameters to create a character.

Type declaration

NameTypeDescription
arms?Partial<ArmsOptions>Parameters to create the character's arms.
body?Partial<BodyOptions>Parameters to create the character's body.
head?Partial<HeadOptions>Parameters to create the character's head.
idleArmSwing?numberThe speed at which the arms swing when the character is idle. Defaults to 0.06.
legs?Partial<LegOptions>Parameters to create the character's legs.
nameTagOptions?Partial<NameTagOptions>-
positionLerp?numberThe lerp factor of the character's position change. Defaults to 0.7.
receiveShadows?booleanWhether this character should receive shadows. Defaults to false.
rotationLerp?numberThe lerp factor of the character's rotation change. Defaults to 0.2.
swingLerp?numberThe lerp factor of the swinging motion of the arms and legs. Defaults to 0.8.
walkingSpeed?numberThe speed at which the arms swing when the character is moving. Defaults to 1.4.

ChunkDataEventData

Ƭ ChunkDataEventData: Object

Type declaration

NameType
chunkChunk
coordsCoords2

ChunkEventData

Ƭ ChunkEventData: Object

Type declaration

NameType
allMeshesMap<number, Mesh[]>
chunkChunk
coordsCoords2

ChunkMeshEventData

Ƭ ChunkMeshEventData: Object

Type declaration

NameType
chunkChunk
coordsCoords2
levelnumber
meshesMesh[]

ChunkMeshUpdateEventData

Ƭ ChunkMeshUpdateEventData: ChunkMeshEventData & { reason: ChunkUpdateReason }


ChunkStage

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


ChunkUpdateEventData

Ƭ ChunkUpdateEventData: ChunkEventData & { reason: ChunkUpdateReason }


ChunkUpdateReason

Ƭ ChunkUpdateReason: "voxel" | "light"


ClickType

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

Three types of clicking for mouse input listening.


CloudsOptions

Ƭ CloudsOptions: Object

Parameters used to create a new Clouds instance.

Type declaration

NameTypeDescription
alphanumberThe opacity of the clouds. Defaults to 0.8.
cloudHeightnumberThe y-height at which the clouds are generated. Defaults to 256.
colorstringThe color of the clouds. Defaults to #fff.
countnumberThe number of cloud cells to generate, count * count. Defaults to 16.
dimensionsCoords3The dimension of each cloud block. Defaults to [20, 20, 20].
falloffnumberThe noise falloff factor used to generate the clouds. Defaults to 0.9.
heightnumberThe vertical count of how many cloud blocks are in a cloud cell. This is also used to determine the overall count of cloud blocks of all the clouds. Defaults to 3.
lerpFactornumberThe lerp factor used to translate cloud blocks from their original position to their new position. Defaults to 0.3.
noiseScalenumberThe scale of the noise used to generate the clouds. Defaults to 0.08.
octavesnumberThe number of octaves used to generate the noise. Defaults to 5.
seednumberThe seed used to generate the clouds. Defaults to -1.
speedFactornumberThe speed at which the clouds move. Defaults to 8.
thresholdnumberThe threshold at which noise values are considered to be "cloudy" and should generate a new cloud block. Defaults to 0.05.
uFogColor?{ value: Color }An object that is used as the uniform for the clouds fog color shader.
uFogColor.valueColor-
uFogFar?{ value: number }An object that is used as the uniform for the clouds fog far shader.
uFogFar.valuenumber-
uFogNear?{ value: number }An object that is used as the uniform for the clouds fog near shader.
uFogNear.valuenumber-
widthnumberThe horizontal count of how many cloud blocks are in a cloud cell. Defaults to 8.

CommandInfo

Ƭ CommandInfo<T>: Object

Information about a command including its processor and documentation.

Type parameters

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

Type declaration

NameType
aliasesstring[]
argsT
category?string
descriptionstring
flagsstring[]
process(args: z.infer<T>) => void

CommandOptions

Ƭ CommandOptions<T>: Object

Options for adding a command.

Type parameters

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

Type declaration

NameType
aliases?string[]
args?T
category?string
descriptionstring
flags?string[]

Coords2

Ƭ Coords2: [number, number]


Coords3

Ƭ Coords3: [number, number, number]


CreatureBodyOptions

Ƭ CreatureBodyOptions: ColorCanvasBoxOptions


CreatureHeadOptions

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


CreatureLegOptions

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


CreatureOptions

Ƭ CreatureOptions: Object

Type declaration

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

CullOptionsType

Ƭ CullOptionsType: Object

Type declaration

NameType
dimensionsCoords3
maxCoords3
minCoords3
realMaxCoords3
realMinCoords3

CustomChunkShaderMaterial

Ƭ CustomChunkShaderMaterial: ShaderMaterial & { map: Texture }

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


DebugOptions

Ƭ DebugOptions: Object

Parameters to create a Debug instance.

Type declaration

NameTypeDescription
asyncPeriodnumber-
containerIdstring-
dataClassstringA class to add to the wrapper of the top-left debug panel.
dataStylesPartial<CSSStyleDeclaration>Styles to apply to the wrapper of the top-left debug panel.
entriesClassstringA class to add to the wrapper of all debug entries.
entriesStylesPartial<CSSStyleDeclaration>Styles to apply to the wrapper of all debug entries.
lineClassstringA class to add to each of the debug entry line (top left).
lineStylesPartial<CSSStyleDeclaration>Styles to apply to each of the debug entry line (top left).
newLineStylesPartial<CSSStyleDeclaration>-
onByDefaultbooleanWhether or not should the debug panel be displayed by default when the page loads. Defaults to true. You can toggle the debug panel by calling Debug.toggle.
showVoxelizebooleanWhether or not should Voxelize x.x.x be displayed in the top-left debug panel. Defaults to true.
statsbooleanWhether or not should stats.js be enabled. Defaults to true.
statsStylesPartial<CSSStyleDeclaration>-

DeepPartial

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

Type parameters

Name
T

Event

Ƭ Event: Object

A Voxelize event from the server.

Type declaration

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

EventHandler

Ƭ EventHandler: (payload: any | null) => void

The handler for an event sent from the Voxelize server.

Type declaration

▸ (payload): void

Parameters
NameType
payloadany | null
Returns

void


FindSimilarOptions

Ƭ FindSimilarOptions: Object

Type declaration

NameType
maxSuggestions?number

FormatSuggestionOptions

Ƭ FormatSuggestionOptions: Object

Type declaration

NameType
maxFallbackItems?number

HeadOptions

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


InputOccasion

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

The occasion that the input should be fired.


InputSpecifics

Ƭ InputSpecifics: Object

The specific options of the key to listen to.

Type declaration

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

ItemSlotsOptions

Ƭ ItemSlotsOptions: Object

Type declaration

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

LegOptions

Ƭ LegOptions: ColorCanvasBoxOptions & { betweenLegsGap?: number }

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

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

where CHARACTER_SCALE is 0.9.


LightBatch

Ƭ LightBatch: Object

Type declaration

NameType
batchIdnumber
completedJobsnumber
jobsLightJob[]
resultsLightBatchResult[]
startSequenceIdnumber
totalJobsnumber

LightBatchResult

Ƭ LightBatchResult: Object

Type declaration

NameType
boundingBoxBoundingBox
colorLightColor
modifiedChunks{ coords: Coords2 ; lights: Uint32Array }[]

LightColor

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

Sunlight or the color of torch light.


LightJob

Ƭ LightJob: Object

Type declaration

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

LightNode

Ƭ LightNode: Object

Type declaration

NameType
levelnumber
voxelCoords3

LightOperations

Ƭ LightOperations: Object

Type declaration

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

LightShinedOptions

Ƭ LightShinedOptions: Object

Type declaration

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

LightWorkerResult

Ƭ LightWorkerResult: Object

Type declaration

NameType
appliedDeltas{ lastSequenceId: number }
appliedDeltas.lastSequenceIdnumber
jobIdstring
modifiedChunks{ coords: Coords2 ; lights: Uint32Array }[]

MeshResultType

Ƭ MeshResultType: Object

Type declaration

NameType
indicesFloat32Array
normalsFloat32Array
positionsFloat32Array

NameTagOptions

Ƭ NameTagOptions: Object

Parameters to create a name tag.

Type declaration

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

NetworkConnectionOptions

Ƭ NetworkConnectionOptions: Object

Type declaration

NameType
reconnectTimeout?number
secret?string
useWebRTC?boolean

NetworkOptions

Ƭ NetworkOptions: Object

Type declaration

NameType
maxBacklogFactornumber
maxPacketsPerTicknumber

PartialRecord

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

Type parameters

NameType
Kextends keyof any
TT

PeersOptions

Ƭ PeersOptions: Object

Parameters to customize the peers manager.

Type declaration

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

PerspectiveOptions

Ƭ PerspectiveOptions: Object

Parameters to create a new Perspective instance.

Type declaration

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

PortraitOptions

Ƭ PortraitOptions: Object

Parameters to create a portrait with.

Type declaration

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

ProcessedUpdate

Ƭ ProcessedUpdate: Object

Type declaration

NameType
newBlockBlock
newIdnumber
newRotationBlockRotation
oldBlockBlock
oldIdnumber
oldRotationBlockRotation
oldStagenumber
stagenumber
voxelCoords3

ProtocolWS

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


RigidControlState

Ƭ RigidControlState: Object

The state of which a Voxelize Controls is in.

Type declaration

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

RigidControlsOptions

Ƭ RigidControlsOptions: Object

Parameters to initialize the Voxelize Controls.

Type declaration

NameTypeDescription
airJumpsnumberHow many times can a client jump in the air. Defaults to 0.
airMoveMultnumberThe factor applied to the movements of the client in air, such as while half-jump. Defaults to 0.7.
alwaysSprintbooleanSprint factor would be on always. Defaults to false.
bodyDepthnumberThe depth of the client's avatar. Defaults to 0.8 blocks.
bodyHeightnumberThe height of the client's avatar. Defaults to 1.55 blocks.
bodyWidthnumberThe width of the client's avatar. Defaults to 0.8 blocks.
crouchFactornumberThe factor to the movement speed when crouch is applied. Defaults to 0.6.
eyeHeightnumberThe ratio to bodyHeight at which the camera is placed from the ground. Defaults at 0.9193548387096774.
fluidPushForcenumberThe force upwards when a client tries to jump in water. Defaults to 0.3.
flyForcenumberThe level of force at which a client flies at. Defaults to 80.
flyImpulsenumberThe level impulse of which a client flies at. Defaults to 2.5.
flyInertianumberThe inertia of a client when they're flying. Defaults to 6.
flySpeednumberThe level of speed at which a client flies at. Defaults to 40.
initialDirectionCoords3-
initialPositionCoords3Initial position of the client. Defaults to (0, 80, 10).
jumpForcenumberThe level of force applied to the client when jumping. Defaults to 1.
jumpImpulsenumberThe level of impulse at which the client jumps upwards. Defaults to 8.
jumpTimenumberThe time, in milliseconds, that a client can be jumping. Defaults to 50ms.
maxPolarAnglenumberMaximum polar angle that camera can look up to. Defaults to Math.PI * 0.99
maxSpeednumberThe maximum level of speed of a client. Default is 6 .
minPolarAnglenumberMinimum polar angle that camera can look down to. Defaults to Math.PI * 0.01.
moveForcenumberThe level of force of which the client can move at. Default is 30.
positionLerpnumberThe interpolation factor of the client's position. Defaults to 1.0.
responsivenessnumberThe level of responsiveness of a client to movements. Default is 240.
rotationLerpnumberThe interpolation factor of the client's rotation. Defaults to 0.9.
runningFrictionnumberDefault running friction of a client. Defaults to 0.1.
sensitivitynumberThe mouse sensitivity. Defaults to 100.
sprintFactornumberThe factor to the movement speed when sprint is applied. Defaults to 1.4.
standingFrictionnumberDefault standing friction of a client. Defaults to 4.
stepHeightnumberHow tall a client can step up. Defaults to 0.5.
stepLerpnumberThe interpolation factor when the client is auto-stepping. Defaults to 0.6.

ShadowOptions

Ƭ ShadowOptions: Object

Parameters to create a shadow.

Type declaration

NameTypeDescription
maxDistancenumberThe maximum distance from the object to the ground to cast a shadow. The shadow's scale scales inversely with distance. Defaults to 10.
maxRadiusnumberThe maximum radius the shadow can have. That is, the radius of the shadow when the object is on the ground. Defaults to 0.5.

SkyOptions

Ƭ SkyOptions: Object

Type declaration

NameTypeDescription
dimensionnumberThe dimension of the dodecahedron sky. The inner canvas box is 0.8 times this dimension.
lerpFactornumberThe lerp factor for the sky gradient. The sky gradient is updated every frame by lerping the current color to the target color. set by the setTopColor, setMiddleColor, and setBottomColor methods.
transitionSpannumber-

SkyShadingCycleData

Ƭ SkyShadingCycleData: Object

Type declaration

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

TargetType

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


TextureInfo

Ƭ TextureInfo: Object

Type declaration

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

UV

Ƭ UV: Object

The UV range of a texture on the texture atlas.

Type declaration

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

VoxelDelta

Ƭ VoxelDelta: Object

Type declaration

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

VoxelInteractOptions

Ƭ VoxelInteractOptions: Object

Parameters to customize the VoxelInteract instance.

Type declaration

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

WorkerPoolJob

Ƭ WorkerPoolJob: Object

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

Type declaration

NameTypeDescription
buffers?ArrayBufferLike[]Any array buffers (transferable) that are passed to the worker.
messageanyA JSON serializable object that is passed to the worker.
resolve(value: any) => void-

WorkerPoolOptions

Ƭ WorkerPoolOptions: Object

Parameters to create a worker pool.

Type declaration

NameTypeDescription
maxWorkernumberThe maximum number of workers to create. Defaults to 8.
name?stringThe name prefix for workers in this pool. Workers will be named {name}-0, {name}-1, etc. Shows up in DevTools for debugging.

WorldChunkEvents

Ƭ WorldChunkEvents: Object

Type declaration

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

WorldClientOptions

Ƭ WorldClientOptions: Object

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

Type declaration

NameTypeDescription
chunkLoadExponentnumberThe exponent applied to the ratio that chunks are loaded, which would then be used to determine whether an angle to a chunk is worth loading. Defaults to 8.
chunkRerequestIntervalnumberThe interval between each time a chunk is re-requested to the server. Defaults to 300 updates.
chunkUniformsOverwritePartial<ChunkRenderer["uniforms"]>The uniforms to overwrite the default chunk material uniforms. Defaults to {}.
clientOnlyMeshingbooleanWhether to use client-only meshing. When true, chunks are always meshed locally. When false, server-provided meshes are used for initial chunk load. Defaults to true.
cloudsOptionsPartial<CloudsOptions>The options to create the clouds. Defaults to {}.
defaultRenderRadiusnumberThe default render radius of the world, in chunks. Change this through world.renderRadius. Defaults to 8 chunks.
deltaRetentionTimenumberHow long to retain delta history in milliseconds. Defaults to 5000ms.
lightJobRetryLimitnumberMaximum number of retries for stale light jobs before falling back to sync. Defaults to 3.
maxChunkRequestsPerUpdatenumberThe maximum chunk requests this world can request from the server per world update. Defaults to 12 chunks.
maxLightWorkersnumberMaximum concurrent light workers. Defaults to 2.
maxLightsUpdateTimenumber-
maxMeshesPerUpdatenumber-
maxProcessesPerUpdatenumberThe maximum amount of chunks received from the server that can be processed per world update. By process, it means to be turned into a Chunk instance. Defaults to 8 chunks.
maxUpdatesPerUpdatenumberThe maximum voxel updates that can be sent to the server per world update. Defaults to 1000 updates.
mergeChunkGeometriesbooleanWhether to merge chunk geometries to reduce draw calls. Useful for mobile. Defaults to false.
minLightLevelnumberThe minimum light level even when sunlight and torch light levels are at zero. Defaults to 0.04.
shaderBasedLightingbooleanWhether shader-based lighting is enabled for this world. When enabled, lighting uses GPU shaders with cascaded shadow maps. CPU light propagation still runs to provide sunlight exposure data. Defaults to false.
skyOptionsPartial<SkyOptions>The options to create the sky. Defaults to {}.
statsSyncIntervalnumberThe interval between each time the world requests the server for its stats. Defaults to 500ms.
sunlightChangeSpannumberThe fraction of the day that sunlight takes to change from appearing to disappearing or disappearing to appearing. Defaults to 0.1.
sunlightEndTimeFracnumberThe fraction of the day that sunlight starts to disappear. Defaults to 0.7.
sunlightStartTimeFracnumberThe fraction of the day that sunlight starts to appear. Defaults to 0.25.
textureUnitDimensionnumberThe default dimension to a single unit of a block face texture. If any texture loaded is greater, it will be downscaled to this resolution. Defaults to 8 pixels.
timeForceThresholdnumberThe threshold to force the server's time to the client's time. Defaults to 0.1.
useLightWorkersbooleanWhether to use web workers for light calculations. Defaults to true.

WorldOptions

Ƭ WorldOptions: WorldClientOptions & WorldServerOptions

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


WorldServerOptions

Ƭ WorldServerOptions: Object

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

Type declaration

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

Variables

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.


DEFAULT_CHUNK_SHADERS

Const DEFAULT_CHUNK_SHADERS: Object

This is the default shaders used for the chunks.

Type declaration

NameType
fragmentstring
vertexstring

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 uShadowStrength;\nuniform float uSunlightIntensity;\nuniform vec3 uSunDirection;\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 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 return shadow / 5.0;\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 if (sampleDepth < coord.z - bias) {\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 shadow = (coord.z - bias > texture(shadowMap, coord.xy).r) ? 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 shadow += (coord.z - bias > depth) ? 0.0 : 1.0;\n }\n\n return shadow / 9.0;\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 NdotL = dot(normalize(worldNormal), normalize(uSunDirection));\n // Large fixed bias to prevent self-shadowing on small entities like characters\n // This ensures entity doesn't shadow itself while still receiving terrain shadows\n float bias = uShadowBias + 0.05;\n float blendRegion = 0.1;\n\n float rawShadow;\n if (vViewDepth < uCascadeSplit0) {\n float shadow0 = sampleShadowMapPCSS(uShadowMap0, vShadowCoord0, bias);\n float blendStart = uCascadeSplit0 * (1.0 - blendRegion);\n if (vViewDepth > blendStart) {\n float shadow1 = sampleShadowMapPCSS(uShadowMap1, vShadowCoord1, bias * 1.5);\n float t = (vViewDepth - blendStart) / (uCascadeSplit0 - blendStart);\n rawShadow = mix(shadow0, shadow1, t);\n } else {\n rawShadow = shadow0;\n }\n } else if (vViewDepth < uCascadeSplit1) {\n float shadow1 = sampleShadowMapPCSS(uShadowMap1, vShadowCoord1, bias * 1.5);\n float blendStart = uCascadeSplit1 * (1.0 - blendRegion);\n if (vViewDepth > blendStart) {\n float shadow2 = sampleShadowMapFast(uShadowMap2, vShadowCoord2, bias * 2.0);\n float t = (vViewDepth - blendStart) / (uCascadeSplit1 - blendStart);\n rawShadow = mix(shadow1, shadow2, t);\n } else {\n rawShadow = shadow1;\n }\n } else if (vViewDepth < uCascadeSplit2) {\n float shadow2 = sampleShadowMapFast(uShadowMap2, vShadowCoord2, bias * 2.0);\n float fadeStart = uCascadeSplit2 * (1.0 - blendRegion);\n if (vViewDepth > fadeStart) {\n float t = (vViewDepth - fadeStart) / (uCascadeSplit2 - fadeStart);\n rawShadow = mix(shadow2, 1.0, t);\n } else {\n rawShadow = shadow2;\n }\n } else {\n return 1.0;\n }\n\n float shadow = mix(1.0, rawShadow, effectiveStrength);\n return max(shadow, 0.4);\n}\n"


ENTITY_SHADOW_VERTEX_MAIN

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


ENTITY_SHADOW_VERTEX_PARS

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


GREEN_LIGHT

Const GREEN_LIGHT: "GREEN"

The string representation of green light.


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


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.


SHADER_LIGHTING_CHUNK_SHADERS

Const SHADER_LIGHTING_CHUNK_SHADERS: Object

Type declaration

NameType
fragmentstring
vertexstring

SHADER_LIGHTING_CROSS_CHUNK_SHADERS

Const SHADER_LIGHTING_CROSS_CHUNK_SHADERS: Object

Type declaration

NameType
fragmentstring
vertexstring

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 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 return shadow / 5.0;\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 if (sampleDepth < coord.z - bias) {\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 shadow = (coord.z - bias > texture(shadowMap, coord.xy).r) ? 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 shadow += (coord.z - bias > depth) ? 0.0 : 1.0;\n }\n\n return shadow / 9.0;\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


Y_ROT_MAP

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

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

Rotation value -> index


Y_ROT_MAP_EIGHT

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


Y_ROT_MAP_FOUR

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


Y_ROT_SEGMENTS

Const Y_ROT_SEGMENTS: 16

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

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


artFunctions

Const artFunctions: Object

A preset of art functions to draw on canvas boxes.

Type declaration

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

customShaders

Const customShaders: Object

Type declaration

NameType
sway(options: Partial<{ amplitude: number ; rooted: boolean ; scale: number ; speed: number ; yScale: number }>) => { fragmentShader: string = baseShaders.fragment; vertexShader: string }
swayCrossShaderBased(options: Partial<{ amplitude: number ; rooted: boolean ; scale: number ; speed: number ; yScale: number }>) => { fragmentShader: string = baseShaders.fragment; vertexShader: string }
swayShaderBased(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


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.

Functions

TRANSPARENT_SORT

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

Parameters

NameType
objectObject3D<Object3DEventMap>

Returns

fn

▸ (a, b): number

Parameters
NameType
aany
bany
Returns

number


createEntityShadowUniforms

createEntityShadowUniforms(): EntityShadowUniforms

Returns

EntityShadowUniforms


createSwayShader

createSwayShader(baseShaders, options?): Object

Parameters

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

Returns

Object

NameType
fragmentShaderstring
vertexShaderstring

cull

cull(array, options): Promise<MeshResultType>

Parameters

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

Returns

Promise<MeshResultType>


findSimilar

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

Parameters

NameType
targetstring
availablestring[]
optionsFindSimilarOptions

Returns

string[]


formatSuggestion

formatSuggestion(suggestions, allAvailable, options?): string

Parameters

NameType
suggestionsstring[]
allAvailablestring[]
optionsFormatSuggestionOptions

Returns

string


prepareTransparentMesh

prepareTransparentMesh(mesh): TransparentMeshData | null

Parameters

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

Returns

TransparentMeshData | null


requestWorkerAnimationFrame

requestWorkerAnimationFrame(callback): number

Parameters

NameType
callback() => void

Returns

number


setWorkerInterval

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

Parameters

NameType
func() => void
intervalnumber

Returns

fn

▸ (): void

Returns

void


setupTransparentSorting

setupTransparentSorting(object): void

Parameters

NameType
objectObject3D<Object3DEventMap>

Returns

void


sortTransparentMesh

sortTransparentMesh(mesh, data, camera): void

Parameters

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

Returns

void


updateEntityShadowUniforms

updateEntityShadowUniforms(target, source): void

Parameters

NameType
targetEntityShadowUniforms
sourceShaderLightingUniforms

Returns

void