QtCraft API C++ classes QML types Handbook

QcVillageFields Namespace

The fields of a village (decision E-406): the crop cells of a piece (blocks with crop) are planted from the style's crops, one crop per row (a run of crop cells along x in one layer), each cell ripe with ripeChance and otherwise at a random earlier stage. More...

Header: #include <worldgen/villages/QcVillageFields.h>

Variables

const double ripeChance

Functions

QList<QcBlockPos> cropCells(const QcStructure &structure, const QcContentRegistry &content)
bool hasCrops(const QcStructure &structure, const QcContentRegistry &content)
std::shared_ptr<const QcStructure> plant(const QcStructure &structure, const QList<QcVillageStyle::Crop> &crops, const QcContentRegistry &content, const std::function<double ()> &random)

Detailed Description

Draws come from the caller's sequence, so a field is a pure function of the seed like the rest of the plan.

Variable Documentation

const double QcVillageFields::ripeChance

The chance of a planted crop cell to be ripe (its last stage).

Function Documentation

QList<QcBlockPos> QcVillageFields::cropCells(const QcStructure &structure, const QcContentRegistry &content)

Returns the crop cells of structure (local cells; blocks that are crops in content), x fastest, then z, then y.

bool QcVillageFields::hasCrops(const QcStructure &structure, const QcContentRegistry &content)

Returns whether structure has crop cells (blocks that are crops in content).

std::shared_ptr<const QcStructure> QcVillageFields::plant(const QcStructure &structure, const QList<QcVillageStyle::Crop> &crops, const QcContentRegistry &content, const std::function<double ()> &random)

Returns a copy of structure with its crop cells (crops in content) planted from crops (not empty) by weight; random yields values in [0, 1).