Moaaaar resource packets

This commit is contained in:
Dylan K. Taylor 2017-03-02 14:42:38 +00:00
parent 425686755b
commit 55598ba703
6 changed files with 194 additions and 3 deletions

View File

@ -153,7 +153,10 @@ use pocketmine\network\mcpe\protocol\RemoveBlockPacket;
use pocketmine\network\mcpe\protocol\RemoveEntityPacket;
use pocketmine\network\mcpe\protocol\ReplaceItemInSlotPacket;
use pocketmine\network\mcpe\protocol\RequestChunkRadiusPacket;
use pocketmine\network\mcpe\protocol\ResourcePackChunkDataPacket;
use pocketmine\network\mcpe\protocol\ResourcePackChunkRequestPacket;
use pocketmine\network\mcpe\protocol\ResourcePackClientResponsePacket;
use pocketmine\network\mcpe\protocol\ResourcePackDataInfoPacket;
use pocketmine\network\mcpe\protocol\ResourcePacksInfoPacket;
use pocketmine\network\mcpe\protocol\ResourcePackStackPacket;
use pocketmine\network\mcpe\protocol\RespawnPacket;
@ -182,6 +185,7 @@ use pocketmine\network\SourceInterface;
use pocketmine\permission\PermissibleBase;
use pocketmine\permission\PermissionAttachment;
use pocketmine\plugin\Plugin;
use pocketmine\resourcepacks\ResourcePackInfoEntry;
use pocketmine\tile\ItemFrame;
use pocketmine\tile\Spawnable;
use pocketmine\utils\TextFormat;
@ -3270,6 +3274,18 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
return true;
}
public function handleResourcePackDataInfo(ResourcePackDataInfoPacket $packet) : bool{
return false;
}
public function handleResourcePackChunkData(ResourcePackChunkDataPacket $packet) : bool{
return false;
}
public function handleResourcePackChunkRequest(ResourcePackChunkRequestPacket $packet) : bool{
return false;
}
public function handleTransfer(TransferPacket $packet) : bool{
return false;
}

View File

