summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockFarmland.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Blocks/BlockFarmland.h')
-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))