fixed several chunks not being received by client if they were teleported by server before ready packet

This commit is contained in:
GameHerobrine 2025-03-05 23:58:00 +03:00
parent a032856009
commit 3580b884d8

View file

@ -311,7 +311,7 @@ class Player{
$this->entity->calculateVelocity();
if($terrain === true){
$this->orderChunks();
$this->getNextChunk($this->level);
if($this->spawned) $this->getNextChunk($this->level);
}
$this->entity->check = true;
if($force === true){
@ -575,7 +575,6 @@ class Player{
if($this->connected === false or $world != $this->level){
return false;
}
foreach($this->chunkCount as $count => $t){
if(isset($this->recoveryQueue[$count]) or isset($this->resendQueue[$count])){
$this->server->schedule(MAX_CHUNK_RATE, [$this, "getNextChunk"], $world);
@ -1730,9 +1729,9 @@ class Player{
$pos = new Position($this->entity->x, $this->entity->y, $this->entity->z, $this->level);
$pData = $this->data->get("position");
$this->teleport($pos, $pData["yaw"] ?? false, $pData["pitch"] ?? false, true, true);
$this->entity->setHealth($this->data->get("health"), "spawn", true, false);
$this->spawned = true;
$this->teleport($pos, $pData["yaw"] ?? false, $pData["pitch"] ?? false, true, true);
$this->server->api->player->spawnAllPlayers($this);
$this->server->api->player->spawnToAllPlayers($this);
$this->server->api->entity->spawnAll($this);