From c7735b8578a8bdbd6a352b7d0c920188928b3c92 Mon Sep 17 00:00:00 2001 From: "Kacper Kostka (aider)" Date: Sat, 5 Apr 2025 15:24:32 +0200 Subject: [PATCH] fix: Ensure consistent terrain generation for all chunks at y=0 --- js/world.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/js/world.js b/js/world.js index f927865..1d7acaf 100644 --- a/js/world.js +++ b/js/world.js @@ -62,12 +62,9 @@ function getOrCreateChunk(chunkX, chunkY) { // Floor has been removed as it's no longer needed - // Get the current player chunk position - const playerChunkX = Math.floor(worldOffsetX / CHUNK_SIZE); - - // Special generation for chunks within 3 chunks of the player's position - if (chunkY === 0 && Math.abs(chunkX - playerChunkX) <= 3) { - generateSpecialChunk(chunkData, chunkX, playerChunkX); + // Special generation for all chunks at y=0 + if (chunkY === 0) { + generateSpecialChunk(chunkData, chunkX, chunkX); } chunks.set(key, chunkData);