#pragma once #include "BlockHandler.h" #include "ChunkInterface.h" class cBlockTallGrassHandler: public cBlockHandler { using super = cBlockHandler; public: cBlockTallGrassHandler(BLOCKTYPE a_BlockType): super(a_BlockType) { } virtual bool DoesIgnoreBuildCollision(cChunkInterface & a_ChunkInterface, Vector3i a_Pos, cPlayer & a_Player, NIBBLETYPE a_Meta) override { return true; } virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, cBlockEntity * a_BlockEntity, const cEntity * a_Digger, const cItem * a_Tool) override { // If using shears, drop self: if ((a_Tool != nullptr) && (a_Tool->m_ItemType == E_ITEM_SHEARS)) { return cItem(m_BlockType, 1, a_BlockMeta); } // Drop seeds, sometimes: if (GetRandomProvider().RandBool(0.125)) { return cItem(E_ITEM_SEEDS); } return {}; } virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override { if (a_RelY <= 0) { return false; } BLOCKTYPE BelowBlock = a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ); return IsBlockTypeOfDirt(BelowBlock); } virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override { UNUSED(a_Meta); return 7; } } ;