Fixed being killed on teleport

This commit is contained in:
Shoghi Cervantes 2014-07-14 15:55:16 +02:00
parent 304524f6d8
commit ebe8a902e5
3 changed files with 8 additions and 4 deletions

View File

@ -2212,9 +2212,11 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
public function setHealth($amount){
parent::setHealth($amount);
$pk = new SetHealthPacket();
$pk->health = $this->getHealth();
$this->dataPacket($pk);
if($this->spawned === true){
$pk = new SetHealthPacket();
$pk->health = $this->getHealth();
$this->dataPacket($pk);
}
}
public function attack($damage, $source = EntityDamageEvent::CAUSE_MAGIC){

View File

@ -1006,6 +1006,8 @@ abstract class Entity extends Position implements Metadatable{
$this->setMotion(new Vector3(0, 0, 0));
if($this->setPositionAndRotation($pos, $yaw === null ? $this->yaw : $yaw, $pitch === null ? $this->pitch : $pitch, true) !== false){
$this->fallDistance = 0;
$this->onGround = true;
return true;
}

View File

@ -47,7 +47,7 @@ class ChunkRequestTask extends AsyncTask{
$this->levelId = $level->getID();
$this->chunkX = $chunkX;
$this->chunkZ = $chunkZ;
$chunk = $level->getChunkAt($chunkX, $chunkZ);
$chunk = $level->getChunkAt($chunkX, $chunkZ, true);
$this->biomeIds = $chunk->getBiomeIdArray();
$this->biomeColors = $chunk->getBiomeColorArray();