summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockEnderChest.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Blocks/BlockEnderChest.h')
-rw-r--r--src/Blocks/BlockEnderChest.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/Blocks/BlockEnderChest.h b/src/Blocks/BlockEnderChest.h
new file mode 100644
index 000000000..2e0da0f17
--- /dev/null
+++ b/src/Blocks/BlockEnderChest.h
@@ -0,0 +1,40 @@
+
+#pragma once
+
+#include "Mixins.h"
+
+
+
+
+class cBlockEnderChestHandler final :
+ public cYawRotator<cBlockEntityHandler, 0x07, 0x03, 0x04, 0x02, 0x05>
+{
+ using Super = cYawRotator<cBlockEntityHandler, 0x07, 0x03, 0x04, 0x02, 0x05>;
+
+public:
+
+ using Super::Super;
+
+private:
+
+ virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
+ {
+ // Only drop something when mined with a pickaxe:
+ if (
+ (a_Tool != nullptr) &&
+ ItemCategory::IsPickaxe(a_Tool->m_ItemType)
+ )
+ {
+ // Only drop self when mined with a silk-touch pickaxe:
+ if (a_Tool->m_Enchantments.GetLevel(cEnchantments::enchSilkTouch) > 0)
+ {
+ return cItem(E_BLOCK_ENDER_CHEST);
+ }
+
+ return cItem(E_BLOCK_OBSIDIAN, 8);
+ }
+
+ return {};
+ }
+
+};