diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-07-26 13:27:27 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-07-26 13:27:27 +0200 |
commit | ef4d68adfd70488df0887f3a5fba1c9aad7a0108 (patch) | |
tree | 1ea3acb0e6b16e8badf7d1d56301bf3dd3a5d99e /src/BlockEntities | |
parent | Add armor items directly to the armor slots. (diff) | |
parent | Git: Ignore AllFiles.lst (generated by cmake) (diff) | |
download | cuberite-ef4d68adfd70488df0887f3a5fba1c9aad7a0108.tar cuberite-ef4d68adfd70488df0887f3a5fba1c9aad7a0108.tar.gz cuberite-ef4d68adfd70488df0887f3a5fba1c9aad7a0108.tar.bz2 cuberite-ef4d68adfd70488df0887f3a5fba1c9aad7a0108.tar.lz cuberite-ef4d68adfd70488df0887f3a5fba1c9aad7a0108.tar.xz cuberite-ef4d68adfd70488df0887f3a5fba1c9aad7a0108.tar.zst cuberite-ef4d68adfd70488df0887f3a5fba1c9aad7a0108.zip |
Diffstat (limited to 'src/BlockEntities')
-rw-r--r-- | src/BlockEntities/BeaconEntity.cpp | 2 | ||||
-rw-r--r-- | src/BlockEntities/BeaconEntity.h | 2 | ||||
-rw-r--r-- | src/BlockEntities/BlockEntity.h | 6 | ||||
-rw-r--r-- | src/BlockEntities/CMakeLists.txt | 42 | ||||
-rw-r--r-- | src/BlockEntities/ChestEntity.cpp | 4 | ||||
-rw-r--r-- | src/BlockEntities/ChestEntity.h | 3 | ||||
-rw-r--r-- | src/BlockEntities/CommandBlockEntity.h | 4 | ||||
-rw-r--r-- | src/BlockEntities/DropSpenserEntity.h | 3 | ||||
-rw-r--r-- | src/BlockEntities/FlowerPotEntity.h | 4 | ||||
-rw-r--r-- | src/BlockEntities/FurnaceEntity.cpp | 2 | ||||
-rw-r--r-- | src/BlockEntities/HopperEntity.h | 3 | ||||
-rw-r--r-- | src/BlockEntities/JukeboxEntity.h | 2 | ||||
-rw-r--r-- | src/BlockEntities/MobHeadEntity.h | 4 | ||||
-rw-r--r-- | src/BlockEntities/NoteEntity.h | 2 | ||||
-rw-r--r-- | src/BlockEntities/SignEntity.h | 4 |
15 files changed, 61 insertions, 26 deletions
diff --git a/src/BlockEntities/BeaconEntity.cpp b/src/BlockEntities/BeaconEntity.cpp index 9a6d85f1d..4b9662797 100644 --- a/src/BlockEntities/BeaconEntity.cpp +++ b/src/BlockEntities/BeaconEntity.cpp @@ -66,7 +66,7 @@ int cBeaconEntity::GetPyramidLevel(void) bool cBeaconEntity::IsMineralBlock(BLOCKTYPE a_BlockType) { - switch(a_BlockType) + switch (a_BlockType) { case E_BLOCK_DIAMOND_BLOCK: case E_BLOCK_GOLD_BLOCK: diff --git a/src/BlockEntities/BeaconEntity.h b/src/BlockEntities/BeaconEntity.h index b1df68bc4..ee1eda391 100644 --- a/src/BlockEntities/BeaconEntity.h +++ b/src/BlockEntities/BeaconEntity.h @@ -33,7 +33,7 @@ public: static bool IsMineralBlock(BLOCKTYPE a_BlockType); // cBlockEntity overrides: - virtual void SaveToJson(Json::Value& a_Value ) override; + virtual void SaveToJson(Json::Value& a_Value) override; virtual void SendTo(cClientHandle & a_Client) override; virtual void UsedBy(cPlayer * a_Player) override; virtual bool Tick(float a_Dt, cChunk & /* a_Chunk */) override; diff --git a/src/BlockEntities/BlockEntity.h b/src/BlockEntities/BlockEntity.h index 7c6688f8d..5710f8543 100644 --- a/src/BlockEntities/BlockEntity.h +++ b/src/BlockEntities/BlockEntity.h @@ -38,9 +38,9 @@ protected: public: // tolua_end - virtual ~cBlockEntity() {}; // force a virtual destructor in all descendants + virtual ~cBlockEntity() {} // force a virtual destructor in all descendants - virtual void Destroy(void) {}; + virtual void Destroy(void) {} void SetWorld(cWorld * a_World) { @@ -79,7 +79,7 @@ public: virtual void SaveToJson (Json::Value & a_Value) = 0; /// Called when a player uses this entity; should open the UI window - virtual void UsedBy( cPlayer * a_Player ) = 0; + virtual void UsedBy( cPlayer * a_Player) = 0; /** Sends the packet defining the block entity to the client specified. To send to all eligible clients, use cWorld::BroadcastBlockEntity() diff --git a/src/BlockEntities/CMakeLists.txt b/src/BlockEntities/CMakeLists.txt index 3e3d17f86..d87594b0d 100644 --- a/src/BlockEntities/CMakeLists.txt +++ b/src/BlockEntities/CMakeLists.txt @@ -4,9 +4,41 @@ project (MCServer) include_directories ("${PROJECT_SOURCE_DIR}/../") -file(GLOB SOURCE - "*.cpp" - "*.h" -) +SET (SRCS + BeaconEntity.cpp + BlockEntity.cpp + ChestEntity.cpp + CommandBlockEntity.cpp + DispenserEntity.cpp + DropSpenserEntity.cpp + DropperEntity.cpp + EnderChestEntity.cpp + FlowerPotEntity.cpp + FurnaceEntity.cpp + HopperEntity.cpp + JukeboxEntity.cpp + MobHeadEntity.cpp + NoteEntity.cpp + SignEntity.cpp) -add_library(BlockEntities ${SOURCE}) +SET (HDRS + BeaconEntity.h + BlockEntity.h + BlockEntityWithItems.h + ChestEntity.h + CommandBlockEntity.h + DispenserEntity.h + DropSpenserEntity.h + DropperEntity.h + EnderChestEntity.h + FlowerPotEntity.h + FurnaceEntity.h + HopperEntity.h + JukeboxEntity.h + MobHeadEntity.h + NoteEntity.h + SignEntity.h) + +if(NOT MSVC) + add_library(BlockEntities ${SRCS} ${HDRS}) +endif() diff --git a/src/BlockEntities/ChestEntity.cpp b/src/BlockEntities/ChestEntity.cpp index 9f50365e9..21e1f6ba2 100644 --- a/src/BlockEntities/ChestEntity.cpp +++ b/src/BlockEntities/ChestEntity.cpp @@ -169,8 +169,8 @@ void cChestEntity::OpenNewWindow(void) if ( m_World->DoWithChestAt(m_PosX - 1, m_PosY, m_PosZ, OpenDbl) || m_World->DoWithChestAt(m_PosX + 1, m_PosY, m_PosZ, OpenDbl) || - m_World->DoWithChestAt(m_PosX , m_PosY, m_PosZ - 1, OpenDbl) || - m_World->DoWithChestAt(m_PosX , m_PosY, m_PosZ + 1, OpenDbl) + m_World->DoWithChestAt(m_PosX, m_PosY, m_PosZ - 1, OpenDbl) || + m_World->DoWithChestAt(m_PosX, m_PosY, m_PosZ + 1, OpenDbl) ) { // The double-chest window has been opened in the callback diff --git a/src/BlockEntities/ChestEntity.h b/src/BlockEntities/ChestEntity.h index 310618504..cd06b3e2c 100644 --- a/src/BlockEntities/ChestEntity.h +++ b/src/BlockEntities/ChestEntity.h @@ -27,7 +27,8 @@ class cChestEntity : typedef cBlockEntityWithItems super; public: - enum { + enum + { ContentsHeight = 3, ContentsWidth = 9, } ; diff --git a/src/BlockEntities/CommandBlockEntity.h b/src/BlockEntities/CommandBlockEntity.h index d7c4eaabe..d02bf7d7b 100644 --- a/src/BlockEntities/CommandBlockEntity.h +++ b/src/BlockEntities/CommandBlockEntity.h @@ -38,8 +38,8 @@ public: /// Creates a new empty command block entity cCommandBlockEntity(int a_X, int a_Y, int a_Z, cWorld * a_World); - bool LoadFromJson( const Json::Value& a_Value ); - virtual void SaveToJson(Json::Value& a_Value ) override; + bool LoadFromJson( const Json::Value& a_Value); + virtual void SaveToJson(Json::Value& a_Value) override; virtual bool Tick(float a_Dt, cChunk & a_Chunk) override; virtual void SendTo(cClientHandle & a_Client) override; diff --git a/src/BlockEntities/DropSpenserEntity.h b/src/BlockEntities/DropSpenserEntity.h index 47d3bd492..9f58d0b07 100644 --- a/src/BlockEntities/DropSpenserEntity.h +++ b/src/BlockEntities/DropSpenserEntity.h @@ -35,7 +35,8 @@ class cDropSpenserEntity : typedef cBlockEntityWithItems super; public: - enum { + enum + { ContentsHeight = 3, ContentsWidth = 3, } ; diff --git a/src/BlockEntities/FlowerPotEntity.h b/src/BlockEntities/FlowerPotEntity.h index 85cb810ad..89901cf2d 100644 --- a/src/BlockEntities/FlowerPotEntity.h +++ b/src/BlockEntities/FlowerPotEntity.h @@ -39,8 +39,8 @@ public: /** Creates a new flowerpot entity at the specified block coords. a_World may be NULL */ cFlowerPotEntity(int a_BlocX, int a_BlockY, int a_BlockZ, cWorld * a_World); - bool LoadFromJson( const Json::Value& a_Value ); - virtual void SaveToJson(Json::Value& a_Value ) override; + bool LoadFromJson( const Json::Value& a_Value); + virtual void SaveToJson(Json::Value& a_Value) override; virtual void Destroy(void) override; diff --git a/src/BlockEntities/FurnaceEntity.cpp b/src/BlockEntities/FurnaceEntity.cpp index 1b1741713..72fd7f2b3 100644 --- a/src/BlockEntities/FurnaceEntity.cpp +++ b/src/BlockEntities/FurnaceEntity.cpp @@ -160,7 +160,7 @@ bool cFurnaceEntity::LoadFromJson(const Json::Value & a_Value) -void cFurnaceEntity::SaveToJson( Json::Value& a_Value ) +void cFurnaceEntity::SaveToJson( Json::Value& a_Value) { a_Value["x"] = m_PosX; a_Value["y"] = m_PosY; diff --git a/src/BlockEntities/HopperEntity.h b/src/BlockEntities/HopperEntity.h index 6ef98f43a..8e856fcda 100644 --- a/src/BlockEntities/HopperEntity.h +++ b/src/BlockEntities/HopperEntity.h @@ -22,7 +22,8 @@ class cHopperEntity : typedef cBlockEntityWithItems super; public: - enum { + enum + { ContentsHeight = 1, ContentsWidth = 5, TICKS_PER_TRANSFER = 8, ///< How many ticks at minimum between two item transfers to or from the hopper diff --git a/src/BlockEntities/JukeboxEntity.h b/src/BlockEntities/JukeboxEntity.h index 8bb3009eb..d677d340f 100644 --- a/src/BlockEntities/JukeboxEntity.h +++ b/src/BlockEntities/JukeboxEntity.h @@ -58,7 +58,7 @@ public: static const char * GetClassStatic(void) { return "cJukeboxEntity"; } virtual void UsedBy(cPlayer * a_Player) override; - virtual void SendTo(cClientHandle &) override { }; + virtual void SendTo(cClientHandle &) override {} private: int m_Record; diff --git a/src/BlockEntities/MobHeadEntity.h b/src/BlockEntities/MobHeadEntity.h index 2bc072d69..f91a3cc9e 100644 --- a/src/BlockEntities/MobHeadEntity.h +++ b/src/BlockEntities/MobHeadEntity.h @@ -37,8 +37,8 @@ public: /** 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; + bool LoadFromJson( const Json::Value& a_Value); + virtual void SaveToJson(Json::Value& a_Value) override; // tolua_begin diff --git a/src/BlockEntities/NoteEntity.h b/src/BlockEntities/NoteEntity.h index 07b8fd259..e8497da3e 100644 --- a/src/BlockEntities/NoteEntity.h +++ b/src/BlockEntities/NoteEntity.h @@ -52,7 +52,7 @@ public: // tolua_end virtual void UsedBy(cPlayer * a_Player) override; - virtual void SendTo(cClientHandle &) override { }; + virtual void SendTo(cClientHandle &) override {} static const char * GetClassStatic(void) { return "cNoteEntity"; } diff --git a/src/BlockEntities/SignEntity.h b/src/BlockEntities/SignEntity.h index 16e0e23bc..33af100a4 100644 --- a/src/BlockEntities/SignEntity.h +++ b/src/BlockEntities/SignEntity.h @@ -37,8 +37,8 @@ public: /// Creates a new empty sign entity at the specified block coords and block type (wall or standing). a_World may be NULL cSignEntity(BLOCKTYPE a_BlockType, int a_X, int a_Y, int a_Z, cWorld * a_World); - bool LoadFromJson( const Json::Value& a_Value ); - virtual void SaveToJson(Json::Value& a_Value ) override; + bool LoadFromJson( const Json::Value& a_Value); + virtual void SaveToJson(Json::Value& a_Value) override; // tolua_begin |