<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [server](./server.md) &gt; [Chunk](./server.chunk.md)

## Chunk class

A 16^3 chunk of blocks representing a slice of world terrain.

When to use: reading chunk data or working with bulk block operations. Do NOT use for: creating terrain directly; prefer `ChunkLattice`<!-- -->.

**Signature:**

```typescript
export default class Chunk implements protocol.Serializable 
```
**Implements:** protocol.Serializable

## Remarks

Chunks are fixed-size (16×16×16) and store block IDs by local coordinates.

<h2>Coordinate System</h2>

- \*\*Global (world) coordinates:\*\* integer block positions in world space. - \*\*Chunk origin:\*\* the world coordinate at the chunk's minimum corner (multiples of 16). - \*\*Local coordinates:\*\* 0..15 per axis within the chunk.

\*\*Category:\*\* Blocks

## Constructors

<table><thead><tr><th>

Constructor


</th><th>

Modifiers


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[(constructor)(originCoordinate)](./server.chunk._constructor_.md)


</td><td>


</td><td>

Creates a new chunk instance.


</td></tr>
</tbody></table>

## Properties

<table><thead><tr><th>

Property


</th><th>

Modifiers


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[blockRotations](./server.chunk.blockrotations.md)


</td><td>

`readonly`


</td><td>

Readonly&lt;Map&lt;number, [BlockRotation](./server.blockrotation.md)<!-- -->&gt;&gt;


</td><td>

The rotations of the blocks in the chunk as a map of block index to rotation.

\*\*Category:\*\* Blocks


</td></tr>
<tr><td>

[blocks](./server.chunk.blocks.md)


</td><td>

`readonly`


</td><td>

Readonly&lt;Uint8Array&gt;


</td><td>

The blocks in the chunk as a flat Uint8Array\[4096\], each index as 0 or a block type ID.

\*\*Category:\*\* Blocks


</td></tr>
<tr><td>

[originCoordinate](./server.chunk.origincoordinate.md)


</td><td>

`readonly`


</td><td>

[Vector3Like](./server.vector3like.md)


</td><td>

The origin coordinate of the chunk (world-space, multiples of 16).

\*\*Category:\*\* Blocks


</td></tr>
</tbody></table>

## Methods

<table><thead><tr><th>

Method


</th><th>

Modifiers


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[blockIndexToLocalCoordinate(index)](./server.chunk.blockindextolocalcoordinate.md)


</td><td>

`static`


</td><td>

Converts a block index to a local coordinate.


</td></tr>
<tr><td>

[getBlockId(localCoordinate)](./server.chunk.getblockid.md)


</td><td>


</td><td>

Gets the block type ID at a specific local coordinate.


</td></tr>
<tr><td>

[getBlockRotation(localCoordinate)](./server.chunk.getblockrotation.md)


</td><td>


</td><td>

Gets the rotation of a block at a specific local coordinate.


</td></tr>
<tr><td>

[globalCoordinateToLocalCoordinate(globalCoordinate)](./server.chunk.globalcoordinatetolocalcoordinate.md)


</td><td>

`static`


</td><td>

Converts a global coordinate to a local coordinate.


</td></tr>
<tr><td>

[globalCoordinateToOriginCoordinate(globalCoordinate)](./server.chunk.globalcoordinatetoorigincoordinate.md)


</td><td>

`static`


</td><td>

Converts a global coordinate to a chunk origin coordinate.


</td></tr>
<tr><td>

[hasBlock(localCoordinate)](./server.chunk.hasblock.md)


</td><td>


</td><td>

Checks if a block exists at a specific local coordinate.


</td></tr>
</tbody></table>
