mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
readded limit to resendQueue, MovePlayerPacket will be sent after AddPlayerPacket to fix AddPlayerPacket bug
This commit is contained in:
parent
31ae786748
commit
00c03d8bf0
2 changed files with 19 additions and 11 deletions
|
|
@ -1621,7 +1621,9 @@ class Player{
|
|||
}
|
||||
|
||||
if(($resendCnt = count($this->resendQueue)) > 0){
|
||||
$limit = 25;
|
||||
foreach($this->resendQueue as $count => $data){
|
||||
if(!--$limit) break;
|
||||
unset($this->resendQueue[$count]);
|
||||
$this->packetStats[1]++;
|
||||
$this->lag[] = $time - $data->sendtime;
|
||||
|
|
|
|||
|
|
@ -1153,27 +1153,33 @@ class Entity extends Position
|
|||
$player->addEntity($this);
|
||||
if($this->level != $player->entity->level || $this->player->gamemode === SPECTATOR) $this->player->setInvisibleFor($player, true, send:false);
|
||||
$pk = new AddPlayerPacket();
|
||||
$pkm = new MovePlayerPacket();
|
||||
$pk->clientID = 0; // $this->player->clientID;
|
||||
$pk->username = $this->player->username;
|
||||
$pk->eid = $this->eid;
|
||||
$pkm->eid = $pk->eid = $this->eid;
|
||||
|
||||
if($this->player->isInvisibleFor($player)){
|
||||
$pk->x = -256;
|
||||
$pk->y = 128;
|
||||
$pk->z = -256;
|
||||
$pk->yaw = 0;
|
||||
$pk->pitch = 0;
|
||||
$pkm->x = $pk->x = -256;
|
||||
$pkm->y = $pk->y = 128;
|
||||
$pkm->z = $pk->z = -256;
|
||||
$pkm->yaw = $pk->yaw = 0;
|
||||
$pkm->pitch = $pk->pitch = 0;
|
||||
$pkm->bodyYaw = 0;
|
||||
}else{
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->yaw = $this->yaw;
|
||||
$pk->pitch = $this->pitch;
|
||||
$pkm->x = $pk->x = $this->x;
|
||||
$pkm->y = $pk->y = $this->y;
|
||||
$pkm->z = $pk->z = $this->z;
|
||||
$pkm->yaw = $pk->yaw = $this->yaw;
|
||||
$pkm->pitch = $pk->pitch = $this->pitch;
|
||||
$pkm->bodyYaw = $this->headYaw;
|
||||
}
|
||||
|
||||
$pk->itemID = 0;
|
||||
$pk->itemAuxValue = 0;
|
||||
$pk->metadata = $this->getMetadata();
|
||||
$player->entityQueueDataPacket($pk);
|
||||
//AddPlayerPacket doesnt read yaw correctly in vanilla(uses PacketUtil::Rot_degreesToChar instead of PacketUtil::Rot_charToDegrees)
|
||||
$player->entityQueueDataPacket($pkm);
|
||||
|
||||
$pk = new PlayerEquipmentPacket();
|
||||
$pk->eid = $this->eid;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue