Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Header

Static Badge Static Badge Static Badge

Static Badge Static Badge Static Badge

Terrain development in Minecraft relies on large, deeply nested JSON structures that quickly become difficult to read and maintain. Rhombus introduces powerful abstractions and a comprehensive Python API, making world generation code cleaner, more modular, and significantly faster to develop.

Rhombus is an eDSL delivered as a Python package that allows worldgen developers to comfortably write expressions resembling the abstract syntax trees of density functions for Minecraft while benefiting from Python's forgiving syntax.

Key Advantages

  • 📦 Object-oriented Design
    Full use of Python’s object model for composing, reusing, and structuring density functions.
  • 📝 Native Comments
    Since Python code is in use, comments work naturally without any custom syntax.
  • 📖 Integrated Documentation
    Functions and classes provide docstrings describing behavior, parameters, and usage.
  • ⚡ Performance Optimization
    Recurring expressions and resource intense operations can be cached automatically.
  • 🗄️ Macro Library
    Growing collection of macros for common patterns and complex operations, reducing boilerplate and improving readability.
  • 🔀 Multi-Version Compilation
    While Rhombus follows an up-to-date-first approach, density functions can be compiled for older versions too. The most optimal implementation for each version is chosen automatically.

Features

Unveil

This list only includes features that are principally not necessary, but make up the real strengths of Rhombus.

  • Macro Library
    • Adaptation of all density function types and noise features in recent versions
    • Caching optimizer
    • General Math
      • Implementations of core functions for older versions: sign, rounding, modulo, etc.
      • Smooth max and min functions
      • Infinity, NaN
      • Sign, Heaviside, ramp and smoothstep functions
      • Spline and exponentiation-based trigonometric functions
      • Spline approximations for some distribution functions: normalPDF, normalCDF, erf, logistic
      • Spline point sampler for arbitrary Python functions
    • Working with Maps
      • Heightmap extrusion
    • Expressive construction of conditionalities
      • Use of the if / elif / else keywords in condition blocks and the ternary operator
      • Fluent Interface
    • Coordinate reconstruction for older versions
  • Mod Support
    • More Density Functions
    • Lithostitched
    • Tectonic
    • En-sityFunctions
    • ikbLib
  • Rhombus Preview
    A lightweight local frontend with file-watching for previewing density functions
    • Visualizer (built on deepslate)
      • Supports all major worldgen mods (see Mod Support)
    • File Explorer & Viewer (built on monaco)
    • Spline Visualization

Impressions

pip install rhombus
from rhombus import *

continent_noise = Noise(-10, [2, 1, 2, 2, 2, 1, 1, 1, 1])
erosion_noise = Noise(-9, [3.5, 0, 2, 4, 2, 2, 3])

erosion = clamp(noise(erosion_noise, xz_scale=1.3, y_scale=0) - 0.1, min=-1, max=1)

height_map = spline(
    erosion,
    [
        (-1, -1, 0),
        (-0.6, -0.95, 0),
        (-0.61, -0.6, 0),
        (-0.2, -0.55, 0),
        (-0.21, -0.2, 0),
        (0.05, -0.2, 0),
        (0.21, 0.2, 0),
        (0.6, 0.3, 0),
        (0.61, 0.8, 0),
        (1, 0.8, 0),
    ],
)

FINAL = maps.extrude_heightmap(height_map, (-1, 0.8), (64, 256))
import beet
import beet.contrib.worldgen
import rhombus

from .previous_code_block import FINAL


def beet_default(ctx: beet.Context):

    FINAL.implement(ctx.data, "minecraft:final_destiny")

    print(FINAL.compile("minecraft:final_destiny"))
