diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-07-20 13:02:23 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-07-20 13:02:23 +0200 |
commit | d0e7b2f18b15afbc78adfdcf7d1b7b3511a0a6ab (patch) | |
tree | 4f283dd99354a72bb8ba30da637b38adb5521b76 /src/BlockEntities | |
parent | Proper comment for DropBlock() (diff) | |
parent | NBTChunkSerializer.cpp: Added break after serializing the splash potion (diff) | |
download | cuberite-d0e7b2f18b15afbc78adfdcf7d1b7b3511a0a6ab.tar cuberite-d0e7b2f18b15afbc78adfdcf7d1b7b3511a0a6ab.tar.gz cuberite-d0e7b2f18b15afbc78adfdcf7d1b7b3511a0a6ab.tar.bz2 cuberite-d0e7b2f18b15afbc78adfdcf7d1b7b3511a0a6ab.tar.lz cuberite-d0e7b2f18b15afbc78adfdcf7d1b7b3511a0a6ab.tar.xz cuberite-d0e7b2f18b15afbc78adfdcf7d1b7b3511a0a6ab.tar.zst cuberite-d0e7b2f18b15afbc78adfdcf7d1b7b3511a0a6ab.zip |
Diffstat (limited to 'src/BlockEntities')
-rw-r--r-- | src/BlockEntities/BeaconEntity.cpp | 2 | ||||
-rw-r--r-- | src/BlockEntities/BlockEntityWithItems.h | 2 | ||||
-rw-r--r-- | src/BlockEntities/CMakeLists.txt | 42 | ||||
-rw-r--r-- | src/BlockEntities/ChestEntity.cpp | 6 | ||||
-rw-r--r-- | src/BlockEntities/ChestEntity.h | 3 | ||||
-rw-r--r-- | src/BlockEntities/CommandBlockEntity.cpp | 2 | ||||
-rw-r--r-- | src/BlockEntities/CommandBlockEntity.h | 2 | ||||
-rw-r--r-- | src/BlockEntities/DropSpenserEntity.cpp | 10 | ||||
-rw-r--r-- | src/BlockEntities/DropSpenserEntity.h | 3 | ||||
-rw-r--r-- | src/BlockEntities/EnderChestEntity.h | 4 | ||||
-rw-r--r-- | src/BlockEntities/FlowerPotEntity.h | 2 | ||||
-rw-r--r-- | src/BlockEntities/HopperEntity.cpp | 8 | ||||
-rw-r--r-- | src/BlockEntities/HopperEntity.h | 3 | ||||
-rw-r--r-- | src/BlockEntities/JukeboxEntity.h | 2 | ||||
-rw-r--r-- | src/BlockEntities/MobHeadEntity.h | 2 | ||||
-rw-r--r-- | src/BlockEntities/NoteEntity.h | 2 | ||||
-rw-r--r-- | src/BlockEntities/SignEntity.h | 2 |
17 files changed, 66 insertions, 31 deletions
diff --git a/src/BlockEntities/BeaconEntity.cpp b/src/BlockEntities/BeaconEntity.cpp index 0914353eb..9a6d85f1d 100644 --- a/src/BlockEntities/BeaconEntity.cpp +++ b/src/BlockEntities/BeaconEntity.cpp @@ -32,7 +32,7 @@ int cBeaconEntity::GetPyramidLevel(void) } Area.Read( - m_World, + m_World, GetPosX() - 4, GetPosX() + 4, MinY, MaxY, GetPosZ() - 4, GetPosZ() + 4, diff --git a/src/BlockEntities/BlockEntityWithItems.h b/src/BlockEntities/BlockEntityWithItems.h index 918781a00..5f1639d45 100644 --- a/src/BlockEntities/BlockEntityWithItems.h +++ b/src/BlockEntities/BlockEntityWithItems.h @@ -50,7 +50,7 @@ public: cItems Pickups; m_Contents.CopyToItems(Pickups); m_Contents.Clear(); - m_World->SpawnItemPickups(Pickups, m_PosX + 0.5, m_PosY + 0.5, m_PosZ + 0.5); // Spawn in centre of block + m_World->SpawnItemPickups(Pickups, m_PosX + 0.5, m_PosY + 0.5, m_PosZ + 0.5); // Spawn in centre of block } // tolua_begin 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 ca164464c..21e1f6ba2 100644 --- a/src/BlockEntities/ChestEntity.cpp +++ b/src/BlockEntities/ChestEntity.cpp @@ -169,15 +169,15 @@ 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 return; } - // There is no chest neighbor, open a single-chest window: + // There is no chest neighbor, open a single-chest window: OpenWindow(new cChestWindow(this)); } 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.cpp b/src/BlockEntities/CommandBlockEntity.cpp index 146ad915b..45f8a3e4d 100644 --- a/src/BlockEntities/CommandBlockEntity.cpp +++ b/src/BlockEntities/CommandBlockEntity.cpp @@ -11,7 +11,7 @@ #include "../CommandOutput.h" #include "../Root.h" -#include "../Server.h" // ExecuteConsoleCommand() +#include "../Server.h" // ExecuteConsoleCommand() #include "../Chunk.h" diff --git a/src/BlockEntities/CommandBlockEntity.h b/src/BlockEntities/CommandBlockEntity.h index 12157670f..d7c4eaabe 100644 --- a/src/BlockEntities/CommandBlockEntity.h +++ b/src/BlockEntities/CommandBlockEntity.h @@ -26,7 +26,7 @@ namespace Json // tolua_begin -class cCommandBlockEntity : +class cCommandBlockEntity : public cBlockEntity { typedef cBlockEntity super; diff --git a/src/BlockEntities/DropSpenserEntity.cpp b/src/BlockEntities/DropSpenserEntity.cpp index 108c2ce1b..dc38e3e9b 100644 --- a/src/BlockEntities/DropSpenserEntity.cpp +++ b/src/BlockEntities/DropSpenserEntity.cpp @@ -42,7 +42,7 @@ cDropSpenserEntity::~cDropSpenserEntity() void cDropSpenserEntity::AddDropSpenserDir(int & a_BlockX, int & a_BlockY, int & a_BlockZ, NIBBLETYPE a_Direction) { - switch (a_Direction & 0x07) // Vanilla uses the 8th bit to determine power state - we don't + switch (a_Direction & 0x07) // Vanilla uses the 8th bit to determine power state - we don't { case E_META_DROPSPENSER_FACING_YM: a_BlockY--; return; case E_META_DROPSPENSER_FACING_YP: a_BlockY++; return; @@ -90,7 +90,7 @@ void cDropSpenserEntity::DropSpense(cChunk & a_Chunk) int SmokeDir = 0; switch (Meta) { - case E_META_DROPSPENSER_FACING_YP: SmokeDir = 4; break; // YP & YM don't have associated smoke dirs, just do 4 (centre of block) + case E_META_DROPSPENSER_FACING_YP: SmokeDir = 4; break; // YP & YM don't have associated smoke dirs, just do 4 (centre of block) case E_META_DROPSPENSER_FACING_YM: SmokeDir = 4; break; case E_META_DROPSPENSER_FACING_XM: SmokeDir = 3; break; case E_META_DROPSPENSER_FACING_XP: SmokeDir = 5; break; @@ -99,7 +99,7 @@ void cDropSpenserEntity::DropSpense(cChunk & a_Chunk) } m_World->BroadcastSoundParticleEffect(2000, m_PosX, m_PosY, m_PosZ, SmokeDir); m_World->BroadcastSoundEffect("random.click", m_PosX * 8, m_PosY * 8, m_PosZ * 8, 1.0f, 1.0f); -} +} @@ -235,7 +235,7 @@ void cDropSpenserEntity::DropFromSlot(cChunk & a_Chunk, int a_SlotNum) cItems Pickups; Pickups.push_back(m_Contents.RemoveOneItem(a_SlotNum)); - const int PickupSpeed = m_World->GetTickRandomNumber(4) + 2; // At least 2, at most 6 + const int PickupSpeed = m_World->GetTickRandomNumber(4) + 2; // At least 2, at most 6 int PickupSpeedX = 0, PickupSpeedY = 0, PickupSpeedZ = 0; switch (Meta) { @@ -249,7 +249,7 @@ void cDropSpenserEntity::DropFromSlot(cChunk & a_Chunk, int a_SlotNum) double MicroX, MicroY, MicroZ; MicroX = DispX + 0.5; - MicroY = DispY + 0.4; // Slightly less than half, to accomodate actual texture hole on DropSpenser + MicroY = DispY + 0.4; // Slightly less than half, to accomodate actual texture hole on DropSpenser MicroZ = DispZ + 0.5; 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/EnderChestEntity.h b/src/BlockEntities/EnderChestEntity.h index 04af67683..ed178f6fc 100644 --- a/src/BlockEntities/EnderChestEntity.h +++ b/src/BlockEntities/EnderChestEntity.h @@ -16,10 +16,10 @@ class cEnderChestEntity : { typedef cBlockEntity super; -public: +public: // tolua_end - cEnderChestEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World); + cEnderChestEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World); virtual ~cEnderChestEntity(); static const char * GetClassStatic(void) { return "cEnderChestEntity"; } diff --git a/src/BlockEntities/FlowerPotEntity.h b/src/BlockEntities/FlowerPotEntity.h index e3570eb9a..85cb810ad 100644 --- a/src/BlockEntities/FlowerPotEntity.h +++ b/src/BlockEntities/FlowerPotEntity.h @@ -27,7 +27,7 @@ namespace Json // tolua_begin -class cFlowerPotEntity : +class cFlowerPotEntity : public cBlockEntity { typedef cBlockEntity super; diff --git a/src/BlockEntities/HopperEntity.cpp b/src/BlockEntities/HopperEntity.cpp index 7af4b9d5d..48d3b8dcc 100644 --- a/src/BlockEntities/HopperEntity.cpp +++ b/src/BlockEntities/HopperEntity.cpp @@ -219,7 +219,7 @@ bool cHopperEntity::MovePickupsIn(cChunk & a_Chunk, Int64 a_CurrentTick) } Vector3f EntityPos = a_Entity->GetPosition(); - Vector3f BlockPos(m_Pos.x + 0.5f, (float)m_Pos.y + 1, m_Pos.z + 0.5f); // One block above hopper, and search from center outwards + Vector3f BlockPos(m_Pos.x + 0.5f, (float)m_Pos.y + 1, m_Pos.z + 0.5f); // One block above hopper, and search from center outwards double Distance = (EntityPos - BlockPos).Length(); if (Distance < 0.5) @@ -243,7 +243,7 @@ bool cHopperEntity::MovePickupsIn(cChunk & a_Chunk, Int64 a_CurrentTick) { m_bFoundPickupsAbove = true; m_Contents.SetSlot(i, Item); - a_Pickup->Destroy(); // Kill pickup + a_Pickup->Destroy(); // Kill pickup return true; } @@ -253,11 +253,11 @@ bool cHopperEntity::MovePickupsIn(cChunk & a_Chunk, Int64 a_CurrentTick) int PreviousCount = m_Contents.GetSlot(i).m_ItemCount; - Item.m_ItemCount -= m_Contents.ChangeSlotCount(i, Item.m_ItemCount) - PreviousCount; // Set count to however many items were added + Item.m_ItemCount -= m_Contents.ChangeSlotCount(i, Item.m_ItemCount) - PreviousCount; // Set count to however many items were added if (Item.IsEmpty()) { - a_Pickup->Destroy(); // Kill pickup if all items were added + a_Pickup->Destroy(); // Kill pickup if all items were added } return true; } 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 3d1d604f7..8bb3009eb 100644 --- a/src/BlockEntities/JukeboxEntity.h +++ b/src/BlockEntities/JukeboxEntity.h @@ -19,7 +19,7 @@ namespace Json // tolua_begin -class cJukeboxEntity : +class cJukeboxEntity : public cBlockEntity { typedef cBlockEntity super; diff --git a/src/BlockEntities/MobHeadEntity.h b/src/BlockEntities/MobHeadEntity.h index 367eb15e7..2bc072d69 100644 --- a/src/BlockEntities/MobHeadEntity.h +++ b/src/BlockEntities/MobHeadEntity.h @@ -25,7 +25,7 @@ namespace Json // tolua_begin -class cMobHeadEntity : +class cMobHeadEntity : public cBlockEntity { typedef cBlockEntity super; diff --git a/src/BlockEntities/NoteEntity.h b/src/BlockEntities/NoteEntity.h index b698899c0..07b8fd259 100644 --- a/src/BlockEntities/NoteEntity.h +++ b/src/BlockEntities/NoteEntity.h @@ -28,7 +28,7 @@ enum ENUM_NOTE_INSTRUMENTS // tolua_begin -class cNoteEntity : +class cNoteEntity : public cBlockEntity { typedef cBlockEntity super; diff --git a/src/BlockEntities/SignEntity.h b/src/BlockEntities/SignEntity.h index 80c7bbfdf..16e0e23bc 100644 --- a/src/BlockEntities/SignEntity.h +++ b/src/BlockEntities/SignEntity.h @@ -25,7 +25,7 @@ namespace Json // tolua_begin -class cSignEntity : +class cSignEntity : public cBlockEntity { typedef cBlockEntity super; |