Skip to content

Commit 473a18f

Browse files
committed
Add base framework for chunks
1 parent cea4b90 commit 473a18f

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package org.crafter.engine.chunk;
2+
3+
import org.joml.Vector2f;
4+
import org.joml.Vector2fc;
5+
import org.joml.Vector2i;
6+
import org.joml.Vector2ic;
7+
8+
/**
9+
* A chunk of map data. It is 16 wide, 128 high, and 16 long.
10+
*/
11+
public class Chunk {
12+
13+
private static final int arraySize = 16*16*128;
14+
private final Vector2ic position;
15+
16+
// Consists of bit shifted integral values
17+
private final int[] data;
18+
19+
public Chunk(Vector2i position) {
20+
this.position = position;
21+
this.data = new int[arraySize];
22+
}
23+
24+
public Vector2ic getPosition() {
25+
return position;
26+
}
27+
28+
public int getX() {
29+
return position.x();
30+
}
31+
32+
public int getY() {
33+
return position.y();
34+
}
35+
36+
//Todo: idea: metadata arraymap
37+
//Todo: bitshift light, block id, state
38+
}

0 commit comments

Comments
 (0)