Player: fixed setPosition() resending all the chunks

closes #3977
This commit is contained in:
Dylan K. Taylor 2020-12-21 00:09:49 +00:00
parent 2ba47a80a4
commit e762b79aae
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -651,6 +651,8 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
protected function setPosition(Vector3 $pos) : bool{
$oldWorld = $this->location->isValid() ? $this->location->getWorld() : null;
if(parent::setPosition($pos)){
$newWorld = $this->getWorld();
if($oldWorld !== $newWorld){
if($oldWorld !== null){
foreach($this->usedChunks as $index => $status){
World::getXZ($index, $X, $Z);
@ -661,6 +663,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
$this->usedChunks = [];
$this->loadQueue = [];
$this->networkSession->onEnterWorld();
}
return true;
}