summaryrefslogtreecommitdiffstats
path: root/src/BlockEntities
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2021-03-15 18:06:40 +0100
committerTiger Wang <ziwei.tiger@outlook.com>2021-03-18 00:44:59 +0100
commitedf9e39ed76001b2bb95d1fb74cc88fa60a42e83 (patch)
tree4b071841150d83d479b1bd94941cc127d0a2a048 /src/BlockEntities
parentshared_ptr -> unique_ptr in generators (diff)
downloadcuberite-edf9e39ed76001b2bb95d1fb74cc88fa60a42e83.tar
cuberite-edf9e39ed76001b2bb95d1fb74cc88fa60a42e83.tar.gz
cuberite-edf9e39ed76001b2bb95d1fb74cc88fa60a42e83.tar.bz2
cuberite-edf9e39ed76001b2bb95d1fb74cc88fa60a42e83.tar.lz
cuberite-edf9e39ed76001b2bb95d1fb74cc88fa60a42e83.tar.xz
cuberite-edf9e39ed76001b2bb95d1fb74cc88fa60a42e83.tar.zst
cuberite-edf9e39ed76001b2bb95d1fb74cc88fa60a42e83.zip
Diffstat (limited to '')
-rw-r--r--src/BlockEntities/BannerEntity.cpp32
-rw-r--r--src/BlockEntities/BannerEntity.h2
-rw-r--r--src/BlockEntities/MobHeadEntity.cpp66
-rw-r--r--src/BlockEntities/MobHeadEntity.h12
4 files changed, 59 insertions, 53 deletions
diff --git a/src/BlockEntities/BannerEntity.cpp b/src/BlockEntities/BannerEntity.cpp
index d7fda3cf7..e7be2065e 100644
--- a/src/BlockEntities/BannerEntity.cpp
+++ b/src/BlockEntities/BannerEntity.cpp
@@ -33,21 +33,18 @@ cBannerEntity::cBannerEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vect
-void cBannerEntity::CopyFrom(const cBlockEntity & a_Src)
+unsigned char cBannerEntity::GetBaseColor() const
{
- Super::CopyFrom(a_Src);
- auto & src = static_cast<const cBannerEntity &>(a_Src);
- m_BaseColor = src.m_BaseColor;
+ return m_BaseColor;
}
-void cBannerEntity::SendTo(cClientHandle & a_Client)
+void cBannerEntity::SetBaseColor(const unsigned char a_Color)
{
- a_Client.SendBlockChange(m_Pos.x, m_Pos.y, m_Pos.z, m_BlockType, m_BlockMeta);
- a_Client.SendUpdateBlockEntity(*this);
+ m_BaseColor = a_Color;
}
@@ -63,16 +60,29 @@ cItems cBannerEntity::ConvertToPickups() const
-unsigned char cBannerEntity::GetBaseColor() const
+void cBannerEntity::CopyFrom(const cBlockEntity & a_Src)
{
- return m_BaseColor;
+ Super::CopyFrom(a_Src);
+ auto & src = static_cast<const cBannerEntity &>(a_Src);
+ m_BaseColor = src.m_BaseColor;
}
-void cBannerEntity::SetBaseColor(const unsigned char a_Color)
+void cBannerEntity::SendTo(cClientHandle & a_Client)
{
- m_BaseColor = a_Color;
+ a_Client.SendBlockChange(m_Pos.x, m_Pos.y, m_Pos.z, m_BlockType, m_BlockMeta);
+ a_Client.SendUpdateBlockEntity(*this);
+}
+
+
+
+
+
+bool cBannerEntity::UsedBy(cPlayer * a_Player)
+{
+ UNUSED(a_Player);
+ return false;
}
diff --git a/src/BlockEntities/BannerEntity.h b/src/BlockEntities/BannerEntity.h
index d265f3279..b6d27f53b 100644
--- a/src/BlockEntities/BannerEntity.h
+++ b/src/BlockEntities/BannerEntity.h
@@ -39,5 +39,5 @@ private:
virtual cItems ConvertToPickups() const override;
virtual void CopyFrom(const cBlockEntity & a_Src) override;
virtual void SendTo(cClientHandle & a_Client) override;
- virtual bool UsedBy(cPlayer * a_Player) override { return true; }
+ virtual bool UsedBy(cPlayer * a_Player) override;
} ; // tolua_export
diff --git a/src/BlockEntities/MobHeadEntity.cpp b/src/BlockEntities/MobHeadEntity.cpp
index eee6cf9c1..14773a0f1 100644
--- a/src/BlockEntities/MobHeadEntity.cpp
+++ b/src/BlockEntities/MobHeadEntity.cpp
@@ -25,41 +25,6 @@ cMobHeadEntity::cMobHeadEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Ve
-cItems cMobHeadEntity::ConvertToPickups() const
-{
- return cItem(E_ITEM_HEAD, 1, static_cast<short>(m_Type));
-}
-
-
-
-
-
-void cMobHeadEntity::CopyFrom(const cBlockEntity & a_Src)
-{
- Super::CopyFrom(a_Src);
- auto & src = static_cast<const cMobHeadEntity &>(a_Src);
- m_OwnerName = src.m_OwnerName;
- m_OwnerTexture = src.m_OwnerTexture;
- m_OwnerTextureSignature = src.m_OwnerTextureSignature;
- m_OwnerUUID = src.m_OwnerUUID;
- m_Rotation = src.m_Rotation;
- m_Type = src.m_Type;
-}
-
-
-
-
-
-bool cMobHeadEntity::UsedBy(cPlayer * a_Player)
-{
- UNUSED(a_Player);
- return true;
-}
-
-
-
-
-
void cMobHeadEntity::SetType(const eMobHeadType & a_Type)
{
if ((!m_OwnerName.empty()) && (a_Type != SKULL_TYPE_PLAYER))
@@ -131,6 +96,31 @@ void cMobHeadEntity::SetOwner(const cUUID & a_OwnerUUID, const AString & a_Owner
+cItems cMobHeadEntity::ConvertToPickups() const
+{
+ return cItem(E_ITEM_HEAD, 1, static_cast<short>(m_Type));
+}
+
+
+
+
+
+void cMobHeadEntity::CopyFrom(const cBlockEntity & a_Src)
+{
+ Super::CopyFrom(a_Src);
+ auto & src = static_cast<const cMobHeadEntity &>(a_Src);
+ m_OwnerName = src.m_OwnerName;
+ m_OwnerTexture = src.m_OwnerTexture;
+ m_OwnerTextureSignature = src.m_OwnerTextureSignature;
+ m_OwnerUUID = src.m_OwnerUUID;
+ m_Rotation = src.m_Rotation;
+ m_Type = src.m_Type;
+}
+
+
+
+
+
void cMobHeadEntity::SendTo(cClientHandle & a_Client)
{
cWorld * World = a_Client.GetPlayer()->GetWorld();
@@ -141,3 +131,9 @@ void cMobHeadEntity::SendTo(cClientHandle & a_Client)
+
+bool cMobHeadEntity::UsedBy(cPlayer * a_Player)
+{
+ UNUSED(a_Player);
+ return false;
+}
diff --git a/src/BlockEntities/MobHeadEntity.h b/src/BlockEntities/MobHeadEntity.h
index 5ed2d8d01..fcc7fc4c4 100644
--- a/src/BlockEntities/MobHeadEntity.h
+++ b/src/BlockEntities/MobHeadEntity.h
@@ -67,12 +67,6 @@ public: // tolua_export
/** Returns the player UUID of the mob head */
cUUID GetOwnerUUID(void) const { return m_OwnerUUID; } // Exported in ManualBindings.cpp
- // cBlockEntity overrides:
- virtual cItems ConvertToPickups() const override;
- virtual void CopyFrom(const cBlockEntity & a_Src) override;
- virtual bool UsedBy(cPlayer * a_Player) override;
- virtual void SendTo(cClientHandle & a_Client) override;
-
private:
eMobHeadType m_Type;
@@ -82,4 +76,10 @@ private:
cUUID m_OwnerUUID;
AString m_OwnerTexture;
AString m_OwnerTextureSignature;
+
+ // cBlockEntity overrides:
+ virtual cItems ConvertToPickups() const override;
+ virtual void CopyFrom(const cBlockEntity & a_Src) override;
+ virtual void SendTo(cClientHandle & a_Client) override;
+ virtual bool UsedBy(cPlayer * a_Player) override;
} ; // tolua_export