Logo of Mapcraft
Mathematics

Mathematics

Set of functions to compute common mathematical operations and transformations

Parameters

  1. MC_Calc.Input
    Main input
  2. MC_Calc.Input2
    Secondary input
  3. MC_Calc.Input3
    Tertiary Input
  4. MC_Calc.Output
    Output

Functions

Absolute

Get the absolute value of a number
		function mapcraft:built_in/math/absolute
	
Parameters
  1. MC_Calc.Input
    Number 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
  1. MC_Calc.Input
    Angle in degrees

Pow

Get the base raised to the power of the exponent
		function mapcraft:built_in/math/pow
	
Parameters
  1. MC_Calc.Input
    Base
  2. MC_Calc.Input2
    Exponent

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
  1. MC_Calc.Input
    Angle in degrees

Sqrt

Get the square root of a number
		function mapcraft:built_in/math/sqrt
	
Parameters
  1. MC_Calc.Input
    Number to be calc

Tan

Get the tangent of an angle in degrees
		function mapcraft:built_in/math/tan
	
Parameters
  1. MC_Calc.Input
    Angle in degrees

Wrap angle

Convert any angle by including it between -180 and 180
		function mapcraft:built_in/math/wrap_angle
	
Parameters
  1. MC_Calc.Input
    Angle in degrees

Example

  1. 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
    	
  2. We wish to obtain the square root of the number
    75086142
    		scoreboard players set Input MC_Calc 75086142
    function mapcraft:built_in/math/sqrt