mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 19:02:59 +00:00
Some protocol changes for 1.1.0.0
This commit is contained in:
@ -45,20 +45,7 @@ class AdventureSettingsPacket extends DataPacket{
|
||||
public $noClip = false;
|
||||
public $worldBuilder = false;
|
||||
public $isFlying = false;
|
||||
|
||||
/*
|
||||
bit mask | flag name
|
||||
0x00000001 world_immutable
|
||||
0x00000002 no_pvp
|
||||
0x00000004 no_pvm
|
||||
0x00000008 no_mvp
|
||||
0x00000010 ?
|
||||
0x00000020 auto_jump
|
||||
0x00000040 allow_fly
|
||||
0x00000080 noclip
|
||||
0x00000100 world_builder (seems to allow building even if the world_immutable flag is set (???))
|
||||
0x00000200 is_flying
|
||||
*/
|
||||
public $muted = false;
|
||||
|
||||
public $flags = 0;
|
||||
public $userPermission;
|
||||
@ -77,6 +64,7 @@ class AdventureSettingsPacket extends DataPacket{
|
||||
$this->noClip = (bool) ($this->flags & (1 << 7));
|
||||
$this->worldBuilder = (bool) ($this->flags & (1 << 8));
|
||||
$this->isFlying = (bool) ($this->flags & (1 << 9));
|
||||
$this->muted = (bool) ($this->flags & (1 << 10));
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
@ -92,6 +80,7 @@ class AdventureSettingsPacket extends DataPacket{
|
||||
$this->flags |= ((int) $this->noClip) << 7;
|
||||
$this->flags |= ((int) $this->worldBuilder) << 8;
|
||||
$this->flags |= ((int) $this->isFlying) << 9;
|
||||
$this->flags |= ((int) $this->muted) << 10;
|
||||
|
||||
$this->putUnsignedVarInt($this->flags);
|
||||
$this->putUnsignedVarInt($this->userPermission);
|
||||
|
@ -35,6 +35,7 @@ class AnimatePacket extends DataPacket{
|
||||
public function decode(){
|
||||
$this->action = $this->getVarInt();
|
||||
$this->eid = $this->getEntityRuntimeId();
|
||||
//TODO: check extra float which appears when 0x80 bitflag is set
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
|
@ -31,21 +31,21 @@ class CommandStepPacket extends DataPacket{
|
||||
public $command;
|
||||
public $overload;
|
||||
public $uvarint1;
|
||||
public $uvarint2;
|
||||
public $bool;
|
||||
public $uvarint64;
|
||||
public $args;
|
||||
public $string4;
|
||||
public $currentStep;
|
||||
public $done;
|
||||
public $clientId;
|
||||
public $inputJson;
|
||||
public $outputJson;
|
||||
|
||||
public function decode(){
|
||||
$this->command = $this->getString();
|
||||
$this->overload = $this->getString();
|
||||
$this->uvarint1 = $this->getUnsignedVarInt();
|
||||
$this->uvarint2 = $this->getUnsignedVarInt();
|
||||
$this->bool = (bool) $this->getByte();
|
||||
$this->uvarint64 = $this->getUnsignedVarLong();
|
||||
$this->args = json_decode($this->getString());
|
||||
$this->string4 = $this->getString();
|
||||
$this->currentStep = $this->getUnsignedVarInt();
|
||||
$this->done = (bool) $this->getByte();
|
||||
$this->clientId = $this->getUnsignedVarLong();
|
||||
$this->inputJson = json_decode($this->getString());
|
||||
$this->outputJson = $this->getString();
|
||||
|
||||
$this->get(true); //TODO: read command origin data
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ class ContainerOpenPacket extends DataPacket{
|
||||
|
||||
public $windowid;
|
||||
public $type;
|
||||
public $slots;
|
||||
public $x;
|
||||
public $y;
|
||||
public $z;
|
||||
@ -45,7 +44,6 @@ class ContainerOpenPacket extends DataPacket{
|
||||
$this->reset();
|
||||
$this->putByte($this->windowid);
|
||||
$this->putByte($this->type);
|
||||
$this->putVarInt($this->slots);
|
||||
$this->putBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->putEntityUniqueId($this->entityId);
|
||||
}
|
||||
|
@ -33,8 +33,10 @@ class ContainerSetContentPacket extends DataPacket{
|
||||
const SPECIAL_ARMOR = 0x78;
|
||||
const SPECIAL_CREATIVE = 0x79;
|
||||
const SPECIAL_HOTBAR = 0x7a;
|
||||
const SPECIAL_FIXED_INVENTORY = 0x7b;
|
||||
|
||||
public $windowid;
|
||||
public $targetEid;
|
||||
public $slots = [];
|
||||
public $hotbar = [];
|
||||
|
||||
@ -45,7 +47,8 @@ class ContainerSetContentPacket extends DataPacket{
|
||||
}
|
||||
|
||||
public function decode(){
|
||||
$this->windowid = $this->getByte();
|
||||
$this->windowid = $this->getUnsignedVarInt();
|
||||
$this->targetEid = $this->getEntityUniqueId();
|
||||
$count = $this->getUnsignedVarInt();
|
||||
for($s = 0; $s < $count and !$this->feof(); ++$s){
|
||||
$this->slots[$s] = $this->getSlot();
|
||||
@ -60,7 +63,8 @@ class ContainerSetContentPacket extends DataPacket{
|
||||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putByte($this->windowid);
|
||||
$this->putUnsignedVarInt($this->windowid);
|
||||
$this->putEntityUniqueId($this->targetEid);
|
||||
$this->putUnsignedVarInt(count($this->slots));
|
||||
foreach($this->slots as $slot){
|
||||
$this->putSlot($slot);
|
||||
|
@ -44,7 +44,9 @@ class DisconnectPacket extends DataPacket{
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putBool($this->hideDisconnectionScreen);
|
||||
$this->putString($this->message);
|
||||
if(!$this->hideDisconnectionScreen){
|
||||
$this->putString($this->message);
|
||||
}
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -29,10 +29,14 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class EntityFallPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::ENTITY_FALL_PACKET;
|
||||
|
||||
public $eid;
|
||||
public $fallDistance;
|
||||
public $bool1;
|
||||
|
||||
public function decode(){
|
||||
$this->eid = $this->getEntityRuntimeId();
|
||||
$this->fallDistance = $this->getLFloat();
|
||||
$this->bool1 = $this->getBool();
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
|
@ -28,16 +28,20 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class InventoryActionPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::INVENTORY_ACTION_PACKET;
|
||||
|
||||
public $unknown;
|
||||
public $uvarint0;
|
||||
public $item;
|
||||
public $varint1;
|
||||
public $varint2;
|
||||
|
||||
public function decode(){
|
||||
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
$this->putUnsignedVarInt($this->unknown);
|
||||
$this->putUnsignedVarInt($this->uvarint0);
|
||||
$this->putSlot($this->item);
|
||||
$this->putVarInt($this->varint1);
|
||||
$this->putVarInt($this->varint2);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -34,7 +34,8 @@ class PlayStatusPacket extends DataPacket{
|
||||
const LOGIN_FAILED_SERVER = 2;
|
||||
const PLAYER_SPAWN = 3;
|
||||
const LOGIN_FAILED_INVALID_TENANT = 4;
|
||||
const LOGIN_FAILED_EDITION_MISMATCH = 5;
|
||||
const LOGIN_FAILED_VANILLA_EDU = 5;
|
||||
const LOGIN_FAILED_EDU_VANILLA = 6;
|
||||
|
||||
public $status;
|
||||
|
||||
|
Reference in New Issue
Block a user