1
0

Double tall grass drops seeds when broken by water (#3763)

This commit is contained in:
dbhicks 2017-06-14 08:23:33 -04:00 committed by Lukas Pioch
parent 5a228fbc16
commit 8d5f01530d

View File

@ -26,26 +26,35 @@ public:
virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_CanDrop) override
{
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
int AlternateY = a_BlockY;
if (Meta & 0x8)
{
super::DropBlock(a_ChunkInterface, a_WorldInterface, a_BlockPluginInterface, a_Digger, a_BlockX, a_BlockY - 1, a_BlockZ, a_CanDrop);
--AlternateY;
}
else
{
++AlternateY;
}
// also destroy the other block if it has a valid height and is a big flower
if (cChunkDef::IsValidHeight(AlternateY) && a_ChunkInterface.GetBlock(a_BlockX, AlternateY, a_BlockZ) == E_BLOCK_BIG_FLOWER)
{
super::DropBlock(a_ChunkInterface, a_WorldInterface, a_BlockPluginInterface, a_Digger, a_BlockX, a_BlockY, a_BlockZ, a_CanDrop);
a_ChunkInterface.FastSetBlock(a_BlockX, AlternateY, a_BlockZ, E_BLOCK_AIR, 0);
}
}
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
NIBBLETYPE Meta = a_BlockMeta & 0x7;
if ((Meta == E_META_BIG_FLOWER_DOUBLE_TALL_GRASS) || (Meta == E_META_BIG_FLOWER_LARGE_FERN))
if (Meta == E_META_BIG_FLOWER_DOUBLE_TALL_GRASS)
{
return;
a_Pickups.push_back(cItem(E_ITEM_SEEDS));
}
else if (Meta != E_META_BIG_FLOWER_LARGE_FERN)
{
a_Pickups.push_back(cItem(E_BLOCK_BIG_FLOWER, 1, Meta));
}
a_Pickups.push_back(cItem(E_BLOCK_BIG_FLOWER, 1, Meta));
}
virtual void OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override