diff --git a/src/gameplay/chunk.cpp b/src/gameplay/chunk.cpp index 2ef6fba..fdd6c11 100644 --- a/src/gameplay/chunk.cpp +++ b/src/gameplay/chunk.cpp @@ -249,8 +249,13 @@ void Chunk::resolve_blocks() { float temp = PerlinNoise::noise(world_x * BIOME_NOISE_FREQUENCY, 0.0f, world_z * BIOME_NOISE_FREQUENCY); float humid = PerlinNoise::noise(world_x * BIOME_NOISE_FREQUENCY, 1.0f, world_z * BIOME_NOISE_FREQUENCY); int height = get_interpolated_height(world_x, world_z, temp, humid); - heights[x][z] = height; + auto biome = get_biome_from_noise(temp, humid); + if (height >= SIZE_Y) { + Logger::warn("height: {} is exceed max_height", height); + height = SIZE_Y - 1; + } + heights[x][z] = height; for (int y = 5; y < height - 5; y++) { m_blocks[get_index(x, y, z)] = 3; }