diff --git a/cubyz-common/src/io/cubyz/world/Chunk.java b/cubyz-common/src/io/cubyz/world/Chunk.java index 58b3f262..7d868cf7 100644 --- a/cubyz-common/src/io/cubyz/world/Chunk.java +++ b/cubyz-common/src/io/cubyz/world/Chunk.java @@ -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) { diff --git a/cubyz-common/src/io/cubyz/world/Structures.java b/cubyz-common/src/io/cubyz/world/Structures.java index 83949740..8f162d0b 100644 --- a/cubyz-common/src/io/cubyz/world/Structures.java +++ b/cubyz-common/src/io/cubyz/world/Structures.java @@ -21,7 +21,9 @@ public class Structures { //Position of the first block of wood int height = 7 + random.nextInt(5); 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 @@ -30,7 +32,9 @@ public class Structures { int j = (height - i) >> 1; for (int k = 1 - j; k < j; k++) { 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); + } } } }