summaryrefslogtreecommitdiffstats
path: root/src/ChunkMap.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2020-04-17 11:36:37 +0200
committerGitHub <noreply@github.com>2020-04-17 11:36:37 +0200
commit26ac146f41091dc070d8075f5fc9de25b5a22578 (patch)
tree5be089162a23ad2f2822be7b5d5d7cebbb958406 /src/ChunkMap.cpp
parentImplement glowing redstone ore (diff)
downloadcuberite-26ac146f41091dc070d8075f5fc9de25b5a22578.tar
cuberite-26ac146f41091dc070d8075f5fc9de25b5a22578.tar.gz
cuberite-26ac146f41091dc070d8075f5fc9de25b5a22578.tar.bz2
cuberite-26ac146f41091dc070d8075f5fc9de25b5a22578.tar.lz
cuberite-26ac146f41091dc070d8075f5fc9de25b5a22578.tar.xz
cuberite-26ac146f41091dc070d8075f5fc9de25b5a22578.tar.zst
cuberite-26ac146f41091dc070d8075f5fc9de25b5a22578.zip
Diffstat (limited to 'src/ChunkMap.cpp')
-rw-r--r--src/ChunkMap.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp
index fd4987bb4..1713173f8 100644
--- a/src/ChunkMap.cpp
+++ b/src/ChunkMap.cpp
@@ -2030,16 +2030,16 @@ int cChunkMap::GrowPlantAt(Vector3i a_BlockPos, int a_NumStages)
-void cChunkMap::SetNextBlockTick(int a_BlockX, int a_BlockY, int a_BlockZ)
+void cChunkMap::SetNextBlockToTick(const Vector3i a_BlockPos)
{
- int ChunkX, ChunkZ;
- cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ);
+ auto ChunkPos = cChunkDef::BlockToChunk(a_BlockPos);
+ auto RelPos = cChunkDef::AbsoluteToRelative(a_BlockPos, ChunkPos);
cCSLock Lock(m_CSChunks);
- cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ChunkZ);
+ auto Chunk = GetChunkNoLoad(ChunkPos);
if (Chunk != nullptr)
{
- Chunk->SetNextBlockTick(a_BlockX, a_BlockY, a_BlockZ);
+ Chunk->SetNextBlockToTick(RelPos);
}
}
@@ -2100,17 +2100,17 @@ void cChunkMap::Tick(std::chrono::milliseconds a_Dt)
-void cChunkMap::TickBlock(int a_BlockX, int a_BlockY, int a_BlockZ)
+void cChunkMap::TickBlock(const Vector3i a_BlockPos)
{
+ auto ChunkPos = cChunkDef::BlockToChunk(a_BlockPos);
+ auto RelPos = cChunkDef::AbsoluteToRelative(a_BlockPos, ChunkPos);
cCSLock Lock(m_CSChunks);
- int ChunkX, ChunkZ;
- cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ);
- cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ChunkZ);
+ auto Chunk = GetChunkNoLoad(ChunkPos);
if ((Chunk == nullptr) || !Chunk->IsValid())
{
return;
}
- Chunk->TickBlock(a_BlockX, a_BlockY, a_BlockZ);
+ Chunk->TickBlock(RelPos);
}