diff options
author | x12xx12x <44411062+12xx12@users.noreply.github.com> | 2024-11-10 00:07:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-10 00:07:11 +0100 |
commit | 44cb43f13cdd8f2b3efb9ae77daa3e994c62bc26 (patch) | |
tree | d252e4cf7abc71dd860c118ba0aed33b806c4fe2 /src/Chunk.cpp | |
parent | fixes for api changes in embedtls (#5540) (diff) | |
download | cuberite-44cb43f13cdd8f2b3efb9ae77daa3e994c62bc26.tar cuberite-44cb43f13cdd8f2b3efb9ae77daa3e994c62bc26.tar.gz cuberite-44cb43f13cdd8f2b3efb9ae77daa3e994c62bc26.tar.bz2 cuberite-44cb43f13cdd8f2b3efb9ae77daa3e994c62bc26.tar.lz cuberite-44cb43f13cdd8f2b3efb9ae77daa3e994c62bc26.tar.xz cuberite-44cb43f13cdd8f2b3efb9ae77daa3e994c62bc26.tar.zst cuberite-44cb43f13cdd8f2b3efb9ae77daa3e994c62bc26.zip |
Diffstat (limited to 'src/Chunk.cpp')
-rw-r--r-- | src/Chunk.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp index fa7faf1f0..35d8a8819 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -370,15 +370,25 @@ void cChunk::SetAllData(SetChunkData && a_SetChunkData) m_BlockEntities = std::move(a_SetChunkData.BlockEntities); // Check that all block entities have a valid blocktype at their respective coords (DEBUG-mode only): -#ifndef NDEBUG + for (auto & KeyPair : m_BlockEntities) { +#ifndef NDEBUG cBlockEntity * Block = KeyPair.second.get(); BLOCKTYPE EntityBlockType = Block->GetBlockType(); BLOCKTYPE WorldBlockType = GetBlock(Block->GetRelX(), Block->GetPosY(), Block->GetRelZ()); ASSERT(WorldBlockType == EntityBlockType); - } #endif + // Reset Pointer + KeyPair.second->SetWorld(nullptr); + + auto Pos = cChunkDef::RelativeToAbsolute({KeyPair.second->GetRelX(), 0, KeyPair.second->GetRelZ()}, {m_PosX, m_PosZ}); + if ((Pos.x != KeyPair.second->GetPosX()) || (Pos.z != KeyPair.second->GetPosZ())) + { + KeyPair.second->SetPos(Pos.addedY(KeyPair.second->GetPosY())); + } + KeyPair.second->SetWorld(m_World); + } // Set the chunk data as valid. // This may be needed for some simulators that perform actions upon block adding (Vaporize), |