pocketmine\entity\Entity::fall PHP Method

fall() public method

public fall ( $fallDistance )
    public function fall($fallDistance)
    {
        if ($this instanceof Player and $this->isSpectator()) {
            return;
        }
        if ($this->getLevel()->getServer()->destroyBlockParticle and $fallDistance > 3) {
            $this->getLevel()->addParticle(new DestroyBlockParticle($this, $this->getLevel()->getBlock($this->floor()->subtract(0, 1, 0))));
        }
        if ($this->isInsideOfWater()) {
            return;
        }
        $damage = floor($fallDistance - 3 - ($this->hasEffect(Effect::JUMP) ? $this->getEffect(Effect::JUMP)->getAmplifier() + 1 : 0));
        //Get the block directly beneath the player's feet, check if it is a slime block
        if ($this->getLevel()->getBlock($this->floor()->subtract(0, 1, 0)) instanceof SlimeBlock) {
            $damage = 0;
        }
        if ($damage > 0) {
            $ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_FALL, $damage);
            $this->attack($ev->getFinalDamage(), $ev);
        }
    }