summaryrefslogtreecommitdiffstats
path: root/src/World.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/World.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/World.cpp')
-rw-r--r--src/World.cpp29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/World.cpp b/src/World.cpp
index 4de325d6e..f70343889 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -2182,18 +2182,12 @@ UInt32 cWorld::SpawnPrimedTNT(Vector3d a_Pos, int a_FuseTicks, double a_InitialV
-void cWorld::SetBlocks(const sSetBlockVector & a_Blocks)
+void cWorld::PlaceBlock(const Vector3i a_Position, const BLOCKTYPE a_BlockType, const NIBBLETYPE a_BlockMeta)
{
- m_ChunkMap->SetBlocks(a_Blocks);
-}
-
-
-
-
+ SetBlock(a_Position, a_BlockType, a_BlockMeta);
-void cWorld::ReplaceBlocks(const sSetBlockVector & a_Blocks, BLOCKTYPE a_FilterBlockType)
-{
- m_ChunkMap->ReplaceBlocks(a_Blocks, a_FilterBlockType);
+ cChunkInterface ChunkInterface(GetChunkMap());
+ cBlockInfo::GetHandler(a_BlockType)->OnPlaced(ChunkInterface, *this, a_Position, a_BlockType, a_BlockMeta);
}
@@ -2211,17 +2205,18 @@ bool cWorld::GetBlocks(sSetBlockVector & a_Blocks, bool a_ContinueOnFailure)
bool cWorld::DigBlock(Vector3i a_BlockPos)
{
- BLOCKTYPE blockType;
- NIBBLETYPE blockMeta;
- GetBlockTypeMeta(a_BlockPos, blockType, blockMeta);
- cChunkInterface chunkInterface(GetChunkMap());
- auto blockHandler = cBlockInfo::GetHandler(blockType);
- blockHandler->OnBreaking(chunkInterface, *this, a_BlockPos);
+ BLOCKTYPE BlockType;
+ NIBBLETYPE BlockMeta;
+ GetBlockTypeMeta(a_BlockPos, BlockType, BlockMeta);
+
if (!m_ChunkMap->DigBlock(a_BlockPos))
{
return false;
}
- blockHandler->OnBroken(chunkInterface, *this, a_BlockPos, blockType, blockMeta);
+
+ cChunkInterface ChunkInterface(GetChunkMap());
+ cBlockInfo::GetHandler(BlockType)->OnBroken(ChunkInterface, *this, a_BlockPos, BlockType, BlockMeta);
+
return true;
}