Level: Fixed entities getting deleted when switching levels

So this came from a bugfix (795d6c8ddf1148dfe6de8ff5ef38a96aee6124fe) which fixed a memory leak related to entities getting kill()ed on chunk unload.
HOWEVER, me2016 did NOT realize that this code is actually entirely pointless and causes unexpected behaviour.

removeEntity() is used in 2 places in the core code:
1. in Entity->close() (so close() doesn't need to be called again, obviously)
2. in Entity->switchLevel() (which then causes the entirely unexpected behaviour of close()ing the entity on level change.

Conclusion: This code is pointless. This fixes the bugfix.
This commit is contained in:
Dylan K. Taylor 2018-01-17 11:30:47 +00:00
parent 2e1a167bed
commit d728154e87

View File

@ -2607,8 +2607,6 @@ class Level implements ChunkManager, Metadatable{
if($entity instanceof Player){
unset($this->players[$entity->getId()]);
$this->checkSleep();
}else{
$entity->close();
}
unset($this->entities[$entity->getId()]);