Apply typehints to pocketmine\network\mcpe\protocol namespace

this is pulled from network-nuke in order to reduce the size of the diff.
This commit is contained in:
Dylan K. Taylor 2018-07-05 13:19:15 +01:00
parent fbd4f4a849
commit 2bba3a0805
116 changed files with 255 additions and 255 deletions

View File

@ -33,11 +33,11 @@ class AddBehaviorTreePacket extends DataPacket{
/** @var string */
public $behaviorTreeJson;
protected function decodePayload(){
protected function decodePayload() : void{
$this->behaviorTreeJson = $this->getString();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putString($this->behaviorTreeJson);
}

View File

@ -55,7 +55,7 @@ class AddEntityPacket extends DataPacket{
/** @var EntityLink[] */
public $links = [];
protected function decodePayload(){
protected function decodePayload() : void{
$this->entityUniqueId = $this->getEntityUniqueId();
$this->entityRuntimeId = $this->getEntityRuntimeId();
$this->type = $this->getUnsignedVarInt();
@ -89,7 +89,7 @@ class AddEntityPacket extends DataPacket{
}
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
$this->putEntityRuntimeId($this->entityRuntimeId);
$this->putUnsignedVarInt($this->type);

View File

@ -43,14 +43,14 @@ class AddHangingEntityPacket extends DataPacket{
/** @var int */
public $direction;
protected function decodePayload(){
protected function decodePayload() : void{
$this->entityUniqueId = $this->getEntityUniqueId();
$this->entityRuntimeId = $this->getEntityRuntimeId();
$this->getBlockPosition($this->x, $this->y, $this->z);
$this->direction = $this->getVarInt();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
$this->putEntityRuntimeId($this->entityRuntimeId);
$this->putBlockPosition($this->x, $this->y, $this->z);

View File

@ -47,7 +47,7 @@ class AddItemEntityPacket extends DataPacket{
/** @var bool */
public $isFromFishing = false;
protected function decodePayload(){
protected function decodePayload() : void{
$this->entityUniqueId = $this->getEntityUniqueId();
$this->entityRuntimeId = $this->getEntityRuntimeId();
$this->item = $this->getSlot();
@ -57,7 +57,7 @@ class AddItemEntityPacket extends DataPacket{
$this->isFromFishing = $this->getBool();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
$this->putEntityRuntimeId($this->entityRuntimeId);
$this->putSlot($this->item);

View File

@ -34,12 +34,12 @@ class AddPaintingPacket extends AddHangingEntityPacket{
/** @var string */
public $title;
protected function decodePayload(){
protected function decodePayload() : void{
parent::decodePayload();
$this->title = $this->getString();
}
protected function encodePayload(){
protected function encodePayload() : void{
parent::encodePayload();
$this->putString($this->title);
}

View File

@ -75,7 +75,7 @@ class AddPlayerPacket extends DataPacket{
/** @var EntityLink[] */
public $links = [];
protected function decodePayload(){
protected function decodePayload() : void{
$this->uuid = $this->getUUID();
$this->username = $this->getString();
$this->thirdPartyName = $this->getString();
@ -105,7 +105,7 @@ class AddPlayerPacket extends DataPacket{
}
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putUUID($this->uuid);
$this->putString($this->username);
$this->putString($this->thirdPartyName);

View File

@ -76,7 +76,7 @@ class AdventureSettingsPacket extends DataPacket{
/** @var int */
public $entityUniqueId; //This is a little-endian long, NOT a var-long. (WTF Mojang)
protected function decodePayload(){
protected function decodePayload() : void{
$this->flags = $this->getUnsignedVarInt();
$this->commandPermission = $this->getUnsignedVarInt();
$this->flags2 = $this->getUnsignedVarInt();
@ -85,7 +85,7 @@ class AdventureSettingsPacket extends DataPacket{
$this->entityUniqueId = $this->getLLong();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putUnsignedVarInt($this->flags);
$this->putUnsignedVarInt($this->commandPermission);
$this->putUnsignedVarInt($this->flags2);
@ -102,7 +102,7 @@ class AdventureSettingsPacket extends DataPacket{
return ($this->flags & $flag) !== 0;
}
public function setFlag(int $flag, bool $value){
public function setFlag(int $flag, bool $value) : void{
if($flag & self::BITFLAG_SECOND_SET){
$flagSet =& $this->flags2;
}else{

View File

@ -43,7 +43,7 @@ class AnimatePacket extends DataPacket{
/** @var float */
public $float = 0.0; //TODO (Boat rowing time?)
protected function decodePayload(){
protected function decodePayload() : void{
$this->action = $this->getVarInt();
$this->entityRuntimeId = $this->getEntityRuntimeId();
if($this->action & 0x80){
@ -51,7 +51,7 @@ class AnimatePacket extends DataPacket{
}
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putVarInt($this->action);
$this->putEntityRuntimeId($this->entityRuntimeId);
if($this->action & 0x80){

View File

@ -103,7 +103,7 @@ class AvailableCommandsPacket extends DataPacket{
*/
public $commandData = [];
protected function decodePayload(){
protected function decodePayload() : void{
for($i = 0, $this->enumValuesCount = $this->getUnsignedVarInt(); $i < $this->enumValuesCount; ++$i){
$this->enumValues[] = $this->getString();
}
@ -133,7 +133,7 @@ class AvailableCommandsPacket extends DataPacket{
return $retval;
}
protected function putEnum(CommandEnum $enum){
protected function putEnum(CommandEnum $enum) : void{
$this->putString($enum->enumName);
$this->putUnsignedVarInt(count($enum->enumValues));
@ -157,7 +157,7 @@ class AvailableCommandsPacket extends DataPacket{
}
}
protected function putEnumValueIndex(int $index){
protected function putEnumValueIndex(int $index) : void{
if($this->enumValuesCount < 256){
$this->putByte($index);
}elseif($this->enumValuesCount < 65536){
@ -201,7 +201,7 @@ class AvailableCommandsPacket extends DataPacket{
return $retval;
}
protected function putCommandData(CommandData $data){
protected function putCommandData(CommandData $data) : void{
$this->putString($data->commandName);
$this->putString($data->commandDescription);
$this->putByte($data->flags);
@ -278,7 +278,7 @@ class AvailableCommandsPacket extends DataPacket{
return "unknown ($argtype)";
}
protected function encodePayload(){
protected function encodePayload() : void{
$enumValuesMap = [];
$postfixesMap = [];
$enumMap = [];

View File

@ -48,12 +48,12 @@ class BatchPacket extends DataPacket{
return true;
}
protected function decodeHeader(){
protected function decodeHeader() : void{
$pid = $this->getByte();
assert($pid === static::NETWORK_ID);
}
protected function decodePayload(){
protected function decodePayload() : void{
$data = $this->getRemaining();
try{
$this->payload = zlib_decode($data, 1024 * 1024 * 64); //Max 64MB
@ -62,18 +62,18 @@ class BatchPacket extends DataPacket{
}
}
protected function encodeHeader(){
protected function encodeHeader() : void{
$this->putByte(static::NETWORK_ID);
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->put(zlib_encode($this->payload, ZLIB_ENCODING_DEFLATE, $this->compressionLevel));
}
/**
* @param DataPacket $packet
*/
public function addPacket(DataPacket $packet){
public function addPacket(DataPacket $packet) : void{
if(!$packet->canBeBatched()){
throw new \InvalidArgumentException(get_class($packet) . " cannot be put inside a BatchPacket");
}
@ -87,7 +87,7 @@ class BatchPacket extends DataPacket{
/**
* @return \Generator
*/
public function getPackets(){
public function getPackets() : \Generator{
$stream = new NetworkBinaryStream($this->payload);
while(!$stream->feof()){
yield $stream->getString();
@ -98,7 +98,7 @@ class BatchPacket extends DataPacket{
return $this->compressionLevel;
}
public function setCompressionLevel(int $level){
public function setCompressionLevel(int $level) : void{
$this->compressionLevel = $level;
}

View File

@ -40,12 +40,12 @@ class BlockEntityDataPacket extends DataPacket{
/** @var string */
public $namedtag;
protected function decodePayload(){
protected function decodePayload() : void{
$this->getBlockPosition($this->x, $this->y, $this->z);
$this->namedtag = $this->getRemaining();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putBlockPosition($this->x, $this->y, $this->z);
$this->put($this->namedtag);
}

View File

@ -42,13 +42,13 @@ class BlockEventPacket extends DataPacket{
/** @var int */
public $eventData;
protected function decodePayload(){
protected function decodePayload() : void{
$this->getBlockPosition($this->x, $this->y, $this->z);
$this->eventType = $this->getVarInt();
$this->eventData = $this->getVarInt();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putBlockPosition($this->x, $this->y, $this->z);
$this->putVarInt($this->eventType);
$this->putVarInt($this->eventData);

View File

@ -43,13 +43,13 @@ class BlockPickRequestPacket extends DataPacket{
/** @var int */
public $hotbarSlot;
protected function decodePayload(){
protected function decodePayload() : void{
$this->getSignedBlockPosition($this->blockX, $this->blockY, $this->blockZ);
$this->addUserData = $this->getBool();
$this->hotbarSlot = $this->getByte();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putSignedBlockPosition($this->blockX, $this->blockY, $this->blockZ);
$this->putBool($this->addUserData);
$this->putByte($this->hotbarSlot);

View File

@ -57,7 +57,7 @@ class BookEditPacket extends DataPacket{
/** @var string */
public $xuid;
protected function decodePayload(){
protected function decodePayload() : void{
$this->type = $this->getByte();
$this->inventorySlot = $this->getByte();
@ -85,7 +85,7 @@ class BookEditPacket extends DataPacket{
}
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putByte($this->type);
$this->putByte($this->inventorySlot);

View File

@ -66,7 +66,7 @@ class BossEventPacket extends DataPacket{
/** @var int */
public $overlay;
protected function decodePayload(){
protected function decodePayload() : void{
$this->bossEid = $this->getEntityUniqueId();
$this->eventType = $this->getUnsignedVarInt();
switch($this->eventType){
@ -96,7 +96,7 @@ class BossEventPacket extends DataPacket{
}
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putEntityUniqueId($this->bossEid);
$this->putUnsignedVarInt($this->eventType);
switch($this->eventType){

View File

@ -35,12 +35,12 @@ class CameraPacket extends DataPacket{
/** @var int */
public $playerUniqueId;
protected function decodePayload(){
protected function decodePayload() : void{
$this->cameraUniqueId = $this->getEntityUniqueId();
$this->playerUniqueId = $this->getEntityUniqueId();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putEntityUniqueId($this->cameraUniqueId);
$this->putEntityUniqueId($this->playerUniqueId);
}

View File

@ -39,13 +39,13 @@ class ChangeDimensionPacket extends DataPacket{
/** @var bool */
public $respawn = false;
protected function decodePayload(){
protected function decodePayload() : void{
$this->dimension = $this->getVarInt();
$this->position = $this->getVector3();
$this->respawn = $this->getBool();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putVarInt($this->dimension);
$this->putVector3($this->position);
$this->putBool($this->respawn);

View File

@ -34,11 +34,11 @@ class ChunkRadiusUpdatedPacket extends DataPacket{
/** @var int */
public $radius;
protected function decodePayload(){
protected function decodePayload() : void{
$this->radius = $this->getVarInt();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putVarInt($this->radius);
}

View File

@ -35,11 +35,11 @@ class ClientToServerHandshakePacket extends DataPacket{
return true;
}
protected function decodePayload(){
protected function decodePayload() : void{
//No payload
}
protected function encodePayload(){
protected function encodePayload() : void{
//No payload
}

View File

@ -65,7 +65,7 @@ class ClientboundMapItemDataPacket extends DataPacket{
/** @var Color[][] */
public $colors = [];
protected function decodePayload(){
protected function decodePayload() : void{
$this->mapId = $this->getEntityUniqueId();
$this->type = $this->getUnsignedVarInt();
$this->dimensionId = $this->getByte();
@ -114,7 +114,7 @@ class ClientboundMapItemDataPacket extends DataPacket{
}
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putEntityUniqueId($this->mapId);
$type = 0;

View File

@ -60,7 +60,7 @@ class CommandBlockUpdatePacket extends DataPacket{
/** @var bool */
public $shouldTrackOutput;
protected function decodePayload(){
protected function decodePayload() : void{
$this->isBlock = $this->getBool();
if($this->isBlock){
@ -80,7 +80,7 @@ class CommandBlockUpdatePacket extends DataPacket{
$this->shouldTrackOutput = $this->getBool();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putBool($this->isBlock);
if($this->isBlock){

View File

@ -43,7 +43,7 @@ class CommandOutputPacket extends DataPacket{
/** @var string */
public $unknownString;
protected function decodePayload(){
protected function decodePayload() : void{
$this->originData = $this->getCommandOriginData();
$this->outputType = $this->getByte();
$this->successCount = $this->getUnsignedVarInt();
@ -70,7 +70,7 @@ class CommandOutputPacket extends DataPacket{
return $message;
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putCommandOriginData($this->originData);
$this->putByte($this->outputType);
$this->putUnsignedVarInt($this->successCount);
@ -85,7 +85,7 @@ class CommandOutputPacket extends DataPacket{
}
}
protected function putCommandMessage(CommandOutputMessage $message){
protected function putCommandMessage(CommandOutputMessage $message) : void{
$this->putBool($message->isInternal);
$this->putString($message->messageId);

View File

@ -38,13 +38,13 @@ class CommandRequestPacket extends DataPacket{
/** @var bool */
public $isInternal;
protected function decodePayload(){
protected function decodePayload() : void{
$this->command = $this->getString();
$this->originData = $this->getCommandOriginData();
$this->isInternal = $this->getBool();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putString($this->command);
$this->putCommandOriginData($this->originData);
$this->putBool($this->isInternal);

View File

@ -34,11 +34,11 @@ class ContainerClosePacket extends DataPacket{
/** @var int */
public $windowId;
protected function decodePayload(){
protected function decodePayload() : void{
$this->windowId = $this->getByte();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putByte($this->windowId);
}

View File

@ -44,14 +44,14 @@ class ContainerOpenPacket extends DataPacket{
/** @var int */
public $entityUniqueId = -1;
protected function decodePayload(){
protected function decodePayload() : void{
$this->windowId = $this->getByte();
$this->type = $this->getByte();
$this->getBlockPosition($this->x, $this->y, $this->z);
$this->entityUniqueId = $this->getEntityUniqueId();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putByte($this->windowId);
$this->putByte($this->type);
$this->putBlockPosition($this->x, $this->y, $this->z);

View File

@ -48,13 +48,13 @@ class ContainerSetDataPacket extends DataPacket{
/** @var int */
public $value;
protected function decodePayload(){
protected function decodePayload() : void{
$this->windowId = $this->getByte();
$this->property = $this->getVarInt();
$this->value = $this->getVarInt();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putByte($this->windowId);
$this->putVarInt($this->property);
$this->putVarInt($this->value);

View File

@ -58,7 +58,7 @@ class CraftingDataPacket extends DataPacket{
return parent::clean();
}
protected function decodePayload(){
protected function decodePayload() : void{
$this->decodedEntries = [];
$recipeCount = $this->getUnsignedVarInt();
for($i = 0; $i < $recipeCount; ++$i){
@ -131,7 +131,7 @@ class CraftingDataPacket extends DataPacket{
return -1;
}
private static function writeShapelessRecipe(ShapelessRecipe $recipe, NetworkBinaryStream $stream){
private static function writeShapelessRecipe(ShapelessRecipe $recipe, NetworkBinaryStream $stream) : int{
$stream->putUnsignedVarInt($recipe->getIngredientCount());
foreach($recipe->getIngredientList() as $item){
$stream->putSlot($item);
@ -148,7 +148,7 @@ class CraftingDataPacket extends DataPacket{
return CraftingDataPacket::ENTRY_SHAPELESS;
}
private static function writeShapedRecipe(ShapedRecipe $recipe, NetworkBinaryStream $stream){
private static function writeShapedRecipe(ShapedRecipe $recipe, NetworkBinaryStream $stream) : int{
$stream->putVarInt($recipe->getWidth());
$stream->putVarInt($recipe->getHeight());
@ -169,7 +169,7 @@ class CraftingDataPacket extends DataPacket{
return CraftingDataPacket::ENTRY_SHAPED;
}
private static function writeFurnaceRecipe(FurnaceRecipe $recipe, NetworkBinaryStream $stream){
private static function writeFurnaceRecipe(FurnaceRecipe $recipe, NetworkBinaryStream $stream) : int{
if(!$recipe->getInput()->hasAnyDamageValue()){ //Data recipe
$stream->putVarInt($recipe->getInput()->getId());
$stream->putVarInt($recipe->getInput()->getDamage());
@ -184,19 +184,19 @@ class CraftingDataPacket extends DataPacket{
}
}
public function addShapelessRecipe(ShapelessRecipe $recipe){
public function addShapelessRecipe(ShapelessRecipe $recipe) : void{
$this->entries[] = $recipe;
}
public function addShapedRecipe(ShapedRecipe $recipe){
public function addShapedRecipe(ShapedRecipe $recipe) : void{
$this->entries[] = $recipe;
}
public function addFurnaceRecipe(FurnaceRecipe $recipe){
public function addFurnaceRecipe(FurnaceRecipe $recipe) : void{
$this->entries[] = $recipe;
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putUnsignedVarInt(count($this->entries));
$writer = new NetworkBinaryStream();

View File

@ -49,7 +49,7 @@ class CraftingEventPacket extends DataPacket{
return parent::clean();
}
protected function decodePayload(){
protected function decodePayload() : void{
$this->windowId = $this->getByte();
$this->type = $this->getVarInt();
$this->id = $this->getUUID();
@ -65,7 +65,7 @@ class CraftingEventPacket extends DataPacket{
}
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putByte($this->windowId);
$this->putVarInt($this->type);
$this->putUUID($this->id);

View File

@ -41,7 +41,7 @@ abstract class DataPacket extends NetworkBinaryStream{
/** @var int */
public $recipientSubId = 0;
public function pid(){
public function pid() : int{
return $this::NETWORK_ID;
}
@ -65,13 +65,13 @@ abstract class DataPacket extends NetworkBinaryStream{
return false;
}
public function decode(){
public function decode() : void{
$this->offset = 0;
$this->decodeHeader();
$this->decodePayload();
}
protected function decodeHeader(){
protected function decodeHeader() : void{
$pid = $this->getUnsignedVarInt();
assert($pid === static::NETWORK_ID);
@ -83,18 +83,18 @@ abstract class DataPacket extends NetworkBinaryStream{
/**
* Note for plugin developers: If you're adding your own packets, you should perform decoding in here.
*/
protected function decodePayload(){
protected function decodePayload() : void{
}
public function encode(){
public function encode() : void{
$this->reset();
$this->encodeHeader();
$this->encodePayload();
$this->isEncoded = true;
}
protected function encodeHeader(){
protected function encodeHeader() : void{
$this->putUnsignedVarInt(static::NETWORK_ID);
$this->putByte($this->senderSubId);
@ -104,7 +104,7 @@ abstract class DataPacket extends NetworkBinaryStream{
/**
* Note for plugin developers: If you're adding your own packets, you should perform encoding in here.
*/
protected function encodePayload(){
protected function encodePayload() : void{
}

View File

@ -40,14 +40,14 @@ class DisconnectPacket extends DataPacket{
return true;
}
protected function decodePayload(){
protected function decodePayload() : void{
$this->hideDisconnectionScreen = $this->getBool();
if(!$this->hideDisconnectionScreen){
$this->message = $this->getString();
}
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putBool($this->hideDisconnectionScreen);
if(!$this->hideDisconnectionScreen){
$this->putString($this->message);

View File

@ -90,13 +90,13 @@ class EntityEventPacket extends DataPacket{
/** @var int */
public $data = 0;
protected function decodePayload(){
protected function decodePayload() : void{
$this->entityRuntimeId = $this->getEntityRuntimeId();
$this->event = $this->getByte();
$this->data = $this->getVarInt();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putEntityRuntimeId($this->entityRuntimeId);
$this->putByte($this->event);
$this->putVarInt($this->data);

View File

@ -38,13 +38,13 @@ class EntityFallPacket extends DataPacket{
/** @var bool */
public $isInVoid;
protected function decodePayload(){
protected function decodePayload() : void{
$this->entityRuntimeId = $this->getEntityRuntimeId();
$this->fallDistance = $this->getLFloat();
$this->isInVoid = $this->getBool();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putEntityRuntimeId($this->entityRuntimeId);
$this->putLFloat($this->fallDistance);
$this->putBool($this->isInVoid);

View File

@ -35,12 +35,12 @@ class EntityPickRequestPacket extends DataPacket{
/** @var int */
public $hotbarSlot;
protected function decodePayload(){
protected function decodePayload() : void{
$this->entityUniqueId = $this->getLLong();
$this->hotbarSlot = $this->getByte();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putLLong($this->entityUniqueId);
$this->putByte($this->hotbarSlot);
}

View File

@ -48,7 +48,7 @@ class EventPacket extends DataPacket{
/** @var int */
public $type;
protected function decodePayload(){
protected function decodePayload() : void{
$this->playerRuntimeId = $this->getEntityRuntimeId();
$this->eventData = $this->getVarInt();
$this->type = $this->getByte();
@ -56,7 +56,7 @@ class EventPacket extends DataPacket{
//TODO: nice confusing mess
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putEntityRuntimeId($this->playerRuntimeId);
$this->putVarInt($this->eventData);
$this->putByte($this->type);

View File

@ -44,7 +44,7 @@ class ExplodePacket extends DataPacket{
return parent::clean();
}
protected function decodePayload(){
protected function decodePayload() : void{
$this->position = $this->getVector3();
$this->radius = (float) ($this->getVarInt() / 32);
$count = $this->getUnsignedVarInt();
@ -55,7 +55,7 @@ class ExplodePacket extends DataPacket{
}
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putVector3($this->position);
$this->putVarInt((int) ($this->radius * 32));
$this->putUnsignedVarInt(count($this->records));

View File

@ -38,13 +38,13 @@ class FullChunkDataPacket extends DataPacket{
/** @var string */
public $data;
protected function decodePayload(){
protected function decodePayload() : void{
$this->chunkX = $this->getVarInt();
$this->chunkZ = $this->getVarInt();
$this->data = $this->getString();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putVarInt($this->chunkX);
$this->putVarInt($this->chunkZ);
$this->putString($this->data);

View File

@ -33,11 +33,11 @@ class GameRulesChangedPacket extends DataPacket{
/** @var array */
public $gameRules = [];
protected function decodePayload(){
protected function decodePayload() : void{
$this->gameRules = $this->getGameRules();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putGameRules($this->gameRules);
}

View File

@ -33,11 +33,11 @@ class GuiDataPickItemPacket extends DataPacket{
/** @var int */
public $hotbarSlot;
protected function decodePayload(){
protected function decodePayload() : void{
$this->hotbarSlot = $this->getLInt();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putLInt($this->hotbarSlot);
}

View File

@ -34,11 +34,11 @@ class HurtArmorPacket extends DataPacket{
/** @var int */
public $health;
protected function decodePayload(){
protected function decodePayload() : void{
$this->health = $this->getVarInt();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putVarInt($this->health);
}

View File

@ -48,7 +48,7 @@ class InteractPacket extends DataPacket{
/** @var float */
public $z;
protected function decodePayload(){
protected function decodePayload() : void{
$this->action = $this->getByte();
$this->target = $this->getEntityRuntimeId();
@ -60,7 +60,7 @@ class InteractPacket extends DataPacket{
}
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putByte($this->action);
$this->putEntityRuntimeId($this->target);

View File

@ -36,7 +36,7 @@ class InventoryContentPacket extends DataPacket{
/** @var Item[] */
public $items = [];
protected function decodePayload(){
protected function decodePayload() : void{
$this->windowId = $this->getUnsignedVarInt();
$count = $this->getUnsignedVarInt();
for($i = 0; $i < $count; ++$i){
@ -44,7 +44,7 @@ class InventoryContentPacket extends DataPacket{
}
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putUnsignedVarInt($this->windowId);
$this->putUnsignedVarInt(count($this->items));
foreach($this->items as $item){

View File

@ -38,13 +38,13 @@ class InventorySlotPacket extends DataPacket{
/** @var Item */
public $item;
protected function decodePayload(){
protected function decodePayload() : void{
$this->windowId = $this->getUnsignedVarInt();
$this->inventorySlot = $this->getUnsignedVarInt();
$this->item = $this->getSlot();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putUnsignedVarInt($this->windowId);
$this->putUnsignedVarInt($this->inventorySlot);
$this->putSlot($this->item);

View File

@ -69,7 +69,7 @@ class InventoryTransactionPacket extends DataPacket{
/** @var \stdClass */
public $trData;
protected function decodePayload(){
protected function decodePayload() : void{
$this->transactionType = $this->getUnsignedVarInt();
for($i = 0, $count = $this->getUnsignedVarInt(); $i < $count; ++$i){
@ -111,7 +111,7 @@ class InventoryTransactionPacket extends DataPacket{
}
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putUnsignedVarInt($this->transactionType);
$this->putUnsignedVarInt(count($this->actions));

View File

@ -38,11 +38,11 @@ class ItemFrameDropItemPacket extends DataPacket{
/** @var int */
public $z;
protected function decodePayload(){
protected function decodePayload() : void{
$this->getBlockPosition($this->x, $this->y, $this->z);
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putBlockPosition($this->x, $this->y, $this->z);
}

View File

@ -43,13 +43,13 @@ class LabTablePacket extends DataPacket{
/** @var int */
public $reactionType;
protected function decodePayload(){
protected function decodePayload() : void{
$this->uselessByte = $this->getByte();
$this->getSignedBlockPosition($this->x, $this->y, $this->z);
$this->reactionType = $this->getByte();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putByte($this->uselessByte);
$this->putSignedBlockPosition($this->x, $this->y, $this->z);
$this->putByte($this->reactionType);

View File

@ -118,13 +118,13 @@ class LevelEventPacket extends DataPacket{
/** @var int */
public $data;
protected function decodePayload(){
protected function decodePayload() : void{
$this->evid = $this->getVarInt();
$this->position = $this->getVector3();
$this->data = $this->getVarInt();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putVarInt($this->evid);
$this->putVector3Nullable($this->position);
$this->putVarInt($this->data);

View File

@ -257,7 +257,7 @@ class LevelSoundEventPacket extends DataPacket{
/** @var bool */
public $disableRelativeVolume = false;
protected function decodePayload(){
protected function decodePayload() : void{
$this->sound = $this->getByte();
$this->position = $this->getVector3();
$this->extraData = $this->getVarInt();
@ -266,7 +266,7 @@ class LevelSoundEventPacket extends DataPacket{
$this->disableRelativeVolume = $this->getBool();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putByte($this->sound);
$this->putVector3($this->position);
$this->putVarInt($this->extraData);

View File

@ -76,7 +76,7 @@ class LoginPacket extends DataPacket{
return $this->protocol !== null and $this->protocol !== ProtocolInfo::CURRENT_PROTOCOL;
}
protected function decodePayload(){
protected function decodePayload() : void{
$this->protocol = $this->getInt();
if($this->protocol !== ProtocolInfo::CURRENT_PROTOCOL){
@ -133,7 +133,7 @@ class LoginPacket extends DataPacket{
$this->locale = $this->clientData["LanguageCode"] ?? null;
}
protected function encodePayload(){
protected function encodePayload() : void{
//TODO
}

View File

@ -35,11 +35,11 @@ class MapInfoRequestPacket extends DataPacket{
/** @var int */
public $mapId;
protected function decodePayload(){
protected function decodePayload() : void{
$this->mapId = $this->getEntityUniqueId();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putEntityUniqueId($this->mapId);
}

View File

@ -37,14 +37,14 @@ class MobArmorEquipmentPacket extends DataPacket{
/** @var Item[] */
public $slots = [];
protected function decodePayload(){
protected function decodePayload() : void{
$this->entityRuntimeId = $this->getEntityRuntimeId();
for($i = 0; $i < 4; ++$i){
$this->slots[$i] = $this->getSlot();
}
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putEntityRuntimeId($this->entityRuntimeId);
for($i = 0; $i < 4; ++$i){
$this->putSlot($this->slots[$i]);

View File

@ -48,7 +48,7 @@ class MobEffectPacket extends DataPacket{
/** @var int */
public $duration = 0;
protected function decodePayload(){
protected function decodePayload() : void{
$this->entityRuntimeId = $this->getEntityRuntimeId();
$this->eventId = $this->getByte();
$this->effectId = $this->getVarInt();
@ -57,7 +57,7 @@ class MobEffectPacket extends DataPacket{
$this->duration = $this->getVarInt();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putEntityRuntimeId($this->entityRuntimeId);
$this->putByte($this->eventId);
$this->putVarInt($this->effectId);

View File

@ -43,7 +43,7 @@ class MobEquipmentPacket extends DataPacket{
/** @var int */
public $windowId = 0;
protected function decodePayload(){
protected function decodePayload() : void{
$this->entityRuntimeId = $this->getEntityRuntimeId();
$this->item = $this->getSlot();
$this->inventorySlot = $this->getByte();
@ -51,7 +51,7 @@ class MobEquipmentPacket extends DataPacket{
$this->windowId = $this->getByte();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putEntityRuntimeId($this->entityRuntimeId);
$this->putSlot($this->item);
$this->putByte($this->inventorySlot);

View File

@ -35,12 +35,12 @@ class ModalFormRequestPacket extends DataPacket{
/** @var string */
public $formData; //json
protected function decodePayload(){
protected function decodePayload() : void{
$this->formId = $this->getUnsignedVarInt();
$this->formData = $this->getString();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putUnsignedVarInt($this->formId);
$this->putString($this->formData);
}

View File

@ -35,12 +35,12 @@ class ModalFormResponsePacket extends DataPacket{
/** @var string */
public $formData; //json
protected function decodePayload(){
protected function decodePayload() : void{
$this->formId = $this->getUnsignedVarInt();
$this->formData = $this->getString();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putUnsignedVarInt($this->formId);
$this->putString($this->formData);
}

View File

@ -47,7 +47,7 @@ class MoveEntityPacket extends DataPacket{
/** @var bool */
public $teleported = false;
protected function decodePayload(){
protected function decodePayload() : void{
$this->entityRuntimeId = $this->getEntityRuntimeId();
$this->position = $this->getVector3();
$this->pitch = $this->getByteRotation();
@ -57,7 +57,7 @@ class MoveEntityPacket extends DataPacket{
$this->teleported = $this->getBool();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putEntityRuntimeId($this->entityRuntimeId);
$this->putVector3($this->position);
$this->putByteRotation($this->pitch);

View File

@ -58,7 +58,7 @@ class MovePlayerPacket extends DataPacket{
/** @var int */
public $teleportItem = 0;
protected function decodePayload(){
protected function decodePayload() : void{
$this->entityRuntimeId = $this->getEntityRuntimeId();
$this->position = $this->getVector3();
$this->pitch = $this->getLFloat();
@ -73,7 +73,7 @@ class MovePlayerPacket extends DataPacket{
}
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putEntityRuntimeId($this->entityRuntimeId);
$this->putVector3($this->position);
$this->putLFloat($this->pitch);

View File

@ -39,14 +39,14 @@ class NpcRequestPacket extends DataPacket{
/** @var int */
public $actionType;
protected function decodePayload(){
protected function decodePayload() : void{
$this->entityRuntimeId = $this->getEntityRuntimeId();
$this->requestType = $this->getByte();
$this->commandString = $this->getString();
$this->actionType = $this->getByte();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putEntityRuntimeId($this->entityRuntimeId);
$this->putByte($this->requestType);
$this->putString($this->commandString);

View File

@ -27,7 +27,7 @@ class PacketPool{
/** @var \SplFixedArray<DataPacket> */
protected static $pool = null;
public static function init(){
public static function init() : void{
static::$pool = new \SplFixedArray(256);
//Normal packets
@ -148,7 +148,7 @@ class PacketPool{
/**
* @param DataPacket $packet
*/
public static function registerPacket(DataPacket $packet){
public static function registerPacket(DataPacket $packet) : void{
static::$pool[$packet->pid()] = clone $packet;
}

View File

@ -37,13 +37,13 @@ class PhotoTransferPacket extends DataPacket{
/** @var string */
public $bookId; //photos are stored in a sibling directory to the games folder (screenshots/(some UUID)/bookID/example.png)
protected function decodePayload(){
protected function decodePayload() : void{
$this->photoName = $this->getString();
$this->photoData = $this->getString();
$this->bookId = $this->getString();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putString($this->photoName);
$this->putString($this->photoData);
$this->putString($this->bookId);

View File

@ -45,7 +45,7 @@ class PlaySoundPacket extends DataPacket{
/** @var float */
public $pitch;
protected function decodePayload(){
protected function decodePayload() : void{
$this->soundName = $this->getString();
$this->getBlockPosition($this->x, $this->y, $this->z);
$this->x /= 8;
@ -55,7 +55,7 @@ class PlaySoundPacket extends DataPacket{
$this->pitch = $this->getLFloat();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putString($this->soundName);
$this->putBlockPosition((int) ($this->x * 8), (int) ($this->y * 8), (int) ($this->z * 8));
$this->putLFloat($this->volume);

View File

@ -49,7 +49,7 @@ class PlayStatusPacket extends DataPacket{
*/
public $protocol;
protected function decodePayload(){
protected function decodePayload() : void{
$this->status = $this->getInt();
}
@ -57,7 +57,7 @@ class PlayStatusPacket extends DataPacket{
return true;
}
protected function encodeHeader(){
protected function encodeHeader() : void{
if($this->protocol < 130){ //MCPE <= 1.1
$this->putByte(static::NETWORK_ID);
}else{
@ -65,7 +65,7 @@ class PlayStatusPacket extends DataPacket{
}
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putInt($this->status);
}

View File

@ -70,14 +70,14 @@ class PlayerActionPacket extends DataPacket{
/** @var int */
public $face;
protected function decodePayload(){
protected function decodePayload() : void{
$this->entityRuntimeId = $this->getEntityRuntimeId();
$this->action = $this->getVarInt();
$this->getBlockPosition($this->x, $this->y, $this->z);
$this->face = $this->getVarInt();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putEntityRuntimeId($this->entityRuntimeId);
$this->putVarInt($this->action);
$this->putBlockPosition($this->x, $this->y, $this->z);

View File

@ -41,13 +41,13 @@ class PlayerHotbarPacket extends DataPacket{
/** @var bool */
public $selectHotbarSlot = true;
protected function decodePayload(){
protected function decodePayload() : void{
$this->selectedHotbarSlot = $this->getUnsignedVarInt();
$this->windowId = $this->getByte();
$this->selectHotbarSlot = $this->getBool();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putUnsignedVarInt($this->selectedHotbarSlot);
$this->putByte($this->windowId);
$this->putBool($this->selectHotbarSlot);

View File

@ -40,14 +40,14 @@ class PlayerInputPacket extends DataPacket{
/** @var bool */
public $sneaking;
protected function decodePayload(){
protected function decodePayload() : void{
$this->motionX = $this->getLFloat();
$this->motionY = $this->getLFloat();
$this->jumping = $this->getBool();
$this->sneaking = $this->getBool();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putLFloat($this->motionX);
$this->putLFloat($this->motionY);
$this->putBool($this->jumping);

View File

@ -46,7 +46,7 @@ class PlayerListPacket extends DataPacket{
return parent::clean();
}
protected function decodePayload(){
protected function decodePayload() : void{
$this->type = $this->getByte();
$count = $this->getUnsignedVarInt();
for($i = 0; $i < $count; ++$i){
@ -82,7 +82,7 @@ class PlayerListPacket extends DataPacket{
}
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putByte($this->type);
$this->putUnsignedVarInt(count($this->entries));
foreach($this->entries as $entry){

View File

@ -42,7 +42,7 @@ class PlayerSkinPacket extends DataPacket{
public $skin;
protected function decodePayload(){
protected function decodePayload() : void{
$this->uuid = $this->getUUID();
$skinId = $this->getString();
@ -56,7 +56,7 @@ class PlayerSkinPacket extends DataPacket{
$this->skin = new Skin($skinId, $skinData, $capeData, $geometryModel, $geometryData);
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putUUID($this->uuid);
$this->putString($this->skin->getSkinId());

View File

@ -33,14 +33,14 @@ class PurchaseReceiptPacket extends DataPacket{
/** @var string[] */
public $entries = [];
protected function decodePayload(){
protected function decodePayload() : void{
$count = $this->getUnsignedVarInt();
for($i = 0; $i < $count; ++$i){
$this->entries[] = $this->getString();
}
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putUnsignedVarInt(count($this->entries));
foreach($this->entries as $entry){
$this->putString($entry);

View File

@ -34,11 +34,11 @@ class RemoveEntityPacket extends DataPacket{
/** @var int */
public $entityUniqueId;
protected function decodePayload(){
protected function decodePayload() : void{
$this->entityUniqueId = $this->getEntityUniqueId();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putEntityUniqueId($this->entityUniqueId);
}

View File

@ -33,11 +33,11 @@ class RemoveObjectivePacket extends DataPacket{
/** @var string */
public $objectiveName;
protected function decodePayload(){
protected function decodePayload() : void{
$this->objectiveName = $this->getString();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putString($this->objectiveName);
}

View File

@ -34,11 +34,11 @@ class RequestChunkRadiusPacket extends DataPacket{
/** @var int */
public $radius;
protected function decodePayload(){
protected function decodePayload() : void{
$this->radius = $this->getVarInt();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putVarInt($this->radius);
}

View File

@ -41,14 +41,14 @@ class ResourcePackChunkDataPacket extends DataPacket{
/** @var string */
public $data;
protected function decodePayload(){
protected function decodePayload() : void{
$this->packId = $this->getString();
$this->chunkIndex = $this->getLInt();
$this->progress = $this->getLLong();
$this->data = $this->get($this->getLInt());
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putString($this->packId);
$this->putLInt($this->chunkIndex);
$this->putLLong($this->progress);

View File

@ -37,12 +37,12 @@ class ResourcePackChunkRequestPacket extends DataPacket{
/** @var int */
public $chunkIndex;
protected function decodePayload(){
protected function decodePayload() : void{
$this->packId = $this->getString();
$this->chunkIndex = $this->getLInt();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putString($this->packId);
$this->putLInt($this->chunkIndex);
}

View File

@ -41,7 +41,7 @@ class ResourcePackClientResponsePacket extends DataPacket{
/** @var string[] */
public $packIds = [];
protected function decodePayload(){
protected function decodePayload() : void{
$this->status = $this->getByte();
$entryCount = $this->getLShort();
while($entryCount-- > 0){
@ -49,7 +49,7 @@ class ResourcePackClientResponsePacket extends DataPacket{
}
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putByte($this->status);
$this->putLShort(count($this->packIds));
foreach($this->packIds as $id){

View File

@ -43,7 +43,7 @@ class ResourcePackDataInfoPacket extends DataPacket{
/** @var string */
public $sha256;
protected function decodePayload(){
protected function decodePayload() : void{
$this->packId = $this->getString();
$this->maxChunkSize = $this->getLInt();
$this->chunkCount = $this->getLInt();
@ -51,7 +51,7 @@ class ResourcePackDataInfoPacket extends DataPacket{
$this->sha256 = $this->getString();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putString($this->packId);
$this->putLInt($this->maxChunkSize);
$this->putLInt($this->chunkCount);

View File

@ -41,7 +41,7 @@ class ResourcePackStackPacket extends DataPacket{
/** @var ResourcePack[] */
public $resourcePackStack = [];
protected function decodePayload(){
protected function decodePayload() : void{
/*$this->mustAccept = $this->getBool();
$behaviorPackCount = $this->getUnsignedVarInt();
while($behaviorPackCount-- > 0){
@ -58,7 +58,7 @@ class ResourcePackStackPacket extends DataPacket{
}*/
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putBool($this->mustAccept);
$this->putUnsignedVarInt(count($this->behaviorPackStack));

View File

@ -39,7 +39,7 @@ class ResourcePacksInfoPacket extends DataPacket{
/** @var ResourcePack[] */
public $resourcePackEntries = [];
protected function decodePayload(){
protected function decodePayload() : void{
/*$this->mustAccept = $this->getBool();
$behaviorPackCount = $this->getLShort();
while($behaviorPackCount-- > 0){
@ -60,7 +60,7 @@ class ResourcePacksInfoPacket extends DataPacket{
}*/
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putBool($this->mustAccept);
$this->putLShort(count($this->behaviorPackEntries));

View File

@ -35,11 +35,11 @@ class RespawnPacket extends DataPacket{
/** @var Vector3 */
public $position;
protected function decodePayload(){
protected function decodePayload() : void{
$this->position = $this->getVector3();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putVector3($this->position);
}

View File

@ -35,11 +35,11 @@ class RiderJumpPacket extends DataPacket{
/** @var int */
public $jumpStrength; //percentage
protected function decodePayload(){
protected function decodePayload() : void{
$this->jumpStrength = $this->getVarInt();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putVarInt($this->jumpStrength);
}

View File

@ -30,11 +30,11 @@ use pocketmine\network\mcpe\NetworkSession;
class ServerSettingsRequestPacket extends DataPacket{
public const NETWORK_ID = ProtocolInfo::SERVER_SETTINGS_REQUEST_PACKET;
protected function decodePayload(){
protected function decodePayload() : void{
//No payload
}
protected function encodePayload(){
protected function encodePayload() : void{
//No payload
}

View File

@ -35,12 +35,12 @@ class ServerSettingsResponsePacket extends DataPacket{
/** @var string */
public $formData; //json
protected function decodePayload(){
protected function decodePayload() : void{
$this->formId = $this->getUnsignedVarInt();
$this->formData = $this->getString();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putUnsignedVarInt($this->formId);
$this->putString($this->formData);
}

View File

@ -41,11 +41,11 @@ class ServerToClientHandshakePacket extends DataPacket{
return true;
}
protected function decodePayload(){
protected function decodePayload() : void{
$this->jwt = $this->getString();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putString($this->jwt);
}

View File

@ -34,11 +34,11 @@ class SetCommandsEnabledPacket extends DataPacket{
/** @var bool */
public $enabled;
protected function decodePayload(){
protected function decodePayload() : void{
$this->enabled = $this->getBool();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putBool($this->enabled);
}

View File

@ -33,11 +33,11 @@ class SetDefaultGameTypePacket extends DataPacket{
/** @var int */
public $gamemode;
protected function decodePayload(){
protected function decodePayload() : void{
$this->gamemode = $this->getVarInt();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putUnsignedVarInt($this->gamemode);
}

View File

@ -34,11 +34,11 @@ class SetDifficultyPacket extends DataPacket{
/** @var int */
public $difficulty;
protected function decodePayload(){
protected function decodePayload() : void{
$this->difficulty = $this->getUnsignedVarInt();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putUnsignedVarInt($this->difficulty);
}

View File

@ -41,7 +41,7 @@ class SetDisplayObjectivePacket extends DataPacket{
/** @var int */
public $sortOrder;
protected function decodePayload(){
protected function decodePayload() : void{
$this->displaySlot = $this->getString();
$this->objectiveName = $this->getString();
$this->displayName = $this->getString();
@ -49,7 +49,7 @@ class SetDisplayObjectivePacket extends DataPacket{
$this->sortOrder = $this->getVarInt();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putString($this->displaySlot);
$this->putString($this->objectiveName);
$this->putString($this->displayName);

View File

@ -36,12 +36,12 @@ class SetEntityDataPacket extends DataPacket{
/** @var array */
public $metadata;
protected function decodePayload(){
protected function decodePayload() : void{
$this->entityRuntimeId = $this->getEntityRuntimeId();
$this->metadata = $this->getEntityMetadata();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putEntityRuntimeId($this->entityRuntimeId);
$this->putEntityMetadata($this->metadata);
}

View File

@ -35,11 +35,11 @@ class SetEntityLinkPacket extends DataPacket{
/** @var EntityLink */
public $link;
protected function decodePayload(){
protected function decodePayload() : void{
$this->link = $this->getEntityLink();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putEntityLink($this->link);
}

View File

@ -37,12 +37,12 @@ class SetEntityMotionPacket extends DataPacket{
/** @var Vector3 */
public $motion;
protected function decodePayload(){
protected function decodePayload() : void{
$this->entityRuntimeId = $this->getEntityRuntimeId();
$this->motion = $this->getVector3();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putEntityRuntimeId($this->entityRuntimeId);
$this->putVector3($this->motion);
}

View File

@ -34,11 +34,11 @@ class SetHealthPacket extends DataPacket{
/** @var int */
public $health;
protected function decodePayload(){
protected function decodePayload() : void{
$this->health = $this->getVarInt();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putVarInt($this->health);
}

View File

@ -33,11 +33,11 @@ class SetLastHurtByPacket extends DataPacket{
/** @var int */
public $entityTypeId;
protected function decodePayload(){
protected function decodePayload() : void{
$this->entityTypeId = $this->getVarInt();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putVarInt($this->entityTypeId);
}

View File

@ -34,11 +34,11 @@ class SetPlayerGameTypePacket extends DataPacket{
/** @var int */
public $gamemode;
protected function decodePayload(){
protected function decodePayload() : void{
$this->gamemode = $this->getVarInt();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putVarInt($this->gamemode);
}

View File

@ -39,7 +39,7 @@ class SetScorePacket extends DataPacket{
/** @var ScorePacketEntry[] */
public $entries = [];
protected function decodePayload(){
protected function decodePayload() : void{
$this->type = $this->getByte();
for($i = 0, $i2 = $this->getUnsignedVarInt(); $i < $i2; ++$i){
$entry = new ScorePacketEntry();
@ -49,7 +49,7 @@ class SetScorePacket extends DataPacket{
}
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putByte($this->type);
$this->putUnsignedVarInt(count($this->entries));
foreach($this->entries as $entry){

View File

@ -45,13 +45,13 @@ class SetSpawnPositionPacket extends DataPacket{
/** @var bool */
public $spawnForced;
protected function decodePayload(){
protected function decodePayload() : void{
$this->spawnType = $this->getVarInt();
$this->getBlockPosition($this->x, $this->y, $this->z);
$this->spawnForced = $this->getBool();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putVarInt($this->spawnType);
$this->putBlockPosition($this->x, $this->y, $this->z);
$this->putBool($this->spawnForced);

View File

@ -33,11 +33,11 @@ class SetTimePacket extends DataPacket{
/** @var int */
public $time;
protected function decodePayload(){
protected function decodePayload() : void{
$this->time = $this->getVarInt();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putVarInt($this->time);
}

View File

@ -50,7 +50,7 @@ class SetTitlePacket extends DataPacket{
/** @var int */
public $fadeOutTime = 0;
protected function decodePayload(){
protected function decodePayload() : void{
$this->type = $this->getVarInt();
$this->text = $this->getString();
$this->fadeInTime = $this->getVarInt();
@ -58,7 +58,7 @@ class SetTitlePacket extends DataPacket{
$this->fadeOutTime = $this->getVarInt();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putVarInt($this->type);
$this->putString($this->text);
$this->putVarInt($this->fadeInTime);

View File

@ -40,12 +40,12 @@ class ShowCreditsPacket extends DataPacket{
/** @var int */
public $status;
protected function decodePayload(){
protected function decodePayload() : void{
$this->playerEid = $this->getEntityRuntimeId();
$this->status = $this->getVarInt();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putEntityRuntimeId($this->playerEid);
$this->putVarInt($this->status);
}

View File

@ -33,11 +33,11 @@ class ShowProfilePacket extends DataPacket{
/** @var string */
public $xuid;
protected function decodePayload(){
protected function decodePayload() : void{
$this->xuid = $this->getString();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putString($this->xuid);
}

View File

@ -35,12 +35,12 @@ class ShowStoreOfferPacket extends DataPacket{
/** @var bool */
public $showAll;
protected function decodePayload(){
protected function decodePayload() : void{
$this->offerId = $this->getString();
$this->showAll = $this->getBool();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putString($this->offerId);
$this->putBool($this->showAll);
}

View File

@ -36,11 +36,11 @@ class SimpleEventPacket extends DataPacket{
/** @var int */
public $eventType;
protected function decodePayload(){
protected function decodePayload() : void{
$this->eventType = $this->getLShort();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putLShort($this->eventType);
}

View File

@ -37,12 +37,12 @@ class SpawnExperienceOrbPacket extends DataPacket{
/** @var int */
public $amount;
protected function decodePayload(){
protected function decodePayload() : void{
$this->position = $this->getVector3();
$this->amount = $this->getVarInt();
}
protected function encodePayload(){
protected function encodePayload() : void{
$this->putVector3($this->position);
$this->putVarInt($this->amount);
}

Some files were not shown because too many files have changed in this diff Show More