Refactor a bunch of network-related things for easier auto-generation of protocol stuff

This commit is contained in:
Dylan K. Taylor
2017-07-12 16:32:39 +01:00
parent e485999218
commit 30df0c2418
16 changed files with 818 additions and 1115 deletions

View File

@ -27,6 +27,7 @@ use pocketmine\event\player\PlayerCreationEvent;
use pocketmine\network\AdvancedSourceInterface;
use pocketmine\network\mcpe\protocol\BatchPacket;
use pocketmine\network\mcpe\protocol\DataPacket;
use pocketmine\network\mcpe\protocol\PacketPool;
use pocketmine\network\mcpe\protocol\ProtocolInfo;
use pocketmine\network\Network;
use pocketmine\Player;
@ -236,7 +237,7 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
private function getPacket($buffer){
$pid = ord($buffer{0});
if(($data = $this->network->getPacket($pid)) === null){
if(($data = PacketPool::getPacketById($pid)) === null){
return null;
}
$data->setBuffer($buffer, 1);