mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
63 lines
No EOL
1.3 KiB
PHP
63 lines
No EOL
1.3 KiB
PHP
<?php
|
|
|
|
class AddPlayerPacket extends RakNetDataPacket{
|
|
public $clientID;
|
|
public $username;
|
|
public $eid;
|
|
public $x;
|
|
public $y;
|
|
public $z;
|
|
public $pitch;
|
|
public $yaw;
|
|
public $itemID;
|
|
public $itemAuxValue;
|
|
/**
|
|
*@deprecated use $itemID instead
|
|
*/
|
|
public $unknown1;
|
|
/**
|
|
*@deprecated use $itemAuxValue instead
|
|
*/
|
|
public $unknown2;
|
|
/**
|
|
*@var array
|
|
*/
|
|
public $metadata;
|
|
|
|
public function pid(){
|
|
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
|
|
return ProtocolInfo3::ADD_PLAYER_PACKET;
|
|
}
|
|
return ProtocolInfo::ADD_PLAYER_PACKET;
|
|
}
|
|
|
|
public function decode(){
|
|
|
|
}
|
|
|
|
public function encode(){
|
|
$this->reset();
|
|
$this->putLong($this->clientID);
|
|
$this->putString($this->username);
|
|
$this->putInt($this->eid);
|
|
$this->putFloat($this->x);
|
|
$this->putFloat($this->y);
|
|
$this->putFloat($this->z);
|
|
$this->putByte($this->yaw);
|
|
$this->putByte($this->pitch);
|
|
$this->putShort($this->itemID);
|
|
$this->putShort($this->itemAuxValue); //Example: bow shooting power
|
|
if($this->PROTOCOL >= ProtocolInfo6::CURRENT_PROTOCOL_6){
|
|
$this->put(Utils::writeMetadata($this->metadata));
|
|
}
|
|
}
|
|
|
|
public function eidsToLocal(Player $p){
|
|
if(!$this->localEids){
|
|
$this->localEids = true;
|
|
$this->eid = $p->global2localEID[$this->eid] ?? false;
|
|
if($this->eid === false) return false;
|
|
}
|
|
return true;
|
|
}
|
|
} |