MathHelper

MathHelper is the Minecraft's utility class for optimized math operations. Available via the global MathHelper object.

TypeNameDescriptionSignature

function

clamp_double

Limit a decimal number by min/max (args: num, min, max)

double(double, double, double)

function

clamp_int

Limit an integer number by min/max (args: num, min, max)

int(int, int, int)

function

cos

Optimized cos of an angle

double(double)

function

sin

Optimized sin of an angle

double(double)

function

sqrt_double

Square root of a decimal number

double(double)

function

floor_double

Drops decimal places from the number

int(double)

function

floor_double_long

Int64 version of floor_double

long(double)

function

abs

Returns the unsigned value of a float

float(float)

function

abs_int

Returns the unsigned value of an int

int(int)

function

ceiling_double_int

Round up a number to the next integer

int(double)

function

denormalizeClamp

Lerp decimal function

double(double, double, double)

function

absMax

Maximum of the absolute value of two decimal numbers

double(double, double)

function

wrapAngleTo180_double

Limits the angle to 360, and reduces it to be in the -180 to 180 range.

double(double)

function

roundUpToPowerOfTwo

Rounds up the number to the next power of two

int(int)

function

roundUp

Rounds up the number to be divisible by n. (args: number, n)

int(int, int)

function

atan2

2-argument arctan

double(double, double)

function

hsvToRGB

Converts HSV values to RGB (args: h, s, v)

int(float, float, float)

Last updated