@ -74,7 +74,10 @@ use pocketmine\network\mcpe\protocol\RemoveBlockPacket;
use pocketmine\network\mcpe\protocol\RemoveEntityPacket;
use pocketmine\network\mcpe\protocol\ReplaceItemInSlotPacket;
use pocketmine\network\mcpe\protocol\RequestChunkRadiusPacket;
use pocketmine\network\mcpe\protocol\ResourcePackChunkDataPacket;
use pocketmine\network\mcpe\protocol\ResourcePackChunkRequestPacket;
use pocketmine\network\mcpe\protocol\ResourcePackClientResponsePacket;
use pocketmine\network\mcpe\protocol\ResourcePackDataInfoPacket;
use pocketmine\network\mcpe\protocol\ResourcePacksInfoPacket;
use pocketmine\network\mcpe\protocol\RespawnPacket;
use pocketmine\network\mcpe\protocol\RiderJumpPacket;
@ -358,7 +361,10 @@ class Network{
$this->registerPacket(ProtocolInfo::REMOVE_ENTITY_PACKET, RemoveEntityPacket::class);
$this->registerPacket(ProtocolInfo::REPLACE_ITEM_IN_SLOT_PACKET, ReplaceItemInSlotPacket::class);
$this->registerPacket(ProtocolInfo::REQUEST_CHUNK_RADIUS_PACKET, RequestChunkRadiusPacket::class);
$this->registerPacket(ProtocolInfo::RESOURCE_PACK_CHUNK_DATA_PACKET, ResourcePackChunkDataPacket::class);
$this->registerPacket(ProtocolInfo::RESOURCE_PACK_CHUNK_REQUEST_PACKET, ResourcePackChunkRequestPacket::class);
$this->registerPacket(ProtocolInfo::RESOURCE_PACK_CLIENT_RESPONSE_PACKET, ResourcePackClientResponsePacket::class);
$this->registerPacket(ProtocolInfo::RESOURCE_PACK_DATA_INFO_PACKET, ResourcePackDataInfoPacket::class);
$this->registerPacket(ProtocolInfo::RESOURCE_PACKS_INFO_PACKET, ResourcePacksInfoPacket::class);
$this->registerPacket(ProtocolInfo::RESPAWN_PACKET, RespawnPacket::class);
$this->registerPacket(ProtocolInfo::RIDER_JUMP_PACKET, RiderJumpPacket::class);

View File

@ -72,7 +72,10 @@ use pocketmine\network\mcpe\protocol\RemoveBlockPacket;
use pocketmine\network\mcpe\protocol\RemoveEntityPacket;
use pocketmine\network\mcpe\protocol\ReplaceItemInSlotPacket;
use pocketmine\network\mcpe\protocol\RequestChunkRadiusPacket;
use pocketmine\network\mcpe\protocol\ResourcePackChunkDataPacket;
use pocketmine\network\mcpe\protocol\ResourcePackChunkRequestPacket;
use pocketmine\network\mcpe\protocol\ResourcePackClientResponsePacket;
use pocketmine\network\mcpe\protocol\ResourcePackDataInfoPacket;
use pocketmine\network\mcpe\protocol\ResourcePacksInfoPacket;
use pocketmine\network\mcpe\protocol\ResourcePackStackPacket;
use pocketmine\network\mcpe\protocol\RespawnPacket;
@ -256,11 +259,11 @@ interface NetworkSession{
public function handleCommandStep(CommandStepPacket $packet) : bool;
//public function handleResourcePackDataInfo(ResourcePackDataInfoPacket $packet) : bool; //TODO
public function handleResourcePackDataInfo(ResourcePackDataInfoPacket $packet) : bool;
//public function handleResourcePackChunkData(ResourcePackChunkDataPacket $packet) : bool; //TODO
public function handleResourcePackChunkData(ResourcePackChunkDataPacket $packet) : bool;
//public function handleResourcePackChunkRequest(ResourcePackChunkRequestPacket $packet) : bool; //TODO
public function handleResourcePackChunkRequest(ResourcePackChunkRequestPacket $packet) : bool;
public function handleTransfer(TransferPacket $packet) : bool;

View File

@ -0,0 +1,56 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\mcpe\NetworkSession;
class ResourcePackChunkDataPacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::RESOURCE_PACK_CHUNK_DATA_PACKET;
public $packId;
public $unknown1;
public $unknown2;
public $data;
public function decode(){
$this->packId = $this->getString();
$this->unknown1 = $this->getLInt();
$this->unknown2 = $this->getLLong();
$this->data = $this->get($this->getLInt());
}
public function encode(){
$this->putString($this->packId);
$this->putLInt($this->unknown1);
$this->putLLong($this->unknown2);
$this->putLInt(strlen($this->data));
$this->put($this->data);
}
public function handle(NetworkSession $session) : bool{
$session->handleResourcePackChunkData($this);
}
}

View File

@ -0,0 +1,50 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\mcpe\NetworkSession;
class ResourcePackChunkRequestPacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::RESOURCE_PACK_CHUNK_REQUEST_PACKET;
public $packId;
public $unknown;
public function decode(){
$this->packId = $this->getString();
$this->unknown = $this->getLInt();
}
public function encode(){
$this->reset();
$this->putString($this->packId);
$this->putLInt($this->unknown);
}
public function handle(NetworkSession $session) : bool{
$session->handleResourcePackChunkRequest($this);
}
}

View File

@ -0,0 +1,60 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\mcpe\NetworkSession;
class ResourcePackDataInfoPacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::RESOURCE_PACK_DATA_INFO_PACKET;
public $packId;
public $int1;
public $int2;
public $packSize;
public $unknown;
public function decode(){
$this->packId = $this->getString();
$this->int1 = $this->getLInt();
$this->int2 = $this->getLInt();
$this->packSize = $this->getLLong();
$this->unknown = $this->getString();
}
public function encode(){
$this->reset();
$this->putString($this->packId);
$this->putLInt($this->int1);
$this->putLInt($this->int2);
$this->putLLong($this->packSize);
$this->putString($this->unknown);
}
public function handle(NetworkSession $session) : bool{
$session->handleResourcePackDataInfo($this);
}
}