diff options
author | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-02-03 19:19:11 +0100 |
---|---|---|
committer | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-02-03 19:19:11 +0100 |
commit | a5403c897658c0cb837c9167d74e7302a09659c2 (patch) | |
tree | 85013e81fad7154733fa52e58138b4c854a597ed /src/Entities/Entity.cpp | |
parent | Merge pull request #2903 from marvinkopf/FixTabAutoComplete (diff) | |
parent | Fixed cChunk::m_Entities corruption upon world travel (diff) | |
download | cuberite-a5403c897658c0cb837c9167d74e7302a09659c2.tar cuberite-a5403c897658c0cb837c9167d74e7302a09659c2.tar.gz cuberite-a5403c897658c0cb837c9167d74e7302a09659c2.tar.bz2 cuberite-a5403c897658c0cb837c9167d74e7302a09659c2.tar.lz cuberite-a5403c897658c0cb837c9167d74e7302a09659c2.tar.xz cuberite-a5403c897658c0cb837c9167d74e7302a09659c2.tar.zst cuberite-a5403c897658c0cb837c9167d74e7302a09659c2.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Entities/Entity.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 593bc6aca..0706a1676 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -1499,8 +1499,17 @@ bool cEntity::DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn, Vector3d return false; } - // Remove all links to the old world - SetWorldTravellingFrom(GetWorld()); // cChunk::Tick() handles entity removal + // Remove entity from chunk + if (!GetWorld()->DoWithChunk(GetChunkX(), GetChunkZ(), [this](cChunk & a_Chunk) -> bool + { + a_Chunk.SafeRemoveEntity(this); + return true; + })) + { + LOGD("Entity Teleportation failed! Didn't find the source chunk!\n"); + return false; + } + GetWorld()->BroadcastDestroyEntity(*this); SetPosition(a_NewPosition); |