2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2013-12-06 19:18:58 -05:00
|
|
|
#include "BlockEntity.h"
|
2019-10-16 04:06:34 -04:00
|
|
|
#include "Mixins.h"
|
2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class cBlockEnderchestHandler :
|
2020-08-09 07:22:10 -04:00
|
|
|
public cYawRotator<cBlockEntityHandler, 0x07, 0x03, 0x04, 0x02, 0x05>
|
2013-07-29 07:13:03 -04:00
|
|
|
{
|
2020-08-09 07:22:10 -04:00
|
|
|
using Super = cYawRotator<cBlockEntityHandler, 0x07, 0x03, 0x04, 0x02, 0x05>;
|
2019-10-16 04:06:34 -04:00
|
|
|
|
2013-07-29 07:13:03 -04:00
|
|
|
public:
|
2019-10-16 04:06:34 -04:00
|
|
|
|
2020-09-20 09:50:52 -04:00
|
|
|
using Super::Super;
|
2019-10-16 04:06:34 -04:00
|
|
|
|
2020-09-20 09:50:52 -04:00
|
|
|
private:
|
2019-10-16 04:06:34 -04:00
|
|
|
|
2020-09-20 09:50:52 -04:00
|
|
|
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, cBlockEntity * a_BlockEntity, const cEntity * a_Digger, const cItem * a_Tool) const override
|
2013-07-29 07:13:03 -04:00
|
|
|
{
|
2019-10-16 04:06:34 -04:00
|
|
|
// 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, 1, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return cItem(E_BLOCK_OBSIDIAN, 8, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return {};
|
2013-07-29 07:13:03 -04:00
|
|
|
}
|
2013-12-06 19:18:58 -05:00
|
|
|
|
2020-04-08 16:35:08 -04:00
|
|
|
};
|
2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|