docs/porting/folds.md

Folds: blending, pre-generation and the fold pass

778 words · ~4 min read

How the imported clusters meet the new ATM10 terrain (concept §3.4). The old terrain and ATM10's worldgen never line up; the seam becomes a fold (plateau, basin or tilted edge with cliffs, falls and overgrowth). This page covers the porter side (layers 1 and 2) and the hand-off to the in-game passes.

1. porter blend

Runs on the output of porter remap (or as part of porter all):

uv run porter blend --out <new world> [--width 1] [--min-section -4] [--max-section 20] [--pregen-margin 3]
whatwherewhy
Heightmaps removed, isLightOn: 0b, section SkyLight/BlockLight removedevery imported chunkblocks changed in the remap; the game recomputes heightmaps and light on load
blending_data: {min_section: -4, max_section: 20}outer ring of each mask (--width chunks, Chebyshev distance to a chunk outside the mask)vanilla old-chunk blending: freshly generated neighbours ease their terrain and biomes towards tagged chunks (only tagged chunks blend, MC-266343)
blending_data removedinner chunksthey never border new terrain
biomesunchangedalready remapped to ATM10 biomes
tinfoil/masks/<dim with ':' → '__'>.jsonoutput world{"dimension": "minecraft:overworld", "chunks": [[cx, cz], ...]}: the imported chunks, input of /tinfoil fold
tinfoil/pregen.txtoutput worldChunky commands per cluster
tinfoil/blend.jsonoutput worldring/chunk counts per dimension

The section range −4…20 is the full 1.21 overworld height (y −64…319).

2. Import and pre-generation

  1. Create the new world: same seed -781762391954646974, normal level type, ATM10 + Tinfoil (concept §3.3). Don't fly around the base areas yet.

  2. Stop the server and copy the porter output into the world folder (region/, entities/, poi/ per dimension, playerdata/, stats/, advancements/, tinfoil/). The imported region files must not overwrite region files the game has already generated; if they do, import with MCA Selector (Import chunks, overwrite on) instead of copying files.

  3. Start the server and run the blocks of tinfoil/pregen.txt in the console, one cluster at a time (wait for Chunky's "Task finished"). Each block generates a square around the cluster plus --pregen-margin chunks (default 3) of new terrain, so the fold pass has finished neighbours to work against:

    # overworld#1: 2021 chunks, blocks 9600..10767 x -608..159
    chunky world minecraft:overworld
    chunky shape square
    chunky center 10184 -224
    chunky radius 632
    chunky start
    

    Chunky skips chunks that already exist, so the imported chunks are only loaded (and upgraded by the DataFixer), never regenerated.

  4. /tinfoil scan compares the loaded chunks with tinfoil/expected.json (porter report): unknown or air-replaced blocks must be 0.

3. Fold, falls and overgrowth passes (in the mod)

/tinfoil fold list | preview <mask> | apply <mask> | undo <mask> | status works on the masks the porter writes to <world>/tinfoil/masks/<name>.json ({"dimension", "chunks": [[cx, cz], ...]}). A job runs a few chunks per tick:

  1. Survey: terrain height per column (trees, plants, snow layers ignored) and its top block.
  2. Plan: the mask's border height is the median of nearby border columns (a tower on the edge doesn't count). Step ≤ 3: gentle blend. Larger: lip at base height, then terraced cliffs (a ledge per ~8 blocks of step) down (plateau) or up (basin) to the new terrain within the band ([folds] bandWidth, default 32). The cliff line wobbles along the edge, never back up outwards.
  3. Apply: raised ground is local stone with megalith-limestone strata every 6 blocks (Bermuda stone below y 0), 2 blocks of subsoil and the original surface block on top; carved ground keeps its surface block.
  4. Falls: on lips with ≥ 6 blocks drop, every ~100/fallsPer100Blocks blocks of edge (min. 28 apart): a 2–5 wide water groove walled behind and at the ends pours over the edge; at the foot a pool dug one block into the ground (so it can't spill) with a Waterfall Mist block (spray, mist, glints by day).
  5. Overgrowth: vines, signal moss (glowing, new) and glow lichen on cliff walls; moss carpet, ferns, azaleas and lilies on grassy tops and ledges (overgrowth density); ruin pieces every ~ruinSpacing blocks where they fit entirely in the band.
  6. Undo: every changed block's old state is saved per chunk in <world>/tinfoil/fold-undo/<mask>/; undo puts them back. A re-run keeps the oldest snapshot.

Never writes inside the mask. Preview shows the cliff line with particles (end rods = plateau, soul flames = basin, green = gentle) for 30 s without changing anything.