mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 18:59:00 +00:00
Rolling chunk load
This commit is contained in:
parent
fdbefa0571
commit
f8d91b5888
@ -327,11 +327,11 @@ abstract class Entity extends Position{
|
||||
$this->level->loadChunk($this->x >> 4, $this->z >> 4);
|
||||
|
||||
$newChunk = $this->level->getUsingChunk($this->x >> 4, $this->z >> 4);
|
||||
foreach($this->hasSpawned as $CID => $player){
|
||||
if(!isset($newChunk[$CID])){
|
||||
foreach($this->hasSpawned as $player){
|
||||
if(!isset($newChunk[$player->CID])){
|
||||
$this->despawnFrom($player);
|
||||
}else{
|
||||
unset($newChunk[$CID]);
|
||||
unset($newChunk[$player->CID]);
|
||||
}
|
||||
}
|
||||
foreach($newChunk as $player){
|
||||
|
@ -30,4 +30,16 @@ class PlayerEntity extends HumanEntity{
|
||||
unset($this->level->players[$this->CID]);
|
||||
parent::close();
|
||||
}
|
||||
|
||||
public function spawnTo(Player $player){
|
||||
if($this->spawned === true){
|
||||
parent::spawnTo($player);
|
||||
}
|
||||
}
|
||||
|
||||
public function despawnFrom(Player $player){
|
||||
if($this->spawned === true){
|
||||
parent::despawnFrom($player);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user