QtCraft API C++ classes QML types Handbook

QcWorldInfo Struct

Metadata of a saved world (world.json). More...

Header: #include <common/world/QcWorldInfo.h>

Public Functions

void readGameRules(const QJsonObject &rules)

Public Variables

QcAdventureRules adventure
bool announceAdvancements
QList<QcPlacedChunkLoader> chunkLoaders
QDateTime created
bool daylightCycle
QcGameMode defaultGameMode
bool drowningDamage
bool explosionBlockDamage
bool fireSpread
QList<QcChunkPos> forcedChunks
QString generator
QString generatorOptions
int generatorVersion
bool keepInventory
QDateTime lastPlayed
QJsonObject limits
int maxEntityCramming
bool mobGriefing
int mobInvulnerabilityTicks
bool mobSpawning
QString name
quint64 nextCreatureId
quint32 nextMapId
QList<QcPackReference> packs
int playerInvulnerabilityTicks
bool quasiConnectivity
bool randomTicks
qint64 seed
bool setupDone
int spawnChunkRadius
QString unknownGameMode
QcWeatherState weather
bool weatherCycle
QJsonObject worldOptions
double worldTime

Static Public Members

const char *const defaultGenerator
const int defaultInvulnerabilityTicks
const int formatVersion
const int maxEntityCrammingLimit
const int maxInvulnerabilityTicks
const int maxSpawnChunkRadius
const int oldestFormatVersion

Detailed Description

A world names the format version of its files; worlds of older development versions are refused, not converted (decision E-356, QtCraft has not been released). What each format changed is recorded in docs/Entscheidungen.md.

Member Function Documentation

void QcWorldInfo::readGameRules(const QJsonObject &rules)

Takes the game rules of world.json ("gameRules", rules); a missing rule gets its default.

Member Variable Documentation

QcAdventureRules QcWorldInfo::adventure

What players in adventure mode may break and act on (decision E-735, world.json "adventure"; a world without the key allows nothing).

bool QcWorldInfo::announceAdvancements

Game rule: the other players read in the chat when someone reaches an advancement (decision E-924); off, only the toast of the player himself shows it.

QList<QcPlacedChunkLoader> QcWorldInfo::chunkLoaders

Every chunk loader block of the world in the order they were placed (decision E-377).

QDateTime QcWorldInfo::created

When the world was created.

QcGameMode QcWorldInfo::defaultGameMode

Game mode of players who join the world for the first time (decision E-282), chosen when the world is created; worlds without the key are survival worlds.

const char *const QcWorldInfo::defaultGenerator

The generator of a world that names none.

bool QcWorldInfo::drowningDamage

Game rule: players and creatures without air under water take damage (decision E-955); off, the air still runs out but nobody drowns.

bool QcWorldInfo::explosionBlockDamage

Game rule: explosions break, light and blow away blocks (decision E-603); off, they still hurt and push bodies but leave every block as it is, lit explosives included.

bool QcWorldInfo::fireSpread

Game rule: fire spreads to flammable blocks and burns them away (decision E-392); off, fires only burn where they are until they go out.

QList<QcChunkPos> QcWorldInfo::forcedChunks

Chunks kept loaded by /forceload (decision E-377), in the order they were added.

const int QcWorldInfo::formatVersion

The format version of the files this game writes.

int QcWorldInfo::generatorVersion

The version of the world generator the world is generated with for good (decision E-922, QcGeneratorVersion); worlds saved without one have QcGeneratorVersion::unversioned.

bool QcWorldInfo::keepInventory

Game rule: players keep their inventory when they die instead of dropping it.

QDateTime QcWorldInfo::lastPlayed

When it was last played.

QJsonObject QcWorldInfo::limits

The world's simulation limits (decision E-349) as written in world.json ("limits"), only the keys an operator set; a single-player world plays with them, a dedicated server ignores them.

int QcWorldInfo::maxEntityCramming

Game rule (decision E-401): creatures in one block cell beyond this many take cramming damage, as in the reference (0: never).

const int QcWorldInfo::maxEntityCrammingLimit

The largest maxEntityCramming.

const int QcWorldInfo::maxSpawnChunkRadius

The largest spawnChunkRadius.

bool QcWorldInfo::mobGriefing

Game rule: creatures change blocks of the world (shadewalkers take and place blocks, decision E-460); off, they leave every block as it is.

QString QcWorldInfo::name

The world's name.

quint64 QcWorldInfo::nextCreatureId

The persistent id the next saved creature gets (QcMobManager::nextUid, decision E-420); saved with the chunks in one journal, so it lies beyond every id saved in them.

quint32 QcWorldInfo::nextMapId

The id the next new map gets (QcMapStore::nextId, decision E-799); saved with the maps in one journal, so ids of maps whose files were kept aside or lost are not handed out again.

const int QcWorldInfo::oldestFormatVersion

The oldest format version this game reads; older worlds are refused.

QList<QcPackReference> QcWorldInfo::packs

Content packs (base game and mods) used when the world was last saved.

bool QcWorldInfo::quasiConnectivity

Game rule: pistons that allow it are also powered through the block above them, noticed only with a block update next to them (quasi-connectivity, decision E-338).

bool QcWorldInfo::randomTicks

Game rule: blocks get random ticks (growing plants, crops, soil; decision E-295).

qint64 QcWorldInfo::seed

The world's seed.

bool QcWorldInfo::setupDone

Whether the generator's one-time setup of the world has run.

int QcWorldInfo::spawnChunkRadius

Game rule (decision E-377): the chunks around the spawn column within this many chunks minus one stay loaded (0: none, 1: the spawn chunk, 2: 3 x 3 chunks …).

QString QcWorldInfo::unknownGameMode

A mode name this version does not know (from a newer game): the world plays as survival but keeps the name when saved, until /defaultgamemode sets another mode.

QcWeatherState QcWorldInfo::weather

The weather and its course (world.json "weather"; a world without it begins with a clear spell).

bool QcWorldInfo::weatherCycle

Game rule: the weather changes by itself (decision E-395); off, it stays as it is until /weather changes it.

QJsonObject QcWorldInfo::worldOptions

The world generation options of a terrain world (decision E-917, QcWorldOptions), stored in full when the world is created: option name -> number or true/false. Empty for worlds without them, which generate with the content's values alone.

double QcWorldInfo::worldTime

Seconds since the world was created, drives the day/night cycle.