Have a look at the results
{
    (
        "minecraft:final_destiny",
        WorldgenDensityFunction(
            {
                "type": "minecraft:sub",
                "left": {
                    "type": "minecraft:add",
                    "left": {
                        "type": "minecraft:mul",
                        "left": {
                            "type": "minecraft:sub",
                            "left": {
                                "type": "minecraft:spline",
                                "spline": {
                                    "coordinate": {
                                        "type": "minecraft:clamp",
                                        "input": {
                                            "type": "minecraft:sub",
                                            "left": {
                                                "type": "minecraft:noise",
                                                "noise": "rhombus:generated/dark_drowned_7849",
                                                "shift_x": 0.0,
                                                "shift_y": 0.0,
                                                "shift_z": 0.0,
                                                "xz_scale": 1.3,
                                                "y_scale": 0,
                                            },
                                            "right": 0.1,
                                        },
                                        "max": 1.0,
                                        "min": -1.0,
                                    },
                                    "points": [
                                        {
                                            "derivative": 0,
                                            "location": -1,
                                            "value": -1.0,
                                        },
                                        {
                                            "derivative": 0,
                                            "location": -0.6,
                                            "value": -0.95,
                                        },
                                        {
                                            "derivative": 0,
                                            "location": -0.61,
                                            "value": -0.6,
                                        },
                                        {
                                            "derivative": 0,
                                            "location": -0.2,
                                            "value": -0.55,
                                        },
                                        {
                                            "derivative": 0,
                                            "location": -0.21,
                                            "value": -0.2,
                                        },
                                        {
                                            "derivative": 0,
                                            "location": 0.05,
                                            "value": -0.2,
                                        },
                                        {
                                            "derivative": 0,
                                            "location": 0.21,
                                            "value": 0.2,
                                        },
                                        {
                                            "derivative": 0,
                                            "location": 0.6,
                                            "value": 0.3,
                                        },
                                        {
                                            "derivative": 0,
                                            "location": 0.61,
                                            "value": 0.8,
                                        },
                                        {"derivative": 0, "location": 1, "value": 0.8},
                                    ],
                                },
                            },
                            "right": -1.0,
                        },
                        "right": 106.66666666666666,
                    },
                    "right": 64.0,
                },
                "right": {
                    "type": "minecraft:cache",
                    "input": {
                        "type": "minecraft:gradient",
                        "axis": "y",
                        "from_coordinate": -30000000,
                        "from_value": -30000000,
                        "tiling": "clamp_to_edge",
                        "to_coordinate": 30000000,
                        "to_value": 30000000,
                    },
                },
            }
        ),
    ),
    (
        "rhombus:generated/dark_drowned_7849",
        WorldgenNoise(
            {
                "base_octave": -9,
                "base_amplitude": 1.0,
                "normalize": True,
                "octave_count": 7,
                "amplitude_modifiers": (3.5, 0, 2, 4, 2, 2, 3),
            }
        ),
    ),
}

Preview

Spread the Word

The easiest way to support the Rhombus project is to propagate its use in your projects. You can use our custom Devin's Badges:


<a href="https://github.com/annhilati/rhombus"><img src="https://raw.githubusercontent.com/annhilati/rhombus/main/docs/images/badge-cozy.svg"/></a>


<a href="https://github.com/annhilati/rhombus"><img src="https://raw.githubusercontent.com/annhilati/rhombus/main/docs/images/badge-cozy-minimal.svg"/></a>

Metadata

Release files for rhombus 0.1.0rc5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rhombus 0.1.0rc5
File Size Uploaded Provenance Actions
rhombus-0.1.0rc5.tar.gz 850.5 kB Without provenance Details for rhombus-0.1.0rc5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rhombus 0.1.0rc5
File Interpreter ABI Platform Actions
rhombus-0.1.0rc5-py3-none-any.whl Python 3 none any Details for rhombus-0.1.0rc5-py3-none-any.whl

Total release size: 1.2 MB

Release files / rhombus-0.1.0rc5.tar.gz

Download URL rhombus-0.1.0rc5.tar.gz
Size 850.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9867c0ef57d6ab837c23a7655a8f25a291e2db281df8074d17463825ad7dce43
BLAKE2b-256 checksum
How to use checksums
12e076966115b4d83e50d93390be14132335745f6ecfb43d676ca6d5c21d7750
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.1

Release files / rhombus-0.1.0rc5-py3-none-any.whl

Download URL rhombus-0.1.0rc5-py3-none-any.whl
Size 351.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e23625be2bc892b382ee9342328ccd046560d26e3ca2718b302ef819e3a8091a
BLAKE2b-256 checksum
How to use checksums
332004bd29166130d8b39d78d34be840f73fbe8ca525ba0acaaa4419bb6ac9b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.1

Security for rhombus 0.1.0rc5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page