MathUtils - Lemonszz/LKLib GitHub Wiki

MathUtils is a collection of methods that help with math stuff.

approachValue

approach value will step the value current towards the target by the step

xPosition = MathUtils.approachValue(xPosition, 0, 0.25F); //xPosition will change by 0.25 towards 0

colourBoost

Shifts the RGB of the given color by the shift amounts.

int grassColour = MathUtils.colourBoost(oldGrassColor, 0, 20, 0); //Will move oldGrassColor to be more green
int waterColour = MathUtils.colourBoost(oldWaterColor, -5, 10, 10); //Will move oldWaterColor to be more green and blue, with less red

changeAngle

Will move an angle (in degrees) towards another angle, with a max step.

float angle = MathUtils.changeAngle(angle, 180, 5); //Will move angle towards 180, with a max change of 5

uuidFromString

Creates a uuid from a given string, the string can be anything. The output will be the same if given the same string.

UUID id = MathUtils.uuidFromString("YummyMummy");