player is spawned after 1st MOVE_PACKET is sent

This commit is contained in:
GameHerobrine 2023-07-02 19:08:40 +03:00
parent 6b765abbe3
commit 2858b43748
2 changed files with 9 additions and 8 deletions

View file

@ -1490,8 +1490,8 @@ class Player{
$this->server->api->entity->spawnAll($this);
$this->server->api->entity->spawnToAll($this->entity);
$this->server->schedule(5, [$this->entity, "update"], [], true);
$this->server->schedule(2, [$this->entity, "updateMovement"], [], true);
//$this->server->schedule(5, [$this->entity, "update"], [], true);
//$this->server->schedule(2, [$this->entity, "updateMovement"], [], true);
//$this->sendArmor();
$array = explode("@n", (string)$this->server->motd);
foreach($array as $msg){
@ -1507,11 +1507,6 @@ class Player{
//$this->loadAllChunks();
$this->blocked = false;
$this->spawned = true;
$this->server->handle("player.spawn", $this);
$this->server->api->chat->broadcast($this->username." joined the game");
$this->server->api->player->spawnAllPlayers($this);
$this->server->api->player->spawnToAllPlayers($this);
break;
case ProtocolInfo::ROTATE_HEAD_PACKET:
if($this->spawned === false){
@ -1529,7 +1524,11 @@ class Player{
break;
case ProtocolInfo::MOVE_PLAYER_PACKET:
if($this->spawned === false){
break;
$this->spawned = true;
$this->server->handle("player.spawn", $this);
$this->server->api->chat->broadcast($this->username." joined the game");
$this->server->api->player->spawnAllPlayers($this);
$this->server->api->player->spawnToAllPlayers($this);
}
if(($this->entity instanceof Entity) and $packet->messageIndex > $this->lastMovement){
$this->lastMovement = $packet->messageIndex;

View file

@ -715,6 +715,8 @@ class Entity extends Position
if($this->speed <= 9 or ($this->speed <= 20 and ($this->player->gamemode & 0x01) === 0x01)){
$this->player->lastCorrect = new Vector3($this->last[0], $this->last[1], $this->last[2]);
}
$hasUpdate = true;
}
}
if($this->knockbackTime > 0){