diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2021-02-06 19:37:03 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@outlook.com> | 2021-02-07 23:36:15 +0100 |
commit | be2bf999c280d6892b38272d3f783b3462f0b745 (patch) | |
tree | 6567e7f011e50dd8e6f65f7dd933a1d7dc34ea93 /src/Entities/Player.h | |
parent | Adds playerlist header and footer broadcasting (1.8-1.13) (diff) | |
download | cuberite-be2bf999c280d6892b38272d3f783b3462f0b745.tar cuberite-be2bf999c280d6892b38272d3f783b3462f0b745.tar.gz cuberite-be2bf999c280d6892b38272d3f783b3462f0b745.tar.bz2 cuberite-be2bf999c280d6892b38272d3f783b3462f0b745.tar.lz cuberite-be2bf999c280d6892b38272d3f783b3462f0b745.tar.xz cuberite-be2bf999c280d6892b38272d3f783b3462f0b745.tar.zst cuberite-be2bf999c280d6892b38272d3f783b3462f0b745.zip |
Diffstat (limited to 'src/Entities/Player.h')
-rw-r--r-- | src/Entities/Player.h | 67 |
1 files changed, 22 insertions, 45 deletions
diff --git a/src/Entities/Player.h b/src/Entities/Player.h index ba3c345ed..f7d54340e 100644 --- a/src/Entities/Player.h +++ b/src/Entities/Player.h @@ -47,42 +47,9 @@ public: CLASS_PROTODEF(cPlayer) - cPlayer(const cClientHandlePtr & a_Client); - virtual ~cPlayer() override; - virtual void OnAddToWorld(cWorld & a_World) override; - virtual void OnRemoveFromWorld(cWorld & a_World) override; - - virtual void SpawnOn(cClientHandle & a_Client) override; - - virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; - - void TickFreezeCode(); - - virtual void HandlePhysics(std::chrono::milliseconds a_Dt, cChunk &) override { UNUSED(a_Dt); } - - /** Returns the currently equipped weapon; empty item if none */ - virtual cItem GetEquippedWeapon(void) const override { return m_Inventory.GetEquippedItem(); } - - /** Returns the currently equipped helmet; empty item if none */ - virtual cItem GetEquippedHelmet(void) const override { return m_Inventory.GetEquippedHelmet(); } - - /** Returns the currently equipped chestplate; empty item if none */ - virtual cItem GetEquippedChestplate(void) const override { return m_Inventory.GetEquippedChestplate(); } - - /** Returns the currently equipped leggings; empty item if none */ - virtual cItem GetEquippedLeggings(void) const override { return m_Inventory.GetEquippedLeggings(); } - - /** Returns the currently equipped boots; empty item if none */ - virtual cItem GetEquippedBoots(void) const override { return m_Inventory.GetEquippedBoots(); } - - /** Returns the currently offhand equipped item; empty item if none */ - virtual cItem GetOffHandEquipedItem(void) const override { return m_Inventory.GetShieldSlot(); } - - virtual void ApplyArmorDamage(int DamageBlocked) override; - // tolua_begin /** Sets the experience total @@ -598,14 +565,19 @@ public: Source: https://minecraft.gamepedia.com/Breaking#Instant_breaking */ bool CanInstantlyMine(BLOCKTYPE a_Block); - /** get player explosion exposure rate */ - virtual float GetExplosionExposureRate(Vector3d a_ExplosionPosition, float a_ExlosionPower) override; - /** Adds an Item to the list of known items. If the item is already known, does nothing. */ void AddKnownItem(const cItem & a_Item); -protected: + // cEntity overrides: + virtual cItem GetEquippedWeapon(void) const override { return m_Inventory.GetEquippedItem(); } + virtual cItem GetEquippedHelmet(void) const override { return m_Inventory.GetEquippedHelmet(); } + virtual cItem GetEquippedChestplate(void) const override { return m_Inventory.GetEquippedChestplate(); } + virtual cItem GetEquippedLeggings(void) const override { return m_Inventory.GetEquippedLeggings(); } + virtual cItem GetEquippedBoots(void) const override { return m_Inventory.GetEquippedBoots(); } + virtual cItem GetOffHandEquipedItem(void) const override { return m_Inventory.GetShieldSlot(); } + +private: typedef std::vector<std::vector<AString> > AStringVectorVector; @@ -766,12 +738,6 @@ protected: /** List of known items as Ids */ std::set<cItem, cItem::sItemCompare> m_KnownItems; - /** Sets the speed and sends it to the client, so that they are forced to move so. */ - virtual void DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) override; - - /** Filters out damage for creative mode / friendly fire */ - virtual bool DoTakeDamage(TakeDamageInfo & TDI) override; - /** Called in each tick to handle food-related processing */ void HandleFood(void); @@ -782,8 +748,6 @@ protected: This can be used both for online and offline UUIDs. */ AString GetUUIDFileName(const cUUID & a_UUID); -private: - /** Pins the player to a_Location until Unfreeze() is called. If ManuallyFrozen is false, the player will unfreeze when the chunk is loaded. */ void FreezeInternal(const Vector3d & a_Location, bool a_ManuallyFrozen); @@ -807,4 +771,17 @@ private: If the recipe is already known, does nothing. */ void AddKnownRecipe(UInt32 RecipeId); + void TickFreezeCode(); + + // cEntity overrides: + virtual void ApplyArmorDamage(int DamageBlocked) override; + virtual void BroadcastMovementUpdate(const cClientHandle * a_Exclude = nullptr) override; + virtual bool DoTakeDamage(TakeDamageInfo & TDI) override; + virtual float GetEnchantmentBlastKnockbackReduction() override; + virtual void HandlePhysics(std::chrono::milliseconds a_Dt, cChunk &) override { UNUSED(a_Dt); } + virtual void OnAddToWorld(cWorld & a_World) override; + virtual void OnRemoveFromWorld(cWorld & a_World) override; + virtual void SpawnOn(cClientHandle & a_Client) override; + virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; + } ; // tolua_export |