/** * @param number $slowness * @return Location|null */ public function tick($slowness) { if (($length = $this->length * $slowness) < 1.0E-7) { return null; } if (($progress = $this->current++ / $length) > 1) { return null; } return new Location($this->getOrigin()->getX() + $this->distance->getX() * $progress, 1.62 + $this->getOrigin()->getY() + $this->distance->getY() * $progress, $this->getOrigin()->getZ() + $this->distance->getZ() * $progress, $this->getOrigin()->getYaw() + $this->distance->getYaw() * $progress, $this->getOrigin()->getPitch() + $this->distance->getPitch() * $progress); }
public static function fromPosition($name, Location $pos) { return new BaseLocation($name, $pos->getX(), $pos->getY(), $pos->getZ(), $pos->getLevel(), $pos->getYaw(), $pos->getPitch()); }
/** * @param $home * @param Location $pos * @return bool */ public function setHome($home, Location $pos) { if (!$this->getPlugin()->validateName($home, false)) { return false; } $this->homes[$home] = new BaseLocation($home, $pos->getX(), $pos->getY(), $pos->getZ(), $pos->getLevel(), $pos->getYaw(), $pos->getPitch()); return true; }