diff --git a/src/pocketmine/level/Location.php b/src/pocketmine/level/Location.php index 6c0ac2e39..f7414829f 100644 --- a/src/pocketmine/level/Location.php +++ b/src/pocketmine/level/Location.php @@ -79,4 +79,11 @@ class Location extends Position{ public function __toString(){ return "Location (level=" . ($this->isValid() ? $this->getLevel()->getName() : "null") . ", x=$this->x, y=$this->y, z=$this->z, yaw=$this->yaw, pitch=$this->pitch)"; } + + public function equals(Vector3 $v){ + if($v instanceof Location){ + return parent::equals($v) and $v->yaw == $this->yaw and $v->pitch == $this->pitch; + } + return parent::equals($v); + } } diff --git a/src/pocketmine/level/Position.php b/src/pocketmine/level/Position.php index 25242c905..78fb2eb5d 100644 --- a/src/pocketmine/level/Position.php +++ b/src/pocketmine/level/Position.php @@ -133,4 +133,10 @@ class Position extends Vector3{ return $this; } + public function equals(Vector3 $v){ + if($v instanceof Position){ + return parent::equals($v) and $v->getLevel() === $this->getLevel(); + } + return parent::equals($v); + } }