From f8f1e0e9dfc6ce6c918dc791d595071d8b1c4641 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Sat, 1 Nov 2014 16:47:40 +0100 Subject: [PATCH] Despawn entities correctly from clients as they move --- src/pocketmine/Player.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index d2688357e..477127459 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -531,9 +531,9 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ } } - $this->level->freeChunk($x, $z, $this); unset($this->usedChunks[$index]); } + $this->level->freeChunk($x, $z, $this); unset($this->loadQueue[$index]); } @@ -724,13 +724,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ $X = null; $Z = null; Level::getXZ($index, $X, $Z); - foreach($this->level->getChunkEntities($X, $Z) as $entity){ - if($entity !== $this){ - $entity->despawnFrom($this); - } - } - - unset($this->usedChunks[$index]); + $this->unloadChunk($X, $Z); } return true;