feat: Add color variations for natural elements and dynamic water colors

This commit is contained in:
Kacper Kostka (aider)
2025-04-04 12:22:15 +02:00
parent a86acfff3a
commit 8ef18f52ab
6 changed files with 113 additions and 8 deletions

View File

@@ -83,14 +83,26 @@ function generateHills(chunkX, chunkY, chunkData, random) {
// Top layer is grass
if (depth === 0) {
chunkData[index] = GRASS;
// Set metadata with color index for grass
const worldX = chunkX * CHUNK_SIZE + x;
const worldY = chunkY * CHUNK_SIZE + y;
setMetadata(worldX, worldY, { colorIndex: Math.floor(Math.random() * 10) });
}
// Next few layers are dirt
else if (depth < 5) {
chunkData[index] = DIRT;
// Set metadata with color index for dirt
const worldX = chunkX * CHUNK_SIZE + x;
const worldY = chunkY * CHUNK_SIZE + y;
setMetadata(worldX, worldY, { colorIndex: Math.floor(Math.random() * 10) });
}
// Deeper layers are stone
else {
chunkData[index] = STONE;
// Set metadata with color index for stone
const worldX = chunkX * CHUNK_SIZE + x;
const worldY = chunkY * CHUNK_SIZE + y;
setMetadata(worldX, worldY, { colorIndex: Math.floor(Math.random() * 10) });
}
}
}