TerraMath is a Minecraft 1.20.x mod that allows you to customize world generation using mathematical functions. Create unique landscapes by defining terrain height through mathematical formulas!
You can also join my Discord to find more formulas or share yours.
-
Custom world generation through mathematical formulas
-
Adjustable basic generation parameters (scale, height, variation, smoothing)

- World generation settings interface
-
Go to "World" tab in world creation screen
-
Enter your desired formula in the field
-
Adjust additional parameters (optional):
-
Scale
-
Base Height (determines average surface level)
-
Height Variation (amplitude of changes)
-
Smoothing (terrain transition smoothness)
-
Mathematical Functions:
Trigonometric:
- sin(x) - sine
- cos(x) - cosine
- tan(x) - tangent
- asin(x) - inverse sine (arcsin)
- acos(x) - inverse cosine (arccos)
- atan(x) - inverse tangent (arctan)
Hyperbolic:
- sinh(x) - hyperbolic sine
- cosh(x) - hyperbolic cosine
- tanh(x) - hyperbolic tangent
Root and Power:
- sqrt(x) - square root
- cbrt(x) - cube root
- pow(x,y) - x raised to power y
- exp(x) - exponential (e^x)
Logarithmic:
- ln(x) - natural logarithm
- lg(x) - base-10 logarithm
Rounding and Numbers:
- abs(x) - absolute value
- floor(x) - largest integer less than x
- ceil(x) - smallest integer greater than x
- round(x) - rounds to nearest integer
- sign(x) - returns sign of x (-1, 0, or 1)
- mod(x,y) - remainder of x divided by y
Special Functions:
- gamma(x) - gamma function
- erf(x) - error function
- beta(x,y) - beta function
Utility Functions:
- max(x,y) - maximum of x and y
- min(x,y) - minimum of x and y
- sigmoid(x) - sigmoid function (1/(1+e^-x))
- clamp(x,min,max) - constrains x between min and max
Variables:
x, y, z - block coordinates in world
Operators:
+, -, *, /, ^, ()
- Extreme formulas that produces XXL landscapes may impact performance (probably not a completely solvable problem)
-
Port to 1.20.2+
-
Additional mathematical functions
-
More terrain customization options
-
Performance optimizations
-
Better formula validation and error messages
Feel free to report bugs or suggest features through the issue tracker!