diff options
author | STRWarrior <niels.breuker@hotmail.nl> | 2014-10-08 21:25:59 +0200 |
---|---|---|
committer | STRWarrior <niels.breuker@hotmail.nl> | 2014-10-08 21:25:59 +0200 |
commit | 36fa1c5c73ba273051904d539e82d1f8f33a50d7 (patch) | |
tree | 052e8dc24a6308ae54a8e8baeee5963df793a33e | |
parent | Added AcaciaTrees for the savanna biomes (diff) | |
download | cuberite-36fa1c5c73ba273051904d539e82d1f8f33a50d7.tar cuberite-36fa1c5c73ba273051904d539e82d1f8f33a50d7.tar.gz cuberite-36fa1c5c73ba273051904d539e82d1f8f33a50d7.tar.bz2 cuberite-36fa1c5c73ba273051904d539e82d1f8f33a50d7.tar.lz cuberite-36fa1c5c73ba273051904d539e82d1f8f33a50d7.tar.xz cuberite-36fa1c5c73ba273051904d539e82d1f8f33a50d7.tar.zst cuberite-36fa1c5c73ba273051904d539e82d1f8f33a50d7.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Generating/Trees.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/Generating/Trees.cpp b/src/Generating/Trees.cpp index c78a30f9b..8fce61b95 100644 --- a/src/Generating/Trees.cpp +++ b/src/Generating/Trees.cpp @@ -416,15 +416,16 @@ void GetAcaciaTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noi a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_NEW_LOG, E_META_NEW_LOG_ACACIA_WOOD)); } - Vector3i BranchPos = Vector3i(a_BlockX, a_BlockY + Height - 1, a_BlockZ); - Vector3i BranchDirection = Vector3i(a_Noise.IntNoise3DInt(a_BlockX * a_Seq, a_BlockY, a_BlockZ) % 3 - 1, 0, a_Noise.IntNoise3DInt(a_BlockX, a_BlockY, a_BlockZ * a_Seq) % 3 - 1); - int Attempts = 0; - while (BranchDirection.Length() == 0.0) + const Vector3i AvailableDirections[] = { - Attempts++; - BranchDirection = Vector3i(a_Noise.IntNoise3DInt(a_BlockX * a_Seq, a_BlockY * Attempts, a_BlockZ) % 3 - 1, 0, a_Noise.IntNoise3DInt(a_BlockX, a_BlockY * Attempts, a_BlockZ * a_Seq) % 3 - 1); - } - BranchDirection.y = 1; + { -1, 1, 0 }, { 0, 1, -1 }, + { -1, 1, 1 }, { -1, 1, -1 }, + { 1, 1, 1 }, { 1, 1, -1 }, + { 1, 1, 0 }, { 0, 1, 1 }, + }; + + Vector3i BranchPos = Vector3i(a_BlockX, a_BlockY + Height - 1, a_BlockZ); + Vector3i BranchDirection = AvailableDirections[a_Noise.IntNoise3DInt(a_BlockX, a_BlockY, a_BlockZ) % 8]; int BranchHeight = a_Noise.IntNoise3DInt(a_BlockX, a_BlockY, a_BlockZ) % 3 + 1; for (int i = 0; i < BranchHeight; i++) |