summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockNetherWart.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Blocks/BlockNetherWart.h')
-rw-r--r--src/Blocks/BlockNetherWart.h37
1 files changed, 27 insertions, 10 deletions
diff --git a/src/Blocks/BlockNetherWart.h b/src/Blocks/BlockNetherWart.h
index 5732259db..6b0b394b5 100644
--- a/src/Blocks/BlockNetherWart.h
+++ b/src/Blocks/BlockNetherWart.h
@@ -9,30 +9,39 @@
class cBlockNetherWartHandler :
- public cBlockPlant
+ public cBlockPlant<false>
{
- typedef cBlockPlant Super;
+ using super = cBlockPlant<false>;
+
public:
- cBlockNetherWartHandler(BLOCKTYPE a_BlockType)
- : Super(a_BlockType, false)
+
+ cBlockNetherWartHandler(BLOCKTYPE a_BlockType):
+ super(a_BlockType)
{
}
- virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_Meta) override
- {
- auto & rand = GetRandomProvider();
- if (a_Meta == 0x3)
+
+
+
+ virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, cBlockEntity * a_BlockEntity, const cEntity * a_Digger, const cItem * a_Tool) override
+ {
+ if (a_BlockMeta == 0x03)
{
// Fully grown, drop the entire produce:
- a_Pickups.emplace_back(E_ITEM_NETHER_WART, 1 + (rand.RandInt<char>(2) + rand.RandInt<char>(2)) / 2, 0);
+ auto & rand = GetRandomProvider();
+ return cItem(E_ITEM_NETHER_WART, 1 + (rand.RandInt<char>(2) + rand.RandInt<char>(2)) / 2, 0);
}
else
{
- a_Pickups.push_back(cItem(E_ITEM_NETHER_WART));
+ return cItem(E_ITEM_NETHER_WART);
}
}
+
+
+
+
virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
{
NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ);
@@ -46,12 +55,20 @@ public:
}
}
+
+
+
+
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
{
// Needs to be placed on top of a Soulsand block:
return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) == E_BLOCK_SOULSAND));
}
+
+
+
+
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
{
UNUSED(a_Meta);