summaryrefslogtreecommitdiffstats
path: root/src/BlockEntities
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-02-19 14:45:09 +0100
committerTheJumper <maximilian.springer@web.de>2014-02-23 19:50:50 +0100
commit1f726b7d9dade75d8f7a3e105f3c9689a1ef0e0b (patch)
tree617bf18a768a493c2cd428297168f57df0901c26 /src/BlockEntities
parentAdd break to Protocol17x.cpp and use new comment delimiter (diff)
downloadcuberite-1f726b7d9dade75d8f7a3e105f3c9689a1ef0e0b.tar
cuberite-1f726b7d9dade75d8f7a3e105f3c9689a1ef0e0b.tar.gz
cuberite-1f726b7d9dade75d8f7a3e105f3c9689a1ef0e0b.tar.bz2
cuberite-1f726b7d9dade75d8f7a3e105f3c9689a1ef0e0b.tar.lz
cuberite-1f726b7d9dade75d8f7a3e105f3c9689a1ef0e0b.tar.xz
cuberite-1f726b7d9dade75d8f7a3e105f3c9689a1ef0e0b.tar.zst
cuberite-1f726b7d9dade75d8f7a3e105f3c9689a1ef0e0b.zip
Diffstat (limited to 'src/BlockEntities')
-rw-r--r--src/BlockEntities/BlockEntity.cpp4
-rw-r--r--src/BlockEntities/MobHeadEntity.cpp108
-rw-r--r--src/BlockEntities/MobHeadEntity.h79
-rw-r--r--src/BlockEntities/SkullEntity.cpp108
-rw-r--r--src/BlockEntities/SkullEntity.h79
5 files changed, 189 insertions, 189 deletions
diff --git a/src/BlockEntities/BlockEntity.cpp b/src/BlockEntities/BlockEntity.cpp
index f01a139d2..57ad83de9 100644
--- a/src/BlockEntities/BlockEntity.cpp
+++ b/src/BlockEntities/BlockEntity.cpp
@@ -15,7 +15,7 @@
#include "JukeboxEntity.h"
#include "NoteEntity.h"
#include "SignEntity.h"
-#include "SkullEntity.h"
+#include "MobHeadEntity.h"
@@ -30,7 +30,7 @@ cBlockEntity * cBlockEntity::CreateByBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE
case E_BLOCK_DISPENSER: return new cDispenserEntity (a_BlockX, a_BlockY, a_BlockZ, a_World);
case E_BLOCK_DROPPER: return new cDropperEntity (a_BlockX, a_BlockY, a_BlockZ, a_World);
case E_BLOCK_ENDER_CHEST: return new cEnderChestEntity (a_BlockX, a_BlockY, a_BlockZ, a_World);
- case E_BLOCK_HEAD: return new cSkullEntity (a_BlockX, a_BlockY, a_BlockZ, a_World);
+ case E_BLOCK_HEAD: return new cMobHeadEntity (a_BlockX, a_BlockY, a_BlockZ, a_World);
case E_BLOCK_LIT_FURNACE: return new cFurnaceEntity (a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_World);
case E_BLOCK_FURNACE: return new cFurnaceEntity (a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_World);
case E_BLOCK_HOPPER: return new cHopperEntity (a_BlockX, a_BlockY, a_BlockZ, a_World);
diff --git a/src/BlockEntities/MobHeadEntity.cpp b/src/BlockEntities/MobHeadEntity.cpp
new file mode 100644
index 000000000..c0a1781f6
--- /dev/null
+++ b/src/BlockEntities/MobHeadEntity.cpp
@@ -0,0 +1,108 @@
+
+// MobHeadEntity.cpp
+
+// Implements the cMobHeadEntity class representing a single skull/head in the world
+
+#include "Globals.h"
+#include "json/json.h"
+#include "MobHeadEntity.h"
+#include "../Entities/Player.h"
+
+
+
+
+
+cMobHeadEntity::cMobHeadEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World) :
+ super(E_BLOCK_HEAD, a_BlockX, a_BlockY, a_BlockZ, a_World),
+ m_Owner("")
+{
+}
+
+
+
+
+
+void cMobHeadEntity::UsedBy(cPlayer * a_Player)
+{
+ UNUSED(a_Player);
+}
+
+
+
+
+
+void cMobHeadEntity::SetType(const eMobHeadType & a_Type)
+{
+ if ((!m_Owner.empty()) && (a_Type != SKULL_TYPE_PLAYER))
+ {
+ m_Owner = "";
+ }
+ m_Type = a_Type;
+}
+
+
+
+
+
+void cMobHeadEntity::SetRotation(eMobHeadRotation a_Rotation)
+{
+ m_Rotation = a_Rotation;
+}
+
+
+
+
+
+void cMobHeadEntity::SetOwner(const AString & a_Owner)
+{
+ if ((a_Owner.length() > 16) || (m_Type != SKULL_TYPE_PLAYER))
+ {
+ return;
+ }
+ m_Owner = a_Owner;
+}
+
+
+
+
+
+void cMobHeadEntity::SendTo(cClientHandle & a_Client)
+{
+ a_Client.SendUpdateBlockEntity(*this);
+}
+
+
+
+
+
+bool cMobHeadEntity::LoadFromJson(const Json::Value & a_Value)
+{
+ m_PosX = a_Value.get("x", 0).asInt();
+ m_PosY = a_Value.get("y", 0).asInt();
+ m_PosZ = a_Value.get("z", 0).asInt();
+
+ m_Type = static_cast<eMobHeadType>(a_Value.get("Type", 0).asInt());
+ m_Rotation = static_cast<eMobHeadRotation>(a_Value.get("Rotation", 0).asInt());
+ m_Owner = a_Value.get("Owner", "").asString();
+
+ return true;
+}
+
+
+
+
+
+void cMobHeadEntity::SaveToJson(Json::Value & a_Value)
+{
+ a_Value["x"] = m_PosX;
+ a_Value["y"] = m_PosY;
+ a_Value["z"] = m_PosZ;
+
+ a_Value["Type"] = m_Type;
+ a_Value["Rotation"] = m_Rotation;
+ a_Value["Owner"] = m_Owner;
+}
+
+
+
+
diff --git a/src/BlockEntities/MobHeadEntity.h b/src/BlockEntities/MobHeadEntity.h
new file mode 100644
index 000000000..367eb15e7
--- /dev/null
+++ b/src/BlockEntities/MobHeadEntity.h
@@ -0,0 +1,79 @@
+// MobHeadEntity.h
+
+// Declares the cMobHeadEntity class representing a single skull/head in the world
+
+
+
+
+
+#pragma once
+
+#include "BlockEntity.h"
+
+
+
+
+
+namespace Json
+{
+ class Value;
+}
+
+
+
+
+
+// tolua_begin
+
+class cMobHeadEntity :
+ public cBlockEntity
+{
+ typedef cBlockEntity super;
+
+public:
+
+ // tolua_end
+
+ /** Creates a new mob head entity at the specified block coords. a_World may be NULL */
+ cMobHeadEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
+
+ bool LoadFromJson( const Json::Value& a_Value );
+ virtual void SaveToJson(Json::Value& a_Value ) override;
+
+ // tolua_begin
+
+ /** Set the Type */
+ void SetType(const eMobHeadType & a_SkullType);
+
+ /** Set the Rotation */
+ void SetRotation(eMobHeadRotation a_Rotation);
+
+ /** Set the Player Name for Mobheads with Player type */
+ void SetOwner(const AString & a_Owner);
+
+ /** Get the Type */
+ eMobHeadType GetType(void) const { return m_Type; }
+
+ /** Get the Rotation */
+ eMobHeadRotation GetRotation(void) const { return m_Rotation; }
+
+ /** Get the setted Player Name */
+ AString GetOwner(void) const { return m_Owner; }
+
+ // tolua_end
+
+ virtual void UsedBy(cPlayer * a_Player) override;
+ virtual void SendTo(cClientHandle & a_Client) override;
+
+ static const char * GetClassStatic(void) { return "cMobHeadEntity"; }
+
+private:
+
+ eMobHeadType m_Type;
+ eMobHeadRotation m_Rotation;
+ AString m_Owner;
+} ; // tolua_export
+
+
+
+
diff --git a/src/BlockEntities/SkullEntity.cpp b/src/BlockEntities/SkullEntity.cpp
deleted file mode 100644
index 43b97b93e..000000000
--- a/src/BlockEntities/SkullEntity.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-
-// SkullEntity.cpp
-
-// Implements the cSkullEntity class representing a single skull/head in the world
-
-#include "Globals.h"
-#include "json/json.h"
-#include "SkullEntity.h"
-#include "../Entities/Player.h"
-
-
-
-
-
-cSkullEntity::cSkullEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World) :
- super(E_BLOCK_HEAD, a_BlockX, a_BlockY, a_BlockZ, a_World),
- m_Owner("")
-{
-}
-
-
-
-
-
-void cSkullEntity::UsedBy(cPlayer * a_Player)
-{
- UNUSED(a_Player);
-}
-
-
-
-
-
-void cSkullEntity::SetSkullType(const eSkullType & a_SkullType)
-{
- if ((!m_Owner.empty()) && (a_SkullType != SKULL_TYPE_PLAYER))
- {
- m_Owner = "";
- }
- m_SkullType = a_SkullType;
-}
-
-
-
-
-
-void cSkullEntity::SetRotation(eSkullRotation a_Rotation)
-{
- m_Rotation = a_Rotation;
-}
-
-
-
-
-
-void cSkullEntity::SetOwner(const AString & a_Owner)
-{
- if ((a_Owner.length() > 16) || (m_SkullType != SKULL_TYPE_PLAYER))
- {
- return;
- }
- m_Owner = a_Owner;
-}
-
-
-
-
-
-void cSkullEntity::SendTo(cClientHandle & a_Client)
-{
- a_Client.SendUpdateBlockEntity(*this);
-}
-
-
-
-
-
-bool cSkullEntity::LoadFromJson(const Json::Value & a_Value)
-{
- m_PosX = a_Value.get("x", 0).asInt();
- m_PosY = a_Value.get("y", 0).asInt();
- m_PosZ = a_Value.get("z", 0).asInt();
-
- m_SkullType = static_cast<eSkullType>(a_Value.get("SkullType", 0).asInt());
- m_Rotation = static_cast<eSkullRotation>(a_Value.get("Rotation", 0).asInt());
- m_Owner = a_Value.get("Owner", "").asString();
-
- return true;
-}
-
-
-
-
-
-void cSkullEntity::SaveToJson(Json::Value & a_Value)
-{
- a_Value["x"] = m_PosX;
- a_Value["y"] = m_PosY;
- a_Value["z"] = m_PosZ;
-
- a_Value["SkullType"] = m_SkullType;
- a_Value["Rotation"] = m_Rotation;
- a_Value["Owner"] = m_Owner;
-}
-
-
-
-
diff --git a/src/BlockEntities/SkullEntity.h b/src/BlockEntities/SkullEntity.h
deleted file mode 100644
index 3dc355623..000000000
--- a/src/BlockEntities/SkullEntity.h
+++ /dev/null
@@ -1,79 +0,0 @@
-// SkullEntity.h
-
-// Declares the cSkullEntity class representing a single skull/head in the world
-
-
-
-
-
-#pragma once
-
-#include "BlockEntity.h"
-
-
-
-
-
-namespace Json
-{
- class Value;
-}
-
-
-
-
-
-// tolua_begin
-
-class cSkullEntity :
- public cBlockEntity
-{
- typedef cBlockEntity super;
-
-public:
-
- // tolua_end
-
- /** Creates a new skull entity at the specified block coords. a_World may be NULL */
- cSkullEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
-
- bool LoadFromJson( const Json::Value& a_Value );
- virtual void SaveToJson(Json::Value& a_Value ) override;
-
- // tolua_begin
-
- /** Set the Skull Type */
- void SetSkullType(const eSkullType & a_SkullType);
-
- /** Set the Rotation */
- void SetRotation(eSkullRotation a_Rotation);
-
- /** Set the Player Name for Player Skull */
- void SetOwner(const AString & a_Owner);
-
- /** Get the Skull Type */
- eSkullType GetSkullType(void) const { return m_SkullType; }
-
- /** Get the Rotation */
- eSkullRotation GetRotation(void) const { return m_Rotation; }
-
- /** Get the setted Player Name */
- AString GetOwner(void) const { return m_Owner; }
-
- // tolua_end
-
- virtual void UsedBy(cPlayer * a_Player) override;
- virtual void SendTo(cClientHandle & a_Client) override;
-
- static const char * GetClassStatic(void) { return "cSkullEntity"; }
-
-private:
-
- eSkullType m_SkullType;
- eSkullRotation m_Rotation;
- AString m_Owner;
-} ; // tolua_export
-
-
-
-