summaryrefslogtreecommitdiffstats
path: root/src/Blocks
diff options
context:
space:
mode:
Diffstat (limited to 'src/Blocks')
-rw-r--r--src/Blocks/BlockBookShelf.h26
-rw-r--r--src/Blocks/BlockHandler.cpp2
-rw-r--r--src/Blocks/CMakeLists.txt1
3 files changed, 29 insertions, 0 deletions
diff --git a/src/Blocks/BlockBookShelf.h b/src/Blocks/BlockBookShelf.h
new file mode 100644
index 000000000..477cb47b7
--- /dev/null
+++ b/src/Blocks/BlockBookShelf.h
@@ -0,0 +1,26 @@
+
+#pragma once
+
+#include "BlockHandler.h"
+
+
+
+
+class cBlockBookShelfHandler :
+ public cBlockHandler
+{
+ public:
+ cBlockBookShelfHandler(BLOCKTYPE a_BlockType) :
+ cBlockHandler(a_BlockType)
+ {
+ }
+
+ virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, cBlockEntity * a_BlockEntity, const cEntity * a_Digger, const cItem * a_Tool) override
+ {
+ if ((ItemCategory::IsTool(a_Tool->m_ItemType)) && (ToolHasSilkTouch(a_Tool)))
+ {
+ return cItem(m_BlockType, 1);
+ }
+ return cItem(E_ITEM_BOOK, 3);
+ }
+};
diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp
index a270a45da..5c23896bd 100644
--- a/src/Blocks/BlockHandler.cpp
+++ b/src/Blocks/BlockHandler.cpp
@@ -8,6 +8,7 @@
#include "BlockAnvil.h"
#include "BlockBed.h"
#include "BlockBigFlower.h"
+#include "BlockBookShelf.h"
#include "BlockBrewingStand.h"
#include "BlockButton.h"
#include "BlockCactus.h"
@@ -202,6 +203,7 @@ static cBlockHandler * CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_BIRCH_FENCE: return new cBlockFenceHandler (a_BlockType);
case E_BLOCK_BIRCH_FENCE_GATE: return new cBlockFenceGateHandler (a_BlockType);
case E_BLOCK_BIRCH_WOOD_STAIRS: return new cBlockStairsHandler (a_BlockType);
+ case E_BLOCK_BOOKCASE: return new cBlockBookShelfHandler (a_BlockType);
case E_BLOCK_BREWING_STAND: return new cBlockBrewingStandHandler (a_BlockType);
case E_BLOCK_BRICK_STAIRS: return new cBlockStairsHandler (a_BlockType);
case E_BLOCK_BROWN_MUSHROOM: return new cBlockMushroomHandler (a_BlockType);
diff --git a/src/Blocks/CMakeLists.txt b/src/Blocks/CMakeLists.txt
index 5a637f69c..22789fe1b 100644
--- a/src/Blocks/CMakeLists.txt
+++ b/src/Blocks/CMakeLists.txt
@@ -14,6 +14,7 @@ SET (HDRS
BlockAnvil.h
BlockBed.h
BlockBigFlower.h
+ BlockBookShelf.h
BlockBrewingStand.h
BlockButton.h
BlockCactus.h