summaryrefslogtreecommitdiffstats
path: root/source/ChunkMap.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-20 13:40:34 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-20 13:40:34 +0200
commitd006ea533763c19d0c35877e87c1384bdd65630d (patch)
tree24d45e32142ac5b9553caa47c62e4e71e45bceaf /source/ChunkMap.cpp
parentPACKET_DESTROY_ENTITY isn't sent for self when the player is kicked (FS #254) (diff)
downloadcuberite-d006ea533763c19d0c35877e87c1384bdd65630d.tar
cuberite-d006ea533763c19d0c35877e87c1384bdd65630d.tar.gz
cuberite-d006ea533763c19d0c35877e87c1384bdd65630d.tar.bz2
cuberite-d006ea533763c19d0c35877e87c1384bdd65630d.tar.lz
cuberite-d006ea533763c19d0c35877e87c1384bdd65630d.tar.xz
cuberite-d006ea533763c19d0c35877e87c1384bdd65630d.tar.zst
cuberite-d006ea533763c19d0c35877e87c1384bdd65630d.zip
Diffstat (limited to '')
-rw-r--r--source/ChunkMap.cpp53
1 files changed, 44 insertions, 9 deletions
diff --git a/source/ChunkMap.cpp b/source/ChunkMap.cpp
index a616cf63d..a5d8b004e 100644
--- a/source/ChunkMap.cpp
+++ b/source/ChunkMap.cpp
@@ -844,16 +844,16 @@ void cChunkMap::CollectPickupsByPlayer(cPlayer * a_Player)
-BLOCKTYPE cChunkMap::GetBlock(int a_X, int a_Y, int a_Z)
+BLOCKTYPE cChunkMap::GetBlock(int a_BlockX, int a_BlockY, int a_BlockZ)
{
int ChunkX, ChunkZ;
- cChunkDef::AbsoluteToRelative( a_X, a_Y, a_Z, ChunkX, ChunkZ );
+ cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ );
cCSLock Lock(m_CSLayers);
cChunkPtr Chunk = GetChunk(ChunkX, ZERO_CHUNK_Y, ChunkZ);
if ((Chunk != NULL) && Chunk->IsValid())
{
- return Chunk->GetBlock(a_X, a_Y, a_Z);
+ return Chunk->GetBlock(a_BlockX, a_BlockY, a_BlockZ);
}
return 0;
}
@@ -862,16 +862,16 @@ BLOCKTYPE cChunkMap::GetBlock(int a_X, int a_Y, int a_Z)
-BLOCKTYPE cChunkMap::GetBlockMeta(int a_X, int a_Y, int a_Z)
+NIBBLETYPE cChunkMap::GetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ)
{
int ChunkX, ChunkZ;
- cChunkDef::AbsoluteToRelative( a_X, a_Y, a_Z, ChunkX, ChunkZ );
+ cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ );
cCSLock Lock(m_CSLayers);
cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ );
if ((Chunk != NULL) && Chunk->IsValid() )
{
- return Chunk->GetMeta(a_X, a_Y, a_Z);
+ return Chunk->GetMeta(a_BlockX, a_BlockY, a_BlockZ);
}
return 0;
}
@@ -880,16 +880,34 @@ BLOCKTYPE cChunkMap::GetBlockMeta(int a_X, int a_Y, int a_Z)
-BLOCKTYPE cChunkMap::GetBlockSkyLight(int a_X, int a_Y, int a_Z)
+NIBBLETYPE cChunkMap::GetBlockSkyLight(int a_BlockX, int a_BlockY, int a_BlockZ)
{
int ChunkX, ChunkZ;
- cChunkDef::AbsoluteToRelative( a_X, a_Y, a_Z, ChunkX, ChunkZ );
+ cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ );
cCSLock Lock(m_CSLayers);
cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ );
if ((Chunk != NULL) && Chunk->IsValid() )
{
- return Chunk->GetSkyLight( a_X, a_Y, a_Z );
+ return Chunk->GetSkyLight(a_BlockX, a_BlockY, a_BlockZ);
+ }
+ return 0;
+}
+
+
+
+
+
+NIBBLETYPE cChunkMap::GetBlockBlockLight(int a_BlockX, int a_BlockY, int a_BlockZ)
+{
+ int ChunkX, ChunkZ;
+ cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ );
+
+ cCSLock Lock(m_CSLayers);
+ cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ );
+ if ((Chunk != NULL) && Chunk->IsValid() )
+ {
+ return Chunk->GetBlockLight(a_BlockX, a_BlockY, a_BlockZ);
}
return 0;
}
@@ -952,6 +970,23 @@ void cChunkMap::GetBlockTypeMeta(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCK
+void cChunkMap::GetBlockInfo(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_Meta, NIBBLETYPE & a_SkyLight, NIBBLETYPE & a_BlockLight)
+{
+ int ChunkX, ChunkZ, X = a_BlockX, Y = a_BlockY, Z = a_BlockZ;
+ cChunkDef::AbsoluteToRelative( X, Y, Z, ChunkX, ChunkZ );
+
+ cCSLock Lock(m_CSLayers);
+ cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ );
+ if ((Chunk != NULL) && Chunk->IsValid())
+ {
+ Chunk->GetBlockInfo(X, Y, Z, a_BlockType, a_Meta, a_SkyLight, a_BlockLight);
+ }
+}
+
+
+
+
+
void cChunkMap::ReplaceBlocks(const sSetBlockVector & a_Blocks, BLOCKTYPE a_FilterBlockType)
{
cCSLock Lock(m_CSLayers);