diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2022-01-02 12:56:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-02 12:56:36 +0100 |
commit | c52f299e724bf893944553ac3aeedf7bf0a58241 (patch) | |
tree | 071ed4a45a7054231f60a9dd705dc4d69d10e6c6 /src/Blocks/BlockEnderChest.h | |
parent | WriteBlockEntity: don't write position multiple times (#5373) (diff) | |
download | cuberite-c52f299e724bf893944553ac3aeedf7bf0a58241.tar cuberite-c52f299e724bf893944553ac3aeedf7bf0a58241.tar.gz cuberite-c52f299e724bf893944553ac3aeedf7bf0a58241.tar.bz2 cuberite-c52f299e724bf893944553ac3aeedf7bf0a58241.tar.lz cuberite-c52f299e724bf893944553ac3aeedf7bf0a58241.tar.xz cuberite-c52f299e724bf893944553ac3aeedf7bf0a58241.tar.zst cuberite-c52f299e724bf893944553ac3aeedf7bf0a58241.zip |
Diffstat (limited to 'src/Blocks/BlockEnderChest.h')
-rw-r--r-- | src/Blocks/BlockEnderChest.h | 40 |
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 {}; + } + +}; |