QtCraft API C++ classes QML types Handbook

QcSurfaceLakes Class

Lakes of liquid on the surface of dry land: the pools with surface (lava lakes, decision E-856), like the reference game since 1.18. More...

Header: #include <worldgen/terrain/QcSurfaceLakes.h>

Public Types

struct Blob
struct Site
Pool

Public Functions

QcSurfaceLakes(const QcTerrainGenerator &terrain, const QcTerrainDefinitions &definitions, std::shared_ptr<const QcContentRegistry> content)
void carve(QcChunk &chunk, const QcSurfaceLakes::Site &site, const QcTerrainColumnGrid &columns) const
int depthAt(const QcSurfaceLakes::Site &site, int x, int z) const
std::optional<QcSurfaceLakes::Site> siteIn(QcChunkPos pos) const

Detailed Description

One per square of region chunks at most: with chance, up to attempts chunks of the square are tried in turn (never within spacing chunks of the next square) and the first fitting site taken. A site is planned from the terrain columns alone (never from generated chunks), so neighbouring chunks keep their trees off it alike: an irregular basin of a few overlapping ellipses inside its chunk, on level ground of an allowed biome away from water, its liquid 1–2 blocks below the lowest ground around it. Thread-safe; plans are cached by square.

Member Type Documentation

[alias] QcSurfaceLakes::Pool

A pool definition of the terrain.

Member Function Documentation

QcSurfaceLakes::QcSurfaceLakes(const QcTerrainGenerator &terrain, const QcTerrainDefinitions &definitions, std::shared_ptr<const QcContentRegistry> content)

Reads the pools from definitions; content tells which blocks are solid or liquid. terrain must outlive the lakes (the terrain generator owns them).

void QcSurfaceLakes::carve(QcChunk &chunk, const QcSurfaceLakes::Site &site, const QcTerrainColumnGrid &columns) const

Writes the lake site into its chunk, whose terrain columns give the ground: the basin dug out above the level, liquid below it, rim where the liquid would touch air or soil, rock and no plants on the ground around it.

int QcSurfaceLakes::depthAt(const QcSurfaceLakes::Site &site, int x, int z) const

Returns the liquid's depth at the column x, z (world) of the basin of site, 0 outside it.

std::optional<QcSurfaceLakes::Site> QcSurfaceLakes::siteIn(QcChunkPos pos) const

Returns the lake planned in the chunk at pos, before villages and structures are asked.