summaryrefslogtreecommitdiffstats
path: root/src/Blocks/ChunkInterface.h
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-01-26 15:20:39 +0100
committerTycho <work.tycho+git@gmail.com>2014-01-26 15:20:39 +0100
commit14e48ccb4bbad6f43121dc27f042083cda160f45 (patch)
tree96df772125eb96f79bf76226e5df91b4e2b99696 /src/Blocks/ChunkInterface.h
parentAdded support for overide in c++11 supporting varients of gcc/clang (diff)
downloadcuberite-14e48ccb4bbad6f43121dc27f042083cda160f45.tar
cuberite-14e48ccb4bbad6f43121dc27f042083cda160f45.tar.gz
cuberite-14e48ccb4bbad6f43121dc27f042083cda160f45.tar.bz2
cuberite-14e48ccb4bbad6f43121dc27f042083cda160f45.tar.lz
cuberite-14e48ccb4bbad6f43121dc27f042083cda160f45.tar.xz
cuberite-14e48ccb4bbad6f43121dc27f042083cda160f45.tar.zst
cuberite-14e48ccb4bbad6f43121dc27f042083cda160f45.zip
Diffstat (limited to 'src/Blocks/ChunkInterface.h')
-rw-r--r--src/Blocks/ChunkInterface.h58
1 files changed, 51 insertions, 7 deletions
diff --git a/src/Blocks/ChunkInterface.h b/src/Blocks/ChunkInterface.h
index 91a635dcf..a16c68013 100644
--- a/src/Blocks/ChunkInterface.h
+++ b/src/Blocks/ChunkInterface.h
@@ -1,26 +1,70 @@
#pragma once
-class cChunkInterface
+#include "../ChunkMap.h"
+#include "../ForEachChunkProvider.h"
+
+class cChunkInterface : public cForEachChunkProvider
{
public:
- BLOCKTYPE GetBlock (int a_BlockX, int a_BlockY, int a_BlockZ);
- BLOCKTYPE GetBlock (const Vector3i & a_Pos ) { return GetBlock( a_Pos.x, a_Pos.y, a_Pos.z ); }
- NIBBLETYPE GetBlockMeta (int a_BlockX, int a_BlockY, int a_BlockZ);
+ cChunkInterface(cChunkMap * a_ChunkMap) : m_ChunkMap(a_ChunkMap) {}
+
+ BLOCKTYPE GetBlock (int a_BlockX, int a_BlockY, int a_BlockZ)
+ {
+ return m_ChunkMap->GetBlock(a_BlockX,a_BlockY,a_BlockZ);
+ }
+ BLOCKTYPE GetBlock (const Vector3i & a_Pos )
+ {
+ return GetBlock( a_Pos.x, a_Pos.y, a_Pos.z );
+ }
+ NIBBLETYPE GetBlockMeta (int a_BlockX, int a_BlockY, int a_BlockZ)
+ {
+ return m_ChunkMap->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
+ }
/** Sets the block at the specified coords to the specified value.
Full processing, incl. updating neighbors, is performed.
*/
- void SetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
+ void SetBlock(cWorldInterface * a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
+ {
+ m_ChunkMap->SetBlock(a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta);
+ }
+ void SetBlockMeta (int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_MetaData)
+ {
+ m_ChunkMap->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, a_MetaData);
+ }
+ void QueueSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_TickDelay, BLOCKTYPE a_PreviousBlockType, cWorldInterface * a_WorldInterface)
+ {
+ m_ChunkMap->QueueSetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_WorldInterface->GetWorldAge() + a_TickDelay, a_PreviousBlockType);
+ }
/** Sets the block at the specified coords to the specified value.
The replacement doesn't trigger block updates.
The replaced blocks aren't checked for block entities (block entity is leaked if it exists at this block)
*/
- void FastSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
+ void FastSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
+ {
+ m_ChunkMap->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta);
+ }
void FastSetBlock(const Vector3i & a_Pos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta ) { FastSetBlock( a_Pos.x, a_Pos.y, a_Pos.z, a_BlockType, a_BlockMeta ); }
+
+ void UseBlockEntity(cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
+ {
+ m_ChunkMap->UseBlockEntity(a_Player, a_BlockX, a_BlockY, a_BlockZ);
+ }
+
+ virtual bool ForEachChunkInRect(int a_MinChunkX, int a_MaxChunkX, int a_MinChunkZ, int a_MaxChunkZ, cChunkDataCallback & a_Callback) override
+ {
+ return m_ChunkMap->ForEachChunkInRect(a_MinChunkX, a_MaxChunkX, a_MinChunkZ, a_MaxChunkZ, a_Callback);
+ }
+
+ virtual bool WriteBlockArea(cBlockArea & a_Area, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes) override
+ {
+ return m_ChunkMap->WriteBlockArea(a_Area, a_MinBlockX, a_MinBlockY, a_MinBlockZ, a_DataTypes);
+ }
- void DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_BlockY, double a_BlockZ, bool a_CanCauseFire, eExplosionSource a_Source, void * a_SourceData);
+private:
+ cChunkMap * m_ChunkMap;
};