mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 16:51:42 +00:00
World: fixed false unload events firing on chunk replacement when tiles and entities are deleted
This commit is contained in:
parent
61112e4912
commit
2e9b2d4aae
@ -2023,16 +2023,18 @@ class World implements ChunkManager{
|
||||
$oldChunk = $this->getOrLoadChunk($chunkX, $chunkZ, false);
|
||||
if($oldChunk !== null and $oldChunk !== $chunk){
|
||||
if($deleteEntitiesAndTiles){
|
||||
foreach($oldChunk->getEntities() as $player){
|
||||
if(!($player instanceof Player)){
|
||||
continue;
|
||||
foreach($oldChunk->getEntities() as $entity){
|
||||
if($entity instanceof Player){
|
||||
$chunk->addEntity($entity);
|
||||
$oldChunk->removeEntity($entity);
|
||||
$entity->chunk = $chunk;
|
||||
}else{
|
||||
$entity->close();
|
||||
}
|
||||
$chunk->addEntity($player);
|
||||
$oldChunk->removeEntity($player);
|
||||
$player->chunk = $chunk;
|
||||
}
|
||||
//TODO: this causes chunkloaders to receive false "unloaded" notifications
|
||||
$this->unloadChunk($chunkX, $chunkZ, false, false);
|
||||
foreach($oldChunk->getTiles() as $tile){
|
||||
$tile->close();
|
||||
}
|
||||
}else{
|
||||
foreach($oldChunk->getEntities() as $entity){
|
||||
$chunk->addEntity($entity);
|
||||
|
Loading…
x
Reference in New Issue
Block a user