summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockNewLeaves.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-02-20 16:24:52 +0100
committerMattes D <github@xoft.cz>2014-02-20 16:24:52 +0100
commit191a08fc32819c911cfa081a12db95a13d9223b6 (patch)
tree69e4fd8f1104652ea18a06ab732a656f3eacb346 /src/Blocks/BlockNewLeaves.h
parentAPIDump: Fixed cBlockArea:GetRelBlockType() return types. (diff)
parentAdd BlockNewLeaves.h and rename Darkoac to Darkoak (diff)
downloadcuberite-191a08fc32819c911cfa081a12db95a13d9223b6.tar
cuberite-191a08fc32819c911cfa081a12db95a13d9223b6.tar.gz
cuberite-191a08fc32819c911cfa081a12db95a13d9223b6.tar.bz2
cuberite-191a08fc32819c911cfa081a12db95a13d9223b6.tar.lz
cuberite-191a08fc32819c911cfa081a12db95a13d9223b6.tar.xz
cuberite-191a08fc32819c911cfa081a12db95a13d9223b6.tar.zst
cuberite-191a08fc32819c911cfa081a12db95a13d9223b6.zip
Diffstat (limited to '')
-rw-r--r--src/Blocks/BlockNewLeaves.h42
1 files changed, 42 insertions, 0 deletions
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);
+ }
+} ;
+
+
+
+
+