描述
TerraMath 是一款适用于 Minecraft 1.20 - 1.21.x 的模组,允许你使用数学函数自定义世界生成。通过定义地形高度的数学公式,创造独特的地貌景观!
你也可以加入我的 Discord 以获取更多公式或分享你自己的公式。
功能
- 通过数学公式自定义世界生成
- 可调整的基础生成参数(缩放、高度、变化幅度、平滑度)
- 支持在基础公式之上配置噪声叠加层
- 公式中支持使用数学常数
客户端使用方法
- 世界生成设置界面
参数配置
- 在世界创建界面的“World”选项卡中
- 打开地形设置界面
- 在字段中输入你想要的公式
- 调整其他参数(可选):
- Scale(缩放比例)
- Base Height(基础高度,决定平均地表水平面)
- Height Variation(高度变化,变化的振幅)
- Smoothing(平滑度,地形过渡的平滑程度)
- 选择噪声类型和设置(可选):
- 噪声类型:Perlin、Simplex、Blended、Normal
- X, Y, Z 坐标乘数
- 通用噪声高度乘数
服务器端使用方法
- 安装 TerraMath 模组后启动服务器
- 检查 config 文件夹,其中会包含一个
terramath.json文件 - 手动在文件中设置必要的参数,或者...
- ...在你的客户端上配置该模组
- 设置参数并保存配置文件
- 将配置文件传输到服务器的 config 文件夹中
重要服务器注意事项:
- 要使配置对新世界生效,请确保配置文件中的
useDefaultFormula参数设置为true - 更改配置设置后,你需要删除现有世界并重启服务器,新的地形公式才会生效
- 或者,你可以将整个世界文件夹从客户端传输到服务器——世界将继续按照相同的公式生成,无需更改配置
公式示例
-
基本波浪地形:
sin(x) -
带有陡峭坡度的尖刺状火山地形:
abs(sin(x/10))*exp(cos(z/15))*8 + tanh(sqrt(x^2 + z^2)/20)*15 -
起伏的山脉:
sin(x/8)*cos(z/8)*10 + abs(sin(x/20))*15 + sqrt(abs(x/10))*5 -
一些疯狂且复杂的计算:
round(sin(x/15))*10 + round(cos(z/15))*10 + sqrt(abs(sin((x+z)/20)))*15 -
带有高原的梯田地形:
floor(sin(x/20) * cos(z/20) * 5) * 4 + sqrt(x^2 + z^2)/10 -
布满陨石坑的地形:
10 * (1 - exp(-((x/30)^2 + (z/30)^2) / 2)) + 5 * perlin(x/50, 0, z/50)
可用函数与运算符
数学函数:
三角函数:
- sin(x) - 正弦
- cos(x) - 余弦
- tan(x) - 正切
- csc(x) - 余割
- sec(x) - 正割
- cot(x) - 余切
- asin(x) - 反正弦
- acos(x) - 反余弦
- atan(x) - 反正切
- atan2(x,y) - 双变量反正切
- acsc(x) - 反余割
- asec(x) - 反正割
- acot(x) - 反余切
双曲函数:
- sinh(x) - 双曲正弦
- cosh(x) - 双曲余弦
- tanh(x) - 双曲正切
- asinh(x) - 反双曲正弦
- acosh(x) - 反双曲余弦
- atanh(x) - 反双曲正切
- csch(x) - 双曲余割
- sech(x) - 双曲正割
- coth(x) - 双曲余切
- acsch(x) - 反双曲余割
- asech(x) - 反双曲正割
- acoth(x) - 反双曲余切
根式与幂运算:
- sqrt(x) - 平方根
- cbrt(x) - 立方根
- root(x,n) - x 的 n 次方根
- pow(x,y) - x 的 y 次幂
- exp(x) - 指数函数 (e^x)
对数函数:
- ln(x) - 自然对数
- lg(x) - 以 10 为底的对数
四舍五入与数值函数:
- abs(x) - 绝对值
- floor(x) - 小于 x 的最大整数
- ceil(x) - 大于 x 的最小整数
- round(x) - 四舍五入到最近的整数
- sign(x) - 返回 x 的符号(-1、0 或 1)
- mod(x,y) - x 除以 y 的余数
- gcd(x,y) - 最大公约数
- lcm(x,y) - 最小公倍数
- modi(x,y) - 模逆元
特殊函数:
- gamma(x) - Gamma 函数
- erf(x) - 误差函数
- beta(x,y) - Beta 函数
随机数生成:
- rand() - 0 到 1 之间的随机数
- randnormal(mean,stdev) - 符合正态分布的随机数
- randrange(min,max) - min 到 max 之间的随机数
噪声函数:
- perlin(x,y,z) - Perlin 噪声
- simplex(x,y,z) - Simplex 噪声
- normal(x,y,z) - 高斯噪声(Normal noise)
- blended(x,y,z) - 混合噪声
- octaved(x,z,octaves,persistence) - 分形噪声(Octaved noise)
实用函数:
- max(x,y) - x 和 y 中的最大值
- min(x,y) - x 和 y 中的最小值
- sigmoid(x) - Sigmoid 函数 (1/(1+e^-x))
- clamp(x,min,max) - 将 x 限制在 min 和 max 之间
常量:
- pi, π - 3.14159... (π 常数)
- e - 2.71828... (自然常数)
- phi, φ - 1.61803... (黄金分割率)
- zeta3, ζ3 - 1.20205... (阿佩里常数)
- catalan, K - 0.91596... (卡特兰常数)
- alpha, α, feigenbaum - 2.50290... (费根鲍姆常数)
- delta, δ, feigenbaumdelta - 4.66920... (费根鲍姆 δ)
- omega, Ω - 0.6889 (宇宙学常数)
变量:
x, y, z - 世界中的方块坐标
运算符:
+, -, *, /, ^, (), !
已知问题
- 生成 XXL 级地形的极端公式可能会影响性能(这可能是一个无法完全解决的问题)
- 如果广泛使用随机数生成函数,会显著影响世界生成的性能。建议谨慎使用这些函数,特别是在复杂的地形公式中,因为它们可能导致帧率下降或区块加载时间增加
贡献
欢迎通过 Issue Tracker 报告错误或提出功能建议!
Description
TerraMath is a Minecraft 1.20 - 1.21.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)
- Configurable noise overlay on top of your base formula
- Support for mathematical constants in formulas
How to Use on Client
- World generation settings interface
Parameter Configuration
- Go to "World" tab in world creation screen
- Open the terrain settings 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)
- Choose noise type and settings (optional):
- Noise type: Perlin, Simplex, Blended, Normal
- X, Y, Z coordinate multipliers
- General noise height multiplier
How to Use on Server
- Start the server with TerraMath mod installed
- Check the config folder, there will be a
terramath.jsonfile - Set the necessary parameters manually in the file, or...
- ...configure the mod on your client
- Set the parameters and save the config
- Transfer the config file to the server's config folder
Important Server Notes:
- For the config to apply to a new world, make sure the
useDefaultFormulaparameter in the config is set totrue - After changing config settings, you'll need to delete the existing world and restart the server for the new terrain formula to take effect
- Alternatively, you can transfer your entire world folder from a client to the server - the world will continue to generate according to the same formula without requiring config changes
Formula Examples
-
Basic wavy landscape:
sin(x) -
Spiky volcanic-like 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 -
Some crazy and heavy thing:
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
- Extreme formulas that produce XXL landscapes may impact performance (probably not a completely solvable problem)
- Random number generation functions can significantly impact world generation performance when used extensively. Consider using these functions sparingly, especially in complex terrain formulas, as they may cause frame rate drops or increased chunk loading time
Contributing
Feel free to report bugs or suggest features through the issue tracker!
下载 TerraMath
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 TerraMath
下载 TerraMath
下载 TerraMath
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 TerraMath
下载 TerraMath
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 TerraMath
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 TerraMath
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 TerraMath
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 TerraMath
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
新增
- 方程模式。包含单个
=的公式(例如y = 64 + 8 * sin(x / 10))被视为隐式曲面:当左侧不大于右侧时,世界为实体。公式现在可以使用y,从而实现洞穴、浮空岛和任意 3D 形状 - 设置界面内的实时 3D 预览。在后台持续重建可旋转的体素预览,当屏幕空间不足时会显示提示
- 地形设置现适用于所有基于噪声的世界类型
- NeoForge 支持版本:1.20.4、1.20.6、1.21.1、1.21.4、1.21.11、26.1.2 和 26.2
- Fabric 和 Forge 平台的 1.21.4、1.21.11、26.1.2 和 26.2 构建版。单一代码库现生成 23 个 jar 包:涵盖 1.20、1.20.4、1.20.6、1.21.1、1.21.4、1.21.11、26.1.2 和 26.2 的 Fabric 与 Forge 版本,以及 NeoForge 自 1.20.4 起的所有版本
性能优化
- 编译后的公式通过类型化接口调用
- 对于不使用
y的公式,按区块缓存公式值,从而加速区块生成 - 不依赖
y的噪声查找(如simplex(x, z)、perlin(x, 0, z))按线程进行记忆化存储,因此混合地形噪声与y的公式不再为每个方块重新计算这些噪声 - 公式缓存现在是线程安全的
- 预览以并行方式评估,并在渲染线程之外构建网格
更改
- 随机公式生成器重写:它从地形原型构建公式,可以对其进行杂交,将比例适配到样本,并过滤掉枯燥的结果
- 弃用 Architectury,改为使用针对每个目标的 Loom 项目。源码拆分为
core、mc、loader和versions - 平滑处理仅在前进模式下应用(如同 1.3.0 版本),并可设置为 0 以关闭。在此之前,它始终开启且值为 0.55,在非高级模式下无法更改,这也导致普通公式的成本高出五倍
- 构建 26.x 目标需要 JDK 25(Gradle 会自动下载它)
修复
- 在某些 1.20.1 世界中,公式仅应用于出生点周围。现在它覆盖所有新生成的区块,并在重新进入世界时保持生效(#22)
floor和round现在返回实数,因此1/floor(...)会返回无穷大而不是因整数除以零而失败,且floor(5)/2的结果为2.5。没有消息的错误不再显示为Syntax error: null(#21)- 公式结果非有限值的点(
Infinity、NaN)被视为虚空,而不是填充至构建限制(#21) - 编译失败的公式不再导致专用服务器挂起:错误会被记录,世界会生成为空而非因仅客户端类而崩溃
已知问题
- 同时使用
y和多个噪声调用的重型公式可能会减缓区块生成速度
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
原版世界生成优化模组
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
新增 50+ 个独特生物群系,为你的世界增添新树木、花卉等更多元素!
模组
添加全屏世界地图,显示你在世界中已探索的区域。与 Xaero's Minimap 搭配使用效果极佳。
模组
基于 GTCEu 1.12.2 的现代 GregTech
模组
让你能够在世界中的任何位置定位结构。
评论 0
登录后参与评分
还没有评论,来抢沙发吧