▶️ ЗАБЕРИ СВОИ 8 ПОДАРКОВ 🎁 ПРИ СОЗДАНИИ СВОЕГО МАЙНКРАФТ СЕРВЕРА
Моды/Racoon Math Library
Racoon Math Library

Racoon Math Library

Do you create data packs for Minecraft but find yourself frustrated by the lack of certain mathematical tools? This library is for you!

40
0

RL-v1.0.2

release27 августа 2025 г.

Tellraw fixed

RML-v1.0.1

release11 августа 2025 г.

Fixed Point = Int fixed point with 3 decimal after the coma(1->1000, 2.107->2107, 3.1415->3141)

Vector = Array of 3 double var

Setup

/function math:setup

To initialize the pack you need to execute this command


Easing Functions

Easing In/Out/InOut Power

/function math:function/ease/inpower
/function math:function/ease/outpower
/function math:function/ease/inoutpower

Input : scoreboard "In0 RacoonMath" progression Fixed Point in range 0-1000 (= 0-1.000), scoreboard "In1 RacoonMath" the int power of the easing

Output: this function return the Fixed Point value of the easing


Other ease functions

Input : scoreboard "In0 RacoonMath" progression Fixed Point in range 0-1000 (= 0-1.000)

Output: these functions return the Fixed Point value of the easing

new in Math Functions input

Sqrt

New Input: scoreboard "Math.In1 RacoonMath" the scale of the Input value

Output: return the sqrt value scaled

ex: To take the square root of 1.230 you run the function with In0 = 1230 and In1 = 1000, return 1109


Fast exponentiation

New Input: scoreboard "Math.In2 RacoonMath" the scale of the base value


new in Vectors

Bezier Interpolation

/function math:vector/interpolation/bezier

return the interpolated 3d vector of the 3 input vector and the progression

Input : storage math:data in (array of 3 vectors), scoreboard "Math.In0 RacoonMath" progression Fixed Point value

Output: storage math:data out (vector)


Cubic Bezier Interpolation

/function math:vector/interpolation/cubic_bezier

return the interpolated 3d vector of the 4 input vector and the progression

Input : storage math:data in (array of 4 vectors), scoreboard "Math.In0 RacoonMath" progression Fixed Point value

Output: storage math:data out (vector)


RML-v1.0.0

release6 августа 2025 г.

Fixed Point = Int fixed point with 3 decimal after the coma(1->1000, 2.107->2107, 3.1415->3141)

Vector = Array of 3 double var

Setup

/function math:setup

To initialize the pack you need to execute this command


Math Functions

Fixed Point exponential Approximation

/function math:function/exp

Input : scoreboard "In0 RacoonMath" Number Fixed Point, max input value : 46238(= 46.238), min input value : -6907(= -6.907)

Output: this function return the value of the fixed point exponential


Integer Fast exponentiation Approximation

/function math:function/fast_exponentiation

Input : scoreboard "In0 RacoonMath" and "In1 RacoonMath", In0 = base, In1 = power

Output: this function return the value of the base raised to the power


Square Root Approximation

/function math:function/sqrt

Input : scoreboard "In0 RacoonMath" Integer

Output: this function return the square root of the Input

