QtCraft API C++ classes QML types Handbook

QcFlatGenerator Class

World generator of the flat world type (decision E-223): the same layers everywhere, from a preset like "bedrock,59*stone,3*dirt,grass_block" (bottom up, n* repeats a layer, names without a namespace are the base game's). More...

Header: #include <worldgen/generators/QcFlatGenerator.h>
Inherits: QcWorldGenerator

Public Functions

QcFlatGenerator(std::shared_ptr<const QcContentRegistry> content, const QString &preset)
const QList<QcBlockId> &layers() const

Reimplemented Public Functions

virtual std::shared_ptr<QcChunk> generate(QcChunkPos pos) const override
virtual bool isNaturalGround(QcBlockId block) const override
virtual QcWorldSetup setup() const override
virtual QcBlockPos spawnPoint() const override

Static Public Members

QcResult<QList<QcBlockId>> parseLayers(const QString &preset, const QcContentRegistry &content)

Detailed Description

No caves, ores, features or structures; the spawn is on top at the origin. The world's rules (worldgen/flat.json) are set up once. Deterministic, seed ignored.

Member Function Documentation

QcFlatGenerator::QcFlatGenerator(std::shared_ptr<const QcContentRegistry> content, const QString &preset)

Builds the layers from preset with the blocks of content. An invalid preset falls back to the content's default with a warning; empty takes the default.

[override virtual] std::shared_ptr<QcChunk> QcFlatGenerator::generate(QcChunkPos pos) const

Reimplements: QcWorldGenerator::generate(QcChunkPos pos) const.

[override virtual] bool QcFlatGenerator::isNaturalGround(QcBlockId block) const

Reimplements: QcWorldGenerator::isNaturalGround(QcBlockId block) const.

const QList<QcBlockId> &QcFlatGenerator::layers() const

Returns the block per height from y 0 up.

[static] QcResult<QList<QcBlockId>> QcFlatGenerator::parseLayers(const QString &preset, const QcContentRegistry &content)

Returns the block per height from y 0 up that preset names, with block names looked up in content; an error for unknown blocks, bad counts, no layers or too many layers.

[override virtual] QcWorldSetup QcFlatGenerator::setup() const

Reimplements: QcWorldGenerator::setup() const.

[override virtual] QcBlockPos QcFlatGenerator::spawnPoint() const

Reimplements: QcWorldGenerator::spawnPoint() const.