mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-27 15:29:36 -04:00
Fix trees causing IndexOutOfRange errors on maps with very low heights such as 16
This commit is contained in:
parent
2a88a33379
commit
ab2032d1d8
@ -347,6 +347,7 @@ namespace ClassicalSharp.Generator {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
int treeY = heightmap[treeZ * Width + treeX] + 1;
|
int treeY = heightmap[treeZ * Width + treeX] + 1;
|
||||||
|
if (treeY >= Height) continue;
|
||||||
int treeHeight = 5 + rnd.Next(3);
|
int treeHeight = 5 + rnd.Next(3);
|
||||||
|
|
||||||
int index = (treeY * Length + treeZ) * Width + treeX;
|
int index = (treeY * Length + treeZ) * Width + treeX;
|
||||||
|
@ -218,6 +218,7 @@ void NotchyGen_PlantTrees() {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
Int32 treeY = Heightmap[treeZ * Width + treeX] + 1;
|
Int32 treeY = Heightmap[treeZ * Width + treeX] + 1;
|
||||||
|
if (treeY >= Height) continue;
|
||||||
Int32 treeHeight = 5 + Random_Next(&rnd, 3);
|
Int32 treeHeight = 5 + Random_Next(&rnd, 3);
|
||||||
|
|
||||||
Int32 index = (treeY * Length + treeZ) * Width + treeX;
|
Int32 index = (treeY * Length + treeZ) * Width + treeX;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user