(If you are interested by how it work see heron's method square root approximation)


Fixed Point natural log Approximation

/function math:function/log

Input : scoreboard "In0 RacoonMath" Fixed Point

Output: this function return the fixed point value of the natural log of the Input

(It's an approximation of the integral of 1/x that give us an approximation of natural log)


Trigonometry

Sin Approximation

/function math:trigo/sin

Input : Yaw of rotation of the execution (angle in degrees)

Output: return the fixed point sin value of the input


Cos Approximation

/function math:trigo/cos

Same that sin but return the cos value


Tan Approximation

/function math:trigo/tan

Same that sin and cos but return the tan value


Fast Sin Approximation

/function math:trigo/fast_sin

A less accurate but more optimized approximation of sin

Input : scoreboard "In0 RacoonMath" Fixed Point (angle in Radians)

Output: return the fixed point sin value of the input


Fast Cos Approximation

/function math:trigo/fast_cos

same that fast sin but for cos


Vectors

Unit Vector

/function math:vector/unit_vector

return a 3d vector with angles of the current rotation and length = 1, very accurate

Input : Rotation of the execution (angle in degrees)

Output: storage math:data out (vector)


Unit Vector Input

/function math:vector/unit_vector_input

return a 3d vector with angles of the inputs and length = 1, less accurate

Input : scoreboards "In0 RacoonMath" and "In1 RacoonMath" (angle in radians)

Output: storage math:data out (vector)


Add

/function math:vector/add

return the sum of the two vector with an accuracy of 3 digits after the coma

Input : storage "math:data in" (array of 2 vectors)

Output: storage math:data out (vector)


Subtract

/function math:vector/subtract

return the subtraction of the two vector with an accuracy of 3 digits after the coma

Input : storage "math:data in" (array of 2 vectors)

Output: storage math:data out (vector)


Opposite

/function math:vector/neg

return the opposite vector with an accuracy of 3 digits after the coma

Input : storage "math:data in" (vector)

Output: storage math:data out (vector)


Multiplication by a fixed point

/function math:vector/mult

return the vector multiplied by a fixed point with an accuracy of 3 digits after the coma

Input : storage "math:data in" (vector) and scoreboard "In0 RacoonMath" (fixed point)

Output: storage math:data out (vector)


Normalize

/function math:vector/normalize

return the normalized vector with an accuracy of 3 digits after the coma

Input : storage "math:data in" (vector)

Output: storage math:data out (vector)


Cross product

/function math:vector/cross_product

return the cross product of the two vector with an accuracy of 3 digits after the coma

Input : storage "math:data in" (array of 2 vectors)

Output: storage math:data out (vector)


Dot product

/function math:vector/dot_product

return the dot product of the two vector with an accuracy of 3 digits after the coma

Input : storage "math:data in" (array of 2 vectors)

Output: return a fixed point


Sort

Radix

/function math:sort/radix

return a sorted int array

Input : storage "math:data in" (int array to sort), scoreboard "In0 RacoonMath" (number of digits take to sort)

Output: storage "math:data out"


Min

/function math:sort/min

return the minimum of an int array

Input : storage "math:data in" (int array)

Output: return an int


Max

/function math:sort/max

return the maximum of an int array

Input : storage "math:data in" (int array)

Output: return an int


Min Max

/function math:sort/min_max

return the minimum and maximum of an int array

Input : storage "math:data in" (int array)

Output: scoreboard "Out0 RacoonMath" (minimum), scoreboard "Out1 RacoonMath" (maximum)


Converter

Tick to hhmmss

/function math:convert/tick_to_hhmmss

convert a tick duration in hours min and sec strings

Input : scoreboard "In0 RacoonMath"

Output: storage "math:data out.hour","math:data out.min","math:data out.sec"


Tick to mmss

/function math:convert/tick_to_mmss

convert a tick duration in min and sec strings

Input : scoreboard "In0 RacoonMath"

Output: storage "math:data out.min","math:data out.sec"


rgb to int

/function math:convert/rgb_to_int

convert rgb in an rgb int

Input : scoreboard "In0 RacoonMath" (Red),scoreboard "In1 RacoonMath" (Green),scoreboard "In2 RacoonMath" (Blue)

Output: return an int


rgba to int

/function math:convert/rgba_to_int

convert rgba in an rgb int

Input : scoreboard "In0 RacoonMath" (Red),scoreboard "In1 RacoonMath" (Green),scoreboard "In2 RacoonMath" (Blue),scoreboard "In3 RacoonMath" (Alpha)

Output: return an int


int to rgb

/function math:convert/int_to_rgb

convert an int in rgb values

Input : scoreboard "In0 RacoonMath"

Output: scoreboard "Out0 RacoonMath" (Red),scoreboard "Out1 RacoonMath" (Green),scoreboard "Out2 RacoonMath" (Blue)


int to rgba

/function math:convert/int_to_rgba

convert an int in rgba values

Input : scoreboard "In0 RacoonMath"

Output: scoreboard "Out0 RacoonMath" (Red),scoreboard "Out1 RacoonMath" (Green),scoreboard "Out2 RacoonMath" (Blue),scoreboard "Out3 RacoonMath" (Alpha)


int to hex

/function math:convert/int_to_hex

convert an int in hexadecimal strings array

Input : scoreboard "In0 RacoonMath"

Output: storage "math:data out"


Совместимость

Minecraft: Java Edition

1.21.x

Платформы

Поддерживаемые окружения

Клиент и сервер

Создатели

Детали

Лицензия:MIT
Опубликован:6 месяцев назад
Обновлён:6 месяцев назад
Главная