Found unknown fields for SetSpawnPositionPacket

This commit is contained in:
Dylan K. Taylor 2017-05-27 13:09:58 +01:00
parent af06d78725
commit 954271b90f
2 changed files with 10 additions and 6 deletions

View File

@ -1180,6 +1180,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
$pk->x = (int) $this->spawnPosition->x; $pk->x = (int) $this->spawnPosition->x;
$pk->y = (int) $this->spawnPosition->y; $pk->y = (int) $this->spawnPosition->y;
$pk->z = (int) $this->spawnPosition->z; $pk->z = (int) $this->spawnPosition->z;
$pk->spawnType = SetSpawnPositionPacket::TYPE_PLAYER_SPAWN;
$this->dataPacket($pk); $this->dataPacket($pk);
} }

View File

@ -29,23 +29,26 @@ use pocketmine\network\mcpe\NetworkSession;
class SetSpawnPositionPacket extends DataPacket{ class SetSpawnPositionPacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::SET_SPAWN_POSITION_PACKET; const NETWORK_ID = ProtocolInfo::SET_SPAWN_POSITION_PACKET;
public $unknown; const TYPE_PLAYER_SPAWN = 0;
const TYPE_WORLD_SPAWN = 1;
public $spawnType;
public $x; public $x;
public $y; public $y;
public $z; public $z;
public $unknownBool; public $spawnForced;
public function decode(){ public function decode(){
$this->unknown = $this->getVarInt(); $this->spawnType = $this->getVarInt();
$this->getBlockPosition($this->x, $this->y, $this->z); $this->getBlockPosition($this->x, $this->y, $this->z);
$this->unknownBool = $this->getBool(); $this->spawnForced = $this->getBool();
} }
public function encode(){ public function encode(){
$this->reset(); $this->reset();
$this->putVarInt($this->unknown); $this->putVarInt($this->spawnType);
$this->putBlockPosition($this->x, $this->y, $this->z); $this->putBlockPosition($this->x, $this->y, $this->z);
$this->putBool($this->unknownBool); $this->putBool($this->spawnForced);
} }
public function handle(NetworkSession $session) : bool{ public function handle(NetworkSession $session) : bool{