mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 17:59:41 +00:00
Protocol updates for 1.1.0.5
This commit is contained in:
parent
17e4f45e97
commit
6c5ca9b256
@ -129,6 +129,13 @@ namespace pocketmine {
|
|||||||
set_time_limit(0); //Who set it to 30 seconds?!?!
|
set_time_limit(0); //Who set it to 30 seconds?!?!
|
||||||
|
|
||||||
error_reporting(-1);
|
error_reporting(-1);
|
||||||
|
|
||||||
|
set_error_handler(function($severity, $message, $file, $line){
|
||||||
|
if((error_reporting() & $severity)){
|
||||||
|
throw new \ErrorException($message, 0, $severity, $file, $line);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
ini_set("allow_url_fopen", 1);
|
ini_set("allow_url_fopen", 1);
|
||||||
ini_set("display_errors", 1);
|
ini_set("display_errors", 1);
|
||||||
ini_set("display_startup_errors", 1);
|
ini_set("display_startup_errors", 1);
|
||||||
|
@ -234,10 +234,9 @@ class Item extends Entity{
|
|||||||
$pk->speedY = $this->motionY;
|
$pk->speedY = $this->motionY;
|
||||||
$pk->speedZ = $this->motionZ;
|
$pk->speedZ = $this->motionZ;
|
||||||
$pk->item = $this->getItem();
|
$pk->item = $this->getItem();
|
||||||
|
$pk->metadata = $this->dataProperties;
|
||||||
$player->dataPacket($pk);
|
$player->dataPacket($pk);
|
||||||
|
|
||||||
$this->sendData($player);
|
|
||||||
|
|
||||||
parent::spawnTo($player);
|
parent::spawnTo($player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ class AddItemEntityPacket extends DataPacket{
|
|||||||
public $speedX;
|
public $speedX;
|
||||||
public $speedY;
|
public $speedY;
|
||||||
public $speedZ;
|
public $speedZ;
|
||||||
|
public $metadata = [];
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
|
||||||
@ -49,6 +50,7 @@ class AddItemEntityPacket extends DataPacket{
|
|||||||
$this->putSlot($this->item);
|
$this->putSlot($this->item);
|
||||||
$this->putVector3f($this->x, $this->y, $this->z);
|
$this->putVector3f($this->x, $this->y, $this->z);
|
||||||
$this->putVector3f($this->speedX, $this->speedY, $this->speedZ);
|
$this->putVector3f($this->speedX, $this->speedY, $this->speedZ);
|
||||||
|
$this->putEntityMetadata($this->metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(NetworkSession $session) : bool{
|
public function handle(NetworkSession $session) : bool{
|
||||||
|
@ -74,13 +74,16 @@ class BatchPacket extends DataPacket{
|
|||||||
|
|
||||||
public function handle(NetworkSession $session) : bool{
|
public function handle(NetworkSession $session) : bool{
|
||||||
if(strlen($this->payload) < 2){
|
if(strlen($this->payload) < 2){
|
||||||
throw new \InvalidStateException("Not enough bytes in payload, expected zlib header");
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$str = zlib_decode($this->payload, 1024 * 1024 * 64); //Max 64MB
|
try{
|
||||||
$len = strlen($str);
|
$str = zlib_decode($this->payload, 1024 * 1024 * 64); //Max 64MB
|
||||||
|
}catch(\ErrorException $e){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if($len === 0){
|
if(strlen($str) === 0){
|
||||||
throw new \InvalidStateException("Decoded BatchPacket payload is empty");
|
throw new \InvalidStateException("Decoded BatchPacket payload is empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,19 @@ class LoginPacket extends DataPacket{
|
|||||||
|
|
||||||
$this->gameEdition = $this->getByte();
|
$this->gameEdition = $this->getByte();
|
||||||
|
|
||||||
$str = zlib_decode($this->getString(), 1024 * 1024 * 64);
|
$str = $this->getString();
|
||||||
|
|
||||||
|
//TODO: remove this hack once the protocol gets bumped
|
||||||
|
if($str{0} === "\x78"){
|
||||||
|
try{
|
||||||
|
$str = zlib_decode($str, 1024 * 1024 * 64);
|
||||||
|
$this->protocol = 0;
|
||||||
|
$this->buffer = null; // <= 1.1.0.4
|
||||||
|
return;
|
||||||
|
}catch(\ErrorException $e){
|
||||||
|
// >= 1.1.0.5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->setBuffer($str, 0);
|
$this->setBuffer($str, 0);
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ class MoveEntityPacket extends DataPacket{
|
|||||||
public $headYaw;
|
public $headYaw;
|
||||||
public $pitch;
|
public $pitch;
|
||||||
public $byte1;
|
public $byte1;
|
||||||
|
public $byte2;
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
$this->eid = $this->getEntityRuntimeId();
|
$this->eid = $this->getEntityRuntimeId();
|
||||||
@ -52,9 +53,10 @@ class MoveEntityPacket extends DataPacket{
|
|||||||
$this->putEntityRuntimeId($this->eid);
|
$this->putEntityRuntimeId($this->eid);
|
||||||
$this->putVector3f($this->x, $this->y, $this->z);
|
$this->putVector3f($this->x, $this->y, $this->z);
|
||||||
$this->putByte($this->pitch / (360.0 / 256));
|
$this->putByte($this->pitch / (360.0 / 256));
|
||||||
$this->putByte($this->yaw / (360.0 / 256));
|
|
||||||
$this->putByte($this->headYaw / (360.0 / 256));
|
$this->putByte($this->headYaw / (360.0 / 256));
|
||||||
|
$this->putByte($this->yaw / (360.0 / 256));
|
||||||
$this->putByte($this->byte1);
|
$this->putByte($this->byte1);
|
||||||
|
$this->putByte($this->byte2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(NetworkSession $session) : bool{
|
public function handle(NetworkSession $session) : bool{
|
||||||
|
@ -32,8 +32,8 @@ interface ProtocolInfo{
|
|||||||
* Actual Minecraft: PE protocol version
|
* Actual Minecraft: PE protocol version
|
||||||
*/
|
*/
|
||||||
const CURRENT_PROTOCOL = 110;
|
const CURRENT_PROTOCOL = 110;
|
||||||
const MINECRAFT_VERSION = 'v1.1.0.3 beta';
|
const MINECRAFT_VERSION = 'v1.1.0.5 beta';
|
||||||
const MINECRAFT_VERSION_NETWORK = '1.1.0.3';
|
const MINECRAFT_VERSION_NETWORK = '1.1.0.5';
|
||||||
|
|
||||||
const LOGIN_PACKET = 0x01;
|
const LOGIN_PACKET = 0x01;
|
||||||
const PLAY_STATUS_PACKET = 0x02;
|
const PLAY_STATUS_PACKET = 0x02;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user