pocketmine\math\Math::ceilFloat PHP Method

ceilFloat() public static method

public static ceilFloat ( $n )
    public static function ceilFloat($n)
    {
        $i = (int) ($n + 1);
        return $n >= $i ? $i : $i - 1;
    }

Usage Example

Esempio n. 1
0
 public function getBlocksAround()
 {
     if ($this->blocksAround === null) {
         $minX = Math::floorFloat($this->boundingBox->minX);
         $minY = Math::floorFloat($this->boundingBox->minY);
         $minZ = Math::floorFloat($this->boundingBox->minZ);
         $maxX = Math::ceilFloat($this->boundingBox->maxX);
         $maxY = Math::ceilFloat($this->boundingBox->maxY);
         $maxZ = Math::ceilFloat($this->boundingBox->maxZ);
         $this->blocksAround = [];
         for ($z = $minZ; $z <= $maxZ; ++$z) {
             for ($x = $minX; $x <= $maxX; ++$x) {
                 for ($y = $minY; $y <= $maxY; ++$y) {
                     $block = $this->level->getBlock($this->temporalVector->setComponents($x, $y, $z));
                     if ($block->hasEntityCollision()) {
                         $this->blocksAround[] = $block;
                     }
                 }
             }
         }
     }
     return $this->blocksAround;
 }
All Usage Examples Of pocketmine\math\Math::ceilFloat