diff --git a/ClassicalSharp/Generator/NotchyGenerator.cs b/ClassicalSharp/Generator/NotchyGenerator.cs index 92972dbed..1f59685f9 100644 --- a/ClassicalSharp/Generator/NotchyGenerator.cs +++ b/ClassicalSharp/Generator/NotchyGenerator.cs @@ -347,6 +347,7 @@ namespace ClassicalSharp.Generator { continue; int treeY = heightmap[treeZ * Width + treeX] + 1; + if (treeY >= Height) continue; int treeHeight = 5 + rnd.Next(3); int index = (treeY * Length + treeZ) * Width + treeX; diff --git a/src/Client/NotchyGenerator.c b/src/Client/NotchyGenerator.c index d6dea53a2..47c37f054 100644 --- a/src/Client/NotchyGenerator.c +++ b/src/Client/NotchyGenerator.c @@ -218,6 +218,7 @@ void NotchyGen_PlantTrees() { continue; Int32 treeY = Heightmap[treeZ * Width + treeX] + 1; + if (treeY >= Height) continue; Int32 treeHeight = 5 + Random_Next(&rnd, 3); Int32 index = (treeY * Length + treeZ) * Width + treeX;