Fixed glitching on respawn due to player 1.62 position offset

This commit is contained in:
Dylan K. Taylor 2017-06-21 11:27:20 +01:00
parent 0f79b19fdc
commit e9c46da7f0

View File

@ -886,11 +886,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
$pos = $ev->getRespawnPosition(); $pos = $ev->getRespawnPosition();
$pk = new RespawnPacket(); $this->sendRespawnPacket($pos);
$pk->x = $pos->x;
$pk->y = $pos->y;
$pk->z = $pos->z;
$this->dataPacket($pk);
$this->sendPlayStatus(PlayStatusPacket::PLAYER_SPAWN); $this->sendPlayStatus(PlayStatusPacket::PLAYER_SPAWN);
@ -930,17 +926,20 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
} }
if($this->getHealth() <= 0){ if($this->getHealth() <= 0){
$pk = new RespawnPacket(); $this->sendRespawnPacket($this->getSpawn());
$pos = $this->getSpawn();
$pk->x = $pos->x;
$pk->y = $pos->y;
$pk->z = $pos->z;
$this->dataPacket($pk);
} }
$this->joined = true; $this->joined = true;
} }
protected function sendRespawnPacket(Vector3 $pos){
$pk = new RespawnPacket();
$pk->x = $pos->x;
$pk->y = $pos->y + $this->baseOffset;
$pk->z = $pos->z;
$this->dataPacket($pk);
}
protected function orderChunks(){ protected function orderChunks(){
if($this->connected === false or $this->viewDistance === -1){ if($this->connected === false or $this->viewDistance === -1){
return false; return false;
@ -3796,12 +3795,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
parent::kill(); parent::kill();
$pk = new RespawnPacket(); $this->sendRespawnPacket($this->getSpawn());
$pos = $this->getSpawn();
$pk->x = $pos->x;
$pk->y = $pos->y;
$pk->z = $pos->z;
$this->dataPacket($pk);
} }
protected function callDeathEvent(){ protected function callDeathEvent(){