mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-17 11:18:52 +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);
|
$this->level->loadChunk($this->x >> 4, $this->z >> 4);
|
||||||
|
|
||||||
$newChunk = $this->level->getUsingChunk($this->x >> 4, $this->z >> 4);
|
$newChunk = $this->level->getUsingChunk($this->x >> 4, $this->z >> 4);
|
||||||
foreach($this->hasSpawned as $CID => $player){
|
foreach($this->hasSpawned as $player){
|
||||||
if(!isset($newChunk[$CID])){
|
if(!isset($newChunk[$player->CID])){
|
||||||
$this->despawnFrom($player);
|
$this->despawnFrom($player);
|
||||||
}else{
|
}else{
|
||||||
unset($newChunk[$CID]);
|
unset($newChunk[$player->CID]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach($newChunk as $player){
|
foreach($newChunk as $player){
|
||||||
|
@ -30,4 +30,16 @@ class PlayerEntity extends HumanEntity{
|
|||||||
unset($this->level->players[$this->CID]);
|
unset($this->level->players[$this->CID]);
|
||||||
parent::close();
|
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