From c53a0ba5f6f71da384a45a07685f8e25c3f91a29 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 23 Sep 2020 16:06:27 +0100 Subject: Unify block entity pickup conversion - Removed normal BlockHandler knowledge of block entities during conversion + Added cBlockEntity::ConvertToPickups that handles it --- src/Blocks/BlockEntity.h | 35 ----------------------------------- 1 file changed, 35 deletions(-) (limited to 'src/Blocks/BlockEntity.h') diff --git a/src/Blocks/BlockEntity.h b/src/Blocks/BlockEntity.h index b1aee7526..4b9de1f12 100644 --- a/src/Blocks/BlockEntity.h +++ b/src/Blocks/BlockEntity.h @@ -4,7 +4,6 @@ #include "BlockHandler.h" #include "ChunkInterface.h" #include "../Item.h" -#include "../BlockEntities/BlockEntityWithItems.h" @@ -44,37 +43,3 @@ private: return true; } }; - - - - - -/** Wrapper for blocks that have a cBlockEntityWithItems descendant attached to them. -When converting to pickups, drops self with meta reset to zero, and adds the container contents. */ -template -class cContainerEntityHandler: - public Base -{ -public: - - constexpr cContainerEntityHandler(BLOCKTYPE a_BlockType): - Base(a_BlockType) - { - } - -private: - - virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, cBlockEntity * a_BlockEntity, const cEntity * a_Digger, const cItem * a_Tool) const override - { - // Reset meta to 0 - cItems res(cItem(Base::m_BlockType, 1, 0)); - - // Drop the contents: - if (a_BlockEntity != nullptr) - { - auto container = static_cast(a_BlockEntity); - res.AddItemGrid(container->GetContents()); - } - return res; - } -}; -- cgit v1.2.3