From 4a79ea0b5a1f69d8a4152fa83b10f70e86879e05 Mon Sep 17 00:00:00 2001 From: Randy <39484230+zenith391@users.noreply.github.com> Date: Sat, 23 Mar 2019 19:41:33 +0100 Subject: [PATCH] fixed some bug --- cubyz-common/src/io/cubyz/world/Chunk.java | 1 - cubyz-common/src/io/cubyz/world/Structures.java | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) 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); + } } } }