diff options
author | worktycho <work.tycho@gmail.com> | 2015-07-01 11:39:46 +0200 |
---|---|---|
committer | worktycho <work.tycho@gmail.com> | 2015-07-01 11:39:46 +0200 |
commit | 11cf88b8722e55e5ab3e1775b62538e96575b600 (patch) | |
tree | 6b16a888c3abce218cd76a719312811a63f0e5f6 /src/Blocks/BlockFarmland.h | |
parent | APIDump: Fixed a forgotten comma. (diff) | |
parent | Added neighbor specification in the OnNeighborChanged() block callback. (diff) | |
download | cuberite-11cf88b8722e55e5ab3e1775b62538e96575b600.tar cuberite-11cf88b8722e55e5ab3e1775b62538e96575b600.tar.gz cuberite-11cf88b8722e55e5ab3e1775b62538e96575b600.tar.bz2 cuberite-11cf88b8722e55e5ab3e1775b62538e96575b600.tar.lz cuberite-11cf88b8722e55e5ab3e1775b62538e96575b600.tar.xz cuberite-11cf88b8722e55e5ab3e1775b62538e96575b600.tar.zst cuberite-11cf88b8722e55e5ab3e1775b62538e96575b600.zip |
Diffstat (limited to 'src/Blocks/BlockFarmland.h')
-rw-r--r-- | src/Blocks/BlockFarmland.h | 13 |
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)) |