entityBaseTick() публичный Метод

public entityBaseTick ( $tickDiff = 1, $EnchantL )
Пример #1
0
 public function onUpdate($tick)
 {
     if (!$this instanceof Human) {
         if ($this->attackingTick > 0) {
             $this->attackingTick--;
         }
         if (!$this->isAlive() and $this->hasSpawned) {
             ++$this->deadTicks;
             if ($this->deadTicks >= 20) {
                 $this->despawnFromAll();
             }
             return true;
         }
         if ($this->isAlive()) {
             $this->motionY -= $this->gravity;
             $this->move($this->motionX, $this->motionY, $this->motionZ);
             $friction = 1 - $this->drag;
             if ($this->onGround and (abs($this->motionX) > 1.0E-5 or abs($this->motionZ) > 1.0E-5)) {
                 $friction = $this->getLevel()->getBlock($this->temporalVector->setComponents((int) floor($this->x), (int) floor($this->y - 1), (int) floor($this->z) - 1))->getFrictionFactor() * $friction;
             }
             $this->motionX *= $friction;
             $this->motionY *= 1 - $this->drag;
             $this->motionZ *= $friction;
             if ($this->onGround) {
                 $this->motionY *= -0.5;
             }
             $this->updateMovement();
         }
     }
     parent::entityBaseTick();
     return parent::onUpdate($tick);
 }