mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 09:19:42 +00:00
Updated packet order, removed player entity id as 0
This commit is contained in:
parent
5fcb0d6aa5
commit
2175d7922a
@ -969,7 +969,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
$pk->spawnZ = (int) $spawnPosition->z;
|
||||
$pk->generator = 1; //0 old, 1 infinite, 2 flat
|
||||
$pk->gamemode = $this->gamemode & 0x01;
|
||||
$pk->eid = 0; //Always use EntityID as zero for the actual player
|
||||
$pk->eid = $this->getId();
|
||||
$this->dataPacket($pk);
|
||||
$this->sendSettings();
|
||||
|
||||
@ -1202,7 +1202,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
$this->lastPitch = $from->pitch;
|
||||
|
||||
$pk = new MovePlayerPacket();
|
||||
$pk->eid = 0;
|
||||
$pk->eid = $this->getId();
|
||||
$pk->x = $from->x;
|
||||
$pk->y = $from->y + $this->getEyeHeight();
|
||||
$pk->z = $from->z;
|
||||
@ -1306,7 +1306,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
}
|
||||
|
||||
$pk = new TakeItemEntityPacket();
|
||||
$pk->eid = 0;
|
||||
$pk->eid = $this->getId();
|
||||
$pk->target = $entity->getId();
|
||||
$this->dataPacket($pk);
|
||||
$pk = new TakeItemEntityPacket();
|
||||
@ -1340,7 +1340,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
}
|
||||
|
||||
$pk = new TakeItemEntityPacket();
|
||||
$pk->eid = 0;
|
||||
$pk->eid = $this->getId();
|
||||
$pk->target = $entity->getId();
|
||||
$this->dataPacket($pk);
|
||||
$pk = new TakeItemEntityPacket();
|
||||
@ -1549,7 +1549,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
$pk->spawnZ = (int) $spawnPosition->z;
|
||||
$pk->generator = 1; //0 old, 1 infinite, 2 flat
|
||||
$pk->gamemode = $this->gamemode & 0x01;
|
||||
$pk->eid = 0; //Always use EntityID as zero for the actual player
|
||||
$pk->eid = $this->getId(); //Always use EntityID as zero for the actual player
|
||||
$this->dataPacket($pk);
|
||||
|
||||
$pk = new SetTimePacket();
|
||||
@ -1605,7 +1605,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
|
||||
if($this->forceMovement instanceof Vector3 and (($dist = $newPos->distanceSquared($this->forceMovement)) > 0.04 or $revert)){
|
||||
$pk = new MovePlayerPacket();
|
||||
$pk->eid = 0;
|
||||
$pk->eid = $this->getId();
|
||||
$pk->x = $this->forceMovement->x;
|
||||
$pk->y = $this->forceMovement->y + $this->getEyeHeight();
|
||||
$pk->z = $this->forceMovement->z;
|
||||
@ -2139,7 +2139,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
}
|
||||
|
||||
$pk = new EntityEventPacket();
|
||||
$pk->eid = 0;
|
||||
$pk->eid = $this->getId();
|
||||
$pk->event = 9;
|
||||
$this->dataPacket($pk);
|
||||
$pk->eid = $this->getId();
|
||||
@ -2696,7 +2696,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
|
||||
if($this->getLastDamageCause() === $source){
|
||||
$pk = new EntityEventPacket();
|
||||
$pk->eid = 0;
|
||||
$pk->eid = $this->getId();
|
||||
$pk->event = 2;
|
||||
$this->dataPacket($pk);
|
||||
}
|
||||
@ -2742,7 +2742,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
$this->newPosition = null;
|
||||
|
||||
$pk = new MovePlayerPacket();
|
||||
$pk->eid = 0;
|
||||
$pk->eid = $this->getId();
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y + $this->getEyeHeight();
|
||||
$pk->z = $this->z;
|
||||
|
@ -332,15 +332,7 @@ abstract class Entity extends Location implements Metadatable{
|
||||
$pk->encode();
|
||||
$pk->isEncoded = true;
|
||||
foreach($player as $p){
|
||||
if($p === $this){
|
||||
/** @var Player $p */
|
||||
$pk2 = new SetEntityDataPacket();
|
||||
$pk2->eid = 0;
|
||||
$pk2->metadata = $this->getData();
|
||||
$p->dataPacket($pk2);
|
||||
}else{
|
||||
$p->dataPacket($pk);
|
||||
}
|
||||
$p->dataPacket($pk);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,12 +31,11 @@ interface Info{
|
||||
* Actual Minecraft: PE protocol version
|
||||
*/
|
||||
const CURRENT_PROTOCOL = 21;
|
||||
|
||||
|
||||
const DISCONNECT_PACKET = 0x82;
|
||||
|
||||
const LOGIN_PACKET = 0x83;
|
||||
const LOGIN_STATUS_PACKET = 0x84;
|
||||
const LOGIN_PACKET = 0x82;
|
||||
const LOGIN_STATUS_PACKET = 0x83;
|
||||
|
||||
const DISCONNECT_PACKET = 0x84;
|
||||
|
||||
const MESSAGE_PACKET = 0x85;
|
||||
const SET_TIME_PACKET = 0x86;
|
||||
|
Loading…
x
Reference in New Issue
Block a user