mirror of
https://github.com/cuberite/cuberite.git
synced 2025-01-09 12:29:38 +08:00
Correct world access in NetherPortalScanner
This commit is contained in:
parent
9d124e6b0a
commit
61aff2af12
@ -297,15 +297,25 @@ void cNetherPortalScanner::OnDisabled(void)
|
|||||||
Position.z += OutOffset;
|
Position.z += OutOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto EntityID = m_EntityID;
|
||||||
|
auto & DestinationWorld = m_World;
|
||||||
|
auto DestinationPosition = Position;
|
||||||
|
|
||||||
// Lookup our warping entity by ID
|
// Lookup our warping entity by ID
|
||||||
// Necessary as they may have been destroyed in the meantime (#4582)
|
// Necessary as they may have been destroyed in the meantime (#4582)
|
||||||
m_SourceWorld.DoWithEntityByID(
|
// And since this is called from the destination world's thread queue a task on the source world
|
||||||
m_EntityID,
|
m_SourceWorld.QueueTask(
|
||||||
[this, &Position](cEntity & a_Entity)
|
[EntityID, &DestinationWorld, DestinationPosition](cWorld & a_World)
|
||||||
{
|
{
|
||||||
FLOGD("Placing player at {0}", Position);
|
a_World.DoWithEntityByID(
|
||||||
a_Entity.MoveToWorld(m_World, Position, true, false);
|
EntityID,
|
||||||
return true;
|
[&DestinationWorld, &DestinationPosition](cEntity & a_Entity)
|
||||||
|
{
|
||||||
|
FLOGD("Placing player at {0}", DestinationPosition);
|
||||||
|
a_Entity.MoveToWorld(DestinationWorld, DestinationPosition, true, false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user