fixed some bug

This commit is contained in:
Randy 2019-03-23 19:41:33 +01:00
parent 951cba6ce6
commit 4a79ea0b5a
2 changed files with 6 additions and 3 deletions

View File

@ -154,7 +154,6 @@ public class Chunk {
for (int py = 0; py < 16; py++) { for (int py = 0; py < 16; py++) {
float value = map[px][py]; float value = map[px][py];
int y = (int) (value * World.WORLD_HEIGHT); int y = (int) (value * World.WORLD_HEIGHT);
y &= 255; // somehow it can go below it :/
for (int j = y > SEA_LEVEL ? y : SEA_LEVEL; j >= 0; j--) { for (int j = y > SEA_LEVEL ? y : SEA_LEVEL; j >= 0; j--) {
BlockInstance bi = null; BlockInstance bi = null;
if(j > y) { if(j > y) {

View File

@ -21,7 +21,9 @@ public class Structures {
//Position of the first block of wood //Position of the first block of wood
int height = 7 + random.nextInt(5); int height = 7 + random.nextInt(5);
for (int i = 0; i < height; i++) { for (int i = 0; i < height; i++) {
ch.addBlock(wood, x, y + i, z); if (y + i < World.WORLD_HEIGHT) {
ch.addBlock(wood, x, y + i, z);
}
} }
//Position of the first block of leaves //Position of the first block of leaves
@ -30,7 +32,9 @@ public class Structures {
int j = (height - i) >> 1; int j = (height - i) >> 1;
for (int k = 1 - j; k < j; k++) { for (int k = 1 - j; k < j; k++) {
for (int l = 1 - j; l < j; l++) { for (int l = 1 - j; l < j; l++) {
ch.addBlock(leaves, x + k, y + i, z + l); if (y + i < World.WORLD_HEIGHT) {
ch.addBlock(leaves, x + k, y + i, z + l);
}
} }
} }
} }