aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/makamys/neodymium/renderer/NeoRegion.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/makamys/neodymium/renderer/NeoRegion.java')
-rw-r--r--src/main/java/makamys/neodymium/renderer/NeoRegion.java25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/main/java/makamys/neodymium/renderer/NeoRegion.java b/src/main/java/makamys/neodymium/renderer/NeoRegion.java
index f983beb..36f5909 100644
--- a/src/main/java/makamys/neodymium/renderer/NeoRegion.java
+++ b/src/main/java/makamys/neodymium/renderer/NeoRegion.java
@@ -3,8 +3,9 @@ package makamys.neodymium.renderer;
import net.minecraft.entity.Entity;
public class NeoRegion {
+ public static final int SIZE = 32;
- private NeoChunk[][] data = new NeoChunk[32][32];
+ private NeoChunk[][] data = new NeoChunk[SIZE][SIZE];
int regionX, regionZ;
@@ -16,9 +17,9 @@ public class NeoRegion {
this.regionX = regionX;
this.regionZ = regionZ;
- for(int i = 0; i < 32; i++) {
- for(int j = 0; j < 32; j++) {
- data[i][j] = new NeoChunk(regionX * 32 + i, regionZ * 32 + j, this);
+ for(int i = 0; i < SIZE; i++) {
+ for(int j = 0; j < SIZE; j++) {
+ data[i][j] = new NeoChunk(regionX * SIZE + i, regionZ * SIZE + j, this);
}
}
}
@@ -28,11 +29,11 @@ public class NeoRegion {
}
public NeoChunk getChunkAbsolute(int chunkXAbs, int chunkZAbs) {
- return getChunk(chunkXAbs - regionX * 32, chunkZAbs - regionZ * 32);
+ return getChunk(chunkXAbs - regionX * SIZE, chunkZAbs - regionZ * SIZE);
}
public NeoChunk getChunk(int x, int z) {
- if(x >= 0 && x < 32 && z >= 0 && z < 32) {
+ if(x >= 0 && x < SIZE && z >= 0 && z < SIZE) {
return data[x][z];
} else {
return null;
@@ -40,8 +41,8 @@ public class NeoRegion {
}
public void tick() {
- for(int i = 0; i < 32; i++) {
- for(int j = 0; j < 32; j++) {
+ for(int i = 0; i < SIZE; i++) {
+ for(int j = 0; j < SIZE; j++) {
NeoChunk chunk = data[i][j];
if(chunk != null) {
chunk.tick();
@@ -57,8 +58,8 @@ public class NeoRegion {
}
public void destroy() {
- for(int i = 0; i < 32; i++) {
- for(int j = 0; j < 32; j++) {
+ for(int i = 0; i < SIZE; i++) {
+ for(int j = 0; j < SIZE; j++) {
NeoChunk chunk = data[i][j];
if(chunk != null) {
chunk.destroy();
@@ -68,8 +69,8 @@ public class NeoRegion {
}
public double distanceTaxicab(Entity entity) {
- double centerX = ((regionX * 32) + 16) * 16;
- double centerZ = ((regionZ * 32) + 16) * 16;
+ double centerX = ((regionX * SIZE) + SIZE / 2) * 16;
+ double centerZ = ((regionZ * SIZE) + SIZE / 2) * 16;
return Math.max(Math.abs(centerX - entity.posX), Math.abs(centerZ - entity.posZ));