From d017fe5e392636e684dd287f69ebc45334fd5969 Mon Sep 17 00:00:00 2001 From: Samuel Barney Date: Mon, 13 Jul 2015 11:02:00 -0600 Subject: Sapling Growth Update * Growth has been slowed down * Saplings do not grow if they do not have enough space to grow * Saplings do not grow unless the light level is 9 or above * Dark Oak doesn't grow unless it is in a 2x2 Jungle Trees now will grow into a large tree when 2x2 saplings are used. --- src/Generating/Trees.cpp | 94 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 91 insertions(+), 3 deletions(-) (limited to 'src/Generating/Trees.cpp') diff --git a/src/Generating/Trees.cpp b/src/Generating/Trees.cpp index c8bbab12f..5da8fc44a 100644 --- a/src/Generating/Trees.cpp +++ b/src/Generating/Trees.cpp @@ -6,6 +6,7 @@ #include "Globals.h" #include "Trees.h" #include "../BlockID.h" +#include "../World.h" @@ -200,7 +201,8 @@ void GetTreeImageByBiome(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_No } else { - GetJungleTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks); + bool IsLarge = a_Noise.IntNoise3DInt(a_BlockX + 32 * a_Seq, a_BlockY + 32 * a_Seq, a_BlockZ) < 0x60000000; + GetJungleTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks, IsLarge); } return; } @@ -920,9 +922,9 @@ void GetAppleBushImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Nois -void GetJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks) +void GetJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks, bool a_Large) { - if (a_Noise.IntNoise3DInt(a_BlockX + 32 * a_Seq, a_BlockY + 32 * a_Seq, a_BlockZ) < 0x60000000) + if (!a_Large) { GetSmallJungleTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks); } @@ -1041,3 +1043,89 @@ void GetSmallJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & + +bool GetLargeTreeAdjustment(cWorld & a_World, int & a_X, int & a_Y, int & a_Z, NIBBLETYPE a_Meta) +{ + bool IsLarge = true; + a_Meta = a_Meta & 0x07; + + // Check to see if we are the northwest corner + for (int x = 0; x < 2; ++x) + { + for (int z = 0; z < 2; ++z) + { + NIBBLETYPE meta; + BLOCKTYPE type; + a_World.GetBlockTypeMeta(a_X + x, a_Y, a_Z + z, type, meta); + IsLarge = IsLarge && (type == E_BLOCK_SAPLING) && ((a_Meta & meta) == a_Meta); + } + } + + if (IsLarge) + { + return true; + } + + IsLarge = true; + // Check to see if we are the southwest corner + for (int x = 0; x < 2; ++x) + { + for (int z = 0; z > -2; --z) + { + NIBBLETYPE meta; + BLOCKTYPE type; + a_World.GetBlockTypeMeta(a_X + x, a_Y, a_Z + z, type, meta); + IsLarge = IsLarge && (type == E_BLOCK_SAPLING) && ((a_Meta & meta) == a_Meta); + } + } + + if (IsLarge) + { + --a_Z; + return true; + } + + IsLarge = true; + // Check to see if we are the southeast corner + for (int x = 0; x > -2; --x) + { + for (int z = 0; z > -2; --z) + { + NIBBLETYPE meta; + BLOCKTYPE type; + a_World.GetBlockTypeMeta(a_X + x, a_Y, a_Z + z, type, meta); + IsLarge = IsLarge && (type == E_BLOCK_SAPLING) && ((a_Meta & meta) == a_Meta); + } + } + + if (IsLarge) + { + --a_Z; + --a_X; + return true; + } + + IsLarge = true; + // Check to see if we are the northeast corner + for (int x = 0; x > -2; --x) + { + for (int z = 0; z < 2; ++z) + { + NIBBLETYPE meta; + BLOCKTYPE type; + a_World.GetBlockTypeMeta(a_X + x, a_Y, a_Z + z, type, meta); + IsLarge = IsLarge && (type == E_BLOCK_SAPLING) && ((a_Meta & meta) == a_Meta); + } + } + + if (IsLarge) + { + --a_X; + } + + return IsLarge; +} + + + + -- cgit v1.2.3