summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockFarmland.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-07-01 10:40:16 +0200
committerMattes D <github@xoft.cz>2015-07-01 10:40:16 +0200
commit66a164a9a75a2d48763520aab3aeb8eeda85c92d (patch)
tree6b16a888c3abce218cd76a719312811a63f0e5f6 /src/Blocks/BlockFarmland.h
parentAPIDump: Fixed a forgotten comma. (diff)
downloadcuberite-66a164a9a75a2d48763520aab3aeb8eeda85c92d.tar
cuberite-66a164a9a75a2d48763520aab3aeb8eeda85c92d.tar.gz
cuberite-66a164a9a75a2d48763520aab3aeb8eeda85c92d.tar.bz2
cuberite-66a164a9a75a2d48763520aab3aeb8eeda85c92d.tar.lz
cuberite-66a164a9a75a2d48763520aab3aeb8eeda85c92d.tar.xz
cuberite-66a164a9a75a2d48763520aab3aeb8eeda85c92d.tar.zst
cuberite-66a164a9a75a2d48763520aab3aeb8eeda85c92d.zip
Diffstat (limited to '')
-rw-r--r--src/Blocks/BlockFarmland.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/Blocks/BlockFarmland.h b/src/Blocks/BlockFarmland.h
index 23a7392da..8d43632ff 100644
--- a/src/Blocks/BlockFarmland.h
+++ b/src/Blocks/BlockFarmland.h
@@ -65,13 +65,22 @@ public:
}
}
- virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override
+
+ virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_WhichNeighbor) override
{
+ // Don't care about any neighbor but the one above us (fix recursion loop in #2213):
+ if (a_WhichNeighbor != BLOCK_FACE_YP)
+ {
+ return;
+ }
+
+ // Don't care about anything if we're at the top of the world:
if (a_BlockY >= cChunkDef::Height)
{
return;
}
+ // Check whether we should revert to dirt:
BLOCKTYPE UpperBlock = a_ChunkInterface.GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ);
if (cBlockInfo::FullyOccupiesVoxel(UpperBlock))
{
@@ -79,11 +88,13 @@ public:
}
}
+
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
a_Pickups.Add(E_BLOCK_DIRT, 1, 0); // Reset meta
}
+
bool IsWaterInNear(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ)
{
if (a_Chunk.GetWorld()->IsWeatherWetAt(a_RelX, a_RelZ))