summaryrefslogtreecommitdiffstats
path: root/src/Entities/Entity.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-02-02 16:37:21 +0100
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-02-02 16:55:00 +0100
commit07b7fd4ad3fef714399009efd5d4a903a561a6f2 (patch)
tree27253c8e468f068dd03d7bf8b434e4e78ca78144 /src/Entities/Entity.cpp
parentMerge pull request #2936 from mathias-github/master (diff)
downloadcuberite-07b7fd4ad3fef714399009efd5d4a903a561a6f2.tar
cuberite-07b7fd4ad3fef714399009efd5d4a903a561a6f2.tar.gz
cuberite-07b7fd4ad3fef714399009efd5d4a903a561a6f2.tar.bz2
cuberite-07b7fd4ad3fef714399009efd5d4a903a561a6f2.tar.lz
cuberite-07b7fd4ad3fef714399009efd5d4a903a561a6f2.tar.xz
cuberite-07b7fd4ad3fef714399009efd5d4a903a561a6f2.tar.zst
cuberite-07b7fd4ad3fef714399009efd5d4a903a561a6f2.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/Entity.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index d4097f734..ff03bae3c 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);