90% of ad revenue goes to creators. Go ad-free while supporting creators with Modrinth Plus. Subscribe today!

Architecury API Fabric API Minecraft

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!

Features

  • Custom world generation through mathematical formulas

  • Adjustable basic generation parameters (scale, height, variation, smoothing)

How to Use

image
  • World generation settings interface

Parameter Configuration

  1. Go to "World" tab in world creation screen

  2. Enter your desired formula in the field

  3. Adjust additional parameters (optional):

    1. Scale - controls terrain size. At value 1, one function period equals one block, at 10 - ten blocks. Higher values create more stretched-out terrain.

    2. 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.

    3. 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.

    4. 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)image
Spiky volcanic-like terrain: abs(sin(x/10))*exp(cos(z/15))*8 + tanh(sqrt(x^2 + z^2)/20)*15image
Rolling mountains: sin(x/8)*cos(z/8)*10 + abs(sin(x/20))*15 + sqrt(abs(x/10))*5image
Some crazy and heavy thing: round(sin(x/15))*10 + round(cos(z/15))*10 + sqrt(abs(sin((x+z)/20)))*15image

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.2+

  • 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!


Project members

addavriance

Member

Details

Licensed GPL-3.0-only
Published 2 months ago
Updated a month ago