From ebe8a902e568b79f30545e01adcb3941c34b8467 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Mon, 14 Jul 2014 15:55:16 +0200 Subject: [PATCH] Fixed being killed on teleport --- src/pocketmine/Player.php | 8 +++++--- src/pocketmine/entity/Entity.php | 2 ++ src/pocketmine/level/ChunkRequestTask.php | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index d85ae1a66..dc4019854 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -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){ diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index 32c746e7d..4c3eeffef 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -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; } diff --git a/src/pocketmine/level/ChunkRequestTask.php b/src/pocketmine/level/ChunkRequestTask.php index 4ade4ba40..01df7af0f 100644 --- a/src/pocketmine/level/ChunkRequestTask.php +++ b/src/pocketmine/level/ChunkRequestTask.php @@ -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();