mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 10:49:10 +00:00
Move Entity despawn logic back to Player
this is not network-session specific, and different implementations will need to do this.
This commit is contained in:
parent
66481fedeb
commit
d7a7ab5102
@ -956,6 +956,11 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
|
||||
$world = $world ?? $this->world;
|
||||
$index = World::chunkHash($x, $z);
|
||||
if(isset($this->usedChunks[$index])){
|
||||
foreach($this->getWorld()->getChunkEntities($x, $z) as $entity){
|
||||
if($entity !== $this){
|
||||
$entity->despawnFrom($this);
|
||||
}
|
||||
}
|
||||
$this->networkSession->stopUsingChunk($x, $z);
|
||||
unset($this->usedChunks[$index]);
|
||||
}
|
||||
|
@ -790,11 +790,7 @@ class NetworkSession{
|
||||
}
|
||||
|
||||
public function stopUsingChunk(int $chunkX, int $chunkZ) : void{
|
||||
foreach($this->player->getWorld()->getChunkEntities($chunkX, $chunkZ) as $entity){
|
||||
if($entity !== $this->player){
|
||||
$entity->despawnFrom($this->player);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function tick() : bool{
|
||||
|
Loading…
x
Reference in New Issue
Block a user