summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2021-05-05 15:25:10 +0200
committerGitHub <noreply@github.com>2021-05-05 15:25:10 +0200
commita62b2b1be2103d7de2fd66c7304b7473e369be3c (patch)
treea44f2b43fd90f5c79af5e308b554349e6dc546af /src/World.cpp
parentRename files to match code (diff)
downloadcuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.tar
cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.tar.gz
cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.tar.bz2
cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.tar.lz
cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.tar.xz
cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.tar.zst
cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.zip
Diffstat (limited to 'src/World.cpp')
-rw-r--r--src/World.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/World.cpp b/src/World.cpp
index 271a295de..10dc909c9 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -1733,7 +1733,7 @@ void cWorld::SetBlockMeta(Vector3i a_BlockPos, NIBBLETYPE a_MetaData)
-NIBBLETYPE cWorld::GetBlockSkyLight(Vector3i a_BlockPos)
+NIBBLETYPE cWorld::GetBlockSkyLight(Vector3i a_BlockPos) const
{
return m_ChunkMap.GetBlockSkyLight(a_BlockPos);
}
@@ -1742,7 +1742,7 @@ NIBBLETYPE cWorld::GetBlockSkyLight(Vector3i a_BlockPos)
-NIBBLETYPE cWorld::GetBlockBlockLight(Vector3i a_BlockPos)
+NIBBLETYPE cWorld::GetBlockBlockLight(Vector3i a_BlockPos) const
{
return m_ChunkMap.GetBlockBlockLight(a_BlockPos);
}
@@ -1751,7 +1751,7 @@ NIBBLETYPE cWorld::GetBlockBlockLight(Vector3i a_BlockPos)
-bool cWorld::GetBlockTypeMeta(Vector3i a_BlockPos, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta)
+bool cWorld::GetBlockTypeMeta(Vector3i a_BlockPos, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) const
{
return m_ChunkMap.GetBlockTypeMeta(a_BlockPos, a_BlockType, a_BlockMeta);
}
@@ -1760,7 +1760,7 @@ bool cWorld::GetBlockTypeMeta(Vector3i a_BlockPos, BLOCKTYPE & a_BlockType, NIBB
-bool cWorld::GetBlockInfo(Vector3i a_BlockPos, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_Meta, NIBBLETYPE & a_SkyLight, NIBBLETYPE & a_BlockLight)
+bool cWorld::GetBlockInfo(Vector3i a_BlockPos, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_Meta, NIBBLETYPE & a_SkyLight, NIBBLETYPE & a_BlockLight) const
{
return m_ChunkMap.GetBlockInfo(a_BlockPos, a_BlockType, a_Meta, a_SkyLight, a_BlockLight);
}
@@ -2017,9 +2017,14 @@ UInt32 cWorld::SpawnEnderCrystal(Vector3d a_Pos, bool a_ShowBottom)
void cWorld::PlaceBlock(const Vector3i a_Position, const BLOCKTYPE a_BlockType, const NIBBLETYPE a_BlockMeta)
{
+ BLOCKTYPE BlockType;
+ NIBBLETYPE BlockMeta;
+ GetBlockTypeMeta(a_Position, BlockType, BlockMeta);
+
SetBlock(a_Position, a_BlockType, a_BlockMeta);
cChunkInterface ChunkInterface(GetChunkMap());
+ cBlockHandler::For(BlockType).OnBroken(ChunkInterface, *this, a_Position, BlockType, BlockMeta, nullptr);
cBlockHandler::For(a_BlockType).OnPlaced(ChunkInterface, *this, a_Position, a_BlockType, a_BlockMeta);
}
@@ -2081,7 +2086,7 @@ cItems cWorld::PickupsFromBlock(Vector3i a_BlockPos, const cEntity * a_Digger, c
-void cWorld::SendBlockTo(int a_X, int a_Y, int a_Z, cPlayer & a_Player)
+void cWorld::SendBlockTo(int a_X, int a_Y, int a_Z, const cPlayer & a_Player)
{
m_ChunkMap.SendBlockTo(a_X, a_Y, a_Z, a_Player);
}