QcServerClient Struct
Server-internal state of one connected client, shared by the parts of QcServer, grouped by what it is for (decision E-367). More...
| Header: | #include <server/core/QcServerClient.h> |
| Inherits: | QcEntity |
Public Types
| struct | Advancements |
| struct | Anvil |
| struct | Crafting |
| struct | Enchanting |
| struct | Fishing |
| struct | Foes |
| struct | HeldContainer |
| struct | Input |
| struct | Login |
| struct | Mining |
| struct | Screen |
| struct | SentEntity |
| struct | Stonecutter |
| struct | View |
| enum class | State { AwaitingHello, AwaitingLogin, Playing, Closed } |
Public Functions
Public Variables
| QcServerClient::Advancements | advancements |
| QcAirSupply | air |
| QcAppearance | appearance |
| double | attackCooldown |
| std::unique_ptr<QcConnection> | connection |
| QcServerClient::Crafting | crafting |
| bool | dead |
| int | drawSlot |
| quint64 | drawStart |
| bool | drawing |
| QcStatusEffects | effects |
| quint32 | enchantSeed |
| QcEquipment | equipment |
| QcExperience | experience |
| double | fallPeak |
| QcServerClient::Fishing | fishing |
| QcServerClient::Foes | foes |
| QcGameMode | gameMode |
| double | health |
| QcHunger | hunger |
| QcHurtWindow | hurt |
| bool | hurtThisTick |
| QcServerClient::Input | input |
| QcInventory | inventory |
| bool | joined |
| QcEquipment | keptEquipment |
| QcInventory | keptInventory |
| qint32 | listedLatencyUs |
| bool | local |
| QcServerClient::Login | login |
| QcServerClient::Mining | mining |
| QString | name |
| bool | pauseRefusalLogged |
| bool | pauseRequested |
| quint32 | pendingBlockAck |
| float | pitch |
| std::optional<QcVec3> | previousPosition |
| quint32 | runeSeed |
| QcServerClient::Screen | screen |
| std::optional<QcMsg::PlayerAir> | sentAir |
| QcStatusEffects | sentEffects |
| std::optional<QcExperience> | sentExperience |
| int | sentFood |
| std::optional<QcMsg::Weather> | sentWeather |
| bool | sneakedBefore |
| bool | sneaking |
| bool | sprinting |
| QcServerClient::State | state |
| bool | stateDirty |
| bool | swung |
| QHash<QcItemId, quint64> | throwReady |
| QcServerClient::View | view |
| int | voidTicks |
Static Public Members
| const QcEntityKind | entityKind |
| const int | inputMargin |
| const double | maxHealth |
| const int | maxInputBudget |
| const qsizetype | maxMiningResendsPerTick |
Detailed Description
Its player is an entity like the others (decision E-364): id, motion and yaw are the player's; only its inputs move it (QcEntityMotion::stepPlayer), and it never rests.
Member Type Documentation
enum class QcServerClient::State
Where the client stands in its connection.
| Constant | Value | Description |
|---|---|---|
QcServerClient::State::AwaitingHello | 0 | Connected, the Hello has not come yet. |
QcServerClient::State::AwaitingLogin | 1 | The LoginChallenge went out, the answer has not come yet. |
QcServerClient::State::Playing | 2 | Logged in and playing. |
QcServerClient::State::Closed | 3 | The connection is closed; the client is removed. |
Member Function Documentation
bool QcServerClient::hasBody() const
Returns whether the player's body is in the world: playing, alive and no spectator (decision E-730). Only such a body is seen by others, noticed by creatures, hit, pushed and pressing plates.
QcGameModes::Rules QcServerClient::rules() const
Returns the rules of the player's game mode.
Member Variable Documentation
QcServerClient::Advancements QcServerClient::advancements
The adventure guide's progress and what the client has heard of it.
QcAppearance QcServerClient::appearance
The player's look: skin, cape and the rest others see.
double QcServerClient::attackCooldown
Seconds until an attack deals full damage again.
std::unique_ptr<QcConnection> QcServerClient::connection
The connection to the client.
quint32 QcServerClient::enchantSeed
Fixes the enchanting table's offers until the player enchants (decision E-864); saved with the player, 0 until the server draws one.
const QcEntityKind QcServerClient::entityKind
The kind of every entity of this type (QcEntity::as).
QcEquipment QcServerClient::equipment
Armour slots; sent to the player and to everyone who sees them.
QcExperience QcServerClient::experience
Experience (QcServerExperience, decision E-398).
double QcServerClient::fallPeak
Highest point of the current fall, for fall damage.
QcServerClient::Fishing QcServerClient::fishing
Fishing with a rod.
QcServerClient::Foes QcServerClient::foes
The creatures this player fought lately.
QcHunger QcServerClient::hunger
Food, saturation and exhaustion (QcPlayerHealth).
QcHurtWindow QcServerClient::hurt
The short invulnerability after a hurt (game rule playerInvulnerabilityTicks, decision E-429).
bool QcServerClient::hurtThisTick
Set when damage was taken; reported to other clients in this tick's sync.
QcInventory QcServerClient::inventory
The hotbar and the main inventory.
bool QcServerClient::joined
The player joined the world (restored or spawned, decision E-367).
qint32 QcServerClient::listedLatencyUs
The round trip the player list shows for the client (decision E-886), in microseconds; -1 while unknown. A display value: the client's reports replace it only when the change shows (QcServerState::reportLatency).
bool QcServerClient::local
Connected through the in-process host (the local single player): exempt from the chat limit, always an operator, no login.
const double QcServerClient::maxHealth
The health of a player at full health.
const qsizetype QcServerClient::maxMiningResendsPerTick
Blocks resent per tick for dropped mining messages (QcServer::resendDroppedMiningTarget).
QString QcServerClient::name
The player's name.
bool QcServerClient::pauseRefusalLogged
A network client's pause request was refused in the log already (once per connection).
bool QcServerClient::pauseRequested
The player has the pause menu open (QcMsg::PauseRequest, decision E-877); only a local player's wish pauses the server (QcServerPause).
quint32 QcServerClient::pendingBlockAck
The highest prediction sequence (decision E-853) of the actions handled since the last world sync; acknowledged after it (BlockAck), so the client knows the drops and other entities of the actions by then. 0: nothing to acknowledge.
float QcServerClient::pitch
The player's body and look; id, motion and yaw are in QcEntity.
std::optional<QcVec3> QcServerClient::previousPosition
Position before the last processed input; actions may have been aimed from there.
quint32 QcServerClient::runeSeed
Orders the runes of the enchanting screen (decision E-884): drawn on its own whenever enchantSeed is, so the client learns nothing about the offers from it; saved with the player.
std::optional<QcExperience> QcServerClient::sentExperience
The experience the client last got; none before the first message.
int QcServerClient::sentFood
Food points last sent to the client; -1 before the first message.
std::optional<QcMsg::Weather> QcServerClient::sentWeather
The weather last sent to the client (QcServerWeather); none before the first message.
bool QcServerClient::sneakedBefore
Whether the player sneaked on the input before the latest one: the server still accepts an aim from the crouched eyes then (QcLineOfSight, decision E-961).
QcServerClient::State QcServerClient::state
Where the client stands in its connection.
bool QcServerClient::stateDirty
The client must get its position again (PlayerState): a correction or an acknowledged input.
bool QcServerClient::swung
Set by actions that swing the arm; reported to other clients in this tick's sync.
QHash<QcItemId, quint64> QcServerClient::throwReady
The tick from which each thrown item may be thrown again (decision E-427, QcPlayerThrows).
int QcServerClient::voidTicks
Ticks spent below the void limit in a row (QcPlayerHealth::applyVoidDamage).