@voxelize/core
Enumerations
Core Classes
Effects Classes
Other Classes
- AnimationUtils
- Arm
- Arrow
- AtlasTexture
- BlockRotation
- BoxLayer
- CSMRenderer
- CanvasBox
- Character
- Chunk
- ChunkPipeline
- ChunkRenderer
- Clouds
- Creature
- Debug
- Entity
- Events
- FaceAnimation
- ItemSlot
- ItemSlots
- LightSourceRegistry
- LightVolume
- MeshPipeline
- Method
- NameTag
- Network
- Perspective
- Portrait
- Registry
- Shadow
- Shadows
- Sky
- SpriteText
- ThreeUtils
- VoxelInteract
- WebRTCConnection
- WorkerPool
Utils Classes
Interfaces
- BlockConditionalPart
- BlockDynamicPattern
- CSMConfig
- DynamicLight
- EntityShadowUniforms
- LightRegion
- LightVolumeConfig
- NetIntercept
- ShaderLightingUniforms
- TransparentMeshData
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 |
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> |
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. |
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. |
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. |
isWaterlogged | boolean | Whether or not is the block waterlogged (exists inside water). |
isolatedFaces | Set<string> | - |
lightReduce | boolean | Whether or not should light reduce by 1 going through this block. |
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 |
stage? | number |
BlockUpdate
Ƭ BlockUpdate: Object
A block update to make on the server.
Type declaration
| Name | Type | Description |
|---|---|---|
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. |
yRotation? | number | The optional y-rotation of the updated block. |
BlockUpdateListener
Ƭ BlockUpdateListener: (args: { newValue: number ; oldValue: number ; voxel: Coords3 }) => void
Type declaration
▸ (args): void
Parameters
| Name | Type |
|---|---|
args | Object |
args.newValue | number |
args.oldValue | number |
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. |
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. 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. Defaults to 0.2. |
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 }
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
| Name | Type | Description |
|---|---|---|
alpha | number | The opacity of the clouds. Defaults to 0.8. |
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 number of cloud cells to generate, count * count. Defaults to 16. |
dimensions | Coords3 | The dimension of each cloud block. Defaults to [20, 20, 20]. |
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. |
speedFactor | number | The speed at which the clouds move. Defaults to 8. |
threshold | number | The 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.value | Color | - |
uFogFar? | { value: number } | An object that is used as the uniform for the clouds fog far shader. |
uFogFar.value | number | - |
uFogNear? | { value: number } | An object that is used as the uniform for the clouds fog near shader. |
uFogNear.value | number | - |
width | number | The 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
| 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[] |
process | (args: z.infer<T>) => void |
CommandOptions
Ƭ CommandOptions<T>: Object
Options for adding a command.
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[] |
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
Parameters to create a Debug instance.
Type declaration
| Name | Type | Description |
|---|---|---|
asyncPeriod | number | - |
containerId | string | - |
dataClass | string | A class to add to the wrapper of the top-left debug panel. |
dataStyles | Partial<CSSStyleDeclaration> | Styles to apply to the wrapper of the top-left debug panel. |
entriesClass | string | A class to add to the wrapper of all debug entries. |
entriesStyles | Partial<CSSStyleDeclaration> | Styles to apply to the wrapper of all debug entries. |
lineClass | string | A class to add to each of the debug entry line (top left). |
lineStyles | Partial<CSSStyleDeclaration> | Styles to apply to each of the debug entry line (top left). |
newLineStyles | Partial<CSSStyleDeclaration> | - |
onByDefault | boolean | Whether 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. |
showVoxelize | boolean | Whether or not should Voxelize x.x.x be displayed in the top-left debug panel. Defaults to true. |
stats | boolean | Whether or not should stats.js be enabled. Defaults to true. |
statsStyles | Partial<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
| Name | Type | Description |
|---|---|---|
name | string | The name to identify the event. |
payload? | any | Additional information of the event. |
EventHandler
Ƭ EventHandler: (payload: any | null) => void
The handler for an event sent from the Voxelize server.