summaryrefslogtreecommitdiffstats
path: root/src/Chunk.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-08-05 09:35:10 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-08-05 09:35:37 +0200
commitd2156aab7cf25383c8f893e6222c89dcf5c17aa4 (patch)
tree06d76192d34ee1dd3d5cbbdb6210d707d5c339f4 /src/Chunk.cpp
parentDelete unreferenced variable (diff)
downloadcuberite-d2156aab7cf25383c8f893e6222c89dcf5c17aa4.tar
cuberite-d2156aab7cf25383c8f893e6222c89dcf5c17aa4.tar.gz
cuberite-d2156aab7cf25383c8f893e6222c89dcf5c17aa4.tar.bz2
cuberite-d2156aab7cf25383c8f893e6222c89dcf5c17aa4.tar.lz
cuberite-d2156aab7cf25383c8f893e6222c89dcf5c17aa4.tar.xz
cuberite-d2156aab7cf25383c8f893e6222c89dcf5c17aa4.tar.zst
cuberite-d2156aab7cf25383c8f893e6222c89dcf5c17aa4.zip
Diffstat (limited to 'src/Chunk.cpp')
-rw-r--r--src/Chunk.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index 17c41acec..e24aa7733 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -1187,14 +1187,14 @@ void cChunk::CreateBlockEntities(void)
auto BlockType = Section->m_BlockTypes[BlockIdx];
if (cBlockEntity::IsBlockEntityBlockType(BlockType))
{
- auto relPos = IndexToCoordinate(BlockIdx);
- relPos.y += static_cast<int>(SectionIdx * cChunkData::SectionHeight);
- auto absPos = RelativeToAbsolute(relPos);
+ auto RelPos = IndexToCoordinate(BlockIdx);
+ RelPos.y += static_cast<int>(SectionIdx * cChunkData::SectionHeight);
+ const auto AbsPos = RelativeToAbsolute(RelPos);
- if (!HasBlockEntityAt(absPos))
+ if (!HasBlockEntityAt(AbsPos))
{
AddBlockEntityClean(cBlockEntity::CreateByBlockType(
- BlockType, GetMeta(relPos), absPos, m_World
+ BlockType, GetMeta(RelPos), AbsPos, m_World
));
}
}
@@ -1223,7 +1223,8 @@ void cChunk::WakeUpSimulators(void)
for (size_t BlockIdx = 0; BlockIdx != cChunkData::SectionBlockCount; ++BlockIdx)
{
const auto BlockType = Section->m_BlockTypes[BlockIdx];
- const auto Position = IndexToCoordinate(BlockIdx);
+ auto Position = IndexToCoordinate(BlockIdx);
+ Position.y += static_cast<int>(SectionIdx * cChunkData::SectionHeight);
RedstoneSimulator->AddBlock(*this, Position, BlockType);
WaterSimulator->AddBlock(*this, Position, BlockType);