Skip to main content

Overview

Density modifiers allow you to modify Minecraft’s terrain generation at a fundamental level by wrapping density functions and noise routers. Density functions determine the 3D shape of terrain, caves, and other world features.
Density function modification is an advanced topic requiring understanding of Minecraft’s noise-based terrain generation. Incorrect modifications can cause terrain artifacts or performance issues.

Wrap Density Function

Wraps an existing density function with a custom density function, allowing modification of terrain shape.
public record WrapDensityFunctionModifier(
    int priority,
    Holder<DensityFunction> targetFunction,
    Holder<DensityFunction> wrapperFunction
) implements Modifier

How It Works

The modifier replaces the target density function’s value with a MergedDensityFunction that applies the wrapper function. The wrapper can reference the original function using marker density functions:
  • lithostitched:wrapped_marker - References the current/wrapped value
  • lithostitched:original_marker - References the original unwrapped value

Parameters

type
string
required
Must be "lithostitched:wrap_density_function"
priority
integer
default:"1000"
Execution priority. Lower values execute first, affecting wrapper nesting order.
target_function
string
required
Registry ID of the density function to wrap. Must be a reference to a registered density function.
wrapper_function
object | string
required
The density function to wrap around the target. Can be:
  • A registry ID (string) referencing another density function
  • An inline density function definition (object)
Use marker functions within the wrapper to reference the target:
  • lithostitched:wrapped_marker - The wrapped/modified value
  • lithostitched:original_marker - The original value before any wrapping

Examples

{
  "type": "lithostitched:wrap_density_function",
  "priority": 1000,
  "target_function": "minecraft:overworld/base_3d_noise",
  "wrapper_function": {
    "type": "minecraft:mul",
    "argument1": {
      "type": "lithostitched:wrapped_marker"
    },
    "argument2": {
      "type": "minecraft:constant",
      "argument": 1.5
    }
  }
}

Wrap Noise Router

Wraps specific targets in a dimension’s noise router, modifying how density functions are used for terrain generation.
public record WrapNoiseRouterModifier(
    int priority,
    ResourceKey<Level> dimension,
    NoiseRouterTarget target,
    Holder<DensityFunction> wrapperFunction
) implements Modifier

How It Works

Noise routers contain multiple density functions for different purposes (continents, erosion, depth, etc.). This modifier wraps one of those targets with a custom density function, allowing targeted terrain modifications.

Parameters

type
string
required
Must be "lithostitched:wrap_noise_router"
priority
integer
default:"1000"
Execution priority. Multiple modifiers with the same target are applied in priority order.
dimension
string
required
Registry ID of the dimension to modify.Common values:
  • "minecraft:overworld"
  • "minecraft:the_nether"
  • "minecraft:the_end"
target
string
required
Which noise router target to wrap.Available targets:
  • barrier - Barrier noise for aquifer barriers
  • fluid_level_floodedness - Aquifer flood level
  • fluid_level_spread - Aquifer spread
  • lava - Lava level noise
  • temperature - Temperature noise
  • vegetation - Vegetation noise
  • continents - Continental shape
  • erosion - Erosion shaping
  • depth - Terrain depth
  • ridges - Ridge formations
  • initial_density - Initial 3D terrain density
  • final_density - Final terrain density (after caves)
  • vein_toggle - Ore vein toggle
  • vein_ridged - Ore vein ridges
  • vein_gap - Ore vein gaps
wrapper_function
object | string
required
The density function to wrap around the target. Use lithostitched:wrapped_marker to reference the original target value.

Examples

{
  "type": "lithostitched:wrap_noise_router",
  "priority": 1000,
  "dimension": "minecraft:overworld",
  "target": "continents",
  "wrapper_function": {
    "type": "minecraft:mul",
    "argument1": {
      "type": "lithostitched:wrapped_marker"
    },
    "argument2": {
      "type": "minecraft:constant",
      "argument": 1.2
    }
  }
}

Marker Density Functions

Lithostitched provides special marker density functions for referencing wrapped values:

Wrapped Marker

References the current wrapped/modified value of the density function.
public record WrappedMarkerDensityFunction() implements DensityFunction, MarkerFunction
{
  "type": "lithostitched:wrapped_marker"
}

