Description
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.
Features
-
Custom world generation through mathematical formulas
-
Adjustable basic generation parameters (scale, height, variation, smoothing)
How to Use
- World generation settings interface
Parameter Configuration
-
Go to "World" tab in world creation screen
-
Enter your desired formula in the field
-
Adjust additional parameters (optional):
-
Scale - controls terrain size. At value 1, one function period equals one block, at 10 - ten blocks. Higher values create more stretched-out terrain.
-
Base Height - the central generation level (in blocks). For example, at value 64 this will be sea level, and the main terrain will be formed relative to this height.
-
Height Variation - maximum deviation from base height (in blocks). At value 32, terrain can deviate 32 blocks up and down from base height. Higher values create taller mountains and deeper valleys.
-
Smoothing - reduces sharp height changes. At value 0, terrain generates as is, increasing the value makes sharp angles and cliffs more gradual.
-
Formula examples
Basic wavy landscape: sin(x)
Spiky volcanic-like terrain: abs(sin(x/10))*exp(cos(z/15))*8 + tanh(sqrt(x^2 + z^2)/20)*15
Rolling mountains: sin(x/8)*cos(z/8)*10 + abs(sin(x/20))*15 + sqrt(abs(x/10))*5
Some crazy and heavy thing: round(sin(x/15))*10 + round(cos(z/15))*10 + sqrt(abs(sin((x+z)/20)))*15
Available Functions and Operators
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:
+, -, *, /, ^, (), !
Known Issues
- Extreme formulas that produces XXL landscapes may impact performance (probably not a completely solvable problem)
Future Plans
-
☑️ Port to 1.20.4+
-
☐ Additional mathematical functions
-
☐ More terrain customization options
-
☐ Performance optimizations
-
☐ Better formula validation and error messages
Contributing
Feel free to report bugs or suggest features through the issue tracker!
90% of ad revenue goes to creators
Support creators and Modrinth ad-free with Modrinth+