Skip to content
Benedikt S. Vogler edited this page Sep 28, 2017 · 4 revisions

The block are similar to the blocks in Minecraft.

Every block has an id and a value and health property. Each field has 8bit, so values from 0 to 255 are possible. In some parts of the engine the three values are combined in one int. This is useful when you have to pass more then one parameter i.e. id and value.

The value can store some information like the orientation (e.g. NPCs) or the color (e.g. wool).

The ids 0-9 are engine reserved blocks e.g. air (id=0).

RenderBlock objects are richer encapsulations of a cell with the three values. They are used for rendering and not for the game logic. E.g. they store information about the sprites.

How to use custom blocks

Spawning blocks

You can set them directly via:

Controller.getMap().setBlock(…);

Javadoc

or by using coordinates:

new Coordinate(x, y, z, true).setBlock(Block); 

javadoc

Dimensions

In most cases you are using game space coordinates. A list with important values can be found in the class RenderBlock. GAME_DIAGLENGTH diagonal lenght of a block from front to back or left to right corner. GAME_EDGELENGTH edge length of a block ^= height. So: 1m ~= GAME_EDGELENGTH

A block has the game space dimensions 1x1x1m = 1m^3.

The center of the block is in [0,0,0]. It is marked as the red dot in the picture. center of block

Wrong isometric block projection

The internet is full of wrong isometric blocks which are not 1:1:1 and more like 1 : 0.8 : 0.8 which is dimetric. An in depth discussion can be found in my bachelor thesis (German).

List of Engine reserved blocks

0 air

1 grass

2 dirt

3 stone

6 pavement

8 sand

9 water

Clone this wiki locally