From cfeda4efc90fd4b1e67d2ca35224e7c11716c596 Mon Sep 17 00:00:00 2001
From: Ethan <codedcells@gmail.com>
Date: Sat, 19 Oct 2024 02:53:59 +0100
Subject: [PATCH] no sky caves

save some calculation, don't cut air in air
---
 ScuffedMinecraft/src/WorldGen.cpp | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/ScuffedMinecraft/src/WorldGen.cpp b/ScuffedMinecraft/src/WorldGen.cpp
index 3d1d598..ca05a53 100644
--- a/ScuffedMinecraft/src/WorldGen.cpp
+++ b/ScuffedMinecraft/src/WorldGen.cpp
@@ -308,10 +308,17 @@ void WorldGen::GenerateChunkData(int chunkX, int chunkY, int chunkZ, int chunkSi
 
 			for (int y = 0; y < chunkSize; y++)
 			{
-				// Cave noise
-				bool cave = false;
 				int currentY = y + startY;
 				
+				if (currentY > noiseY and currentY > waterLevel)
+				{
+					// Sky is air, no need to process
+					chunkData->push_back(Blocks::AIR);
+					continue;
+				}
+				
+				// Cave noise
+				bool cave = false;
 				for (int i = 0; i < caveSettingsLength; i++)
 				{
 					if (currentY > caveSettings[i].maxHeight)
@@ -331,21 +338,18 @@ void WorldGen::GenerateChunkData(int chunkX, int chunkY, int chunkZ, int chunkSi
 				}
 
 				// Step 1: Terrain Shape (surface and caves) and Ores
-
-				// Sky and Caves
-				if (currentY > noiseY)
-				{
-					if (currentY <= waterLevel)
-						chunkData->push_back(Blocks::WATER);
-					else
-						chunkData->push_back(Blocks::AIR);
-					continue;
-				}
-				else if (cave) {
+				if (cave) {
+					// TODO: This is where cave stuff goes
 					chunkData->push_back(Blocks::AIR);
 					continue;
 				}
 				
+				if (currentY > noiseY and currentY <= waterLevel)
+					// TODO: This is where wet stuff goes
+					chunkData->push_back(Blocks::WATER);
+					continue
+				}
+				
 				// Ground
 				bool blockSet = false;
 				for (int i = 0; i < oreSettingsLength; i++)