summaryrefslogtreecommitdiffstats
path: root/src/NetherPortalScanner.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-04-19 21:25:53 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-04-19 22:43:14 +0200
commit61aff2af1270493702d9c2ec25aaed57b6d542a6 (patch)
tree6a17ffa729cc1ef5e9c99bb88c10918ace0e33b1 /src/NetherPortalScanner.cpp
parentMore arrow patches (diff)
downloadcuberite-61aff2af1270493702d9c2ec25aaed57b6d542a6.tar
cuberite-61aff2af1270493702d9c2ec25aaed57b6d542a6.tar.gz
cuberite-61aff2af1270493702d9c2ec25aaed57b6d542a6.tar.bz2
cuberite-61aff2af1270493702d9c2ec25aaed57b6d542a6.tar.lz
cuberite-61aff2af1270493702d9c2ec25aaed57b6d542a6.tar.xz
cuberite-61aff2af1270493702d9c2ec25aaed57b6d542a6.tar.zst
cuberite-61aff2af1270493702d9c2ec25aaed57b6d542a6.zip
Diffstat (limited to 'src/NetherPortalScanner.cpp')
-rw-r--r--src/NetherPortalScanner.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/NetherPortalScanner.cpp b/src/NetherPortalScanner.cpp
index 10ea64f02..292b7f136 100644
--- a/src/NetherPortalScanner.cpp
+++ b/src/NetherPortalScanner.cpp
@@ -297,15 +297,25 @@ void cNetherPortalScanner::OnDisabled(void)
Position.z += OutOffset;
}
+ auto EntityID = m_EntityID;
+ auto & DestinationWorld = m_World;
+ auto DestinationPosition = Position;
+
// Lookup our warping entity by ID
// Necessary as they may have been destroyed in the meantime (#4582)
- m_SourceWorld.DoWithEntityByID(
- m_EntityID,
- [this, &Position](cEntity & a_Entity)
+ // And since this is called from the destination world's thread queue a task on the source world
+ m_SourceWorld.QueueTask(
+ [EntityID, &DestinationWorld, DestinationPosition](cWorld & a_World)
{
- FLOGD("Placing player at {0}", Position);
- a_Entity.MoveToWorld(m_World, Position, true, false);
- return true;
+ a_World.DoWithEntityByID(
+ EntityID,
+ [&DestinationWorld, &DestinationPosition](cEntity & a_Entity)
+ {
+ FLOGD("Placing player at {0}", DestinationPosition);
+ a_Entity.MoveToWorld(DestinationWorld, DestinationPosition, true, false);
+ return true;
+ }
+ );
}
);