more typehints, removed more 32-bit leftovers

This commit is contained in:
Dylan K. Taylor
2017-06-25 11:40:12 +01:00
parent 22d148a59d
commit c0377fc63a
8 changed files with 53 additions and 42 deletions

View File

@ -31,7 +31,9 @@ use pocketmine\network\mcpe\NetworkSession;
class AddEntityPacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::ADD_ENTITY_PACKET;
/** @var int|null */
public $entityUniqueId = null; //TODO
/** @var int */
public $entityRuntimeId;
public $type;
public $x;

View File

@ -31,7 +31,9 @@ use pocketmine\network\mcpe\NetworkSession;
class AddItemEntityPacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::ADD_ITEM_ENTITY_PACKET;
/** @var int|null */
public $entityUniqueId = null; //TODO
/** @var int */
public $entityRuntimeId;
public $item;
public $x;

View File

@ -31,7 +31,9 @@ use pocketmine\network\mcpe\NetworkSession;
class AddPaintingPacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::ADD_PAINTING_PACKET;
/** @var int|null */
public $entityUniqueId = null; //TODO
/** @var int */
public $entityRuntimeId;
public $x;
public $y;

View File

@ -27,13 +27,18 @@ namespace pocketmine\network\mcpe\protocol;
use pocketmine\item\Item;
use pocketmine\network\mcpe\NetworkSession;
use pocketmine\utils\UUID;
class AddPlayerPacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::ADD_PLAYER_PACKET;
/** @var UUID */
public $uuid;
/** @var string */
public $username;
/** @var int|null */
public $entityUniqueId = null; //TODO
/** @var int */
public $entityRuntimeId;
public $x;
public $y;

View File

@ -128,6 +128,7 @@ class ClientboundMapItemDataPacket extends DataPacket{
$this->putByte($decoration["xOffset"]);
$this->putByte($decoration["yOffset"]);
$this->putString($decoration["label"]);
assert($decoration["color"] instanceof Color);
$this->putLInt($decoration["color"]->toARGB());
}
}

View File

@ -254,41 +254,41 @@ abstract class DataPacket extends BinaryStream{
/**
* Reads and returns an EntityUniqueID
* @return int|string
* @return int
*/
public function getEntityUniqueId(){
public function getEntityUniqueId() : int{
return $this->getVarLong();
}
/**
* Writes an EntityUniqueID
* @param int|string $eid
* @param int $eid
*/
public function putEntityUniqueId($eid){
public function putEntityUniqueId(int $eid){
$this->putVarLong($eid);
}
/**
* Reads and returns an EntityRuntimeID
* @return int|string
* @return int
*/
public function getEntityRuntimeId(){
public function getEntityRuntimeId() : int{
return $this->getUnsignedVarLong();
}
/**
* Writes an EntityUniqueID
* @param int|string $eid
* @param int $eid
*/
public function putEntityRuntimeId($eid){
public function putEntityRuntimeId(int $eid){
$this->putUnsignedVarLong($eid);
}
/**
* Reads an block position with unsigned Y coordinate.
* @param int $x
* @param int $y 0-255
* @param int $z
* @param int &$x
* @param int &$y
* @param int &$z
*/
public function getBlockPosition(&$x, &$y, &$z){
$x = $this->getVarInt();
@ -298,11 +298,11 @@ abstract class DataPacket extends BinaryStream{
/**
* Writes a block position with unsigned Y coordinate.
* @param int &$x
* @param int &$y
* @param int &$z
* @param int $x
* @param int $y
* @param int $z
*/
public function putBlockPosition($x, $y, $z){
public function putBlockPosition(int $x, int $y, int $z){
$this->putVarInt($x);
$this->putUnsignedVarInt($y);
$this->putVarInt($z);
@ -326,7 +326,7 @@ abstract class DataPacket extends BinaryStream{
* @param int $y
* @param int $z
*/
public function putSignedBlockPosition($x, $y, $z){
public function putSignedBlockPosition(int $x, int $y, int $z){
$this->putVarInt($x);
$this->putVarInt($y);
$this->putVarInt($z);
@ -350,7 +350,7 @@ abstract class DataPacket extends BinaryStream{
* @param float $y
* @param float $z
*/
public function putVector3f($x, $y, $z){
public function putVector3f(float $x, float $y, float $z){
$this->putLFloat($x);
$this->putLFloat($y);
$this->putLFloat($z);