Chunk - rvandoosselaer/Blocks GitHub Wiki

A chunk is a way of organising and structuring blocks. The default size of a chunk is 32x32x32 and thus holds 32.768 blocks.

The size of chunk can be changed using the BlocksConfig object.

Adding and removing blocks

Blocks can be added, removed and fetched from a chunk. The first block of a default size chunk is at (0, 0, 0) and the last block of a default size chunk is at (31, 31, 31).

chunk.addBlock(0, 0, 0, grassBlock);
Block grassBlock = chunk.getBlock(0, 0, 0);
chunk.removeBlock(0, 0, 0);

💡 When the structure of a chunk changes, when blocks are added or removed, the update() method on the chunk should be called!

Location and world location

When creating a chunk, the location of the chunk is a mandatory parameter. A chunk of default size at location (1, 0, 1) will have its center in the scene at (48, 16, 48). The scene or world location of a chunk can be fetched with the getWorldLocation() method.

When the node of the chunk is generated, the node is already positioned at the correct location in the scene.

See javadoc