From e6c510e7fdb8e7d2554cbc85a805583057fd42c6 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Thu, 10 Jul 2014 13:15:24 +0200 Subject: [PATCH] Fixed #1595 Undefined variable on QueryHandler --- src/pocketmine/entity/Living.php | 7 ++----- src/pocketmine/network/query/QueryHandler.php | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/pocketmine/entity/Living.php b/src/pocketmine/entity/Living.php index d62504ef1..8d3e25ec8 100644 --- a/src/pocketmine/entity/Living.php +++ b/src/pocketmine/entity/Living.php @@ -67,11 +67,8 @@ abstract class Living extends Entity implements Damageable{ $motion = new Vector3(0, 0.25, 0); if($source instanceof EntityDamageByEntityEvent){ $e = $source->getDamager(); - $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; + $motion->x = -cos(deg2rad($e->pitch)) * sin(deg2rad($e->yaw)) * 0.5; + $motion->z = cos(deg2rad($e->pitch)) * sin(deg2rad($e->yaw)) * 0.5; } $this->setMotion($motion); $this->setHealth($this->getHealth() - $damage); diff --git a/src/pocketmine/network/query/QueryHandler.php b/src/pocketmine/network/query/QueryHandler.php index 96da8622e..803cc9918 100644 --- a/src/pocketmine/network/query/QueryHandler.php +++ b/src/pocketmine/network/query/QueryHandler.php @@ -122,7 +122,7 @@ class QueryHandler{ break; case self::STATISTICS: //Stat $token = Binary::readInt(substr($payload, 0, 4)); - if($token !== self::getTokenString($this->token, $address) and $token !== self::getTokenString($this->lastToken, $ip)){ + if($token !== self::getTokenString($this->token, $address) and $token !== self::getTokenString($this->lastToken, $address)){ break; } $reply = chr(self::STATISTICS);