TerraMath
Create Unique Worlds with Mathematics
TerraMath is a modification for Minecraft versions 1.20-1.21.x that opens up limitless possibilities for creating personalized landscapes through mathematical functions. Transform ordinary world generation into true art by describing terrain using formulas!
Main Features
- Creating unique landscapes using mathematical expressions
- Configuring basic generation parameters: scale, height, variation, smoothing
- Adding noise effects on top of the main formula
- Support for mathematical constants in calculations
Client Usage
To configure world generation:
- Go to the "World" tab when creating a new world
- Open terrain settings
- Enter your desired formula in the appropriate field
- Configure additional parameters (optional):
- Scale
- Base height (determines average surface level)
- Height variation (amplitude of changes)
- Smoothing (smoothness of terrain transitions)
- Choose noise type and settings (optional):
- Noise type: Perlin, Simplex, Blended, Normal
- X, Y, Z coordinate multipliers
- General noise height multiplier
Server Configuration
- Start the server with TerraMath mod installed
- A
terramath.jsonfile will appear in the configuration folder - Configure parameters manually in the file, or...
- ...configure the mod on your client
- Save the configuration
- Transfer the configuration file to the server's config folder
Important Server Notes:
- For the configuration to apply to a new world, make sure the
useDefaultFormulaparameter in the config is set totrue - After changing settings, you need to delete the existing world and restart the server for the new terrain formula to take effect
- Alternatively, you can transfer the entire world folder from client to server — the world will continue generating according to the same formula without configuration changes
Formula Examples
-
Wavy landscape:
sin(x) -
Spiky volcanic terrain with steep slopes:
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 -
Complex and resource-intensive terrain:
round(sin(x/15))10 + round(cos(z/15))10 + sqrt(abs(sin((x+z)/20)))15 -
Terraced landscape with plateaus:
floor(sin(x/20) cos(z/20) 5) 4 + sqrt(x^2 + z^2)/10 -
Crater-filled terrain:
10 (1 - exp(-((x/30)^2 + (z/30)^2) / 2)) + 5 perlin(x/50, 0, z/50)
Available Functions and Operators
Mathematical Functions:
Trigonometric:
- sin(x) - sine
- cos(x) - cosine
- tan(x) - tangent
- csc(x) - cosecant
- sec(x) - secant
- cot(x) - cotangent
- asin(x) - inverse sine
- acos(x) - inverse cosine
- atan(x) - inverse tangent
- atan2(x,y) - two-argument inverse tangent
- acsc(x) - inverse cosecant
- asec(x) - inverse secant
- acot(x) - inverse cotangent
Hyperbolic:
- sinh(x) - hyperbolic sine
- cosh(x) - hyperbolic cosine
- tanh(x) - hyperbolic tangent
- asinh(x) - inverse hyperbolic sine
- acosh(x) - inverse hyperbolic cosine
- atanh(x) - inverse hyperbolic tangent
- csch(x) - hyperbolic cosecant
- sech(x) - hyperbolic secant
- coth(x) - hyperbolic cotangent
- acsch(x) - inverse hyperbolic cosecant
- asech(x) - inverse hyperbolic secant
- acoth(x) - inverse hyperbolic cotangent
Root and Power:
- sqrt(x) - square root
- cbrt(x) - cube root
- root(x,n) - nth root of x
- 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
- gcd(x,y) - greatest common divisor
- lcm(x,y) - least common multiple
- modi(x,y) - modular inverse
Special Functions:
- gamma(x) - gamma function
- erf(x) - error function
- beta(x,y) - beta function
Random Number Generation:
- rand() - random number between 0 and 1
- randnormal(mean,stdev) - random number from normal distribution
- randrange(min,max) - random number between min and max
Noise Functions:
- perlin(x,y,z) - perlin noise
- simplex(x,y,z) - simplex noise
- normal(x,y,z) - normal noise
- blended(x,y,z) - blended noise
- octaved(x,z,octaves,persistence) - octaved noise
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
Constants:
- pi, π - 3.14159... (π constant)
- e - 2.71828... (Euler's number)
- phi, φ - 1.61803... (Golden ratio)
- zeta3, ζ3 - 1.20205... (Apéry's constant)
- catalan, K - 0.91596... (Catalan's constant)
- alpha, α, feigenbaum - 2.50290... (Feigenbaum constant)
- delta, δ, feigenbaumdelta - 4.66920... (Feigenbaum delta)
- omega, Ω - 0.6889 (Cosmological constant)
Variables:
x, y, z - block coordinates in world
Operators:
+, -, , /, ^, (), !
Known Issues
- Complex formulas creating huge landscapes may affect performance (probably an unavoidable problem)
- Random number generation functions can significantly reduce world generation performance when used intensively. It is recommended to use these functions moderately, especially in complex terrain formulas, as they may cause FPS drops or increased chunk loading time
Contributing
You can report bugs or suggest new features through the issue tracking system!