pocketmine\math\Math::clamp PHP Method

clamp() public static method

public static clamp ( $value, $low, $high )
    public static function clamp($value, $low, $high)
    {
        return min($high, max($low, $value));
    }

Usage Example

Esempio n. 1
0
 private function clamp(Vector3 $pos)
 {
     return new Vector3(Math::clamp($pos->getFloorX(), 0, 16), Math::clamp($pos->getFloorY(), 1, 120), Math::clamp($pos->getFloorZ(), 0, 16));
 }