diff options
author | Mattes D <github@xoft.cz> | 2020-04-17 11:36:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-17 11:36:37 +0200 |
commit | 26ac146f41091dc070d8075f5fc9de25b5a22578 (patch) | |
tree | 5be089162a23ad2f2822be7b5d5d7cebbb958406 /src/ChunkMap.cpp | |
parent | Implement glowing redstone ore (diff) | |
download | cuberite-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 '')
-rw-r--r-- | src/ChunkMap.cpp | 20 |
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); } |