From d3789d4fed01424585f9d6a82afc22e79df7eb08 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Thu, 10 Jul 2014 13:05:15 +0200 Subject: [PATCH] Fixed /kick player name --- src/pocketmine/entity/Living.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/entity/Living.php b/src/pocketmine/entity/Living.php index 8d3e25ec8..d62504ef1 100644 --- a/src/pocketmine/entity/Living.php +++ b/src/pocketmine/entity/Living.php @@ -67,8 +67,11 @@ abstract class Living extends Entity implements Damageable{ $motion = new Vector3(0, 0.25, 0); if($source instanceof EntityDamageByEntityEvent){ $e = $source->getDamager(); - $motion->x = -cos(deg2rad($e->pitch)) * sin(deg2rad($e->yaw)) * 0.5; - $motion->z = cos(deg2rad($e->pitch)) * sin(deg2rad($e->yaw)) * 0.5; + $deltaX = $this->x - $e->x; + $deltaZ = $this->z - $e->z; + $yaw = atan2($deltaX, $deltaZ); + $motion->x = sin($yaw) * 0.5; + $motion->z = cos($yaw) * 0.5; } $this->setMotion($motion); $this->setHealth($this->getHealth() - $damage);