From af34d7eb8278c37b5c7575e78a613dfd47dae714 Mon Sep 17 00:00:00 2001 From: zhenyan121 <3367366583@qq.com> Date: Sat, 18 Apr 2026 16:19:19 +0800 Subject: [PATCH] fix: y is too height --- src/gameplay/chunk.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; }