From 4aef9919dc4468bb520006312bfd1229281359fe Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 20 Oct 2018 16:26:10 +0100 Subject: [PATCH] Use newly added API method --- src/pocketmine/entity/Entity.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index 9f2389200..756817f61 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -1804,7 +1804,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{ $this->chunk = $this->level->getChunk($chunkX, $chunkZ, true); if(!$this->justCreated){ - $newChunk = $this->level->getChunkPlayers($chunkX, $chunkZ); + $newChunk = $this->level->getViewersForPosition($this); foreach($this->hasSpawned as $player){ if(!isset($newChunk[$player->getLoaderId()])){ $this->despawnFrom($player); @@ -1963,7 +1963,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{ if($this->chunk === null or $this->closed){ return; } - foreach($this->level->getChunkPlayers($this->chunk->getX(), $this->chunk->getZ()) as $player){ + foreach($this->level->getViewersForPosition($this) as $player){ if($player->isOnline()){ $this->spawnTo($player); }