Starting with Data Packs - ToCraft/CraftedTerrainGeneration GitHub Wiki

To get started with a custom data pack that uses CTGen, you need to have a basic understanding on how a data pack is structured. For reference, reach out to the Minecraft Wiki. Your data pack structure should look like this:

<data pack name>
├── data
│   ├── <namespace>
│   │   └── worldgen
│   │       ├── map_based                       -- everything connected to CTGen belongs into this directory
│   │       │   ├── biomes                       -- here are your custom biome maps saved
│   │       │   │   └── <custom_map>.png
│   │       │   ├── hieghtmaps                    -- here are your custom heightmaps saved
│   │       │   │   └── <custom_map>.png
│   │       │   └── zones                       -- optional, this is where you save custom zones, but required for CLI preprocessing (skip if you don't know what it is)
│   │       │       ├── zone_a.json
│   │       │       ├── zone_b.json
│   │       │       ├── zone_c.json
│   │       └── world_preset
│   │           └── <custom_preset>.json        -- example world preset that configures the CTGen chunk generator
│   └── minecraft
│       └── tags
│           └── worldgen
│               └── world_preset
│                   └── normal.json             -- make the world preset available in the selection menu
└── pack.mcmeta

Note that the <custom_preset>.json and the tag specification are only required so the ChunkGenerator can be read as a custom world preset. Of course, you can also use it in other use cases, such as custom dimensions, but I'll only explain custom world presets here, since the process is nearly the same.

Custom Map

Each map consists of a biome map and a heightmap. The biome map is a PNG, where each pixel represents 4-by-4 Minecraft blocks. The biome is defined via the color, for more information, read Zones.

Elarth - Biome Map

In contrast, there is also a so-called heightmap. It's a grey PNG where each pixel represents the height of 4-by-4 Minecraft blocks. It is important that both maps have the exact same dimensions, so each section in Minecraft has a corresponding Zone and height.

Elarth - Heightmap

Each pixel of the heightmap must have the same values for Red, Green and Blue. This value will result in the Y coordinate of the surface, only altered by transition.

Generator

The settings define the most important things for the chunk generator and values that are persistent throughout the zones. Since many parameters might be complicated at first, it's recommended to start using the ones below.

Here's the dimension setup at data/elarth/dimension/elarth.json used for the Elarth data pack:

{
   "type":"minecraft:overworld",
   "generator":{
      "type":"ctgen:map_based_chunk_generator",
      "settings":{
         "default_map_biome":{
            "biome":"minecraft:deep_ocean",
            "color":"#002355",
            "terrain_modifier":33.0
         },
         "map_id":"elarth:elarth",
         "noise_gen_settings":"ctgen:overworld",
         "zones":[
            {
               "biome":"minecraft:stony_shore",
               "color":"#828c82"
            },
            {
               "biome":"minecraft:snowy_slopes",
               "color":"#d9d9d9"
            },
            {
               "biome":"minecraft:jagged_peaks",
               "color":"#a8a8a8",
               "terrain_modifier":50.0
            },
            {
               "biome":"minecraft:frozen_ocean",
               "color":"#4e7ecc",
               "pixel_weight":3.0
            },
            {
               "biome":"minecraft:frozen_river",
               "color":"#5791f0",
               "pixel_weight":2.0
            },
            {
               "biome":"minecraft:plains",
               "color":"#395f39"
            },
            {
               "biome":"minecraft:forest",
               "color":"#2b462b",
               "terrain_modifier":10.0
            },
            {
               "biome":"minecraft:windswept_gravelly_hills",
               "color":"#979797",
               "terrain_modifier":18.0
            },
            {
               "biome":"minecraft:stony_peaks",
               "color":"#828282",
               "terrain_modifier":50.0
            },
            {
               "biome":"minecraft:lukewarm_ocean",
               "color":"#0053d9",
               "pixel_weight":3.0
            },
            {
               "biome":"minecraft:desert",
               "color":"#a5ab36"
            },
            {
               "biome":"minecraft:badlands",
               "color":"#545438",
               "terrain_modifier":12.0
            },
            {
               "biome":"minecraft:badlands",
               "color":"#464735",
               "terrain_modifier":24.0
            },
            {
               "biome":"minecraft:river",
               "color":"#0162ff",
               "pixel_weight":2.0,
               "terrain_modifier":0.5
            },
            {
               "biome":"minecraft:ocean",
               "color":"#002a67",
               "terrain_modifier":16.0
            },
            {
               "biome":"minecraft:deep_ocean",
               "color":"#002355",
               "terrain_modifier":33.0
            }
         ]
      }
   }
}

You'll notice that the chunk generator is configured to ctgen:map_based_chunk_generator. This is CTGen's built-in Chunk Generator. It is also very important to set "noise_gen_settings":"ctgen:overworld". This will tell Minecraft what Noise Settings should be used. This can be modified to a custom setting. It is used for caves, block placements and surface rules.

The default_map_biome key defines a Zone, that is used when a pixel can't be read or the player is outside of the map. zones is a list of Zones, where each possible color of the Biome Map is mapped to a biome, maybe also additional parameters (take a look at Zones for details).

When using a dedicated zones directory, the script can be simplified to this (Note: You should replace the zones with your own ones!):

{
  "dimensions": {
    "minecraft:overworld": {
      "type": "minecraft:overworld",
      "generator": {
        "type": "ctgen:map_based_chunk_generator",
        "settings": {
          "noise_gen_settings": "ctgen:overworld",
          "biome_map": "elarth:elarth",
          "default_map_biome": "ctgen:deep_ocean",
          "zones": [
            "ctgen:stony_flats",
            "ctgen:snowy_flats",
            "ctgen:snowy_slopes",
            "ctgen:snowy_mountains",
            "ctgen:frozen_lake",
            "ctgen:frozen_river",
            "ctgen:plains",
            "ctgen:forest",
            "ctgen:hills",
            "ctgen:mountains",
            "ctgen:lake",
            "ctgen:desert",
            "ctgen:badlands",
            "ctgen:badlands_mountains",
            "ctgen:river",
            "ctgen:ocean",
            "ctgen:deep_ocean"
          ]
        }
      }
    }
  }
}

For now, you should continue with Zones.


Every parameter not present will be automatically filled with the value of the chunk generator settings below.

Here's every possible setting mapped to its default value explained, used in a world preset:

{
  "dimensions": {
    "minecraft:overworld": {
      "type": "minecraft:overworld",
      "generator": {
        "type": "ctgen:map_based_chunk_generator",    // important, tells Minecraft to use the CTGen Chunk Generator
        "settings": {                                 // this is where the actual ChunkGenerator settings start
          "noise_gen_settings": "ctgen:overworld",    // this line is required. It sets the backend noise generator settings, used for surface rules, caves, etc. ONLY modify if you know what you're doing!
          "map_id": "<namespace>:<custom_map>",       // the id of your map image
          "zones": [                                  // list all zones that should be used for generation. Don't add more than one zone with the same color!
            "<namespace>:zone_a",
            "<namespace>:zone_b",
            "<namespace>:zone_c"
          ],
          "default_map_biome": "<namespace>:zone_a",  // a default biome. Will be used for chunks outside the map image
          "transition": 16,                           // how large the transition should be. Modify with caution! A high value might result that it seems like the ChunkGenerator skips thin zones as rivers!
          "spawn_pixel_x": 0,                         // pixel on the map image that should be parsed as 0 | 0 in game. note that this is the pixel position on the upscaled image, if "pixels_are_chunks" == true
          "spawn_pixel_y": 0,                         // see above
        }
      }
    }
  }
}

Transition

The transition parameter defines, how the program will smooth edges and matches a range of blocks. This was introduced, to fix 4-by-4 blocks in the world. Be careful when changing the value. In general, do not set it lower then 4 and do not raise it above the smallest zone in your map, e.g. the thinnest part of a river.

⚠️ **GitHub.com Fallback** ⚠️