@voxelize/core
Enumerations
Core Classes
Effects Classes
Other Classes
- AnimationUtils
- Arm
- Arrow
- AtlasTexture
- BlockRotation
- BoxLayer
- CanvasBox
- Character
- Chunk
- Clouds
- Debug
- Entity
- Events
- FaceAnimation
- ItemSlot
- ItemSlots
- Method
- NameTag
- Perspective
- Portrait
- Registry
- Shadow
- Shadows
- SharedWorkerPool
- Sky
- SpriteText
- ThreeUtils
- VoxelInteract
- WorkerPool
Utils Classes
Interfaces
Type Aliases
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> |
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 }[] | A list of block face data that this block has. |
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. |
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. |
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. |
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. |
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