From 66a164a9a75a2d48763520aab3aeb8eeda85c92d Mon Sep 17 00:00:00 2001 From: Mattes D Date: Wed, 1 Jul 2015 10:40:16 +0200 Subject: Added neighbor specification in the OnNeighborChanged() block callback. Fixes the OnNeighborChanged endless recursion with large melon / pumpkin fields. Fixes #2213. --- src/Blocks/BlockLeaves.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/Blocks/BlockLeaves.h') diff --git a/src/Blocks/BlockLeaves.h b/src/Blocks/BlockLeaves.h index 5c9283979..2368eab7b 100644 --- a/src/Blocks/BlockLeaves.h +++ b/src/Blocks/BlockLeaves.h @@ -75,10 +75,14 @@ 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 { + // Unset 0x8 bit so this block gets checked for decay: NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); - a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta & 0x7); // Unset 0x8 bit so it gets checked for decay + if ((Meta & 0x08) != 0) + { + a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta & 0x7); + } } -- cgit v1.2.3