Cuberite
A lightweight, fast and extensible game server for Minecraft
|
#include <Player.h>
Classes | |
struct | BodyStanceCrouching |
Tag representing a sneaking pose. More... | |
struct | BodyStanceGliding |
Tag representing a swimming or elytra flying pose. More... | |
struct | BodyStanceSleeping |
Tag representing a sleeping pose. More... | |
struct | BodyStanceSprinting |
Tag representing a sprinting pose. More... | |
struct | BodyStanceStanding |
Tag representing the neutral stance. More... | |
Public Member Functions | |
void | AbortEating (void) |
Aborts the current eating operation. More... | |
void | AddFoodExhaustion (double a_Exhaustion) |
Adds the specified exhaustion to m_FoodExhaustion. More... | |
void | AddInventoryPaintSlot (int a_SlotNum) |
Adds a slot to the list for inventory painting. More... | |
void | AddKnownItem (const cItem &a_Item) |
Adds an Item to the list of known items. More... | |
void | AwardAchievement (CustomStatistic a_Ach) |
Awards the player an achievement. More... | |
void | CancelChargingBow (void) |
Cancels the current bow charging. More... | |
virtual bool | CanFly (void) const |
Returns wheter the player can fly or not. More... | |
bool | CanInstantlyMine (BLOCKTYPE a_Block) |
Given tool, enchantments, status effects, and world position returns whether a_Block would be instantly mined. More... | |
bool | CanMobsTarget (void) const |
Returns true if the player can be targeted by Mobs. More... | |
void | ClearInventoryPaintSlots (void) |
Clears the list of slots that are being inventory-painted. More... | |
void | CloseWindow (bool a_CanRefuse=true) |
Closes the current window, resets current window to m_InventoryWindow. More... | |
void | CloseWindowIfID (char a_WindowID, bool a_CanRefuse=true) |
Closes the current window if it matches the specified ID, resets current window to m_InventoryWindow. More... | |
cPlayer (const std::shared_ptr< cClientHandle > &a_Client) | |
int | DeltaExperience (int a_Xp_delta) |
bool | DoesPlacingBlocksIntersectEntity (std::initializer_list< sSetBlock > a_Blocks) const |
Whether placing the given blocks would intersect any entitiy. More... | |
bool | Feed (int a_Food, double a_Saturation) |
Adds to FoodLevel and FoodSaturationLevel, returns true if any food has been consumed, false if player "full". More... | |
int | FinishChargingBow (void) |
Finishes charging the current bow. More... | |
void | FinishEating (void) |
Finishes eating the currently equipped item. More... | |
void | ForceSetSpeed (const Vector3d &a_Speed) |
Forces the player to move in the given direction. More... | |
void | Freeze (const Vector3d &a_Location) |
Prevent the player from moving and lock him into a_Location. More... | |
cClientHandle * | GetClientHandle (void) const |
AString | GetColor (void) const |
Returns the full color code to use for this player, based on their rank. More... | |
int | GetCurrentXp (void) |
Gets the current experience. More... | |
const AString & | GetCustomName (void) const |
Returns the custom name of this player. More... | |
cItem & | GetDraggingItem (void) |
In UI windows, get the item that the player is dragging. More... | |
eGameMode | GetEffectiveGameMode (void) const |
Returns the current effective gamemode (inherited gamemode is resolved before returning) More... | |
MTRand | GetEnchantmentRandomProvider () |
Get a copy of the PRNG for enchanting related generation, don't use this for other purposes. More... | |
cItemGrid & | GetEnderChestContents (void) |
Gets the contents of the player's associated enderchest. More... | |
virtual cItem | GetEquippedBoots (void) const override |
Returns the currently equipped boots; empty item if none. More... | |
virtual cItem | GetEquippedChestplate (void) const override |
Returns the currently equipped chestplate; empty item if none. More... | |
virtual cItem | GetEquippedHelmet (void) const override |
Returns the currently equipped helmet; empty item if none. More... | |
const cItem & | GetEquippedItem (void) const |
virtual cItem | GetEquippedLeggings (void) const override |
Returns the currently equipped leggings; empty item if none. More... | |
virtual cItem | GetEquippedWeapon (void) const override |
Returns the curently equipped weapon; empty item if none. More... | |
double | GetEyeHeight (void) const |
Vector3d | GetEyePosition (void) const |
UInt32 | GetFloaterID (void) const |
double | GetFlyingMaxSpeed (void) const |
Gets the flying relative maximum speed. More... | |
double | GetFoodExhaustionLevel (void) const |
int | GetFoodLevel (void) const |
double | GetFoodSaturationLevel (void) const |
int | GetFoodTickTimer (void) const |
eGameMode | GetGameMode (void) const |
Returns the current gamemode. More... | |
cInventory & | GetInventory (void) |
const cInventory & | GetInventory (void) const |
const cSlotNums & | GetInventoryPaintSlots (void) const |
Returns the list of slots currently stored for inventory painting. More... | |
AString | GetIP (void) const |
const std::set< UInt32 > & | GetKnownRecipes () const |
Gets the set of IDs for recipes this player has discovered. More... | |
Vector3i | GetLastBedPos (void) const |
Gets the player's potential respawn position (named LastBedPos for compatibility reasons). More... | |
const AString & | GetLoadedWorldName () const |
double | GetMaxSpeed (void) const |
Returns the current relative maximum speed (takes current sprinting / flying state into account) More... | |
float | GetMiningProgressPerTick (BLOCKTYPE a_Block) |
Returns the progress mined per tick for the block a_Block as a fraction (1 would be completely mined) Depends on hardness values so check those are correct. More... | |
const AString & | GetName (void) const |
double | GetNormalMaxSpeed (void) const |
Gets the normal relative maximum speed. More... | |
virtual cItem | GetOffHandEquipedItem (void) const override |
Returns the currently offhand equipped item; empty item if none. More... | |
const AStringVector & | GetPermissions (void) const |
Returns all the permissions that the player has assigned to them. More... | |
AString | GetPlayerListName (void) const |
Returns the name that is used in the playerlist. More... | |
AString | GetPrefix (void) const |
Returns the player name prefix, may contain @ format directives. More... | |
cWorld * | GetRespawnWorld () |
const AStringVector & | GetRestrictions (void) const |
Returns all the restrictions that the player has assigned to them. More... | |
int | GetSkinParts (void) const |
double | GetSprintingMaxSpeed (void) const |
Gets the sprinting relative maximum speed. More... | |
StatisticsManager & | GetStatistics () |
Return the associated statistic and achievement manager. More... | |
AString | GetSuffix (void) const |
Returns the player name suffix, may contain @ format directives. More... | |
cTeam * | GetTeam (void) |
Returns the associated team, nullptr if none. More... | |
const cTeam * | GetTeam (void) const |
Returns the associated team, nullptr if none. More... | |
Vector3d | GetThrowSpeed (double a_SpeedCoeff) const |
Returns the initial speed vector of a throw, with a 3D length of a_SpeedCoeff. More... | |
Vector3d | GetThrowStartPos (void) const |
Returns the position where projectiles thrown by this player should start, player eye position + adjustment. More... | |
const cUUID & | GetUUID (void) const |
Returns the UUID that has been read from the client, or nil if not available. More... | |
cWindow * | GetWindow (void) |
const cWindow * | GetWindow (void) const |
int | GetXpLevel (void) const |
Gets the current level - XpLevel. More... | |
int | GetXpLifetimeTotal (void) |
Gets the experience total - XpTotal for score on death. More... | |
float | GetXpPercentage (void) const |
Gets the experience bar percentage - XpP. More... | |
bool | HasCustomName (void) const |
Returns true if the player has a custom name. More... | |
bool | HasPermission (const AString &a_Permission) const |
bool | HasSkinPart (eSkinPart a_Part) const |
virtual void | Heal (int a_Health) override |
Heals the player by the specified amount of HPs (positive only); sends health update. More... | |
bool | IsChargingBow (void) const |
Returns true if the player is currently charging the bow. More... | |
bool | IsClimbing (void) const |
Returns whether the player is climbing (ladders, vines etc.) More... | |
virtual bool | IsCrouched (void) const override |
bool | IsEating (void) const |
Returns true if the player is currently in the process of eating the currently equipped item. More... | |
virtual bool | IsFireproof () const override |
Returns true if the player is fireproof Stops players burning in creative or spectator modes. More... | |
bool | IsFishing (void) const |
Returns true if the player has thrown out a floater. More... | |
bool | IsFlying (void) const |
Returns true if the player is currently flying. More... | |
bool | IsFrozen () |
Is the player frozen? More... | |
bool | IsGameModeAdventure (void) const |
Returns true if the player is in Adventure mode, either explicitly, or by inheriting from current world. More... | |
bool | IsGameModeCreative (void) const |
Returns true if the player is in Creative mode, either explicitly, or by inheriting from current world. More... | |
bool | IsGameModeSpectator (void) const |
Returns true if the player is in Spectator mode, either explicitly, or by inheriting from current world. More... | |
bool | IsGameModeSurvival (void) const |
Returns true if the player is in Survival mode, either explicitly, or by inheriting from current world. More... | |
bool | IsInBed (void) const |
Returns true if a player is sleeping in a bed. More... | |
bool | IsLeftHanded () const |
Returns true if the player's left hand is dominant. More... | |
virtual bool | IsOnGround (void) const override |
Returns whether the entity is on ground or not. More... | |
bool | IsRespawnPointForced (void) const |
Returns if the respawn point is unconditionally used. More... | |
bool | IsSatiated (void) const |
Returns true if the player is satiated, i. More... | |
virtual bool | IsSprinting (void) const override |
bool | IsStanding () const |
Returns true if a player is standing normally, that is, in a neutral pose. More... | |
virtual void | Killed (const cEntity &a_Victim, eDamageType a_DamageType) override |
Called when the entity kills another entity. More... | |
virtual void | KilledBy (TakeDamageInfo &a_TDI) override |
Called when the health drops below zero. More... | |
void | LoadFromDisk () |
Loads the player data from the save file. More... | |
void | LoadRank (void) |
(Re)loads the rank and permissions from the cRankManager and sends a permission level update to the client. More... | |
void | NotifyNearbyWolves (cPawn *a_Opponent, bool a_IsPlayerInvolved) |
Notify nearby wolves that the player or one of the player's wolves took damage or did damage to an entity. More... | |
void | OnLoseSpectated () |
Called when spectation stops, because the player crouched or when the entity we're spectating gets removed from the world. More... | |
void | OpenHorseInventory () |
Opens the inventory of any tame horse the player is riding. More... | |
void | OpenWindow (cWindow &a_Window) |
Opens the specified window; closes the current one first using CloseWindow() More... | |
void | PermuteEnchantmentSeed () |
Permute the seed for enchanting related PRNGs, don't use this for other purposes. More... | |
bool | PlaceBlock (Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) |
Attempts to place the block in the world with a call to PlaceBlocks. More... | |
bool | PlaceBlocks (std::initializer_list< sSetBlock > a_Blocks) |
Calls the block placement hooks and places the blocks in the world. More... | |
void | ReplaceOneEquippedItemTossRest (const cItem &) |
Removes one item from the the current equipped item stack, and attempts to add the specified item stack back to the same slot. More... | |
void | Respawn (void) |
void | SaveToDisk (void) |
Saves all player data, such as inventory, to JSON. More... | |
void | SendAboveActionBarMessage (const AString &a_Message) |
void | SendAboveActionBarMessage (const cCompositeChat &a_Message) |
void | SendBlocksAround (Vector3i a_BlockPos, int a_Range=1) |
Sends the block in the specified range around the specified coord to the client as a block change packet. More... | |
void | SendMessage (const AString &a_Message) |
void | SendMessage (const cCompositeChat &a_Message) |
void | SendMessageFailure (const AString &a_Message) |
void | SendMessageFatal (const AString &a_Message) |
void | SendMessageInfo (const AString &a_Message) |
void | SendMessagePrivateMsg (const AString &a_Message, const AString &a_Sender) |
void | SendMessageRaw (const AString &a_MessageRaw, eChatType a_Type=eChatType::ctChatBox) |
void | SendMessageSuccess (const AString &a_Message) |
void | SendMessageWarning (const AString &a_Message) |
void | SendRotation (double a_YawDegrees, double a_PitchDegrees) |
Sends the "look" packet to the player, forcing them to set their rotation to the specified values. More... | |
void | SendSystemMessage (const AString &a_Message) |
void | SendSystemMessage (const cCompositeChat &a_Message) |
void | SetBedPos (Vector3i a_Position) |
Sets the player's bed position to the specified position. More... | |
void | SetBedPos (Vector3i a_Position, const cWorld &a_World) |
Sets the player's bed position to the specified position. More... | |
void | SetCanFly (bool a_CanFly) |
If true the player can fly even when he's not in creative. More... | |
void | SetCrouch (bool a_ShouldCrouch) |
Starts or stops crouching, if our current body stance permits, broadcasting the state change. More... | |
bool | SetCurrentExperience (int a_XpTotal) |
Sets the experience total Returns true on success "should" really only be called at init or player death, plugins excepted. More... | |
void | SetCustomName (const AString &a_CustomName) |
Sets the custom name of this player. More... | |
void | SetDraggingItem (const cItem &a_Item) |
In UI windows, set the item that the player is dragging. More... | |
void | SetElytraFlight (bool a_ShouldElytraFly) |
Starts or stops elytra flight, if our current body stance permits, broadcasting the state change. More... | |
void | SetFlying (bool a_ShouldFly) |
Starts or stops flying, broadcasting the state change. More... | |
void | SetFlyingMaxSpeed (double a_Speed) |
Sets the flying relative maximum speed. More... | |
void | SetFoodExhaustionLevel (double a_FoodExhaustionLevel) |
void | SetFoodLevel (int a_FoodLevel) |
void | SetFoodSaturationLevel (double a_FoodSaturationLevel) |
void | SetFoodTickTimer (int a_FoodTickTimer) |
void | SetGameMode (eGameMode a_GameMode) |
Sets the gamemode for the player. More... | |
void | SetIsFishing (bool a_IsFishing, UInt32 a_FloaterID=cEntity::INVALID_ID) |
void | SetIsInBed (bool a_IsInBed) |
Sets a player's in-bed state. More... | |
void | SetLeftHanded (bool a_IsLeftHanded) |
Sets the dominant hand of the player. More... | |
void | SetNormalMaxSpeed (double a_Speed) |
Sets the normal relative maximum speed. More... | |
void | SetRespawnPosition (Vector3i a_Position, const cWorld &a_World) |
Sets the player's forced respawn position and world. More... | |
void | SetSkinParts (int a_Parts) |
void | SetSprint (bool a_ShouldSprint) |
Starts or stops sprinting, if our current body stance permits, broadcasting the state change. More... | |
void | SetSprintingMaxSpeed (double a_Speed) |
Sets the sprinting relative maximum speed. More... | |
void | SetTeam (cTeam *a_Team) |
Sets the player team, nullptr if none. More... | |
void | SetTouchGround (bool a_bTouchGround) |
void | SetVisible (bool a_bVisible) |
void | SpectateEntity (cEntity *a_Target) |
Spectates the target entity. More... | |
void | StartChargingBow (void) |
Starts charging the equipped bow. More... | |
void | StartEating (void) |
Starts eating the currently equipped item. More... | |
virtual void | TeleportToCoords (double a_PosX, double a_PosY, double a_PosZ) override |
Teleports to the coordinates specified. More... | |
void | TossEquippedItem (char a_Amount=1) |
tosses the item in the selected hotbar slot More... | |
void | TossHeldItem (char a_Amount=1) |
tosses the item held in hand (when in UI windows) More... | |
void | TossItems (const cItems &a_Items) |
Tosses a list of items. More... | |
void | TossPickup (const cItem &a_Item) |
tosses a pickup newly created from a_Item More... | |
void | Unfreeze () |
Cancels Freeze(...) and allows the player to move naturally. More... | |
void | UpdateCapabilities () |
Updates player's capabilities - flying, visibility, etc. More... | |
void | UpdateMovementStats (const Vector3d &a_DeltaPos, bool a_PreviousIsOnGround) |
Update movement-related statistics. More... | |
cTeam * | UpdateTeam (void) |
Forces the player to query the scoreboard for his team. More... | |
void | UseEquippedItem (cItemHandler::eDurabilityLostAction a_Action) |
Damage the player's equipped item by the amount of damage such an item is damaged by when used for a_Action. More... | |
void | UseEquippedItem (short a_Damage=1) |
Damage the player's equipped item by a_Damage, possibly less if the equipped item is enchanted. More... | |
void | UseItem (int a_SlotNumber, short a_Damage=1) |
Damage the item in a_SlotNumber by a_Damage, possibly less if the equipped item is enchanted. More... | |
virtual | ~cPlayer () override |
Public Member Functions inherited from cPawn | |
void | AddEntityEffect (cEntityEffect::eType a_EffectType, int a_EffectDurationTicks, short a_EffectIntensity, double a_DistanceModifier=1) |
Applies an entity effect. More... | |
void | ClearEntityEffects (void) |
Removes all currently applied entity effects (used when drinking milk) More... | |
cPawn (eEntityType a_EntityType, float a_Width, float a_Height) | |
cEntityEffect * | GetEntityEffect (cEntityEffect::eType a_EffectType) const |
Returns the entity effect, if it is currently applied or nullptr if not. More... | |
std::map< cEntityEffect::eType, cEntityEffect * > | GetEntityEffects () const |
Returns all entity effects. More... | |
virtual void | HandleAir (void) override |
Called in each tick to handle air-related processing i.e. More... | |
virtual void | HandleFalling (void) |
void | HandleFarmlandTrampling (double a_FallHeight, BLOCKTYPE a_BlockAtFoot, BLOCKTYPE a_BlockBelow) |
Handles farmland trampling when hitting the ground. More... | |
bool | HasEntityEffect (cEntityEffect::eType a_EffectType) const |
Returns true, if the entity effect is currently applied. More... | |
void | NoLongerTargetingMe (cMonster *a_Monster) |
Remove the monster from the list of monsters targeting this pawn. More... | |
void | RemoveEntityEffect (cEntityEffect::eType a_EffectType) |
Removes a currently applied entity effect. More... | |
void | StopEveryoneFromTargetingMe () |
Tells all pawns which are targeting us to stop targeting us. More... | |
void | TargetingMe (cMonster *a_Monster) |
Add the monster to the list of monsters targeting this pawn. More... | |
Public Member Functions inherited from cEntity | |
void | AddLeashedMob (cMonster *a_Monster) |
Adds a mob to the leashed list of mobs. More... | |
void | AddPosition (const Vector3d &a_AddPos) |
void | AddPosition (double a_AddPosX, double a_AddPosY, double a_AddPosZ) |
void | AddPosX (double a_AddPosX) |
void | AddPosY (double a_AddPosY) |
void | AddPosZ (double a_AddPosZ) |
void | AddSpeed (const Vector3d &a_AddSpeed) |
void | AddSpeed (double a_AddSpeedX, double a_AddSpeedY, double a_AddSpeedZ) |
void | AddSpeedX (double a_AddSpeedX) |
void | AddSpeedY (double a_AddSpeedY) |
void | AddSpeedZ (double a_AddSpeedZ) |
virtual bool | ArmorCoversAgainst (eDamageType a_DamageType) |
Returns whether armor will protect against the specified damage type. More... | |
void | AttachTo (cEntity &a_AttachTo) |
Attaches to the specified entity; detaches from any previous one first. More... | |
void | BroadcastDeathMessage (TakeDamageInfo &a_TDI) |
Announces a death message on chat about killing the entity. More... | |
cEntity (eEntityType a_EntityType, Vector3d a_Pos, float a_Width, float a_Height) | |
void | Destroy () |
Destroys the entity, schedules it for memory freeing and broadcasts the DestroyEntity packet. More... | |
void | Detach (void) |
Detaches from the currently attached entity, if any. More... | |
virtual void | DetectCacti (void) |
Detects the time for application of cacti damage. More... | |
virtual void | DetectMagma (void) |
Detects the time for application of magma block damage. More... | |
virtual bool | DetectPortal (void) |
Detects whether we are in a portal block and begins teleportation procedures if so Returns true if MoveToWorld() was called, false if not. More... | |
virtual bool | DoesPreventBlockPlacement (void) const |
Returns whether blocks can be placed intersecting this entities' hitbox. More... | |
float | GetAirDrag (void) const |
int | GetAirLevel (void) const |
Gets remaining air of a monster. More... | |
virtual float | GetArmorCoverAgainst (const cEntity *a_Attacker, eDamageType a_DamageType, int a_RawDamage) |
Returns the hitpoints out of a_RawDamage that the currently equipped armor would cover. More... | |
cEntity * | GetAttached () |
Gets entity (vehicle) attached to this entity. More... | |
cBoundingBox | GetBoundingBox () const |
int | GetChunkX (void) const |
int | GetChunkZ (void) const |
virtual const char * | GetClass (void) const |
Returns the topmost class name for the object. More... | |
virtual void | GetDrops (cItems &a_Drops, cEntity *a_Killer=nullptr) |
Returns the list of drops for this pawn when it is killed. More... | |
virtual float | GetEnchantmentCoverAgainst (const cEntity *a_Attacker, eDamageType a_DamageType, int a_Damage) |
Returns the hitpoints that the currently equipped armor's enchantments would cover. More... | |
eEntityType | GetEntityType (void) const |
float | GetGravity (void) const |
double | GetHeadYaw (void) const |
float | GetHealth (void) const |
Returns the health of this entity. More... | |
float | GetHeight (void) const |
int | GetInvulnerableTicks (void) const |
Gets the invulnerable ticks from the entity. More... | |
virtual double | GetKnockbackAmountAgainst (const cEntity &a_Receiver) |
Returns the knockback amount that the currently equipped items would cause to a_Receiver on a hit. More... | |
Vector3d | GetLastSentPosition (void) const |
Returns the last position we sent to all the clients. More... | |
Vector3d | GetLookVector (void) const |
double | GetMass (void) const |
float | GetMaxHealth (void) const |
cChunk * | GetParentChunk () |
Returns the chunk responsible for ticking this entity. More... | |
const cChunk * | GetParentChunk () const |
virtual const char * | GetParentClass (void) const |
Returns the topmost class's parent class name for the object. More... | |
double | GetPitch (void) const |
const Vector3d & | GetPosition (void) const |
Exported in ManualBindings. More... | |
double | GetPosX (void) const |
double | GetPosY (void) const |
double | GetPosZ (void) const |
virtual int | GetRawDamageAgainst (const cEntity &a_Receiver) |
Returns the hitpoints that this pawn can deal to a_Receiver using its equipped items. More... | |
double | GetRoll (void) const |
const Vector3d & | GetSpeed (void) const |
Exported in ManualBindings. More... | |
double | GetSpeedX (void) const |
double | GetSpeedY (void) const |
double | GetSpeedZ (void) const |
long int | GetTicksAlive (void) const |
Gets number of ticks this entity has been alive for. More... | |
UInt32 | GetUniqueID (void) const |
float | GetWidth (void) const |
cWorld * | GetWorld (void) const |
double | GetYaw (void) const |
virtual void | HandleSpeedFromAttachee (float a_Forward, float a_Sideways) |
bool | HasAnyMobLeashed () const |
Returs whether the entity has any mob leashed to it. More... | |
bool | Initialize (OwnedEntity a_Self, cWorld &a_EntityWorld) |
Spawns the entity in the world; returns true if spawned, false if not (plugin disallowed). More... | |
virtual bool | IsA (const char *a_ClassName) const |
Returns true if the entity is of the specified class or a subclass (cPawn's IsA("cEntity") returns true) More... | |
bool | IsArrow (void) const |
bool | IsAttachedTo (const cEntity *a_Entity) const |
Returns true if this entity is attached to the specified entity. More... | |
bool | IsBoat (void) const |
bool | IsDestroyed () const |
Deprecated. More... | |
bool | IsEnderCrystal (void) const |
bool | IsExpOrb (void) const |
bool | IsFallingBlock (void) const |
bool | IsFloater (void) const |
virtual bool | IsHeadInWater (void) const |
Returns true if any part of the entity is in a water block. More... | |
virtual bool | IsInFire (void) const |
Returns true if any part of the entity is in a fire block. More... | |
virtual bool | IsInLava (void) const |
Returns true if any part of the entity is in a lava block. More... | |
virtual bool | IsInWater (void) const |
Returns true if any part of the entity is in a water block. More... | |
bool | IsItemFrame (void) const |
bool | IsLeashKnot (void) const |
bool | IsMinecart (void) const |
bool | IsMob (void) const |
virtual bool | IsOnFire (void) const |
bool | IsOrientationDirty () const |
Returns whether the entity's orientation has been set manually. More... | |
bool | IsPainting (void) const |
bool | IsPawn (void) const |
bool | IsPickup (void) const |
bool | IsPlayer (void) const |
bool | IsProjectile (void) const |
virtual bool | IsRiding (void) const |
bool | IsTicking (void) const |
Returns true if the entity is valid and ticking. More... | |
bool | IsTNT (void) const |
bool | IsWorldChangeScheduled () const |
Returns true if a world change is scheduled to happen. More... | |
bool | MoveToWorld (const AString &a_WorldName, bool a_ShouldSendRespawn=true) |
Moves entity to specified world, taking a world name. More... | |
bool | MoveToWorld (cWorld &a_World, bool a_ShouldSendRespawn, Vector3d a_NewPosition) |
bool | MoveToWorld (cWorld &a_World, bool a_ShouldSendRespawn=true) |
Moves entity to specified world, taking a world pointer. More... | |
bool | MoveToWorld (cWorld &a_World, Vector3d a_NewPosition, bool a_ShouldSetPortalCooldown=false, bool a_ShouldSendRespawn=true) |
void | OnAcquireSpectator (cPlayer &a_Player) |
Called when a player begins spectating this entity. More... | |
virtual void | OnFinishedBurning (void) |
Called when the entity finishes burning. More... | |
void | OnLoseSpectator (cPlayer &a_Player) |
Called when a player stops spectating this entity. More... | |
virtual void | OnRightClicked (cPlayer &a_Player) |
Called when the specified player right-clicks this entity. More... | |
virtual void | OnStartedBurning (void) |
Called when the entity starts burning. More... | |
void | RemoveLeashedMob (cMonster *a_Monster) |
Removes a mob from the leashed list of mobs. More... | |
void | SetAirDrag (float a_AirDrag) |
void | SetGravity (float a_Gravity) |
void | SetHeadYaw (double a_HeadYaw) |
void | SetHealth (float a_Health) |
Sets the health of this entity; doesn't broadcast any hurt animation. More... | |
void | SetInvulnerableTicks (int a_InvulnerableTicks) |
Set the invulnerable ticks from the entity. More... | |
void | SetIsFireproof (bool a_IsFireproof) |
Sets whether the entity is fireproof. More... | |
void | SetIsTicking (bool a_IsTicking) |
Set the entity's status to either ticking or not ticking. More... | |
void | SetMass (double a_Mass) |
void | SetMaxHealth (float a_MaxHealth) |
Sets the maximum value for the health. More... | |
void | SetParentChunk (cChunk *a_Chunk) |
Sets the parent chunk, which is the chunk responsible for ticking this entity. More... | |
void | SetPitch (double a_Pitch) |
void | SetPitchFromSpeed (void) |
Sets the pitch to match the speed vector (entity gies "face-forward") More... | |
void | SetPosition (const Vector3d &a_Position) |
void | SetPosition (double a_PosX, double a_PosY, double a_PosZ) |
void | SetPosX (double a_PosX) |
void | SetPosY (double a_PosY) |
void | SetPosZ (double a_PosZ) |
void | SetRoll (double a_Roll) |
void | SetSize (float a_Width, float a_Height) |
Update an entity's size, for example, on body stance changes. More... | |
void | SetSpeed (double a_SpeedX, double a_SpeedY, double a_SpeedZ) |
Sets the speed of the entity, measured in m / sec. More... | |
void | SetSpeed (Vector3d a_Speed) |
Sets the speed of the entity, measured in m / sec. More... | |
void | SetSpeedX (double a_SpeedX) |
Sets the speed in the X axis, leaving the other speed components intact. More... | |
void | SetSpeedY (double a_SpeedY) |
Sets the speed in the Y axis, leaving the other speed components intact. More... | |
void | SetSpeedZ (double a_SpeedZ) |
Sets the speed in the Z axis, leaving the other speed components intact. More... | |
void | SetWorld (cWorld *a_World) |
Sets the internal world pointer to a new cWorld, doesn't update anything else. More... | |
void | SetYaw (double a_Yaw) |
void | SetYawFromSpeed (void) |
Sets the rotation to match the speed vector (entity goes "face-forward") More... | |
void | StartBurning (int a_TicksLeftBurning) |
Puts the entity on fire for the specified amount of ticks. More... | |
void | SteerVehicle (float a_Forward, float a_Sideways) |
void | StopBurning (void) |
Stops the entity from burning, resets all burning timers. More... | |
void | TakeDamage (cEntity &a_Attacker) |
Makes this pawn take damage from an attack by a_Attacker. More... | |
void | TakeDamage (eDamageType a_DamageType, cEntity *a_Attacker, int a_RawDamage, double a_KnockbackAmount) |
Makes this entity take the specified damage. More... | |
void | TakeDamage (eDamageType a_DamageType, cEntity *a_Attacker, int a_RawDamage, float a_FinalDamage, double a_KnockbackAmount) |
Makes this entity take the specified damage. More... | |
void | TakeDamage (eDamageType a_DamageType, UInt32 a_Attacker, int a_RawDamage, double a_KnockbackAmount) |
Makes this entity take the specified damage. More... | |
virtual void | TeleportToEntity (cEntity &a_Entity) |
Teleports to the entity specified. More... | |
virtual void | TickBurning (cChunk &a_Chunk) |
Updates the state related to this entity being on fire. More... | |
virtual void | TickInVoid (cChunk &a_Chunk) |
Handles when the entity is in the void. More... | |
void | WrapHeadYaw () |
Makes sure head yaw is not over the specified range. More... | |
void | WrapRotation () |
Makes sure rotation is not over the specified range. More... | |
void | WrapSpeed () |
Makes speed is not over 20. More... | |
virtual | ~cEntity ()=default |
Static Public Member Functions | |
static int | CalcLevelFromXp (int a_CurrentXp) |
Inverse of XpForLevel Ref: https://minecraft.wiki/w/XP values are as per this with pre-calculations. More... | |
static bool | PermissionMatches (const AStringVector &a_Permission, const AStringVector &a_Template) |
Returns true iff a_Permission matches the a_Template. More... | |
static int | XpForLevel (int a_Level) |
Calculates the amount of XP needed for a given level Ref: https://minecraft.wiki/w/XP. More... | |
Static Public Member Functions inherited from cPawn | |
static bool | FindTeleportDestination (cWorld &a_World, const int a_HeightRequired, const unsigned int a_NumTries, Vector3d &a_Destination, const cBoundingBox a_BoundingBox) |
static bool | FindTeleportDestination (cWorld &a_World, const int a_HeightRequired, const unsigned int a_NumTries, Vector3d &a_Destination, const Vector3i a_MinBoxCorner, const Vector3i a_MaxBoxCorner) |
static bool | FindTeleportDestination (cWorld &a_World, const int a_HeightRequired, const unsigned int a_NumTries, Vector3d &a_Destination, Vector3i a_Centre, const int a_HalfCubeWidth) |
Used by enderman and chorus fruit. More... | |
Static Public Member Functions inherited from cEntity | |
static const char * | GetClassStatic (void) |
Returns the class name of this class. More... | |
Static Public Attributes | |
static const int | MAX_FOOD_LEVEL = 20 |
static const int | MAX_HEALTH = 20 |
Static Public Attributes inherited from cEntity | |
static const int | BURN_DAMAGE = 1 |
Damage to deal when the entity is burning. More... | |
static const int | BURN_TICKS = 160 |
Ticks to keep an entity burning after it has stood in lava / fire. More... | |
static const int | BURN_TICKS_PER_DAMAGE = 20 |
Ticks to wait between damaging an entity when it is burning. More... | |
static const int | DROWNING_TICKS = 20 |
Number of ticks per heart of damage. More... | |
static const int | FALL_DAMAGE_HEIGHT = 4 |
Y difference after which fall damage is applied. More... | |
static const int | FIRE_DAMAGE = 1 |
Damage to deal when standing in fire. More... | |
static const int | FIRE_TICKS_PER_DAMAGE = 10 |
Ticks to wait between damaging an entity when it stands in fire. More... | |
static const UInt32 | INVALID_ID = 0 |
Special ID that is considered an "invalid value", signifying no entity. More... | |
static const int | LAVA_DAMAGE = 4 |
Damage to deal when standing in lava. More... | |
static const int | LAVA_TICKS_PER_DAMAGE = 10 |
Ticks to wait between damaging an entity when it stands in lava. More... | |
static const int | MAX_AIR_LEVEL = 300 |
Maximum air an entity can have. More... | |
static const int | VOID_BOUNDARY = -64 |
Y position to begin applying void damage. More... | |
Private Types | |
typedef std::vector< std::vector< AString > > | AStringVectorVector |
using | Super = cPawn |
Private Member Functions | |
void | AddKnownRecipe (UInt32 RecipeId) |
Add the recipe Id to the known recipes. More... | |
virtual void | ApplyArmorDamage (int DamageBlocked) override |
Applies damage to the armor after the armor blocked the given amount. More... | |
virtual void | BroadcastMovementUpdate (const cClientHandle *a_Exclude=nullptr) override |
Updates clients of changes in the entity. More... | |
virtual bool | DoTakeDamage (TakeDamageInfo &TDI) override |
Makes this entity take damage specified in the a_TDI. More... | |
void | FreezeInternal (const Vector3d &a_Location, bool a_ManuallyFrozen) |
Pins the player to a_Location until Unfreeze() is called. More... | |
float | GetDigSpeed (BLOCKTYPE a_Block) |
Returns the dig speed using the current tool on the block a_Block. More... | |
virtual float | GetEnchantmentBlastKnockbackReduction () override |
Returns explosion knock back reduction percent from blast protection level. More... | |
float | GetLiquidHeightPercent (NIBBLETYPE a_Meta) |
Returns how high the liquid is in percent. More... | |
AString | GetUUIDFileName (const cUUID &a_UUID) |
Returns the filename for the player data based on the UUID given. More... | |
void | HandleFloater (void) |
Called in each tick if the player is fishing to make sure the floater dissapears when the player doesn't have a fishing rod as equipped item. More... | |
void | HandleFood (void) |
Called in each tick to handle food-related processing. More... | |
virtual void | HandlePhysics (std::chrono::milliseconds a_Dt, cChunk &) override |
Handles the physics of the entity - updates position based on speed, updates speed based on environment. More... | |
virtual bool | IsElytraFlying (void) const override |
bool | IsInsideWater () |
Checks if the player is inside of water. More... | |
virtual bool | IsInvisible () const override |
virtual bool | IsRclking (void) const override |
virtual void | OnAddToWorld (cWorld &a_World) override |
Called when the entity is added to a world. More... | |
virtual void | OnDetach () override |
Called when this entity dismounts from m_AttachedTo. More... | |
virtual void | OnRemoveFromWorld (cWorld &a_World) override |
Called when the entity is removed from a world. More... | |
void | RefreshRank () |
(Re)loads the rank and permissions from the cRankManager. More... | |
virtual void | SpawnOn (cClientHandle &a_Client) override |
Descendants override this function to send a command to the specified client to spawn the entity on the client. More... | |
virtual void | Tick (std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override |
void | TickFreezeCode () |
Private Attributes | |
std::variant< BodyStanceCrouching, BodyStanceSleeping, BodyStanceSprinting, BodyStanceStanding, BodyStanceGliding > | m_BodyStance |
The current body stance the player has adopted. More... | |
int | m_BowCharge |
std::shared_ptr< cClientHandle > | m_ClientHandle |
cWindow * | m_CurrentWindow |
std::string | m_CurrentWorldName |
The name of the world which the player currently resides in. More... | |
int | m_CurrentXp |
AString | m_CustomName |
std::string | m_DefaultWorldPath |
The save path of the default world. More... | |
cItem | m_DraggingItem |
The item being dragged by the cursor while in a UI window. More... | |
cTickTimeLong | m_EatingFinishTick |
The world tick in which eating will be finished. More... | |
unsigned int | m_EnchantmentSeed |
cItemGrid | m_EnderChestContents |
An item grid that stores the player specific enderchest contents. More... | |
UInt32 | m_FloaterID |
double | m_FlyingMaxSpeed |
Max speed, relative to the game default flying max speed, when flying. More... | |
double | m_FoodExhaustionLevel |
A "buffer" which adds up hunger before it is substracted from m_FoodSaturationLevel or m_FoodLevel. More... | |
int | m_FoodLevel |
Represents the food bar, one point equals half a "drumstick". More... | |
double | m_FoodSaturationLevel |
"Overcharge" for the m_FoodLevel; is depleted before m_FoodLevel More... | |
int | m_FoodTickTimer |
Count-up to the healing or damaging action, based on m_FoodLevel. More... | |
eGameMode | m_GameMode |
cInventory | m_Inventory |
Stores the player's inventory, consisting of crafting grid, hotbar, and main slots. More... | |
cSlotNums | m_InventoryPaintSlots |
cWindow * | m_InventoryWindow |
bool | m_IsChargingBow |
bool | m_IsFishing |
bool | m_IsFlightCapable |
If this is true the player can fly. More... | |
bool | m_IsFlying |
bool | m_IsFrozen |
If true, we are locking m_Position to m_FrozenPosition. More... | |
bool | m_IsLeftHanded |
Whether the player is left-handed, or right-handed. More... | |
bool | m_IsManuallyFrozen |
Was the player frozen manually by a plugin or automatically by the server? More... | |
bool | m_IsRespawnPointForced |
Whether we unconditionally respawn to m_RespawnPosition, or check if a bed is unobstructed and available first. More... | |
bool | m_IsTeleporting |
Flag used by food handling system to determine whether a teleport has just happened. More... | |
bool | m_IsVisible |
std::set< cItem, cItem::sItemCompare > | m_KnownItems |
List of known items as Ids. More... | |
std::set< UInt32 > | m_KnownRecipes |
List on known recipes as Ids. More... | |
int | m_LifetimeTotalXp |
Player Xp level. More... | |
AString | m_MsgNameColorCode |
AString | m_MsgPrefix |
AString | m_MsgSuffix |
double | m_NormalMaxSpeed |
Max speed, relative to the game default. More... | |
AStringVector | m_Permissions |
All the permissions that this player has, based on their rank. More... | |
AString | m_Rank |
The name of the rank assigned to this player. More... | |
Vector3i | m_RespawnPosition |
The player's potential respawn position, initialised to world spawn by default. More... | |
AStringVector | m_Restrictions |
All the restrictions that this player has, based on their rank. More... | |
int | m_SkinParts |
Displayed skin part bit mask. More... | |
std::string | m_SpawnWorldName |
The name of the world which the player respawns in upon death. More... | |
cEntity * | m_Spectating |
The entity that this player is spectating, nullptr if none. More... | |
AStringVectorVector | m_SplitPermissions |
All the permissions that this player has, based on their rank, split into individual dot-delimited parts. More... | |
AStringVectorVector | m_SplitRestrictions |
All the restrictions that this player has, based on their rank, split into individual dot-delimited parts. More... | |
double | m_SprintingMaxSpeed |
Max speed, relative to the game default max speed, when sprinting. More... | |
StatisticsManager | m_Stats |
cTeam * | m_Team |
unsigned int | m_TicksUntilNextSave |
How long till the player's inventory will be saved Default save interval is #defined in PLAYER_INVENTORY_SAVE_INTERVAL. More... | |
Additional Inherited Members | |
Public Types inherited from cEntity | |
enum | eEntityType { etEntity , etEnderCrystal , etPlayer , etPickup , etMonster , etFallingBlock , etMinecart , etBoat , etTNT , etProjectile , etExpOrb , etFloater , etItemFrame , etPainting , etLeashKnot , etMob = etMonster } |
Protected Types inherited from cPawn | |
typedef std::map< cEntityEffect::eType, std::unique_ptr< cEntityEffect > > | tEffectMap |
Protected Member Functions inherited from cPawn | |
virtual void | ResetPosition (Vector3d a_NewPosition) override |
Set the entities position and last sent position. More... | |
Protected Member Functions inherited from cEntity | |
void | BroadcastLeashedMobs () |
If has any mobs are leashed, broadcasts every leashed entity to this. More... | |
void | DoMoveToWorld (const sWorldChangeInfo &a_WorldChangeInfo) |
Handles the moving of this entity between worlds. More... | |
virtual void | SetSwimState (cChunk &a_Chunk) |
Called once per tick to set m_IsInFire, m_IsInLava, m_IsInWater and m_IsHeadInWater. More... | |
Static Protected Member Functions inherited from cEntity | |
static void | ApplyFriction (Vector3d &a_Speed, double a_SlowdownMultiplier, float a_Dt) |
Applies friction to an entity. More... | |
Protected Attributes inherited from cPawn | |
bool | m_bTouchGround |
tEffectMap | m_EntityEffects |
double | m_LastGroundHeight |
Protected Attributes inherited from cEntity | |
float | m_AirDrag |
Stores the air drag that is applied to the entity every tick, measured in speed ratio per tick Acts as air friction and slows down flight Will be interpolated if the server tick rate varies Data: https://minecraft.wiki/w/Entity#Motion_of_entities. More... | |
int | m_AirLevel |
Air level of a mobile. More... | |
int | m_AirTickTimer |
cEntity * | m_AttachedTo |
The entity to which this entity is attached (vehicle), nullptr if none. More... | |
cEntity * | m_Attachee |
The entity which is attached to this entity (rider), nullptr if none. More... | |
bool | m_bDirtyHead |
Stores whether head yaw has been set manually. More... | |
bool | m_bDirtyOrientation |
Stores whether our yaw / pitch / roll (body orientation) has been set manually. More... | |
bool | m_bHasSentNoSpeed |
Stores whether we have sent a Velocity packet with a speed of zero (no speed) to the client Ensures that said packet is sent only once. More... | |
bool | m_bOnGround |
Stores if the entity is on the ground. More... | |
eEntityType | m_EntityType |
float | m_Gravity |
Stores gravity that is applied to an entity every tick For realistic effects, this should be negative. More... | |
float | m_Health |
bool | m_IsFireproof |
Whether the entity is capable of taking fire or lava damage. More... | |
bool | m_IsHeadInWater |
If the entity's head is in a water block. More... | |
bool | m_IsInFire |
If any part of the entity is in a fire block. More... | |
bool | m_IsInLava |
If any part of the entity is in a lava block. More... | |
bool | m_IsInWater |
If any part of the entity is in a water block. More... | |
Vector3d | m_LastPosition |
Vector3d | m_LastSentPosition |
Last position sent to client via the Relative Move or Teleport packets (not Velocity) Only updated if cEntity::BroadcastMovementUpdate() is called! More... | |
float | m_MaxHealth |
sPortalCooldownData | m_PortalCooldownData |
Portal delay timer and cooldown boolean data. More... | |
Vector3d | m_Speed |
Measured in meters / second (m / s) More... | |
long int | m_TicksAlive |
The number of ticks this entity has been alive for. More... | |
int | m_TicksLeftBurning |
Time, in ticks, until the entity extinguishes its fire. More... | |
int | m_TicksSinceLastBurnDamage |
Time, in ticks, since the last damage dealt by being on fire. More... | |
int | m_TicksSinceLastFireDamage |
Time, in ticks, since the last damage dealt by standing in fire. More... | |
int | m_TicksSinceLastLavaDamage |
Time, in ticks, since the last damage dealt by standing in lava. More... | |
int | m_TicksSinceLastVoidDamage |
Time, in ticks, since the last damage dealt by the void. More... | |
UInt32 | m_UniqueID |
The ID of the entity that is guaranteed to be unique within a single run of the server. More... | |
cWorld * | m_World |
sWorldChangeInfo | m_WorldChangeInfo |
If field m_NewWorld not nullptr, a world change is scheduled and a task is queued in the current world. More... | |
|
private |
|
private |
cPlayer::cPlayer | ( | const std::shared_ptr< cClientHandle > & | a_Client | ) |
Definition at line 117 of file Player.cpp.
|
overridevirtual |
Definition at line 155 of file Player.cpp.
void cPlayer::AbortEating | ( | void | ) |
Aborts the current eating operation.
Definition at line 551 of file Player.cpp.
void cPlayer::AddFoodExhaustion | ( | double | a_Exhaustion | ) |
Adds the specified exhaustion to m_FoodExhaustion.
Expects only positive values.
Definition at line 439 of file Player.cpp.
void cPlayer::AddInventoryPaintSlot | ( | int | a_SlotNum | ) |
Adds a slot to the list for inventory painting.
To be used by cWindow only
Definition at line 571 of file Player.cpp.
void cPlayer::AddKnownItem | ( | const cItem & | a_Item | ) |
Adds an Item to the list of known items.
If the item is already known, does nothing.
Definition at line 2708 of file Player.cpp.
|
private |
Add the recipe Id to the known recipes.
If the recipe is already known, does nothing.
Definition at line 2734 of file Player.cpp.
|
overrideprivatevirtual |
Applies damage to the armor after the armor blocked the given amount.
Reimplemented from cEntity.
Definition at line 2848 of file Player.cpp.
void cPlayer::AwardAchievement | ( | CustomStatistic | a_Ach | ) |
Awards the player an achievement.
If all prerequisites are met, this method will award the achievement and will broadcast a chat message. If the achievement has been already awarded to the player, this method will just increment the stat counter.
Definition at line 1372 of file Player.cpp.
|
overrideprivatevirtual |
Updates clients of changes in the entity.
Reimplemented from cEntity.
Definition at line 2862 of file Player.cpp.
|
static |
Inverse of XpForLevel Ref: https://minecraft.wiki/w/XP values are as per this with pre-calculations.
Definition at line 184 of file Player.cpp.
void cPlayer::CancelChargingBow | ( | void | ) |
Cancels the current bow charging.
Definition at line 339 of file Player.cpp.
|
inlinevirtual |
bool cPlayer::CanInstantlyMine | ( | BLOCKTYPE | a_Block | ) |
Given tool, enchantments, status effects, and world position returns whether a_Block would be instantly mined.
Depends on hardness values so check those are correct. Source: https://minecraft.wiki/w/Breaking#Instant_breaking
Definition at line 2696 of file Player.cpp.
bool cPlayer::CanMobsTarget | ( | void | ) | const |
Returns true if the player can be targeted by Mobs.
Definition at line 1061 of file Player.cpp.
void cPlayer::ClearInventoryPaintSlots | ( | void | ) |
Clears the list of slots that are being inventory-painted.
To be used by cWindow only
Definition at line 561 of file Player.cpp.
void cPlayer::CloseWindow | ( | bool | a_CanRefuse = true | ) |
Closes the current window, resets current window to m_InventoryWindow.
A plugin may refuse the closing if a_CanRefuse is true
Definition at line 1144 of file Player.cpp.
void cPlayer::CloseWindowIfID | ( | char | a_WindowID, |
bool | a_CanRefuse = true |
||
) |
Closes the current window if it matches the specified ID, resets current window to m_InventoryWindow.
Definition at line 1169 of file Player.cpp.
int cPlayer::DeltaExperience | ( | int | a_Xp_delta | ) |
Definition at line 279 of file Player.cpp.
bool cPlayer::DoesPlacingBlocksIntersectEntity | ( | std::initializer_list< sSetBlock > | a_Blocks | ) | const |
Whether placing the given blocks would intersect any entitiy.
Definition at line 2366 of file Player.cpp.
|
overrideprivatevirtual |
Makes this entity take damage specified in the a_TDI.
The TDI is sent through plugins first, then applied. If it returns false, the entity hasn't receive any damage.
Reimplemented from cEntity.
Definition at line 2881 of file Player.cpp.
bool cPlayer::Feed | ( | int | a_Food, |
double | a_Saturation | ||
) |
Adds to FoodLevel and FoodSaturationLevel, returns true if any food has been consumed, false if player "full".
Definition at line 423 of file Player.cpp.
int cPlayer::FinishChargingBow | ( | void | ) |
Finishes charging the current bow.
Returns the number of ticks for which the bow has been charged
Definition at line 324 of file Player.cpp.
void cPlayer::FinishEating | ( | void | ) |
Finishes eating the currently equipped item.
Consumes the item, updates health and broadcasts the packets
Definition at line 527 of file Player.cpp.
void cPlayer::ForceSetSpeed | ( | const Vector3d & | a_Speed | ) |
Forces the player to move in the given direction.
Definition at line 1540 of file Player.cpp.
void cPlayer::Freeze | ( | const Vector3d & | a_Location | ) |
Prevent the player from moving and lock him into a_Location.
Definition at line 1423 of file Player.cpp.
|
private |
Pins the player to a_Location until Unfreeze() is called.
If ManuallyFrozen is false, the player will unfreeze when the chunk is loaded.
Definition at line 2530 of file Player.cpp.
|
inline |
AString cPlayer::GetColor | ( | void | ) | const |
Returns the full color code to use for this player, based on their rank.
The returned value either is empty, or includes the cChatColor::Delimiter.
Definition at line 1651 of file Player.cpp.
|
inline |
|
inline |
|
private |
Returns the dig speed using the current tool on the block a_Block.
Returns one if using hand. If the player is using a tool that is good to break the block the value is higher. If he has an enchanted tool with efficiency or he has a haste or mining fatique effect it gets multiplied by a specific factor depending on the strength of the effect or enchantment. In he is in water it gets divided by 5 except if his tool is enchanted with aqua affinity. If he is not on ground it also gets divided by 5. Source: https://minecraft.wiki/w/Breaking#Calculation
Definition at line 2607 of file Player.cpp.
|
inline |
eGameMode cPlayer::GetEffectiveGameMode | ( | void | ) | const |
Returns the current effective gamemode (inherited gamemode is resolved before returning)
Definition at line 1531 of file Player.cpp.
|
overrideprivatevirtual |
Returns explosion knock back reduction percent from blast protection level.
Reimplemented from cEntity.
Definition at line 2932 of file Player.cpp.
MTRand cPlayer::GetEnchantmentRandomProvider | ( | ) |
Get a copy of the PRNG for enchanting related generation, don't use this for other purposes.
The PRNG's state is initialised with an internal seed, such that until PermuteEnchantmentSeed is called, this function returns the same PRNG.
Definition at line 1567 of file Player.cpp.
|
inline |
|
inlineoverridevirtual |
|
inlineoverridevirtual |
|
inlineoverridevirtual |
|
inline |
|
inlineoverridevirtual |
|
inlineoverridevirtual |
double cPlayer::GetEyeHeight | ( | void | ) | const |
Definition at line 992 of file Player.cpp.
Vector3d cPlayer::GetEyePosition | ( | void | ) | const |
Definition at line 1001 of file Player.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
const cSlotNums & cPlayer::GetInventoryPaintSlots | ( | void | ) | const |
Returns the list of slots currently stored for inventory painting.
To be used by cWindow only
Definition at line 581 of file Player.cpp.
AString cPlayer::GetIP | ( | void | ) | const |
Definition at line 1070 of file Player.cpp.
const std::set< UInt32 > & cPlayer::GetKnownRecipes | ( | ) | const |
Gets the set of IDs for recipes this player has discovered.
Definition at line 206 of file Player.cpp.
|
inline |
|
private |
Returns how high the liquid is in percent.
Used by IsInsideWater
Definition at line 2565 of file Player.cpp.
|
inline |
double cPlayer::GetMaxSpeed | ( | void | ) | const |
Returns the current relative maximum speed (takes current sprinting / flying state into account)
Definition at line 591 of file Player.cpp.
float cPlayer::GetMiningProgressPerTick | ( | BLOCKTYPE | a_Block | ) |
Returns the progress mined per tick for the block a_Block as a fraction (1 would be completely mined) Depends on hardness values so check those are correct.
Source: https://minecraft.wiki/w/Breaking#Calculation
Definition at line 2673 of file Player.cpp.
const AString & cPlayer::GetName | ( | void | ) | const |
Definition at line 1299 of file Player.cpp.
|
inline |
|
inlineoverridevirtual |
|
inline |
AString cPlayer::GetPlayerListName | ( | void | ) | const |
Returns the name that is used in the playerlist.
Definition at line 1685 of file Player.cpp.
AString cPlayer::GetPrefix | ( | void | ) | const |
Returns the player name prefix, may contain @ format directives.
Definition at line 1667 of file Player.cpp.
cWorld * cPlayer::GetRespawnWorld | ( | ) |
Definition at line 817 of file Player.cpp.
|
inline |
|
inline |
|
inline |
AString cPlayer::GetSuffix | ( | void | ) | const |
Returns the player name suffix, may contain @ format directives.
Definition at line 1676 of file Player.cpp.
|
inline |
|
inline |
Vector3d cPlayer::GetThrowSpeed | ( | double | a_SpeedCoeff | ) | const |
Returns the initial speed vector of a throw, with a 3D length of a_SpeedCoeff.
Definition at line 1517 of file Player.cpp.
Vector3d cPlayer::GetThrowStartPos | ( | void | ) | const |
Returns the position where projectiles thrown by this player should start, player eye position + adjustment.
Definition at line 1501 of file Player.cpp.
const cUUID & cPlayer::GetUUID | ( | void | ) | const |
Returns the UUID that has been read from the client, or nil if not available.
Definition at line 2431 of file Player.cpp.
Returns the filename for the player data based on the UUID given.
This can be used both for online and offline UUIDs.
Definition at line 2514 of file Player.cpp.
int cPlayer::GetXpLevel | ( | void | ) | const |
Gets the current level - XpLevel.
Definition at line 237 of file Player.cpp.
|
inline |
float cPlayer::GetXpPercentage | ( | void | ) | const |
Gets the experience bar percentage - XpP.
Definition at line 246 of file Player.cpp.
|
private |
Called in each tick if the player is fishing to make sure the floater dissapears when the player doesn't have a fishing rod as equipped item.
Definition at line 2172 of file Player.cpp.
|
private |
Called in each tick to handle food-related processing.
Definition at line 2116 of file Player.cpp.
|
inlineoverrideprivatevirtual |
|
inline |
bool cPlayer::HasPermission | ( | const AString & | a_Permission | ) | const |
Definition at line 1586 of file Player.cpp.
|
overridevirtual |
Heals the player by the specified amount of HPs (positive only); sends health update.
Reimplemented from cEntity.
Definition at line 369 of file Player.cpp.
|
inline |
bool cPlayer::IsClimbing | ( | void | ) | const |
Returns whether the player is climbing (ladders, vines etc.)
Definition at line 2191 of file Player.cpp.
|
overridevirtual |
Reimplemented from cEntity.
Definition at line 2949 of file Player.cpp.
|
inline |
|
overrideprivatevirtual |
Reimplemented from cEntity.
Definition at line 2967 of file Player.cpp.
|
inlineoverridevirtual |
|
inline |
|
inline |
bool cPlayer::IsFrozen | ( | ) |
Is the player frozen?
Definition at line 1432 of file Player.cpp.
bool cPlayer::IsGameModeAdventure | ( | void | ) | const |
Returns true if the player is in Adventure mode, either explicitly, or by inheriting from current world.
Definition at line 1043 of file Player.cpp.
bool cPlayer::IsGameModeCreative | ( | void | ) | const |
Returns true if the player is in Creative mode, either explicitly, or by inheriting from current world.
Definition at line 1025 of file Player.cpp.
bool cPlayer::IsGameModeSpectator | ( | void | ) | const |
Returns true if the player is in Spectator mode, either explicitly, or by inheriting from current world.
Definition at line 1052 of file Player.cpp.
bool cPlayer::IsGameModeSurvival | ( | void | ) | const |
Returns true if the player is in Survival mode, either explicitly, or by inheriting from current world.
Definition at line 1034 of file Player.cpp.
bool cPlayer::IsInBed | ( | void | ) | const |
Returns true if a player is sleeping in a bed.
Definition at line 451 of file Player.cpp.
|
private |
Checks if the player is inside of water.
Definition at line 2578 of file Player.cpp.
|
overrideprivatevirtual |
Reimplemented from cPawn.
Definition at line 2976 of file Player.cpp.
bool cPlayer::IsLeftHanded | ( | ) | const |
Returns true if the player's left hand is dominant.
Definition at line 460 of file Player.cpp.
|
inlineoverridevirtual |
|
inlineoverrideprivatevirtual |
|
inline |
|
inline |
|
overridevirtual |
Reimplemented from cEntity.
Definition at line 2958 of file Player.cpp.
bool cPlayer::IsStanding | ( | ) | const |
Returns true if a player is standing normally, that is, in a neutral pose.
Definition at line 469 of file Player.cpp.
|
overridevirtual |
Called when the entity kills another entity.
Reimplemented from cEntity.
Definition at line 896 of file Player.cpp.
|
overridevirtual |
Called when the health drops below zero.
a_TDI's Attacker may be nullptr (environmental damage)
Reimplemented from cPawn.
Definition at line 855 of file Player.cpp.
void cPlayer::LoadFromDisk | ( | ) |
Loads the player data from the save file.
Sets m_World to the world where the player will spawn, based on the stored world name or the default world by calling LoadFromFile().
Definition at line 1803 of file Player.cpp.
void cPlayer::LoadRank | ( | void | ) |
(Re)loads the rank and permissions from the cRankManager and sends a permission level update to the client.
Definition at line 2312 of file Player.cpp.
void cPlayer::NotifyNearbyWolves | ( | cPawn * | a_Opponent, |
bool | a_IsPlayerInvolved | ||
) |
Notify nearby wolves that the player or one of the player's wolves took damage or did damage to an entity.
a_Opponent | the opponent we're fighting. |
a_IsPlayerInvolved | Should be true if the player took or did damage, and false if one of the player's wolves took or did damage. |
Definition at line 831 of file Player.cpp.
|
overrideprivatevirtual |
Called when the entity is added to a world.
e.g after first spawning or after successfuly moving between worlds.
a_World | The world being added to. |
Reimplemented from cEntity.
Definition at line 2985 of file Player.cpp.
|
overrideprivatevirtual |
Called when this entity dismounts from m_AttachedTo.
Reimplemented from cEntity.
Definition at line 3036 of file Player.cpp.
void cPlayer::OnLoseSpectated | ( | ) |
Called when spectation stops, because the player crouched or when the entity we're spectating gets removed from the world.
Definition at line 173 of file Player.cpp.
|
overrideprivatevirtual |
Called when the entity is removed from a world.
e.g. When the entity is destroyed or moved to a different world.
a_World | The world being removed from. |
Reimplemented from cPawn.
Definition at line 3075 of file Player.cpp.
void cPlayer::OpenHorseInventory | ( | ) |
Opens the inventory of any tame horse the player is riding.
If the player is not riding a horse or if the horse is untamed, does nothing.
Definition at line 1904 of file Player.cpp.
void cPlayer::OpenWindow | ( | cWindow & | a_Window | ) |
Opens the specified window; closes the current one first using CloseWindow()
Definition at line 1123 of file Player.cpp.
|
static |
Returns true iff a_Permission matches the a_Template.
A match is defined by either being exactly the same, or each sub-item matches until there's a wildcard in a_Template. Ie. {"a", "b", "c"} matches {"a", "b", "*"} but doesn't match {"a", "b"}
Definition at line 1622 of file Player.cpp.
void cPlayer::PermuteEnchantmentSeed | ( | ) |
Permute the seed for enchanting related PRNGs, don't use this for other purposes.
Definition at line 1576 of file Player.cpp.
bool cPlayer::PlaceBlock | ( | Vector3i | a_Position, |
BLOCKTYPE | a_BlockType, | ||
NIBBLETYPE | a_BlockMeta | ||
) |
Attempts to place the block in the world with a call to PlaceBlocks.
Definition at line 2440 of file Player.cpp.
bool cPlayer::PlaceBlocks | ( | std::initializer_list< sSetBlock > | a_Blocks | ) |
Calls the block placement hooks and places the blocks in the world.
First the "placing" hooks for all the blocks are called, then the blocks are placed, and finally the "placed" hooks are called. If the any of the "placing" hooks aborts, none of the blocks are placed and the function returns false. Returns true if all the blocks are placed.
Definition at line 2449 of file Player.cpp.
|
private |
(Re)loads the rank and permissions from the cRankManager.
Loads the m_Rank, m_Permissions, m_MsgPrefix, m_MsgSuffix and m_MsgNameColorCode members.
Definition at line 2807 of file Player.cpp.
void cPlayer::ReplaceOneEquippedItemTossRest | ( | const cItem & | a_Item | ) |
Removes one item from the the current equipped item stack, and attempts to add the specified item stack back to the same slot.
If it is not possible to place the item in the same slot, tries to place the specified item elsewhere in the inventory. If this is not possible, then any remaining items are tossed. If the currently equipped slot is empty, its contents are simply set to the given Item.
Definition at line 1745 of file Player.cpp.
void cPlayer::Respawn | ( | void | ) |
Definition at line 936 of file Player.cpp.
void cPlayer::SaveToDisk | ( | void | ) |
Saves all player data, such as inventory, to JSON.
Definition at line 1933 of file Player.cpp.
void cPlayer::SendAboveActionBarMessage | ( | const AString & | a_Message | ) |
Definition at line 1272 of file Player.cpp.
void cPlayer::SendAboveActionBarMessage | ( | const cCompositeChat & | a_Message | ) |
Definition at line 1290 of file Player.cpp.
void cPlayer::SendBlocksAround | ( | Vector3i | a_BlockPos, |
int | a_Range = 1 |
||
) |
Sends the block in the specified range around the specified coord to the client as a block change packet.
The blocks in range (a_BlockX - a_Range, a_BlockX + a_Range) are sent (NY-metric).
Definition at line 2325 of file Player.cpp.
void cPlayer::SendMessage | ( | const AString & | a_Message | ) |
Definition at line 1182 of file Player.cpp.
void cPlayer::SendMessage | ( | const cCompositeChat & | a_Message | ) |
Definition at line 1245 of file Player.cpp.
void cPlayer::SendMessageFailure | ( | const AString & | a_Message | ) |
Definition at line 1200 of file Player.cpp.
void cPlayer::SendMessageFatal | ( | const AString & | a_Message | ) |
Definition at line 1227 of file Player.cpp.
void cPlayer::SendMessageInfo | ( | const AString & | a_Message | ) |
Definition at line 1191 of file Player.cpp.
Definition at line 1236 of file Player.cpp.
void cPlayer::SendMessageRaw | ( | const AString & | a_MessageRaw, |
eChatType | a_Type = eChatType::ctChatBox |
||
) |
Definition at line 1254 of file Player.cpp.
void cPlayer::SendMessageSuccess | ( | const AString & | a_Message | ) |
Definition at line 1209 of file Player.cpp.
void cPlayer::SendMessageWarning | ( | const AString & | a_Message | ) |
Definition at line 1218 of file Player.cpp.
void cPlayer::SendRotation | ( | double | a_YawDegrees, |
double | a_PitchDegrees | ||
) |
Sends the "look" packet to the player, forcing them to set their rotation to the specified values.
a_YawDegrees is clipped to range [-180, +180), a_PitchDegrees is clipped to range [-180, +180) but the client only uses [-90, +90]
Definition at line 1460 of file Player.cpp.
void cPlayer::SendSystemMessage | ( | const AString & | a_Message | ) |
Definition at line 1263 of file Player.cpp.
void cPlayer::SendSystemMessage | ( | const cCompositeChat & | a_Message | ) |
Definition at line 1281 of file Player.cpp.
void cPlayer::SetBedPos | ( | Vector3i | a_Position | ) |
Sets the player's bed position to the specified position.
Sets the respawn world to the player's world and unforces the respawn point. The given position will be used subject to bed checks when respawning.
Definition at line 786 of file Player.cpp.
Sets the player's bed position to the specified position.
The spawn point is unforced. The given position will be used subject to bed checks when respawning.
Definition at line 795 of file Player.cpp.
void cPlayer::SetCanFly | ( | bool | a_CanFly | ) |
If true the player can fly even when he's not in creative.
Definition at line 748 of file Player.cpp.
void cPlayer::SetCrouch | ( | bool | a_ShouldCrouch | ) |
Starts or stops crouching, if our current body stance permits, broadcasting the state change.
Definition at line 656 of file Player.cpp.
bool cPlayer::SetCurrentExperience | ( | int | a_XpTotal | ) |
Sets the experience total Returns true on success "should" really only be called at init or player death, plugins excepted.
Definition at line 259 of file Player.cpp.
void cPlayer::SetCustomName | ( | const AString & | a_CustomName | ) |
Sets the custom name of this player.
If you want to disable the custom name, simply set an empty string. The custom name will be used in the tab-list, in the player nametag and in the tab-completion.
Definition at line 763 of file Player.cpp.
void cPlayer::SetDraggingItem | ( | const cItem & | a_Item | ) |
In UI windows, set the item that the player is dragging.
Definition at line 1707 of file Player.cpp.
void cPlayer::SetElytraFlight | ( | bool | a_ShouldElytraFly | ) |
Starts or stops elytra flight, if our current body stance permits, broadcasting the state change.
Definition at line 682 of file Player.cpp.
void cPlayer::SetFlying | ( | bool | a_ShouldFly | ) |
Starts or stops flying, broadcasting the state change.
Definition at line 700 of file Player.cpp.
void cPlayer::SetFlyingMaxSpeed | ( | double | a_Speed | ) |
Sets the flying relative maximum speed.
Sends the update to player, if needed.
Definition at line 641 of file Player.cpp.
void cPlayer::SetFoodExhaustionLevel | ( | double | a_FoodExhaustionLevel | ) |
Definition at line 414 of file Player.cpp.
void cPlayer::SetFoodLevel | ( | int | a_FoodLevel | ) |
Definition at line 379 of file Player.cpp.
void cPlayer::SetFoodSaturationLevel | ( | double | a_FoodSaturationLevel | ) |
Definition at line 396 of file Player.cpp.
void cPlayer::SetFoodTickTimer | ( | int | a_FoodTickTimer | ) |
Definition at line 405 of file Player.cpp.
void cPlayer::SetGameMode | ( | eGameMode | a_GameMode | ) |
Sets the gamemode for the player.
The gamemode may be gmNotSet, in that case the player inherits the world's gamemode. Updates the gamemode on the client (sends the packet)
Definition at line 1308 of file Player.cpp.
|
inline |
void cPlayer::SetIsInBed | ( | bool | a_IsInBed | ) |
Sets a player's in-bed state.
We can't be sure plugins will keep this value updated, so no exporting. If value is false (not in bed), will update players of the fact that they have been ejected from the bed.
Definition at line 496 of file Player.cpp.
void cPlayer::SetLeftHanded | ( | bool | a_IsLeftHanded | ) |
Sets the dominant hand of the player.
Definition at line 719 of file Player.cpp.
void cPlayer::SetNormalMaxSpeed | ( | double | a_Speed | ) |
Sets the normal relative maximum speed.
Sends the update to player, if needed.
Definition at line 611 of file Player.cpp.
Sets the player's forced respawn position and world.
Definition at line 806 of file Player.cpp.
void cPlayer::SetSkinParts | ( | int | a_Parts | ) |
Definition at line 2504 of file Player.cpp.
void cPlayer::SetSprint | ( | bool | a_ShouldSprint | ) |
Starts or stops sprinting, if our current body stance permits, broadcasting the state change.
Definition at line 729 of file Player.cpp.
void cPlayer::SetSprintingMaxSpeed | ( | double | a_Speed | ) |
Sets the sprinting relative maximum speed.
Sends the update to player, if needed.
Definition at line 626 of file Player.cpp.
void cPlayer::SetTeam | ( | cTeam * | a_Team | ) |
Sets the player team, nullptr if none.
Definition at line 1079 of file Player.cpp.
void cPlayer::SetTouchGround | ( | bool | a_bTouchGround | ) |
Definition at line 351 of file Player.cpp.
void cPlayer::SetVisible | ( | bool | a_bVisible | ) |
Definition at line 1549 of file Player.cpp.
|
overrideprivatevirtual |
Descendants override this function to send a command to the specified client to spawn the entity on the client.
To spawn on all eligible clients, use cChunkMap::BroadcastSpawnEntity()
Implements cEntity.
Definition at line 3137 of file Player.cpp.
void cPlayer::SpectateEntity | ( | cEntity * | a_Target | ) |
Spectates the target entity.
If a_Target is nullptr or a pointer to self, end spectation.
Definition at line 1471 of file Player.cpp.
void cPlayer::StartChargingBow | ( | void | ) |
Starts charging the equipped bow.
Definition at line 312 of file Player.cpp.
void cPlayer::StartEating | ( | void | ) |
Starts eating the currently equipped item.
Resets the eating timer and sends the proper animation packet
Definition at line 514 of file Player.cpp.
|
overridevirtual |
Teleports to the coordinates specified.
Reimplemented from cEntity.
Definition at line 1404 of file Player.cpp.
|
overrideprivatevirtual |
Reimplemented from cPawn.
Definition at line 3157 of file Player.cpp.
|
private |
Definition at line 2749 of file Player.cpp.
void cPlayer::TossEquippedItem | ( | char | a_Amount = 1 | ) |
tosses the item in the selected hotbar slot
Definition at line 1720 of file Player.cpp.
void cPlayer::TossHeldItem | ( | char | a_Amount = 1 | ) |
tosses the item held in hand (when in UI windows)
Definition at line 1764 of file Player.cpp.
void cPlayer::TossItems | ( | const cItems & | a_Items | ) |
Tosses a list of items.
Definition at line 478 of file Player.cpp.
void cPlayer::TossPickup | ( | const cItem & | a_Item | ) |
tosses a pickup newly created from a_Item
Definition at line 1791 of file Player.cpp.
void cPlayer::Unfreeze | ( | ) |
Cancels Freeze(...) and allows the player to move naturally.
Definition at line 1441 of file Player.cpp.
void cPlayer::UpdateCapabilities | ( | ) |
Updates player's capabilities - flying, visibility, etc.
from their gamemode.
Definition at line 1346 of file Player.cpp.
void cPlayer::UpdateMovementStats | ( | const Vector3d & | a_DeltaPos, |
bool | a_PreviousIsOnGround | ||
) |
Update movement-related statistics.
Definition at line 2216 of file Player.cpp.
cTeam * cPlayer::UpdateTeam | ( | void | ) |
Forces the player to query the scoreboard for his team.
Definition at line 1103 of file Player.cpp.
void cPlayer::UseEquippedItem | ( | cItemHandler::eDurabilityLostAction | a_Action | ) |
Damage the player's equipped item by the amount of damage such an item is damaged by when used for a_Action.
Definition at line 2048 of file Player.cpp.
void cPlayer::UseEquippedItem | ( | short | a_Damage = 1 | ) |
Damage the player's equipped item by a_Damage, possibly less if the equipped item is enchanted.
Definition at line 2033 of file Player.cpp.
void cPlayer::UseItem | ( | int | a_SlotNumber, |
short | a_Damage = 1 |
||
) |
Damage the item in a_SlotNumber by a_Damage, possibly less if the equipped item is enchanted.
Definition at line 2063 of file Player.cpp.
|
static |
Calculates the amount of XP needed for a given level Ref: https://minecraft.wiki/w/XP.
Definition at line 215 of file Player.cpp.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
All the permissions that this player has, based on their rank, split into individual dot-delimited parts.
This is used mainly by the HasPermission() function to optimize the lookup.
|
private |
All the restrictions that this player has, based on their rank, split into individual dot-delimited parts.
This is used mainly by the HasPermission() function to optimize the lookup.
|
private |
|
private |
|
private |