QtCraft API C++ classes QML types Handbook

QcClientGameMode Class

The local player's game mode as the server reported it (decision E-282), with the world's adventure allow-lists in adventure mode (decision E-735), and what the client does with it: the wish to fly that goes with every input (decision E-284), the pace of instant breaking in creative mode, and the requests for catalogue items (E-283) and picked blocks (E-285). More...

Header: #include <clientcore/player/QcClientGameMode.h>

Public Types

Sender
WishListener

Public Functions

const QcAdventureRules &adventure() const
void creativeItem(int slot, const QcItemStack &stack) const
bool flightWanted() const
void mirrorFlight(bool wanted)
QcGameMode mode() const
std::optional<QcBlockPos> nextInstantBreak(std::optional<QcBlockPos> mined)
void pickBlock(QcBlockPos pos) const
void releaseInstantBreak()
QcGameModes::Rules rules() const
void setAdventure(QcAdventureRules adventure)
void setFlightWanted(bool wanted)
void setMode(QcGameMode mode)
void setSender(QcClientGameMode::Sender sender)
void setWishListener(QcClientGameMode::WishListener listener)
void stepped(bool flying)
void toggleFlight()

Static Public Members

const int instantBreakTicks
quint8 steppedFlySpeed(quint8 speed, int steps)

Detailed Description

Member Type Documentation

[alias] QcClientGameMode::Sender

Sends a request to the server.

[alias] QcClientGameMode::WishListener

Takes the player's wish to fly to where the inputs are made (the session's tick core).

Member Function Documentation

const QcAdventureRules &QcClientGameMode::adventure() const

Returns the allow-lists that came with the mode (empty outside adventure mode).

See also setAdventure().

void QcClientGameMode::creativeItem(int slot, const QcItemStack &stack) const

The creative catalogue: puts stack into slot (QcMsg::CreativeItem); the server refuses it outside creative mode.

bool QcClientGameMode::flightWanted() const

Returns the wish sent with the next input.

See also setFlightWanted().

void QcClientGameMode::mirrorFlight(bool wanted)

Takes the wish wanted as the tick core holds it, without telling the listener (decision E-560).

QcGameMode QcClientGameMode::mode() const

Returns the game mode the server reported.

See also setMode().

std::optional<QcBlockPos> QcClientGameMode::nextInstantBreak(std::optional<QcBlockPos> mined)

Instant breaking: returns the block to break this tick (or none), given the block the player mines, mined (none while the button is up). The first strike breaks at once, holding repeats every instantBreakTicks.

void QcClientGameMode::pickBlock(QcBlockPos pos) const

The middle mouse button on the block at pos (QcMsg::PickBlock).

void QcClientGameMode::releaseInstantBreak()

The button went up: the next press is a first strike again, even before the next tick.

QcGameModes::Rules QcClientGameMode::rules() const

Returns the rules of the game mode.

void QcClientGameMode::setAdventure(QcAdventureRules adventure)

Takes the adventure allow-lists that came with the mode.

See also adventure().

void QcClientGameMode::setFlightWanted(bool wanted)

Sets the wish wanted directly (control interface); tells the wish listener.

See also flightWanted().

void QcClientGameMode::setMode(QcGameMode mode)

Takes the game mode the server reported.

See also mode().

void QcClientGameMode::setSender(QcClientGameMode::Sender sender)

Sets sender, how requests reach the server (the session's connection).

void QcClientGameMode::setWishListener(QcClientGameMode::WishListener listener)

Sets where the wish to fly goes to listener.

void QcClientGameMode::stepped(bool flying)

After each predicted step, flying as predicted: a landing or a mode without flight ended the flight, so the wish follows the predicted state.

[static] quint8 QcClientGameMode::steppedFlySpeed(quint8 speed, int steps)

Returns the spectator's flight speed (QcPlayerInput::flySpeed) after steps notches of the mouse wheel (up is faster), within its range (decision E-730).

void QcClientGameMode::toggleFlight()

Double tap of jump: starts or ends a flight where the mode allows flying.

Member Variable Documentation

const int QcClientGameMode::instantBreakTicks

While the mine button is held in creative mode, the next block breaks this many ticks after the previous one (the model waits about as long).