summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authorPokechu22 <pokechu022@gmail.com>2017-01-03 21:19:29 +0100
committersweetgiorni <sweet.giorni@gmail.com>2017-01-03 22:11:26 +0100
commit28cc26c54ca09ed9ceb2ed2df53dc323f0be405c (patch)
tree3b93c8049db5188fcd4c41bcd3267c4fc9e1c293 /src/Entities
parentPlayer check (diff)
downloadcuberite-28cc26c54ca09ed9ceb2ed2df53dc323f0be405c.tar
cuberite-28cc26c54ca09ed9ceb2ed2df53dc323f0be405c.tar.gz
cuberite-28cc26c54ca09ed9ceb2ed2df53dc323f0be405c.tar.bz2
cuberite-28cc26c54ca09ed9ceb2ed2df53dc323f0be405c.tar.lz
cuberite-28cc26c54ca09ed9ceb2ed2df53dc323f0be405c.tar.xz
cuberite-28cc26c54ca09ed9ceb2ed2df53dc323f0be405c.tar.zst
cuberite-28cc26c54ca09ed9ceb2ed2df53dc323f0be405c.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/Player.cpp24
-rw-r--r--src/Entities/Player.h13
2 files changed, 36 insertions, 1 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index f3ea45cf4..9fba0d015 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -90,7 +90,9 @@ cPlayer::cPlayer(cClientHandlePtr a_Client, const AString & a_PlayerName) :
m_TicksUntilNextSave(PLAYER_INVENTORY_SAVE_INTERVAL),
m_bIsTeleporting(false),
m_UUID((a_Client != nullptr) ? a_Client->GetUUID() : ""),
- m_CustomName("")
+ m_CustomName(""),
+ m_SkinParts(0),
+ m_MainHand(mhRight)
{
ASSERT(a_PlayerName.length() <= 16); // Otherwise this player could crash many clients...
@@ -2632,6 +2634,26 @@ bool cPlayer::PlaceBlocks(const sSetBlockVector & a_Blocks)
+void cPlayer::SetSkinParts(int a_Parts)
+{
+ m_SkinParts = a_Parts & spMask;
+ m_World->BroadcastEntityMetadata(*this, m_ClientHandle.get());
+}
+
+
+
+
+
+void cPlayer::SetMainHand(eMainHand a_Hand)
+{
+ m_MainHand = a_Hand;
+ m_World->BroadcastEntityMetadata(*this, m_ClientHandle.get());
+}
+
+
+
+
+
void cPlayer::AttachTo(cEntity * a_AttachTo)
{
// Different attach, if this is a spectator
diff --git a/src/Entities/Player.h b/src/Entities/Player.h
index dab814692..b592913bd 100644
--- a/src/Entities/Player.h
+++ b/src/Entities/Player.h
@@ -499,6 +499,13 @@ public:
The blocks in range (a_BlockX - a_Range, a_BlockX + a_Range) are sent (NY-metric). */
void SendBlocksAround(int a_BlockX, int a_BlockY, int a_BlockZ, int a_Range = 1);
+ bool HasSkinPart(eSkinPart a_Part) const { return (m_SkinParts & a_Part) != 0; }
+ int GetSkinParts(void) const { return m_SkinParts; }
+ void SetSkinParts(int a_Parts);
+
+ eMainHand GetMainHand(void) const { return m_MainHand; }
+ void SetMainHand(eMainHand a_Hand);
+
// tolua_end
/** Calls the block placement hooks and places the blocks in the world.
@@ -682,6 +689,12 @@ protected:
AString m_CustomName;
+ /** Displayed skin part bit mask */
+ int m_SkinParts;
+
+ /** The main hand of the player */
+ eMainHand m_MainHand;
+
/** 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;