summaryrefslogtreecommitdiffstats
path: root/src/Blocks/ChunkInterface.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-07-29 20:30:38 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-08-04 19:15:18 +0200
commit6bdd130aab51b630918ed664c4389cf33bcb2e06 (patch)
treeeed35c8716f9ea18afe8fd909c09e8595928a671 /src/Blocks/ChunkInterface.cpp
parentDo not GetBlock individually in simulators (diff)
downloadcuberite-6bdd130aab51b630918ed664c4389cf33bcb2e06.tar
cuberite-6bdd130aab51b630918ed664c4389cf33bcb2e06.tar.gz
cuberite-6bdd130aab51b630918ed664c4389cf33bcb2e06.tar.bz2
cuberite-6bdd130aab51b630918ed664c4389cf33bcb2e06.tar.lz
cuberite-6bdd130aab51b630918ed664c4389cf33bcb2e06.tar.xz
cuberite-6bdd130aab51b630918ed664c4389cf33bcb2e06.tar.zst
cuberite-6bdd130aab51b630918ed664c4389cf33bcb2e06.zip
Diffstat (limited to 'src/Blocks/ChunkInterface.cpp')
-rw-r--r--src/Blocks/ChunkInterface.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/Blocks/ChunkInterface.cpp b/src/Blocks/ChunkInterface.cpp
index fd64ee9fc..15198dd37 100644
--- a/src/Blocks/ChunkInterface.cpp
+++ b/src/Blocks/ChunkInterface.cpp
@@ -12,6 +12,15 @@
+bool cChunkInterface::DoWithChunkAt(Vector3i a_BlockPos, cChunkCallback a_Callback)
+{
+ return m_ChunkMap->DoWithChunkAt(a_BlockPos, a_Callback);
+}
+
+
+
+
+
BLOCKTYPE cChunkInterface::GetBlock(Vector3i a_Pos)
{
return m_ChunkMap->GetBlock(a_Pos);
@@ -95,16 +104,16 @@ bool cChunkInterface::WriteBlockArea(cBlockArea & a_Area, int a_MinBlockX, int a
bool cChunkInterface::DigBlock(cWorldInterface & a_WorldInterface, Vector3i a_BlockPos)
{
- BLOCKTYPE blockType;
- NIBBLETYPE blockMeta;
- GetBlockTypeMeta(a_BlockPos, blockType, blockMeta);
- auto handler = cBlockInfo::GetHandler(blockType);
- handler->OnBreaking(*this, a_WorldInterface, a_BlockPos);
+ BLOCKTYPE BlockType;
+ NIBBLETYPE BlockMeta;
+ GetBlockTypeMeta(a_BlockPos, BlockType, BlockMeta);
+
if (!m_ChunkMap->DigBlock(a_BlockPos))
{
return false;
}
- handler->OnBroken(*this, a_WorldInterface, a_BlockPos, blockType, blockMeta);
+
+ cBlockInfo::GetHandler(BlockType)->OnBroken(*this, a_WorldInterface, a_BlockPos, BlockType, BlockMeta);
return true;
}