Package net.minestom.server.utils
Class MathUtils
java.lang.Object
net.minestom.server.utils.MathUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
bitsToRepresent
(int n) static double
clamp
(double value, double min, double max) static float
clamp
(float value, float min, float max) static int
clamp
(int value, int min, int max) static Direction
getHorizontalDirection
(float yawInDegrees) static boolean
isBetween
(byte number, byte min, byte max) static boolean
isBetween
(double number, double min, double max) static boolean
isBetween
(float number, float min, float max) static boolean
isBetween
(int number, int min, int max) static boolean
isBetweenUnordered
(double number, double compare1, double compare2) static boolean
isBetweenUnordered
(float number, float compare1, float compare2) static double
mod
(double a, double b) static double
round
(double value, int places) static float
round
(float value, int places) static double
square
(double num) static float
square
(float num) static int
square
(int num)
-
Method Details
-
square
public static int square(int num) -
square
public static float square(float num) -
square
public static double square(double num) -
round
public static double round(double value, int places) -
round
public static float round(float value, int places) -
getHorizontalDirection
-
isBetween
public static boolean isBetween(byte number, byte min, byte max) -
isBetween
public static boolean isBetween(int number, int min, int max) -
isBetween
public static boolean isBetween(double number, double min, double max) -
isBetween
public static boolean isBetween(float number, float min, float max) -
isBetweenUnordered
public static boolean isBetweenUnordered(double number, double compare1, double compare2) -
isBetweenUnordered
public static boolean isBetweenUnordered(float number, float compare1, float compare2) -
clamp
public static int clamp(int value, int min, int max) -
clamp
public static float clamp(float value, float min, float max) -
clamp
public static double clamp(double value, double min, double max) -
mod
public static double mod(double a, double b) -
bitsToRepresent
public static int bitsToRepresent(int n)
-