summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockHandler.h
diff options
context:
space:
mode:
authorworktycho <work.tycho@gmail.com>2015-07-01 11:39:46 +0200
committerworktycho <work.tycho@gmail.com>2015-07-01 11:39:46 +0200
commit11cf88b8722e55e5ab3e1775b62538e96575b600 (patch)
tree6b16a888c3abce218cd76a719312811a63f0e5f6 /src/Blocks/BlockHandler.h
parentAPIDump: Fixed a forgotten comma. (diff)
parentAdded neighbor specification in the OnNeighborChanged() block callback. (diff)
downloadcuberite-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.h')
-rw-r--r--src/Blocks/BlockHandler.h20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/Blocks/BlockHandler.h b/src/Blocks/BlockHandler.h
index a71c70e8b..1b357c3f1 100644
--- a/src/Blocks/BlockHandler.h
+++ b/src/Blocks/BlockHandler.h
@@ -56,13 +56,19 @@ public:
/// Called before a block gets destroyed / replaced with air
virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ);
- /// Called when a direct neighbor of this block has been changed (The position is the own position, not the neighbor position)
- virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) {}
-
- /// Notifies all neighbors of the given block about a change
- static void NeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ);
-
- /// Called while the player diggs the block.
+ /** Called when a direct neighbor of this block has been changed (The position is the block's own position, not the changing neighbor's position)
+ a_WhichNeighbor indicates which neighbor has changed. For example, BLOCK_FACE_YP meant the neighbor above has changed.
+ BLOCK_FACE_NONE means that it is a neighbor not directly adjacent (diagonal, etc.) */
+ virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_WhichNeighbor) {}
+
+ /** Notifies the specified neighbor that the current block has changed.
+ a_NeighborXYZ coords are the coords of the neighbor
+ a_WhichNeighbor specifies which neighbor (relative to a_NeighborXYZ) has changed.
+ For example BLOCK_FACE_YP means that the block at {a_NeighborX, a_NeighborY + 1, a_NeighborZ} has changed.
+ BLOCK_FACE_NONE means that it is a neighbor not directly adjacent (diagonal, etc.) */
+ static void NeighborChanged(cChunkInterface & a_ChunkInterface, int a_NeighborX, int a_NeighborY, int a_NeighborZ, eBlockFace a_WhichNeighbor);
+
+ /** Called when the player starts digging the block. */
virtual void OnDigging(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) {}
/// Called if the user right clicks the block and the block is useable