summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-02-19 19:18:40 +0100
committerHowaner <franzi.moos@googlemail.com>2014-02-19 19:18:40 +0100
commit16f3809ded538611c6c26a41316cf35bb8b1f5a5 (patch)
tree5479bee290c6d5c46a0db2e878a84bf962a22409
parentAdd new Trees (without Generator) (diff)
downloadcuberite-16f3809ded538611c6c26a41316cf35bb8b1f5a5.tar
cuberite-16f3809ded538611c6c26a41316cf35bb8b1f5a5.tar.gz
cuberite-16f3809ded538611c6c26a41316cf35bb8b1f5a5.tar.bz2
cuberite-16f3809ded538611c6c26a41316cf35bb8b1f5a5.tar.lz
cuberite-16f3809ded538611c6c26a41316cf35bb8b1f5a5.tar.xz
cuberite-16f3809ded538611c6c26a41316cf35bb8b1f5a5.tar.zst
cuberite-16f3809ded538611c6c26a41316cf35bb8b1f5a5.zip
-rw-r--r--src/BlockID.h12
-rw-r--r--src/Blocks/BlockNewLeaves.h42
-rw-r--r--src/Generating/Trees.cpp2
-rw-r--r--src/Generating/Trees.h4
-rw-r--r--src/World.cpp12
5 files changed, 57 insertions, 15 deletions
diff --git a/src/BlockID.h b/src/BlockID.h
index e1716b8b3..3413555f4 100644
--- a/src/BlockID.h
+++ b/src/BlockID.h
@@ -527,12 +527,12 @@ enum
E_META_SANDSTONE_SMOOTH = 2,
// E_BLOCK_SAPLING metas (lowest 3 bits):
- E_META_SAPLING_APPLE = 0,
- E_META_SAPLING_CONIFER = 1,
- E_META_SAPLING_BIRCH = 2,
- E_META_SAPLING_JUNGLE = 3,
- E_META_SAPLING_ACACIA = 4,
- E_META_SAPLING_DARKOAC = 5,
+ E_META_SAPLING_APPLE = 0,
+ E_META_SAPLING_CONIFER = 1,
+ E_META_SAPLING_BIRCH = 2,
+ E_META_SAPLING_JUNGLE = 3,
+ E_META_SAPLING_ACACIA = 4,
+ E_META_SAPLING_DARK_OAK = 5,
// E_BLOCK_SILVERFISH_EGG metas:
E_META_SILVERFISH_EGG_STONE = 0,
diff --git a/src/Blocks/BlockNewLeaves.h b/src/Blocks/BlockNewLeaves.h
new file mode 100644
index 000000000..5a267e8c6
--- /dev/null
+++ b/src/Blocks/BlockNewLeaves.h
@@ -0,0 +1,42 @@
+#pragma once
+#include "BlockHandler.h"
+#include "BlockLeaves.h"
+#include "../World.h"
+
+
+
+
+
+
+class cBlockNewLeavesHandler :
+ public cBlockLeavesHandler
+{
+public:
+ cBlockNewLeavesHandler(BLOCKTYPE a_BlockType)
+ : cBlockLeavesHandler(a_BlockType)
+ {
+ }
+
+
+ virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
+ {
+ MTRand rand;
+
+ // Only the first 2 bits contain the display information, the others are for growing
+ if (rand.randInt(5) == 0)
+ {
+ a_Pickups.push_back(cItem(E_BLOCK_SAPLING, 1, (a_BlockMeta & 3) + 4));
+ }
+ }
+
+
+ void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override
+ {
+ cBlockHandler::OnDestroyed(a_ChunkInterface, a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ);
+ }
+} ;
+
+
+
+
+
diff --git a/src/Generating/Trees.cpp b/src/Generating/Trees.cpp
index ada20954a..a660285d1 100644
--- a/src/Generating/Trees.cpp
+++ b/src/Generating/Trees.cpp
@@ -391,7 +391,7 @@ void GetAcaciaTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noi
-void GetDarkoacTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks)
+void GetDarkoakTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks)
{
// TODO
}
diff --git a/src/Generating/Trees.h b/src/Generating/Trees.h
index 7619f4458..00f343a3d 100644
--- a/src/Generating/Trees.h
+++ b/src/Generating/Trees.h
@@ -66,8 +66,8 @@ void GetBirchTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Nois
/// Generates an image of a random acacia tree
void GetAcaciaTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
-/// Generates an image of a random darkoac tree
-void GetDarkoacTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
+/// Generates an image of a random darkoak tree
+void GetDarkoakTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
/// Generates an image of a random large birch tree
void GetTallBirchTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks,sSetBlockVector & a_OtherBlocks);
diff --git a/src/World.cpp b/src/World.cpp
index 369a854d2..313a8d7fa 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -1207,12 +1207,12 @@ void cWorld::GrowTreeFromSapling(int a_X, int a_Y, int a_Z, NIBBLETYPE a_Sapling
sSetBlockVector Logs, Other;
switch (a_SaplingMeta & 0x07)
{
- case E_META_SAPLING_APPLE: GetAppleTreeImage (a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break;
- case E_META_SAPLING_BIRCH: GetBirchTreeImage (a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break;
- case E_META_SAPLING_CONIFER: GetConiferTreeImage(a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break;
- case E_META_SAPLING_JUNGLE: GetJungleTreeImage (a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break;
- case E_META_SAPLING_ACACIA: GetAcaciaTreeImage (a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break;
- case E_META_SAPLING_DARKOAC: GetDarkoacTreeImage(a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break;
+ case E_META_SAPLING_APPLE: GetAppleTreeImage (a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break;
+ case E_META_SAPLING_BIRCH: GetBirchTreeImage (a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break;
+ case E_META_SAPLING_CONIFER: GetConiferTreeImage(a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break;
+ case E_META_SAPLING_JUNGLE: GetJungleTreeImage (a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break;
+ case E_META_SAPLING_ACACIA: GetAcaciaTreeImage (a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break;
+ case E_META_SAPLING_DARK_OAK: GetDarkoakTreeImage(a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break;
}
Other.insert(Other.begin(), Logs.begin(), Logs.end());
Logs.clear();