Original Marker

References the original unwrapped value before any modifications.
public record OriginalMarkerDensityFunction() implements DensityFunction, MarkerFunction
{
  "type": "lithostitched:original_marker"
}

Noise Router Targets

Detailed explanation of each noise router target:
Controls large-scale continental landmass shapes. Higher values create more land, lower values create more ocean.Use cases: Adjust ocean/land ratio, create more dramatic coastlines
Controls terrain erosion patterns affecting valleys, mountains, and plains.Use cases: Make terrain more rugged or smoother, adjust valley depth
Affects the depth/height offset of terrain.Use cases: Raise or lower overall terrain height, create floating islands
Controls ridge and peak formations in mountainous terrain.Use cases: Make mountains more jagged or rounded, adjust peak height
The initial 3D density before caves and features are carved.Use cases: Fundamental terrain shape modification, terrain amplification
The final density after caves and features, determines solid vs air blocks.Use cases: Add noise to terrain surfaces, create unusual formations
Controls temperature distribution affecting biome placement.Use cases: Shift climate zones, create temperature gradients
Affects vegetation/humidity distribution for biome placement.Use cases: Modify biome distribution patterns, create vegetation bands
Control ore vein generation introduced in 1.18.Use cases: Modify ore vein frequency, size, or distribution

Density Function Wrapper System

The wrapping mechanism uses the DensityFunctionWrapper utility:
public class DensityFunctionWrapper {
    public static DensityFunction wrap(final DensityFunction wrapped, DensityFunction wrapper) {
        if (wrapped instanceof MergedDensityFunction merged) {
            // Already wrapped, add another layer
            final DensityFunction original = merged.original();
            return new MergedDensityFunction(original, wrapped, wrapper.mapAll(value -> {
                if (value instanceof OriginalMarkerDensityFunction) {
                    return original;
                }
                if (isMarker(value)) {
                    return wrapped;
                }
                return value;
            }));
        }
        
        // First wrapping
        return new MergedDensityFunction(wrapped, wrapped, wrapper.mapAll(value -> {
            if (isMarker(value)) {
                return wrapped;
            }
            return value;
        }));
    }
}
This system allows multiple modifiers to wrap the same density function, with each wrapper able to reference both the original and previously wrapped values.

Best Practices

Density functions use mathematical operations:
  • minecraft:add - Addition
  • minecraft:mul - Multiplication
  • minecraft:clamp - Limit to min/max range
  • minecraft:blend_density - Smooth blending
Study vanilla density functions before creating custom ones.
Always clamp modified density functions to reasonable ranges to prevent terrain artifacts:
{
  "type": "minecraft:clamp",
  "input": { /* your modification */ },
  "min": -2.0,
  "max": 2.0
}
  • Generate multiple worlds with different seeds
  • Check terrain at different coordinates (0,0 vs 10000,10000)
  • Verify biome transitions look natural
  • Test in multiplayer to catch synchronization issues
Density functions run for every block during generation. Complex wrappers can slow world generation:
  • Use simple operations when possible
  • Avoid deeply nested functions
  • Profile with spark or similar tools
When multiple modifiers target the same function:
  • Use priority to control order
  • Consider whether each needs original vs wrapped value
  • Test with all modifiers active simultaneously

Common Patterns

Terrain Amplification

Multiply density functions by constants > 1.0 to create more dramatic terrain

Terrain Smoothing

Multiply by constants < 1.0 or use quarter_negative to smooth terrain

Height Offset

Add constants to depth or density to raise/lower terrain

Noise Injection

Add noise functions to create variation in otherwise uniform terrain

Advanced Example: Multi-Layer Modification

{
  "type": "lithostitched:wrap_density_function",
  "priority": 900,
  "target_function": "minecraft:overworld/base_3d_noise",
  "wrapper_function": {
    "type": "minecraft:mul",
    "argument1": {"type": "lithostitched:wrapped_marker"},
    "argument2": {"type": "minecraft:constant", "argument": 1.3}
  }
}

Density Functions

Learn about density function types

Noise Settings

Understand noise configuration

Surface Modifiers

Modify surface block placement

Examples

See practical density modifier examples

Build docs developers (and LLMs) love