public function setMotion(Vector3 $mot)
 {
     if (parent::setMotion($mot)) {
         if ($this->chunk !== null) {
             $this->level->addEntityMotion($this->chunk->getX(), $this->chunk->getZ(), $this->getId(), $this->motionX, $this->motionY, $this->motionZ);
             $pk = new SetEntityMotionPacket();
             $pk->entities[] = [0, $mot->x, $mot->y, $mot->z];
             $this->dataPacket($pk);
         }
         if ($this->motionY > 0) {
             $this->startAirTicks = -log($this->gravity / ($this->gravity + $this->drag * $this->motionY)) / $this->drag * 2 + 5;
         }
         return true;
     }
     return false;
 }
Exemple #2
0
 public function setMotion(Vector3 $mot)
 {
     if (parent::setMotion($mot)) {
         $this->addEntityMotion($this->getId(), $this->motionX, $this->motionY, $this->motionZ);
         if ($this->motionY > 0) {
             $this->startAirTicks = -log($this->gravity / ($this->gravity + $this->drag * $this->motionY)) / $this->drag * 2 + 5;
         }
         return true;
     }
     return false;
 }