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/BlockHandler.cpp | |
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/BlockHandler.cpp')
-rw-r--r-- | src/Blocks/BlockHandler.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp index 520d0d328..412fc3aeb 100644 --- a/src/Blocks/BlockHandler.cpp +++ b/src/Blocks/BlockHandler.cpp @@ -389,12 +389,12 @@ void cBlockHandler::OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWor void cBlockHandler::OnPlaced(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) { // Notify the neighbors - NeighborChanged(a_ChunkInterface, a_BlockX - 1, a_BlockY, a_BlockZ); - NeighborChanged(a_ChunkInterface, a_BlockX + 1, a_BlockY, a_BlockZ); - NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ); - NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ); - NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ - 1); - NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ + 1); + NeighborChanged(a_ChunkInterface, a_BlockX - 1, a_BlockY, a_BlockZ, BLOCK_FACE_XP); + NeighborChanged(a_ChunkInterface, a_BlockX + 1, a_BlockY, a_BlockZ, BLOCK_FACE_XM); + NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ, BLOCK_FACE_YP); + NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ, BLOCK_FACE_YM); + NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ - 1, BLOCK_FACE_ZP); + NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ + 1, BLOCK_FACE_ZM); } @@ -404,23 +404,23 @@ void cBlockHandler::OnPlaced(cChunkInterface & a_ChunkInterface, cWorldInterface void cBlockHandler::OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) { // Notify the neighbors - NeighborChanged(a_ChunkInterface, a_BlockX - 1, a_BlockY, a_BlockZ); - NeighborChanged(a_ChunkInterface, a_BlockX + 1, a_BlockY, a_BlockZ); - NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ); - NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ); - NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ - 1); - NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ + 1); + NeighborChanged(a_ChunkInterface, a_BlockX - 1, a_BlockY, a_BlockZ, BLOCK_FACE_XP); + NeighborChanged(a_ChunkInterface, a_BlockX + 1, a_BlockY, a_BlockZ, BLOCK_FACE_XM); + NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ, BLOCK_FACE_YP); + NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ, BLOCK_FACE_YM); + NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ - 1, BLOCK_FACE_ZP); + NeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ + 1, BLOCK_FACE_ZM); } -void cBlockHandler::NeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) +void cBlockHandler::NeighborChanged(cChunkInterface & a_ChunkInterface, int a_NeighborX, int a_NeighborY, int a_NeighborZ, eBlockFace a_WhichNeighbor) { - if ((a_BlockY >= 0) && (a_BlockY < cChunkDef::Height)) + if ((a_NeighborY >= 0) && (a_NeighborY < cChunkDef::Height)) { - cBlockInfo::GetHandler(a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ))->OnNeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ); + cBlockInfo::GetHandler(a_ChunkInterface.GetBlock(a_NeighborX, a_NeighborY, a_NeighborZ))->OnNeighborChanged(a_ChunkInterface, a_NeighborX, a_NeighborY, a_NeighborZ, a_WhichNeighbor); } } |