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++) {
float value = map[px][py];
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--) {
BlockInstance bi = null;
if(j > y) {

View File

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