Terrain Height

Generate Minecraft worlds by map images!

  1. Basic Height
  2. Noise Height
  3. Registering Terrain Height Types

Descendants of Terrain Height return an additional block height that is added to the zone specific height.

Basic Height

Always returns 0, resulting in entirely flat zones.

{
    "type": "ctgen:basic_height"
}

Or in Java:

TerrainHeight terrain = new BasicHeight();

Noise Height

Places a random layer of noise over the world. The noise value is multiplied by the threshold modifier of the biome.

{
  "type": "ctgen:noise_height",
  "noise": {
    "octaves": [
      {
        "frequency": 1,
        "amplitude": 1
      }
    ],
    "persistence": 1.0,
    "stretch": 1
  }
}
  • noise - a noise codec
    • octaves - the octaves for the SimplexNoise. Will be applied in the specified order
    • persistence - multiplies the amplitude for each octave
    • stretch - stretch the noise in x and z direction

Or in Java:

TerrainHeight terrain = new NoiseHeight(new Noise(List.of(1f), 1D, 1, 1));

Registering Terrain Height Types

You can also register a custom terrain height algorithm using code similar to this one:

public class BasicHeight extends TerrainHeight {
  public static final Codec<BasicHeight> CODEC = RecordCodecBuilder.create(instance -> instance.stable(new BasicHeight()));
  public static final ResourceLocation ID = new ResourceLocation(YourMod.MODID, "basic_height");

  @Override
  public double getHeight(MapSettings settings, SimplexNoise noise, int x, int z, double terrainModifier) {
    return 0;
  }

  @Override
  protected Codec<BasicHeight> codec() {
    return CODEC;
  }
}

To register the height algorithm, just use this snippet:

CTRegistries.TERRAIN.register(BasicHeight.ID, BasicHeight.CODEC);

Continue with Home