diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 4083bc38d..c8c3bc01a 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -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; diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index 0e72eb431..cdda34cd7 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -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); } } diff --git a/src/pocketmine/network/protocol/Info.php b/src/pocketmine/network/protocol/Info.php index 25d4094f9..51ec4197e 100644 --- a/src/pocketmine/network/protocol/Info.php +++ b/src/pocketmine/network/protocol/Info.php @@ -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;