Mathematics
Set of functions to compute common mathematical operations and transformations
Parameters
- MC_Calc.InputMain input
- MC_Calc.Input2Secondary input
- MC_Calc.Input3Tertiary Input
- MC_Calc.OutputOutput
Functions
Absolute
Get the absolute value of a number
function mapcraft:built_in/math/absolute
Parameters
- MC_Calc.InputNumber to be put in absolute
Cos
Get the cosine of an angle in degrees (scaled up by 100)
function mapcraft:built_in/math/cos
Parameters
- MC_Calc.InputAngle in degrees
Pow
Get the base raised to the power of the exponent
function mapcraft:built_in/math/pow
Parameters
- MC_Calc.InputBase
- MC_Calc.Input2Exponent
Rand
Get a random negative or positive number
function mapcraft:built_in/math/rand
Reset
Resets all variables of the object
function mapcraft:built_in/math/reset
Can be useful in case of strange problems with your calculations, but it is not necessary to use it all the time.
Sin
Get the sine of an angle in degrees (scaled up by 100)
function mapcraft:built_in/math/sin
Parameters
- MC_Calc.InputAngle in degrees
Sqrt
Get the square root of a number
function mapcraft:built_in/math/sqrt
Parameters
- MC_Calc.InputNumber to be calc
Tan
Get the tangent of an angle in degrees
function mapcraft:built_in/math/tan
Parameters
- MC_Calc.InputAngle in degrees
Wrap angle
Convert any angle by including it between -180 and 180
function mapcraft:built_in/math/wrap_angle
Parameters
- MC_Calc.InputAngle in degrees
Example
- We wish to obtain a set number >= 0
function mapcraft:built_in/math/rand scoreboard players operation Input MC_Calc = Output MC_Calc function mapcraft:built_in/math/absolute
- We wish to obtain the square root of the number 75086142
scoreboard players set Input MC_Calc 75086142 function mapcraft:built_in/math/sqrt