summaryrefslogtreecommitdiffstats
path: root/src/BlockEntities
diff options
context:
space:
mode:
Diffstat (limited to 'src/BlockEntities')
-rw-r--r--src/BlockEntities/BannerEntity.cpp13
-rw-r--r--src/BlockEntities/BannerEntity.h20
-rw-r--r--src/BlockEntities/BeaconEntity.cpp49
-rw-r--r--src/BlockEntities/BeaconEntity.h11
-rw-r--r--src/BlockEntities/BedEntity.cpp5
-rw-r--r--src/BlockEntities/BedEntity.h17
-rw-r--r--src/BlockEntities/BlockEntity.cpp80
-rw-r--r--src/BlockEntities/BlockEntity.h28
-rw-r--r--src/BlockEntities/BlockEntityWithItems.cpp5
-rw-r--r--src/BlockEntities/BlockEntityWithItems.h34
-rw-r--r--src/BlockEntities/BrewingstandEntity.cpp15
-rw-r--r--src/BlockEntities/BrewingstandEntity.h27
-rw-r--r--src/BlockEntities/ChestEntity.cpp28
-rw-r--r--src/BlockEntities/ChestEntity.h15
-rw-r--r--src/BlockEntities/CommandBlockEntity.cpp54
-rw-r--r--src/BlockEntities/CommandBlockEntity.h11
-rw-r--r--src/BlockEntities/DispenserEntity.cpp119
-rw-r--r--src/BlockEntities/DispenserEntity.h18
-rw-r--r--src/BlockEntities/DropSpenserEntity.cpp27
-rw-r--r--src/BlockEntities/DropSpenserEntity.h24
-rw-r--r--src/BlockEntities/DropperEntity.cpp6
-rw-r--r--src/BlockEntities/DropperEntity.h11
-rw-r--r--src/BlockEntities/EnchantingTableEntity.cpp11
-rw-r--r--src/BlockEntities/EnchantingTableEntity.h17
-rw-r--r--src/BlockEntities/EndPortalEntity.h9
-rw-r--r--src/BlockEntities/EnderChestEntity.cpp15
-rw-r--r--src/BlockEntities/EnderChestEntity.h10
-rw-r--r--src/BlockEntities/FlowerPotEntity.cpp2
-rw-r--r--src/BlockEntities/FlowerPotEntity.h11
-rw-r--r--src/BlockEntities/FurnaceEntity.cpp18
-rw-r--r--src/BlockEntities/FurnaceEntity.h26
-rw-r--r--src/BlockEntities/HopperEntity.cpp34
-rw-r--r--src/BlockEntities/HopperEntity.h21
-rw-r--r--src/BlockEntities/JukeboxEntity.cpp5
-rw-r--r--src/BlockEntities/JukeboxEntity.h17
-rw-r--r--src/BlockEntities/MobHeadEntity.cpp15
-rw-r--r--src/BlockEntities/MobHeadEntity.h19
-rw-r--r--src/BlockEntities/MobSpawnerEntity.cpp29
-rw-r--r--src/BlockEntities/MobSpawnerEntity.h42
-rw-r--r--src/BlockEntities/NoteEntity.cpp32
-rw-r--r--src/BlockEntities/NoteEntity.h29
-rw-r--r--src/BlockEntities/SignEntity.cpp11
-rw-r--r--src/BlockEntities/SignEntity.h14
43 files changed, 531 insertions, 473 deletions
diff --git a/src/BlockEntities/BannerEntity.cpp b/src/BlockEntities/BannerEntity.cpp
index 10f185bfd..a2aa99c49 100644
--- a/src/BlockEntities/BannerEntity.cpp
+++ b/src/BlockEntities/BannerEntity.cpp
@@ -13,10 +13,15 @@
-cBannerEntity::cBannerEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World, unsigned char a_BaseColor, AString a_CustomName):
- Super(a_BlockType, a_BlockMeta, a_Pos, a_World),
- m_BaseColor(a_BaseColor),
- m_CustomName(std::move(a_CustomName))
+cBannerEntity::cBannerEntity(
+ BLOCKTYPE a_BlockType,
+ NIBBLETYPE a_BlockMeta,
+ Vector3i a_Pos,
+ cWorld * a_World,
+ unsigned char a_BaseColor,
+ AString a_CustomName
+) :
+ Super(a_BlockType, a_BlockMeta, a_Pos, a_World), m_BaseColor(a_BaseColor), m_CustomName(std::move(a_CustomName))
{
ASSERT((a_BlockType == E_BLOCK_WALL_BANNER) || (a_BlockType == E_BLOCK_STANDING_BANNER));
}
diff --git a/src/BlockEntities/BannerEntity.h b/src/BlockEntities/BannerEntity.h
index 91ef87e8c..e08c33216 100644
--- a/src/BlockEntities/BannerEntity.h
+++ b/src/BlockEntities/BannerEntity.h
@@ -16,16 +16,21 @@
// tolua_begin
-class cBannerEntity :
- public cBlockEntity
+class cBannerEntity : public cBlockEntity
{
// tolua_end
using Super = cBlockEntity;
-public:
-
- cBannerEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World, unsigned char a_BaseColor = 1, AString a_CustomName = "");
+ public:
+ cBannerEntity(
+ BLOCKTYPE a_BlockType,
+ NIBBLETYPE a_BlockMeta,
+ Vector3i a_Pos,
+ cWorld * a_World,
+ unsigned char a_BaseColor = 1,
+ AString a_CustomName = ""
+ );
unsigned char GetBaseColor() const { return m_BaseColor; }
void SetBaseColor(unsigned char a_Color) { m_BaseColor = a_Color; }
@@ -33,8 +38,7 @@ public:
const AString & GetCustomName() const { return m_CustomName; }
void SetCustomName(const AString & a_CustomName) { m_CustomName = a_CustomName; }
-private:
-
+ private:
unsigned char m_BaseColor;
AString m_CustomName;
@@ -44,4 +48,4 @@ private:
virtual void CopyFrom(const cBlockEntity & a_Src) override;
virtual void SendTo(cClientHandle & a_Client) override;
virtual bool UsedBy(cPlayer * a_Player) override;
-} ; // tolua_export
+}; // tolua_export
diff --git a/src/BlockEntities/BeaconEntity.cpp b/src/BlockEntities/BeaconEntity.cpp
index bff1b2e18..d9dd0848f 100644
--- a/src/BlockEntities/BeaconEntity.cpp
+++ b/src/BlockEntities/BeaconEntity.cpp
@@ -12,7 +12,7 @@
-cBeaconEntity::cBeaconEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World):
+cBeaconEntity::cBeaconEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World) :
Super(a_BlockType, a_BlockMeta, a_Pos, 1, 1, a_World),
m_IsActive(false),
m_BeaconLevel(0),
@@ -36,13 +36,7 @@ char cBeaconEntity::CalculatePyramidLevel(void)
int MinY = std::max(GetPosY() - 4, 0);
int MaxY = std::max(GetPosY() - 1, 0);
- Area.Read(
- *m_World,
- GetPosX() - 4, GetPosX() + 4,
- MinY, MaxY,
- GetPosZ() - 4, GetPosZ() + 4,
- cBlockArea::baTypes
- );
+ Area.Read(*m_World, GetPosX() - 4, GetPosX() + 4, MinY, MaxY, GetPosZ() - 4, GetPosZ() + 4, cBlockArea::baTypes);
int Layer = 1;
int MiddleXZ = 4;
@@ -197,14 +191,11 @@ void cBeaconEntity::UpdateBeacon(void)
}
Vector3d BeaconPosition(m_Pos);
- GetWorld()->ForEachPlayer([=](cPlayer & a_Player)
+ GetWorld()->ForEachPlayer(
+ [=](cPlayer & a_Player)
{
Vector3d Distance = BeaconPosition - a_Player.GetPosition();
- if (
- (std::abs(Distance.y) <= 14) &&
- (std::abs(Distance.x) <= 20) &&
- (std::abs(Distance.z) <= 20)
- )
+ if ((std::abs(Distance.y) <= 14) && (std::abs(Distance.x) <= 20) && (std::abs(Distance.z) <= 20))
{
a_Player.AwardAchievement(CustomStatistic::AchFullBeacon);
}
@@ -235,21 +226,24 @@ void cBeaconEntity::GiveEffects(void)
bool HasSecondaryEffect = (m_BeaconLevel >= 4) && (m_PrimaryEffect != m_SecondaryEffect) && (m_SecondaryEffect > 0);
auto Area = cBoundingBox(m_Pos, Radius, Radius + static_cast<double>(cChunkDef::Height), -Radius);
- GetWorld()->ForEachEntityInBox(Area, [&](cEntity & a_Entity)
- {
- if (!a_Entity.IsPlayer())
+ GetWorld()->ForEachEntityInBox(
+ Area,
+ [&](cEntity & a_Entity)
{
- return false;
- }
- auto & Player = static_cast<cPlayer &>(a_Entity);
- Player.AddEntityEffect(m_PrimaryEffect, 180, EffectLevel);
+ if (!a_Entity.IsPlayer())
+ {
+ return false;
+ }
+ auto & Player = static_cast<cPlayer &>(a_Entity);
+ Player.AddEntityEffect(m_PrimaryEffect, 180, EffectLevel);
- if (HasSecondaryEffect)
- {
- Player.AddEntityEffect(m_SecondaryEffect, 180, 0);
+ if (HasSecondaryEffect)
+ {
+ Player.AddEntityEffect(m_SecondaryEffect, 180, 0);
+ }
+ return false;
}
- return false;
- });
+ );
}
@@ -325,7 +319,8 @@ bool cBeaconEntity::UsedBy(cPlayer * a_Player)
if (Window != nullptr)
{
// if (a_Player->GetWindow() != Window)
- // -> Because mojang doesn't send a 'close window' packet when you click the cancel button in the beacon inventory ...
+ // -> Because mojang doesn't send a 'close window' packet when you click the cancel button in the beacon
+ // inventory ...
{
a_Player->OpenWindow(*Window);
}
diff --git a/src/BlockEntities/BeaconEntity.h b/src/BlockEntities/BeaconEntity.h
index e5230e2cb..c668d9768 100644
--- a/src/BlockEntities/BeaconEntity.h
+++ b/src/BlockEntities/BeaconEntity.h
@@ -16,15 +16,13 @@
// tolua_begin
-class cBeaconEntity :
- public cBlockEntityWithItems
+class cBeaconEntity : public cBlockEntityWithItems
{
// tolua_end
using Super = cBlockEntityWithItems;
-public: // tolua_export
-
+ public: // tolua_export
cBeaconEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
// cBlockEntity overrides:
@@ -74,10 +72,9 @@ public: // tolua_export
// tolua_end
-protected:
-
+ protected:
bool m_IsActive;
char m_BeaconLevel;
cEntityEffect::eType m_PrimaryEffect, m_SecondaryEffect;
-} ; // tolua_export
+}; // tolua_export
diff --git a/src/BlockEntities/BedEntity.cpp b/src/BlockEntities/BedEntity.cpp
index 7f5f90639..9f8e3b658 100644
--- a/src/BlockEntities/BedEntity.cpp
+++ b/src/BlockEntities/BedEntity.cpp
@@ -13,9 +13,8 @@
-cBedEntity::cBedEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World, short a_Color):
- Super(a_BlockType, a_BlockMeta, a_Pos, a_World),
- m_Color(a_Color)
+cBedEntity::cBedEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World, short a_Color) :
+ Super(a_BlockType, a_BlockMeta, a_Pos, a_World), m_Color(a_Color)
{
ASSERT(a_BlockType == E_BLOCK_BED);
}
diff --git a/src/BlockEntities/BedEntity.h b/src/BlockEntities/BedEntity.h
index 9f75b7946..4d5b1c299 100644
--- a/src/BlockEntities/BedEntity.h
+++ b/src/BlockEntities/BedEntity.h
@@ -12,15 +12,19 @@
// tolua_begin
-class cBedEntity :
- public cBlockEntity
+class cBedEntity : public cBlockEntity
{
// tolua_end
using Super = cBlockEntity;
-public: // tolua_export
-
- cBedEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World, short a_Color = E_META_WOOL_RED);
+ public: // tolua_export
+ cBedEntity(
+ BLOCKTYPE a_BlockType,
+ NIBBLETYPE a_BlockMeta,
+ Vector3i a_Pos,
+ cWorld * a_World,
+ short a_Color = E_META_WOOL_RED
+ );
// tolua_begin
@@ -41,7 +45,6 @@ public: // tolua_export
virtual bool UsedBy(cPlayer * a_Player) override { return false; }
virtual void SendTo(cClientHandle & a_Client) override;
-private:
-
+ private:
short m_Color;
}; // tolua_export
diff --git a/src/BlockEntities/BlockEntity.cpp b/src/BlockEntities/BlockEntity.cpp
index 7c0660431..113c28a6c 100644
--- a/src/BlockEntities/BlockEntity.cpp
+++ b/src/BlockEntities/BlockEntity.cpp
@@ -29,7 +29,12 @@
-cBlockEntity::cBlockEntity(const BLOCKTYPE a_BlockType, const NIBBLETYPE a_BlockMeta, const Vector3i a_Pos, cWorld * const a_World) :
+cBlockEntity::cBlockEntity(
+ const BLOCKTYPE a_BlockType,
+ const NIBBLETYPE a_BlockMeta,
+ const Vector3i a_Pos,
+ cWorld * const a_World
+) :
m_Pos(a_Pos),
m_RelX(a_Pos.x - cChunkDef::Width * FAST_FLOOR_DIV(a_Pos.x, cChunkDef::Width)),
m_RelZ(a_Pos.z - cChunkDef::Width * FAST_FLOOR_DIV(a_Pos.z, cChunkDef::Width)),
@@ -74,40 +79,51 @@ void cBlockEntity::CopyFrom(const cBlockEntity & a_Src)
-OwnedBlockEntity cBlockEntity::CreateByBlockType(const BLOCKTYPE a_BlockType, const NIBBLETYPE a_BlockMeta, const Vector3i a_Pos, cWorld * const a_World)
+OwnedBlockEntity cBlockEntity::CreateByBlockType(
+ const BLOCKTYPE a_BlockType,
+ const NIBBLETYPE a_BlockMeta,
+ const Vector3i a_Pos,
+ cWorld * const a_World
+)
{
switch (a_BlockType)
{
// Banners:
case E_BLOCK_STANDING_BANNER:
- case E_BLOCK_WALL_BANNER: return std::make_unique<cBannerEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
+ case E_BLOCK_WALL_BANNER: return std::make_unique<cBannerEntity>(a_BlockType, a_BlockMeta, a_Pos, a_World);
// Others:
- case E_BLOCK_BEACON: return std::make_unique<cBeaconEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
- case E_BLOCK_BED: return std::make_unique<cBedEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
- case E_BLOCK_BREWING_STAND: return std::make_unique<cBrewingstandEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
- case E_BLOCK_CHEST: return std::make_unique<cChestEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
- case E_BLOCK_COMMAND_BLOCK: return std::make_unique<cCommandBlockEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
- case E_BLOCK_DISPENSER: return std::make_unique<cDispenserEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
- case E_BLOCK_DROPPER: return std::make_unique<cDropperEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
- case E_BLOCK_ENCHANTMENT_TABLE: return std::make_unique<cEnchantingTableEntity>(a_BlockType, a_BlockMeta, a_Pos, a_World);
- case E_BLOCK_ENDER_CHEST: return std::make_unique<cEnderChestEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
- case E_BLOCK_END_PORTAL: return std::make_unique<cEndPortalEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
- case E_BLOCK_FLOWER_POT: return std::make_unique<cFlowerPotEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
- case E_BLOCK_FURNACE: return std::make_unique<cFurnaceEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
- case E_BLOCK_HEAD: return std::make_unique<cMobHeadEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
- case E_BLOCK_HOPPER: return std::make_unique<cHopperEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
- case E_BLOCK_JUKEBOX: return std::make_unique<cJukeboxEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
- case E_BLOCK_LIT_FURNACE: return std::make_unique<cFurnaceEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
- case E_BLOCK_MOB_SPAWNER: return std::make_unique<cMobSpawnerEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
- case E_BLOCK_NOTE_BLOCK: return std::make_unique<cNoteEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
- case E_BLOCK_SIGN_POST: return std::make_unique<cSignEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
- case E_BLOCK_TRAPPED_CHEST: return std::make_unique<cChestEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
- case E_BLOCK_WALLSIGN: return std::make_unique<cSignEntity >(a_BlockType, a_BlockMeta, a_Pos, a_World);
+ case E_BLOCK_BEACON: return std::make_unique<cBeaconEntity>(a_BlockType, a_BlockMeta, a_Pos, a_World);
+ case E_BLOCK_BED: return std::make_unique<cBedEntity>(a_BlockType, a_BlockMeta, a_Pos, a_World);
+ case E_BLOCK_BREWING_STAND:
+ return std::make_unique<cBrewingstandEntity>(a_BlockType, a_BlockMeta, a_Pos, a_World);
+ case E_BLOCK_CHEST: return std::make_unique<cChestEntity>(a_BlockType, a_BlockMeta, a_Pos, a_World);
+ case E_BLOCK_COMMAND_BLOCK:
+ return std::make_unique<cCommandBlockEntity>(a_BlockType, a_BlockMeta, a_Pos, a_World);
+ case E_BLOCK_DISPENSER: return std::make_unique<cDispenserEntity>(a_BlockType, a_BlockMeta, a_Pos, a_World);
+ case E_BLOCK_DROPPER: return std::make_unique<cDropperEntity>(a_BlockType, a_BlockMeta, a_Pos, a_World);
+ case E_BLOCK_ENCHANTMENT_TABLE:
+ return std::make_unique<cEnchantingTableEntity>(a_BlockType, a_BlockMeta, a_Pos, a_World);
+ case E_BLOCK_ENDER_CHEST: return std::make_unique<cEnderChestEntity>(a_BlockType, a_BlockMeta, a_Pos, a_World);
+ case E_BLOCK_END_PORTAL: return std::make_unique<cEndPortalEntity>(a_BlockType, a_BlockMeta, a_Pos, a_World);
+ case E_BLOCK_FLOWER_POT: return std::make_unique<cFlowerPotEntity>(a_BlockType, a_BlockMeta, a_Pos, a_World);
+ case E_BLOCK_FURNACE: return std::make_unique<cFurnaceEntity>(a_BlockType, a_BlockMeta, a_Pos, a_World);
+ case E_BLOCK_HEAD: return std::make_unique<cMobHeadEntity>(a_BlockType, a_BlockMeta, a_Pos, a_World);
+ case E_BLOCK_HOPPER: return std::make_unique<cHopperEntity>(a_BlockType, a_BlockMeta, a_Pos, a_World);
+ case E_BLOCK_JUKEBOX: return std::make_unique<cJukeboxEntity>(a_BlockType, a_BlockMeta, a_Pos, a_World);
+ case E_BLOCK_LIT_FURNACE: return std::make_unique<cFurnaceEntity>(a_BlockType, a_BlockMeta, a_Pos, a_World);
+ case E_BLOCK_MOB_SPAWNER: return std::make_unique<cMobSpawnerEntity>(a_BlockType, a_BlockMeta, a_Pos, a_World);
+ case E_BLOCK_NOTE_BLOCK: return std::make_unique<cNoteEntity>(a_BlockType, a_BlockMeta, a_Pos, a_World);
+ case E_BLOCK_SIGN_POST: return std::make_unique<cSignEntity>(a_BlockType, a_BlockMeta, a_Pos, a_World);
+ case E_BLOCK_TRAPPED_CHEST: return std::make_unique<cChestEntity>(a_BlockType, a_BlockMeta, a_Pos, a_World);
+ case E_BLOCK_WALLSIGN: return std::make_unique<cSignEntity>(a_BlockType, a_BlockMeta, a_Pos, a_World);
default:
{
- LOGD("%s: Requesting creation of an unknown block entity - block type %d (%s)",
- __FUNCTION__, a_BlockType, ItemTypeToString(a_BlockType).c_str()
+ LOGD(
+ "%s: Requesting creation of an unknown block entity - block type %d (%s)",
+ __FUNCTION__,
+ a_BlockType,
+ ItemTypeToString(a_BlockType).c_str()
);
ASSERT(!"Requesting creation of an unknown block entity");
return nullptr;
@@ -119,9 +135,7 @@ OwnedBlockEntity cBlockEntity::CreateByBlockType(const BLOCKTYPE a_BlockType, co
-void cBlockEntity::Destroy()
-{
-}
+void cBlockEntity::Destroy() {}
@@ -177,9 +191,7 @@ void cBlockEntity::OnAddToWorld(cWorld & a_World, cChunk & a_Chunk)
-void cBlockEntity::OnRemoveFromWorld()
-{
-}
+void cBlockEntity::OnRemoveFromWorld() {}
@@ -187,7 +199,9 @@ void cBlockEntity::OnRemoveFromWorld()
void cBlockEntity::SetPos(const Vector3i a_NewPos)
{
- ASSERT(m_World == nullptr); // Cannot move block entities that represent world blocks (only use this for cBlockArea's BEs)
+ ASSERT(
+ m_World == nullptr
+ ); // Cannot move block entities that represent world blocks (only use this for cBlockArea's BEs)
m_Pos = a_NewPos;
}
diff --git a/src/BlockEntities/BlockEntity.h b/src/BlockEntities/BlockEntity.h
index e13600e8c..0672da0ec 100644
--- a/src/BlockEntities/BlockEntity.h
+++ b/src/BlockEntities/BlockEntity.h
@@ -23,12 +23,10 @@ using cBlockEntities = std::unordered_map<size_t, OwnedBlockEntity>;
// tolua_begin
class cBlockEntity
{
-protected:
-
+ protected:
cBlockEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
-public:
-
+ public:
// tolua_end
virtual ~cBlockEntity() = default; // force a virtual destructor in all descendants
@@ -38,7 +36,8 @@ public:
OwnedBlockEntity Clone(Vector3i a_Pos);
/** Returns the contents of this block entity that it would drop if broken.
- Note that the block handler will usually handle pickups for the block itself, in addition to any items returned here. */
+ Note that the block handler will usually handle pickups for the block itself, in addition to any items returned
+ here. */
virtual cItems ConvertToPickups() const;
/** Copies all properties of a_Src into this entity, except for its m_World and location.
@@ -49,7 +48,12 @@ public:
/** Creates a new block entity for the specified block type at the specified absolute pos.
If a_World is valid, then the entity is created bound to that world
Returns nullptr for unknown block types. */
- static OwnedBlockEntity CreateByBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World = nullptr);
+ static OwnedBlockEntity CreateByBlockType(
+ BLOCKTYPE a_BlockType,
+ NIBBLETYPE a_BlockMeta,
+ Vector3i a_Pos,
+ cWorld * a_World = nullptr
+ );
/** Called when this block entity's associated block is destroyed.
It is guaranteed that this function is called before OnRemoveFromWorld. */
@@ -71,13 +75,14 @@ public:
virtual void SendTo(cClientHandle & a_Client) = 0;
/** Updates the internally stored position.
- Note that this should not ever be used for world-contained block entities, it is meant only for when BEs in a cBlockArea are manipulated.
- Asserts that the block entity is not assigned to a world. */
+ Note that this should not ever be used for world-contained block entities, it is meant only for when BEs in a
+ cBlockArea are manipulated. Asserts that the block entity is not assigned to a world. */
void SetPos(Vector3i a_NewPos);
void SetWorld(cWorld * a_World);
- /** Ticks the entity; returns true if the chunk should be marked as dirty as a result of this ticking. By default does nothing. */
+ /** Ticks the entity; returns true if the chunk should be marked as dirty as a result of this ticking. By default
+ * does nothing. */
virtual bool Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk);
/** Called when a player uses this entity; should open the UI window.
@@ -107,8 +112,7 @@ public:
// tolua_end
-protected:
-
+ protected:
/** Position in absolute block coordinates */
Vector3i m_Pos;
@@ -124,4 +128,4 @@ protected:
NIBBLETYPE m_BlockMeta;
cWorld * m_World;
-} ; // tolua_export
+}; // tolua_export
diff --git a/src/BlockEntities/BlockEntityWithItems.cpp b/src/BlockEntities/BlockEntityWithItems.cpp
index 5a52b9767..5b6473a03 100644
--- a/src/BlockEntities/BlockEntityWithItems.cpp
+++ b/src/BlockEntities/BlockEntityWithItems.cpp
@@ -12,9 +12,10 @@ cBlockEntityWithItems::cBlockEntityWithItems(
BLOCKTYPE a_BlockType,
NIBBLETYPE a_BlockMeta,
Vector3i a_Pos,
- int a_ItemGridWidth, int a_ItemGridHeight,
+ int a_ItemGridWidth,
+ int a_ItemGridHeight,
cWorld * a_World
-):
+) :
Super(a_BlockType, a_BlockMeta, a_Pos, a_World),
cBlockEntityWindowOwner(this),
m_Contents(a_ItemGridWidth, a_ItemGridHeight)
diff --git a/src/BlockEntities/BlockEntityWithItems.h b/src/BlockEntities/BlockEntityWithItems.h
index f191c8f43..fec288b14 100644
--- a/src/BlockEntities/BlockEntityWithItems.h
+++ b/src/BlockEntities/BlockEntityWithItems.h
@@ -19,25 +19,24 @@
// tolua_begin
-class cBlockEntityWithItems :
- public cBlockEntity,
- // tolua_end
- public cItemGrid::cListener,
- // tolua_begin
- public cBlockEntityWindowOwner
+class cBlockEntityWithItems : public cBlockEntity,
+ // tolua_end
+ public cItemGrid::cListener,
+ // tolua_begin
+ public cBlockEntityWindowOwner
{
// tolua_end
using Super = cBlockEntity;
-public: // tolua_export
-
+ public: // tolua_export
cBlockEntityWithItems(
- BLOCKTYPE a_BlockType, // Type of the block that the entity represents
- NIBBLETYPE a_BlockMeta, // Meta of the block that the entity represents
- Vector3i a_Pos, // Abs position of the block entity
- int a_ItemGridWidth, int a_ItemGridHeight, // Dimensions of the ItemGrid
- cWorld * a_World // Optional world to assign to the entity
+ BLOCKTYPE a_BlockType, // Type of the block that the entity represents
+ NIBBLETYPE a_BlockMeta, // Meta of the block that the entity represents
+ Vector3i a_Pos, // Abs position of the block entity
+ int a_ItemGridWidth,
+ int a_ItemGridHeight, // Dimensions of the ItemGrid
+ cWorld * a_World // Optional world to assign to the entity
);
// cBlockEntity overrides:
@@ -46,10 +45,10 @@ public: // tolua_export
// tolua_begin
- const cItem & GetSlot(int a_SlotNum) const { return m_Contents.GetSlot(a_SlotNum); }
+ const cItem & GetSlot(int a_SlotNum) const { return m_Contents.GetSlot(a_SlotNum); }
const cItem & GetSlot(int a_X, int a_Y) const { return m_Contents.GetSlot(a_X, a_Y); }
- void SetSlot(int a_SlotNum, const cItem & a_Item) { m_Contents.SetSlot(a_SlotNum, a_Item); }
+ void SetSlot(int a_SlotNum, const cItem & a_Item) { m_Contents.SetSlot(a_SlotNum, a_Item); }
void SetSlot(int a_X, int a_Y, const cItem & a_Item) { m_Contents.SetSlot(a_X, a_Y, a_Item); }
/** Returns the ItemGrid used for storing the contents */
@@ -60,10 +59,9 @@ public: // tolua_export
/** Const version of the GetContents() function for C++ type-safety */
const cItemGrid & GetContents(void) const { return m_Contents; }
-protected:
-
+ protected:
cItemGrid m_Contents;
// cItemGrid::cListener overrides:
virtual void OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum) override;
-} ; // tolua_export
+}; // tolua_export
diff --git a/src/BlockEntities/BrewingstandEntity.cpp b/src/BlockEntities/BrewingstandEntity.cpp
index 12f8d5a36..c0b4860cb 100644
--- a/src/BlockEntities/BrewingstandEntity.cpp
+++ b/src/BlockEntities/BrewingstandEntity.cpp
@@ -11,7 +11,12 @@
-cBrewingstandEntity::cBrewingstandEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World):
+cBrewingstandEntity::cBrewingstandEntity(
+ BLOCKTYPE a_BlockType,
+ NIBBLETYPE a_BlockMeta,
+ Vector3i a_Pos,
+ cWorld * a_World
+) :
Super(a_BlockType, a_BlockMeta, a_Pos, ContentsWidth, ContentsHeight, a_World),
m_IsBrewing(false),
m_TimeBrewed(0),
@@ -240,7 +245,8 @@ void cBrewingstandEntity::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum)
if (m_CurrentBrewingRecipes[i] != nullptr)
{
Recipe = m_CurrentBrewingRecipes[i];
- if (Recipe->Ingredient.IsEqual(GetSlot(bsIngredient)) && Recipe->Input.IsEqual(GetSlot(static_cast<int>(i))))
+ if (Recipe->Ingredient.IsEqual(GetSlot(bsIngredient)) &&
+ Recipe->Input.IsEqual(GetSlot(static_cast<int>(i))))
{
Stop = false;
continue;
@@ -331,8 +337,3 @@ void cBrewingstandEntity::LoadRecipes(void)
}
}
}
-
-
-
-
-
diff --git a/src/BlockEntities/BrewingstandEntity.h b/src/BlockEntities/BrewingstandEntity.h
index 66eaa920d..e43172edb 100644
--- a/src/BlockEntities/BrewingstandEntity.h
+++ b/src/BlockEntities/BrewingstandEntity.h
@@ -16,8 +16,7 @@ class cClientHandle;
// tolua_begin
-class cBrewingstandEntity :
- public cBlockEntityWithItems
+class cBrewingstandEntity : public cBlockEntityWithItems
{
// tolua_end
@@ -25,18 +24,17 @@ class cBrewingstandEntity :
// tolua_begin
-public:
-
+ public:
enum
{
- bsLeftBottle = 0, // Left bottle slot number
- bsMiddleBottle = 1, // Middle bottle slot number
- bsRightBottle = 2, // Right bottle slot number
- bsIngredient = 3, // Top ingredient slot number
- bsFuel = 4, // Top left fuel slot number
-
- ContentsWidth = 5,
- ContentsHeight = 1,
+ bsLeftBottle = 0, // Left bottle slot number
+ bsMiddleBottle = 1, // Middle bottle slot number
+ bsRightBottle = 2, // Right bottle slot number
+ bsIngredient = 3, // Top ingredient slot number
+ bsFuel = 4, // Top left fuel slot number
+
+ ContentsWidth = 5,
+ ContentsHeight = 1,
};
// tolua_end
@@ -109,8 +107,7 @@ public:
/** Gets the recipes. Will be called if the brewing stand gets loaded from the world. */
void LoadRecipes(void);
-protected:
-
+ protected:
/** Set to true if the brewing stand is brewing an item */
bool m_IsBrewing;
@@ -137,4 +134,4 @@ protected:
// cItemGrid::cListener overrides:
virtual void OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) override;
-} ; // tolua_export
+}; // tolua_export
diff --git a/src/BlockEntities/ChestEntity.cpp b/src/BlockEntities/ChestEntity.cpp
index 11146bf46..e2f4140ce 100644
--- a/src/BlockEntities/ChestEntity.cpp
+++ b/src/BlockEntities/ChestEntity.cpp
@@ -14,7 +14,7 @@
-cChestEntity::cChestEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World):
+cChestEntity::cChestEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World) :
Super(a_BlockType, a_BlockMeta, a_Pos, ContentsWidth, ContentsHeight, a_World),
m_NumActivePlayers(0),
m_Neighbour(nullptr)
@@ -33,10 +33,7 @@ cChestEntity & cChestEntity::GetPrimaryChest()
}
// The primary chest should be the one with lesser X or Z coord:
- return (
- (m_Neighbour->GetPosX() < GetPosX()) ||
- (m_Neighbour->GetPosZ() < GetPosZ())
- ) ? *m_Neighbour : *this;
+ return ((m_Neighbour->GetPosX() < GetPosX()) || (m_Neighbour->GetPosZ() < GetPosZ())) ? *m_Neighbour : *this;
}
@@ -96,10 +93,8 @@ bool cChestEntity::IsBlocked()
{
return (
(GetPosY() < cChunkDef::Height - 1) &&
- (
- !cBlockInfo::IsTransparent(GetWorld()->GetBlock(GetPos().addedY(1))) ||
- !cOcelot::IsCatSittingOnBlock(GetWorld(), Vector3d(GetPos()))
- )
+ (!cBlockInfo::IsTransparent(GetWorld()->GetBlock(GetPos().addedY(1))) ||
+ !cOcelot::IsCatSittingOnBlock(GetWorld(), Vector3d(GetPos())))
);
}
@@ -146,17 +141,14 @@ void cChestEntity::OnAddToWorld(cWorld & a_World, cChunk & a_Chunk)
Super::OnAddToWorld(a_World, a_Chunk);
// Scan horizontally adjacent blocks for any neighbouring chest of the same type:
- if (
- const auto Position = GetRelPos();
-
- ScanNeighbour(a_Chunk, Position.addedX(-1)) ||
- ScanNeighbour(a_Chunk, Position.addedX(+1)) ||
- ScanNeighbour(a_Chunk, Position.addedZ(-1)) ||
- ScanNeighbour(a_Chunk, Position.addedZ(+1))
- )
+ if (const auto Position = GetRelPos();
+
+ ScanNeighbour(a_Chunk, Position.addedX(-1)) || ScanNeighbour(a_Chunk, Position.addedX(+1)) ||
+ ScanNeighbour(a_Chunk, Position.addedZ(-1)) || ScanNeighbour(a_Chunk, Position.addedZ(+1)))
{
m_Neighbour->m_Neighbour = this;
- m_Neighbour->DestroyWindow(); // Force neighbour's window shut. Does Mojang server do this or should a double window open?
+ m_Neighbour->DestroyWindow(
+ ); // Force neighbour's window shut. Does Mojang server do this or should a double window open?
}
}
diff --git a/src/BlockEntities/ChestEntity.h b/src/BlockEntities/ChestEntity.h
index ee3c59b8b..456dc4880 100644
--- a/src/BlockEntities/ChestEntity.h
+++ b/src/BlockEntities/ChestEntity.h
@@ -15,8 +15,7 @@ class cClientHandle;
// tolua_begin
-class cChestEntity :
- public cBlockEntityWithItems
+class cChestEntity : public cBlockEntityWithItems
{
// tolua_end
@@ -24,13 +23,12 @@ class cChestEntity :
// tolua_begin
-public:
-
+ public:
enum
{
ContentsHeight = 3,
- ContentsWidth = 9,
- } ;
+ ContentsWidth = 9,
+ };
// tolua_end
@@ -52,8 +50,7 @@ public:
/** Sets the number of players who currently have this chest open */
void SetNumberOfPlayers(int a_NumActivePlayers) { m_NumActivePlayers = a_NumActivePlayers; }
-private:
-
+ private:
/** Number of players who currently have this chest open */
int m_NumActivePlayers;
@@ -78,4 +75,4 @@ private:
/** cItemGrid::cListener overrides: */
virtual void OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum) override;
-} ; // tolua_export
+}; // tolua_export
diff --git a/src/BlockEntities/CommandBlockEntity.cpp b/src/BlockEntities/CommandBlockEntity.cpp
index b747501c8..414fd40bd 100644
--- a/src/BlockEntities/CommandBlockEntity.cpp
+++ b/src/BlockEntities/CommandBlockEntity.cpp
@@ -17,10 +17,13 @@
-cCommandBlockEntity::cCommandBlockEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World):
- Super(a_BlockType, a_BlockMeta, a_Pos, a_World),
- m_ShouldExecute(false),
- m_Result(0)
+cCommandBlockEntity::cCommandBlockEntity(
+ BLOCKTYPE a_BlockType,
+ NIBBLETYPE a_BlockMeta,
+ Vector3i a_Pos,
+ cWorld * a_World
+) :
+ Super(a_BlockType, a_BlockMeta, a_Pos, a_World), m_ShouldExecute(false), m_Result(0)
{
ASSERT(a_BlockType == E_BLOCK_COMMAND_BLOCK);
}
@@ -158,18 +161,28 @@ void cCommandBlockEntity::Execute()
return;
}
- class CommandBlockOutCb :
- public cLogCommandDeleteSelfOutputCallback
+ class CommandBlockOutCb : public cLogCommandDeleteSelfOutputCallback
{
cCommandBlockEntity * m_CmdBlock;
- public:
- CommandBlockOutCb(cCommandBlockEntity * a_CmdBlock) : m_CmdBlock(a_CmdBlock) {}
+ public:
+ CommandBlockOutCb(cCommandBlockEntity * a_CmdBlock) :
+ m_CmdBlock(a_CmdBlock)
+ {
+ }
virtual void Out(const AString & a_Text) override
{
// Overwrite field
- m_CmdBlock->SetLastOutput(cClientHandle::FormatChatPrefix(m_CmdBlock->GetWorld()->ShouldUseChatPrefixes(), "SUCCESS", cChatColor::Green, cChatColor::White) + a_Text);
+ m_CmdBlock->SetLastOutput(
+ cClientHandle::FormatChatPrefix(
+ m_CmdBlock->GetWorld()->ShouldUseChatPrefixes(),
+ "SUCCESS",
+ cChatColor::Green,
+ cChatColor::White
+ ) +
+ a_Text
+ );
}
};
@@ -182,13 +195,8 @@ void cCommandBlockEntity::Execute()
}
// Administrator commands are not executable by command blocks:
- if (
- (RealCommand != "stop") &&
- (RealCommand != "restart") &&
- (RealCommand != "kick") &&
- (RealCommand != "ban") &&
- (RealCommand != "ipban")
- )
+ if ((RealCommand != "stop") && (RealCommand != "restart") && (RealCommand != "kick") && (RealCommand != "ban") &&
+ (RealCommand != "ipban"))
{
cServer * Server = cRoot::Get()->GetServer();
LOGD("cCommandBlockEntity: Executing command %s", m_Command.c_str());
@@ -196,14 +204,18 @@ void cCommandBlockEntity::Execute()
}
else
{
- SetLastOutput(cClientHandle::FormatChatPrefix(GetWorld()->ShouldUseChatPrefixes(), "FAILURE", cChatColor::Rose, cChatColor::White) + "Adminstration commands can not be executed");
+ SetLastOutput(
+ cClientHandle::FormatChatPrefix(
+ GetWorld()->ShouldUseChatPrefixes(),
+ "FAILURE",
+ cChatColor::Rose,
+ cChatColor::White
+ ) +
+ "Adminstration commands can not be executed"
+ );
LOGD("cCommandBlockEntity: Prevented execution of administration command %s", m_Command.c_str());
}
// TODO 2014-01-18 xdot: Update the signal strength.
m_Result = 0;
}
-
-
-
-
diff --git a/src/BlockEntities/CommandBlockEntity.h b/src/BlockEntities/CommandBlockEntity.h
index a24a34287..0d9dbb877 100644
--- a/src/BlockEntities/CommandBlockEntity.h
+++ b/src/BlockEntities/CommandBlockEntity.h
@@ -17,15 +17,13 @@
// tolua_begin
-class cCommandBlockEntity :
- public cBlockEntity
+class cCommandBlockEntity : public cBlockEntity
{
// tolua_end
using Super = cBlockEntity;
-public: // tolua_export
-
+ public: // tolua_export
/** Creates a new empty command block entity */
cCommandBlockEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
@@ -58,8 +56,7 @@ public: // tolua_export
// tolua_end
-private:
-
+ private:
/** Executes the associated command */
void Execute();
@@ -70,4 +67,4 @@ private:
AString m_LastOutput;
NIBBLETYPE m_Result;
-} ; // tolua_export
+}; // tolua_export
diff --git a/src/BlockEntities/DispenserEntity.cpp b/src/BlockEntities/DispenserEntity.cpp
index c2ce6cf7c..59a9a997b 100644
--- a/src/BlockEntities/DispenserEntity.cpp
+++ b/src/BlockEntities/DispenserEntity.cpp
@@ -14,7 +14,7 @@
-cDispenserEntity::cDispenserEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World):
+cDispenserEntity::cDispenserEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World) :
Super(a_BlockType, a_BlockMeta, a_Pos, a_World)
{
ASSERT(a_BlockType == E_BLOCK_DISPENSER);
@@ -41,9 +41,15 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
// Dispense the item:
const cItem & SlotItem = m_Contents.GetSlot(a_SlotNum);
- if (ItemCategory::IsMinecart(SlotItem.m_ItemType) && IsBlockRail(DispBlock)) // only actually place the minecart if there are rails!
+ if (ItemCategory::IsMinecart(SlotItem.m_ItemType) &&
+ IsBlockRail(DispBlock)) // only actually place the minecart if there are rails!
{
- if (m_World->SpawnMinecart(DispAbsCoord.x + 0.5, DispAbsCoord.y + 0.5, DispAbsCoord.z + 0.5, SlotItem.m_ItemType) != cEntity::INVALID_ID)
+ if (m_World->SpawnMinecart(
+ DispAbsCoord.x + 0.5,
+ DispAbsCoord.y + 0.5,
+ DispAbsCoord.z + 0.5,
+ SlotItem.m_ItemType
+ ) != cEntity::INVALID_ID)
{
m_Contents.ChangeSlotCount(a_SlotNum, -1);
}
@@ -53,7 +59,12 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
{
case E_ITEM_BUCKET:
{
- LOGD("Dispensing empty bucket in slot %d; DispBlock is \"%s\" (%d).", a_SlotNum, ItemTypeToString(DispBlock).c_str(), DispBlock);
+ LOGD(
+ "Dispensing empty bucket in slot %d; DispBlock is \"%s\" (%d).",
+ a_SlotNum,
+ ItemTypeToString(DispBlock).c_str(),
+ DispBlock
+ );
switch (DispBlock)
{
case E_BLOCK_STATIONARY_WATER:
@@ -85,7 +96,12 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
case E_ITEM_WATER_BUCKET:
{
- LOGD("Dispensing water bucket in slot %d; DispBlock is \"%s\" (%d).", a_SlotNum, ItemTypeToString(DispBlock).c_str(), DispBlock);
+ LOGD(
+ "Dispensing water bucket in slot %d; DispBlock is \"%s\" (%d).",
+ a_SlotNum,
+ ItemTypeToString(DispBlock).c_str(),
+ DispBlock
+ );
if (EmptyLiquidBucket(DispBlock, a_SlotNum))
{
DispChunk->SetBlock(DispRelCoord, E_BLOCK_WATER, 0);
@@ -99,7 +115,12 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
case E_ITEM_LAVA_BUCKET:
{
- LOGD("Dispensing lava bucket in slot %d; DispBlock is \"%s\" (%d).", a_SlotNum, ItemTypeToString(DispBlock).c_str(), DispBlock);
+ LOGD(
+ "Dispensing lava bucket in slot %d; DispBlock is \"%s\" (%d).",
+ a_SlotNum,
+ ItemTypeToString(DispBlock).c_str(),
+ DispBlock
+ );
if (EmptyLiquidBucket(DispBlock, a_SlotNum))
{
DispChunk->SetBlock(DispRelCoord, E_BLOCK_LAVA, 0);
@@ -115,7 +136,8 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
{
double MobX = 0.5 + DispAbsCoord.x;
double MobZ = 0.5 + DispAbsCoord.z;
- auto MonsterType = cItemSpawnEggHandler::ItemDamageToMonsterType(m_Contents.GetSlot(a_SlotNum).m_ItemDamage);
+ auto MonsterType =
+ cItemSpawnEggHandler::ItemDamageToMonsterType(m_Contents.GetSlot(a_SlotNum).m_ItemDamage);
if (m_World->SpawnMob(MobX, DispAbsCoord.y, MobZ, MonsterType, false) != cEntity::INVALID_ID)
{
m_Contents.ChangeSlotCount(a_SlotNum, -1);
@@ -128,7 +150,11 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
// Spawn a primed TNT entity, if space allows:
if (!cBlockInfo::IsSolid(DispBlock))
{
- m_World->SpawnPrimedTNT(Vector3d(0.5, 0.5, 0.5) + DispAbsCoord, 80, 0); // 80 ticks fuse, no initial velocity
+ m_World->SpawnPrimedTNT(
+ Vector3d(0.5, 0.5, 0.5) + DispAbsCoord,
+ 80,
+ 0
+ ); // 80 ticks fuse, no initial velocity
m_Contents.ChangeSlotCount(a_SlotNum, -1);
}
break;
@@ -153,7 +179,11 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
case E_ITEM_FIRE_CHARGE:
{
- if (SpawnProjectileFromDispenser(DispAbsCoord, cProjectileEntity::pkFireCharge, GetShootVector(Meta) * 20) != cEntity::INVALID_ID)
+ if (SpawnProjectileFromDispenser(
+ DispAbsCoord,
+ cProjectileEntity::pkFireCharge,
+ GetShootVector(Meta) * 20
+ ) != cEntity::INVALID_ID)
{
m_Contents.ChangeSlotCount(a_SlotNum, -1);
}
@@ -162,7 +192,11 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
case E_ITEM_ARROW:
{
- if (SpawnProjectileFromDispenser(DispAbsCoord, cProjectileEntity::pkArrow, GetShootVector(Meta) * 30 + Vector3d(0, 1, 0)) != cEntity::INVALID_ID)
+ if (SpawnProjectileFromDispenser(
+ DispAbsCoord,
+ cProjectileEntity::pkArrow,
+ GetShootVector(Meta) * 30 + Vector3d(0, 1, 0)
+ ) != cEntity::INVALID_ID)
{
m_Contents.ChangeSlotCount(a_SlotNum, -1);
}
@@ -171,7 +205,11 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
case E_ITEM_SNOWBALL:
{
- if (SpawnProjectileFromDispenser(DispAbsCoord, cProjectileEntity::pkSnowball, GetShootVector(Meta) * 20 + Vector3d(0, 1, 0)) != cEntity::INVALID_ID)
+ if (SpawnProjectileFromDispenser(
+ DispAbsCoord,
+ cProjectileEntity::pkSnowball,
+ GetShootVector(Meta) * 20 + Vector3d(0, 1, 0)
+ ) != cEntity::INVALID_ID)
{
m_Contents.ChangeSlotCount(a_SlotNum, -1);
}
@@ -180,7 +218,11 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
case E_ITEM_EGG:
{
- if (SpawnProjectileFromDispenser(DispAbsCoord, cProjectileEntity::pkEgg, GetShootVector(Meta) * 20 + Vector3d(0, 1, 0)) != cEntity::INVALID_ID)
+ if (SpawnProjectileFromDispenser(
+ DispAbsCoord,
+ cProjectileEntity::pkEgg,
+ GetShootVector(Meta) * 20 + Vector3d(0, 1, 0)
+ ) != cEntity::INVALID_ID)
{
m_Contents.ChangeSlotCount(a_SlotNum, -1);
}
@@ -189,7 +231,11 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
case E_ITEM_BOTTLE_O_ENCHANTING:
{
- if (SpawnProjectileFromDispenser(DispAbsCoord, cProjectileEntity::pkExpBottle, GetShootVector(Meta) * 20 + Vector3d(0, 1, 0)) != cEntity::INVALID_ID)
+ if (SpawnProjectileFromDispenser(
+ DispAbsCoord,
+ cProjectileEntity::pkExpBottle,
+ GetShootVector(Meta) * 20 + Vector3d(0, 1, 0)
+ ) != cEntity::INVALID_ID)
{
m_Contents.ChangeSlotCount(a_SlotNum, -1);
}
@@ -198,7 +244,12 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
case E_ITEM_POTION:
{
- if (SpawnProjectileFromDispenser(DispAbsCoord, cProjectileEntity::pkSplashPotion, GetShootVector(Meta) * 20 + Vector3d(0, 1, 0), &SlotItem) != cEntity::INVALID_ID)
+ if (SpawnProjectileFromDispenser(
+ DispAbsCoord,
+ cProjectileEntity::pkSplashPotion,
+ GetShootVector(Meta) * 20 + Vector3d(0, 1, 0),
+ &SlotItem
+ ) != cEntity::INVALID_ID)
{
m_Contents.ChangeSlotCount(a_SlotNum, -1);
}
@@ -246,7 +297,8 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
break;
}
- spawnPos += GetShootVector(Meta) * 0.8; // A boat is bigger than one block. Add the shoot vector to put it outside the dispenser.
+ spawnPos += GetShootVector(Meta) *
+ 0.8; // A boat is bigger than one block. Add the shoot vector to put it outside the dispenser.
spawnPos += Vector3d(0.5, 0.5, 0.5);
if (m_World->SpawnBoat(spawnPos, cBoat::ItemToMaterial(SlotItem)))
@@ -258,7 +310,12 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
case E_ITEM_FIREWORK_ROCKET:
{
- if (SpawnProjectileFromDispenser(DispAbsCoord, cProjectileEntity::pkFirework, GetShootVector(Meta) * 20 + Vector3d(0, 1, 0), &SlotItem) != cEntity::INVALID_ID)
+ if (SpawnProjectileFromDispenser(
+ DispAbsCoord,
+ cProjectileEntity::pkFirework,
+ GetShootVector(Meta) * 20 + Vector3d(0, 1, 0),
+ &SlotItem
+ ) != cEntity::INVALID_ID)
{
m_Contents.ChangeSlotCount(a_SlotNum, -1);
}
@@ -277,11 +334,14 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
-UInt32 cDispenserEntity::SpawnProjectileFromDispenser(Vector3i a_BlockPos, cProjectileEntity::eKind a_Kind, const Vector3d & a_ShootVector, const cItem * a_Item)
+UInt32 cDispenserEntity::SpawnProjectileFromDispenser(
+ Vector3i a_BlockPos,
+ cProjectileEntity::eKind a_Kind,
+ const Vector3d & a_ShootVector,
+ const cItem * a_Item
+)
{
- return m_World->CreateProjectile(Vector3d(0.5, 0.5, 0.5) + a_BlockPos,
- a_Kind, nullptr, a_Item, &a_ShootVector
- );
+ return m_World->CreateProjectile(Vector3d(0.5, 0.5, 0.5) + a_BlockPos, a_Kind, nullptr, a_Item, &a_ShootVector);
}
@@ -292,12 +352,12 @@ Vector3d cDispenserEntity::GetShootVector(NIBBLETYPE a_Meta)
{
switch (a_Meta & E_META_DROPSPENSER_FACING_MASK)
{
- case E_META_DROPSPENSER_FACING_YP: return Vector3d( 0, 1, 0);
- case E_META_DROPSPENSER_FACING_YM: return Vector3d( 0, -1, 0);
- case E_META_DROPSPENSER_FACING_XM: return Vector3d(-1, 0, 0);
- case E_META_DROPSPENSER_FACING_XP: return Vector3d( 1, 0, 0);
- case E_META_DROPSPENSER_FACING_ZM: return Vector3d( 0, 0, -1);
- case E_META_DROPSPENSER_FACING_ZP: return Vector3d( 0, 0, 1);
+ case E_META_DROPSPENSER_FACING_YP: return Vector3d(0, 1, 0);
+ case E_META_DROPSPENSER_FACING_YM: return Vector3d(0, -1, 0);
+ case E_META_DROPSPENSER_FACING_XM: return Vector3d(-1, 0, 0);
+ case E_META_DROPSPENSER_FACING_XP: return Vector3d(1, 0, 0);
+ case E_META_DROPSPENSER_FACING_ZM: return Vector3d(0, 0, -1);
+ case E_META_DROPSPENSER_FACING_ZP: return Vector3d(0, 0, 1);
}
LOGWARNING("Unhandled dispenser meta: %d", a_Meta);
ASSERT(!"Unhandled dispenser facing");
@@ -336,11 +396,8 @@ bool cDispenserEntity::ScoopUpLiquid(int a_SlotNum, short a_ResultingBucketItemT
bool cDispenserEntity::EmptyLiquidBucket(BLOCKTYPE a_BlockInFront, int a_SlotNum)
{
- if (
- (a_BlockInFront != E_BLOCK_AIR) &&
- !IsBlockLiquid(a_BlockInFront) &&
- !cFluidSimulator::CanWashAway(a_BlockInFront)
- )
+ if ((a_BlockInFront != E_BLOCK_AIR) && !IsBlockLiquid(a_BlockInFront) &&
+ !cFluidSimulator::CanWashAway(a_BlockInFront))
{
// Not a suitable block in front
return false;
diff --git a/src/BlockEntities/DispenserEntity.h b/src/BlockEntities/DispenserEntity.h
index 47c0996f4..3b6540acf 100644
--- a/src/BlockEntities/DispenserEntity.h
+++ b/src/BlockEntities/DispenserEntity.h
@@ -8,15 +8,13 @@
// tolua_begin
-class cDispenserEntity :
- public cDropSpenserEntity
+class cDispenserEntity : public cDropSpenserEntity
{
// tolua_end
using Super = cDropSpenserEntity;
-public: // tolua_export
-
+ public: // tolua_export
/** Constructor used for normal operation */
cDispenserEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
@@ -37,7 +35,9 @@ public: // tolua_export
a_Item is the item from the internal storage from which the projectile originated.
Returns the UniqueID of the spawned projectile, or cEntity::INVALID_ID on failure. */
UInt32 SpawnProjectileFromDispenser(
- int a_BlockX, int a_BlockY, int a_BlockZ,
+ int a_BlockX,
+ int a_BlockY,
+ int a_BlockZ,
cProjectileEntity::eKind a_Kind,
const Vector3d & a_Speed,
const cItem * a_Item = nullptr
@@ -46,13 +46,13 @@ public: // tolua_export
return SpawnProjectileFromDispenser({a_BlockX, a_BlockY, a_BlockZ}, a_Kind, a_Speed, a_Item);
}
- /** Returns a unit vector in the cardinal direction of where the dispenser with the specified meta would be facing. */
+ /** Returns a unit vector in the cardinal direction of where the dispenser with the specified meta would be facing.
+ */
static Vector3d GetShootVector(NIBBLETYPE a_BlockMeta);
// tolua_end
-private:
-
+ private:
// cDropSpenser overrides:
virtual void DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum) override;
@@ -62,4 +62,4 @@ private:
/** If the a_BlockInFront can be washed away by liquid and the empty bucket can fit,
does the m_Contents processing and returns true. Returns false otherwise. */
bool EmptyLiquidBucket(BLOCKTYPE a_BlockInFront, int a_SlotNum);
-} ; // tolua_export
+}; // tolua_export
diff --git a/src/BlockEntities/DropSpenserEntity.cpp b/src/BlockEntities/DropSpenserEntity.cpp
index 6c0df0606..db901aa48 100644
--- a/src/BlockEntities/DropSpenserEntity.cpp
+++ b/src/BlockEntities/DropSpenserEntity.cpp
@@ -2,7 +2,8 @@
// DropSpenserEntity.cpp
// Declares the cDropSpenserEntity class representing a common ancestor to the cDispenserEntity and cDropperEntity
-// The dropper and dispenser only needs to override the DropSpenseFromSlot() function to provide the specific item behavior
+// The dropper and dispenser only needs to override the DropSpenseFromSlot() function to provide the specific item
+// behavior
#include "Globals.h"
#include "DropSpenserEntity.h"
@@ -16,9 +17,13 @@
-cDropSpenserEntity::cDropSpenserEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World):
- Super(a_BlockType, a_BlockMeta, a_Pos, ContentsWidth, ContentsHeight, a_World),
- m_ShouldDropSpense(false)
+cDropSpenserEntity::cDropSpenserEntity(
+ BLOCKTYPE a_BlockType,
+ NIBBLETYPE a_BlockMeta,
+ Vector3i a_Pos,
+ cWorld * a_World
+) :
+ Super(a_BlockType, a_BlockMeta, a_Pos, ContentsWidth, ContentsHeight, a_World), m_ShouldDropSpense(false)
{
}
@@ -82,7 +87,9 @@ void cDropSpenserEntity::DropSpense(cChunk & a_Chunk)
int SmokeDir = 0;
switch (Meta & E_META_DROPSPENSER_FACING_MASK)
{
- case E_META_DROPSPENSER_FACING_YP: SmokeDir = static_cast<int>(SmokeDirection::CENTRE); break; // YP & YM don't have associated smoke dirs, just do 4 (centre of block)
+ case E_META_DROPSPENSER_FACING_YP:
+ SmokeDir = static_cast<int>(SmokeDirection::CENTRE);
+ break; // YP & YM don't have associated smoke dirs, just do 4 (centre of block)
case E_META_DROPSPENSER_FACING_YM: SmokeDir = static_cast<int>(SmokeDirection::CENTRE); break;
case E_META_DROPSPENSER_FACING_XM: SmokeDir = static_cast<int>(SmokeDirection::EAST); break;
case E_META_DROPSPENSER_FACING_XP: SmokeDir = static_cast<int>(SmokeDirection::WEST); break;
@@ -204,12 +211,12 @@ void cDropSpenserEntity::DropFromSlot(cChunk & a_Chunk, int a_SlotNum)
int PickupSpeedX = 0, PickupSpeedY = 0, PickupSpeedZ = 0;
switch (Meta & E_META_DROPSPENSER_FACING_MASK)
{
- case E_META_DROPSPENSER_FACING_YP: PickupSpeedY = PickupSpeed; break;
+ case E_META_DROPSPENSER_FACING_YP: PickupSpeedY = PickupSpeed; break;
case E_META_DROPSPENSER_FACING_YM: PickupSpeedY = -PickupSpeed; break;
case E_META_DROPSPENSER_FACING_XM: PickupSpeedX = -PickupSpeed; break;
- case E_META_DROPSPENSER_FACING_XP: PickupSpeedX = PickupSpeed; break;
+ case E_META_DROPSPENSER_FACING_XP: PickupSpeedX = PickupSpeed; break;
case E_META_DROPSPENSER_FACING_ZM: PickupSpeedZ = -PickupSpeed; break;
- case E_META_DROPSPENSER_FACING_ZP: PickupSpeedZ = PickupSpeed; break;
+ case E_META_DROPSPENSER_FACING_ZP: PickupSpeedZ = PickupSpeed; break;
}
double MicroX, MicroY, MicroZ;
@@ -220,7 +227,3 @@ void cDropSpenserEntity::DropFromSlot(cChunk & a_Chunk, int a_SlotNum)
m_World->SpawnItemPickups(Pickups, MicroX, MicroY, MicroZ, PickupSpeedX, PickupSpeedY, PickupSpeedZ);
}
-
-
-
-
diff --git a/src/BlockEntities/DropSpenserEntity.h b/src/BlockEntities/DropSpenserEntity.h
index 9eb3d15ea..2a7f298be 100644
--- a/src/BlockEntities/DropSpenserEntity.h
+++ b/src/BlockEntities/DropSpenserEntity.h
@@ -2,7 +2,8 @@
// DropSpenser.h
// Declares the cDropSpenser class representing a common ancestor to the cDispenserEntity and cDropperEntity
-// The dropper and dispenser only needs to override the DropSpenseFromSlot() function to provide the specific item behavior
+// The dropper and dispenser only needs to override the DropSpenseFromSlot() function to provide the specific item
+// behavior
@@ -23,8 +24,7 @@ class cClientHandle;
// tolua_begin
-class cDropSpenserEntity :
- public cBlockEntityWithItems
+class cDropSpenserEntity : public cBlockEntityWithItems
{
// tolua_end
@@ -32,13 +32,12 @@ class cDropSpenserEntity :
// tolua_begin
-public:
-
+ public:
enum
{
ContentsHeight = 3,
- ContentsWidth = 3,
- } ;
+ ContentsWidth = 3,
+ };
// tolua_end
@@ -53,7 +52,8 @@ public:
// tolua_begin
- /** Modifies the block coords to match the dropspenser direction given (where the dropspensed pickups should materialize) */
+ /** Modifies the block coords to match the dropspenser direction given (where the dropspensed pickups should
+ * materialize) */
void AddDropSpenserDir(Vector3i & a_RelCoord, NIBBLETYPE a_Direction);
/** Sets the dropspenser to dropspense an item in the next tick */
@@ -61,11 +61,11 @@ public:
// tolua_end
-protected:
-
+ protected:
bool m_ShouldDropSpense; ///< If true, the dropspenser will dropspense an item in the next tick
- /** Does the actual work on dropspensing an item. Chooses the slot, calls DropSpenseFromSlot() and handles smoke / sound effects */
+ /** Does the actual work on dropspensing an item. Chooses the slot, calls DropSpenseFromSlot() and handles smoke /
+ * sound effects */
void DropSpense(cChunk & a_Chunk);
/** Override this function to provide the specific behavior for item dropspensing (drop / shoot / pour / ...) */
@@ -73,4 +73,4 @@ protected:
/** Helper function, drops one item from the specified slot (like a dropper) */
void DropFromSlot(cChunk & a_Chunk, int a_SlotNum);
-} ; // tolua_export
+}; // tolua_export
diff --git a/src/BlockEntities/DropperEntity.cpp b/src/BlockEntities/DropperEntity.cpp
index 341924ebb..8e8c69b43 100644
--- a/src/BlockEntities/DropperEntity.cpp
+++ b/src/BlockEntities/DropperEntity.cpp
@@ -10,7 +10,7 @@
-cDropperEntity::cDropperEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World):
+cDropperEntity::cDropperEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World) :
Super(a_BlockType, a_BlockMeta, a_Pos, a_World)
{
ASSERT(a_BlockType == E_BLOCK_DROPPER);
@@ -24,7 +24,3 @@ void cDropperEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
{
DropFromSlot(a_Chunk, a_SlotNum);
}
-
-
-
-
diff --git a/src/BlockEntities/DropperEntity.h b/src/BlockEntities/DropperEntity.h
index ea12a89b9..8d84ced46 100644
--- a/src/BlockEntities/DropperEntity.h
+++ b/src/BlockEntities/DropperEntity.h
@@ -16,20 +16,17 @@
// tolua_begin
-class cDropperEntity :
- public cDropSpenserEntity
+class cDropperEntity : public cDropSpenserEntity
{
// tolua_end
using Super = cDropSpenserEntity;
-public: // tolua_export
-
+ public: // tolua_export
/** Constructor used for normal operation */
cDropperEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
-protected:
-
+ protected:
// cDropSpenserEntity overrides:
virtual void DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum) override;
-} ; // tolua_export
+}; // tolua_export
diff --git a/src/BlockEntities/EnchantingTableEntity.cpp b/src/BlockEntities/EnchantingTableEntity.cpp
index 81c42caaf..ed38ec764 100644
--- a/src/BlockEntities/EnchantingTableEntity.cpp
+++ b/src/BlockEntities/EnchantingTableEntity.cpp
@@ -8,9 +8,14 @@
-cEnchantingTableEntity::cEnchantingTableEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World, AString a_CustomName) :
- Super(a_BlockType, a_BlockMeta, a_Pos, a_World),
- m_CustomName(std::move(a_CustomName))
+cEnchantingTableEntity::cEnchantingTableEntity(
+ BLOCKTYPE a_BlockType,
+ NIBBLETYPE a_BlockMeta,
+ Vector3i a_Pos,
+ cWorld * a_World,
+ AString a_CustomName
+) :
+ Super(a_BlockType, a_BlockMeta, a_Pos, a_World), m_CustomName(std::move(a_CustomName))
{
ASSERT(a_BlockType == E_BLOCK_ENCHANTMENT_TABLE);
}
diff --git a/src/BlockEntities/EnchantingTableEntity.h b/src/BlockEntities/EnchantingTableEntity.h
index 1f0aafdf3..cba116625 100644
--- a/src/BlockEntities/EnchantingTableEntity.h
+++ b/src/BlockEntities/EnchantingTableEntity.h
@@ -7,20 +7,23 @@
-class cEnchantingTableEntity :
- public cBlockEntity
+class cEnchantingTableEntity : public cBlockEntity
{
using Super = cBlockEntity;
-public:
-
- cEnchantingTableEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World, AString a_CustomName = "");
+ public:
+ cEnchantingTableEntity(
+ BLOCKTYPE a_BlockType,
+ NIBBLETYPE a_BlockMeta,
+ Vector3i a_Pos,
+ cWorld * a_World,
+ AString a_CustomName = ""
+ );
const AString & GetCustomName() const { return m_CustomName; }
void SetCustomName(const AString & a_CustomName) { m_CustomName = a_CustomName; }
-private:
-
+ private:
// cBlockEntity overrides:
virtual cItems ConvertToPickups() const override;
virtual void CopyFrom(const cBlockEntity & a_Src) override;
diff --git a/src/BlockEntities/EndPortalEntity.h b/src/BlockEntities/EndPortalEntity.h
index 3480ad49c..5736ab803 100644
--- a/src/BlockEntities/EndPortalEntity.h
+++ b/src/BlockEntities/EndPortalEntity.h
@@ -7,17 +7,14 @@
-class cEndPortalEntity :
- public cBlockEntity
+class cEndPortalEntity : public cBlockEntity
{
using Super = cBlockEntity;
-public:
-
+ public:
cEndPortalEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
-private:
-
+ private:
// cBlockEntity overrides:
virtual void CopyFrom(const cBlockEntity & a_Src) override;
virtual bool UsedBy(cPlayer * a_Player) override;
diff --git a/src/BlockEntities/EnderChestEntity.cpp b/src/BlockEntities/EnderChestEntity.cpp
index 07cc8aa18..3f815bb00 100644
--- a/src/BlockEntities/EnderChestEntity.cpp
+++ b/src/BlockEntities/EnderChestEntity.cpp
@@ -14,9 +14,8 @@
-cEnderChestEntity::cEnderChestEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World):
- Super(a_BlockType, a_BlockMeta, a_Pos, a_World),
- cBlockEntityWindowOwner(this)
+cEnderChestEntity::cEnderChestEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World) :
+ Super(a_BlockType, a_BlockMeta, a_Pos, a_World), cBlockEntityWindowOwner(this)
{
ASSERT(a_BlockType == E_BLOCK_ENDER_CHEST);
}
@@ -50,13 +49,9 @@ void cEnderChestEntity::OnRemoveFromWorld()
bool cEnderChestEntity::UsedBy(cPlayer * a_Player)
{
- if (
- (GetPosY() < cChunkDef::Height - 1) &&
- (
- !cBlockInfo::IsTransparent(GetWorld()->GetBlock(GetPos().addedY(1))) ||
- !cOcelot::IsCatSittingOnBlock(GetWorld(), Vector3d(GetPos()))
- )
- )
+ if ((GetPosY() < cChunkDef::Height - 1) &&
+ (!cBlockInfo::IsTransparent(GetWorld()->GetBlock(GetPos().addedY(1))) ||
+ !cOcelot::IsCatSittingOnBlock(GetWorld(), Vector3d(GetPos()))))
{
// Obstruction, don't open
return false;
diff --git a/src/BlockEntities/EnderChestEntity.h b/src/BlockEntities/EnderChestEntity.h
index d2fb4d67e..a004716f7 100644
--- a/src/BlockEntities/EnderChestEntity.h
+++ b/src/BlockEntities/EnderChestEntity.h
@@ -9,16 +9,14 @@
// tolua_begin
-class cEnderChestEntity :
- public cBlockEntity,
- public cBlockEntityWindowOwner
+class cEnderChestEntity : public cBlockEntity,
+ public cBlockEntityWindowOwner
{
// tolua_end
using Super = cBlockEntity;
-public: // tolua_export
-
+ public: // tolua_export
cEnderChestEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
// cBlockEntity overrides:
@@ -31,4 +29,4 @@ public: // tolua_export
/** Opens a new enderchest window for this enderchest */
void OpenNewWindow(void);
-} ; // tolua_export
+}; // tolua_export
diff --git a/src/BlockEntities/FlowerPotEntity.cpp b/src/BlockEntities/FlowerPotEntity.cpp
index df14acc8e..60362c95c 100644
--- a/src/BlockEntities/FlowerPotEntity.cpp
+++ b/src/BlockEntities/FlowerPotEntity.cpp
@@ -13,7 +13,7 @@
-cFlowerPotEntity::cFlowerPotEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World):
+cFlowerPotEntity::cFlowerPotEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World) :
Super(a_BlockType, a_BlockMeta, a_Pos, a_World)
{
ASSERT(a_BlockType == E_BLOCK_FLOWER_POT);
diff --git a/src/BlockEntities/FlowerPotEntity.h b/src/BlockEntities/FlowerPotEntity.h
index 1d95ef570..8eccfcd37 100644
--- a/src/BlockEntities/FlowerPotEntity.h
+++ b/src/BlockEntities/FlowerPotEntity.h
@@ -16,15 +16,13 @@
// tolua_begin
-class cFlowerPotEntity :
- public cBlockEntity
+class cFlowerPotEntity : public cBlockEntity
{
// tolua_end
using Super = cBlockEntity;
-public: // tolua_export
-
+ public: // tolua_export
/** Creates a new flowerpot entity at the specified block coords. a_World may be nullptr */
cFlowerPotEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
@@ -50,7 +48,6 @@ public: // tolua_export
static bool IsFlower(short m_ItemType, short m_ItemData);
-private:
-
+ private:
cItem m_Item;
-} ; // tolua_export
+}; // tolua_export
diff --git a/src/BlockEntities/FurnaceEntity.cpp b/src/BlockEntities/FurnaceEntity.cpp
index 8ca539170..7cd73d04f 100644
--- a/src/BlockEntities/FurnaceEntity.cpp
+++ b/src/BlockEntities/FurnaceEntity.cpp
@@ -16,13 +16,13 @@ enum
PROGRESSBAR_FUEL = 0,
PROGRESSBAR_SMELTING = 2,
PROGRESSBAR_SMELTING_CONFIRM = 3,
-} ;
+};
-cFurnaceEntity::cFurnaceEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World):
+cFurnaceEntity::cFurnaceEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World) :
Super(a_BlockType, a_BlockMeta, a_Pos, ContentsWidth, ContentsHeight, a_World),
m_CurrentRecipe(nullptr),
m_IsCooking(a_BlockType == E_BLOCK_LIT_FURNACE),
@@ -255,10 +255,10 @@ void cFurnaceEntity::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum)
ASSERT(a_ItemGrid == &m_Contents);
switch (a_SlotNum)
{
- case fsInput: UpdateInput(); break;
- case fsFuel: UpdateFuel(); break;
+ case fsInput: UpdateInput(); break;
+ case fsFuel: UpdateFuel(); break;
case fsOutput: UpdateOutput(); break;
- default: ASSERT(!"Invalid furnace slot update!"); break;
+ default: ASSERT(!"Invalid furnace slot update!"); break;
}
}
@@ -398,7 +398,10 @@ void cFurnaceEntity::UpdateProgressBars(bool a_ForceUpdate)
BroadcastProgress(PROGRESSBAR_FUEL, static_cast<short>(CurFuel));
int CurCook = (m_NeedCookTime > 0) ? (200 * m_TimeCooked / m_NeedCookTime) : 0;
- BroadcastProgress(PROGRESSBAR_SMELTING_CONFIRM, 200); // Post 1.8, Mojang requires a random packet with an ID of three and value of 200. Wat. Wat. Wat.
+ BroadcastProgress(
+ PROGRESSBAR_SMELTING_CONFIRM,
+ 200
+ ); // Post 1.8, Mojang requires a random packet with an ID of three and value of 200. Wat. Wat. Wat.
BroadcastProgress(PROGRESSBAR_SMELTING, static_cast<short>(CurCook));
}
@@ -414,7 +417,8 @@ void cFurnaceEntity::SetIsCooking(bool a_IsCooking)
}
m_IsCooking = a_IsCooking;
- // Only light the furnace as it is extinguished only when the fuel runs out, not when cooking stops - handled in this::Tick()
+ // Only light the furnace as it is extinguished only when the fuel runs out, not when cooking stops - handled in
+ // this::Tick()
if (m_IsCooking)
{
m_BlockType = E_BLOCK_LIT_FURNACE;
diff --git a/src/BlockEntities/FurnaceEntity.h b/src/BlockEntities/FurnaceEntity.h
index c6b5ee09f..c98f018d1 100644
--- a/src/BlockEntities/FurnaceEntity.h
+++ b/src/BlockEntities/FurnaceEntity.h
@@ -15,8 +15,7 @@ class cClientHandle;
// tolua_begin
-class cFurnaceEntity :
- public cBlockEntityWithItems
+class cFurnaceEntity : public cBlockEntityWithItems
{
// tolua_end
@@ -24,15 +23,14 @@ class cFurnaceEntity :
// tolua_begin
-public:
-
+ public:
enum
{
- fsInput = 0, // Input slot number
- fsFuel = 1, // Fuel slot number
+ fsInput = 0, // Input slot number
+ fsFuel = 1, // Fuel slot number
fsOutput = 2, // Output slot number
- ContentsWidth = 3,
+ ContentsWidth = 3,
ContentsHeight = 1,
};
@@ -49,8 +47,8 @@ public:
virtual bool UsedBy(cPlayer * a_Player) override;
/** Restarts cooking
- Used after the furnace is loaded from storage to set up the internal variables so that cooking continues, if it was active
- Returns true if cooking */
+ Used after the furnace is loaded from storage to set up the internal variables so that cooking continues, if it was
+ active Returns true if cooking */
bool ContinueCooking(void);
// tolua_begin
@@ -102,14 +100,10 @@ public:
m_TimeCooked = a_TimeCooked;
}
- void SetLoading(bool a_IsLoading)
- {
- m_IsLoading = a_IsLoading;
- }
-
+ void SetLoading(bool a_IsLoading) { m_IsLoading = a_IsLoading; }
-protected:
+ protected:
/** The recipe for the current input slot */
const cFurnaceRecipe::cRecipe * m_CurrentRecipe;
@@ -167,4 +161,4 @@ protected:
// cItemGrid::cListener overrides:
virtual void OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) override;
-} ; // tolua_export
+}; // tolua_export
diff --git a/src/BlockEntities/HopperEntity.cpp b/src/BlockEntities/HopperEntity.cpp
index d7faca174..e28248b82 100644
--- a/src/BlockEntities/HopperEntity.cpp
+++ b/src/BlockEntities/HopperEntity.cpp
@@ -24,7 +24,7 @@
-cHopperEntity::cHopperEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World):
+cHopperEntity::cHopperEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World) :
Super(a_BlockType, a_BlockMeta, a_Pos, ContentsWidth, ContentsHeight, a_World),
m_LastMoveItemsInTick(0),
m_LastMoveItemsOutTick(0),
@@ -52,10 +52,10 @@ std::pair<bool, Vector3i> cHopperEntity::GetOutputBlockPos(NIBBLETYPE a_BlockMet
switch (a_BlockMeta)
{
case E_META_HOPPER_FACING_XM: return {true, pos.addedX(-1)};
- case E_META_HOPPER_FACING_XP: return {true, pos.addedX( 1)};
+ case E_META_HOPPER_FACING_XP: return {true, pos.addedX(1)};
case E_META_HOPPER_FACING_YM: return {true, pos.addedY(-1)};
case E_META_HOPPER_FACING_ZM: return {true, pos.addedZ(-1)};
- case E_META_HOPPER_FACING_ZP: return {true, pos.addedZ( 1)};
+ case E_META_HOPPER_FACING_ZP: return {true, pos.addedZ(1)};
default:
{
// Not attached
@@ -184,7 +184,9 @@ bool cHopperEntity::MoveItemsIn(cChunk & a_Chunk, const cTickTimeLong a_CurrentT
case E_BLOCK_DROPPER:
case E_BLOCK_HOPPER:
{
- res = MoveItemsFromGrid(*static_cast<cBlockEntityWithItems *>(a_Chunk.GetBlockEntity(this->GetPos().addedY(1))));
+ res =
+ MoveItemsFromGrid(*static_cast<cBlockEntityWithItems *>(a_Chunk.GetBlockEntity(this->GetPos().addedY(1))
+ ));
break;
}
}
@@ -206,15 +208,13 @@ bool cHopperEntity::MovePickupsIn(cChunk & a_Chunk)
{
class cHopperPickupSearchCallback
{
- public:
+ public:
cHopperPickupSearchCallback(Vector3i a_Pos, cItemGrid & a_Contents) :
- m_Pos(a_Pos),
- m_bFoundPickupsAbove(false),
- m_Contents(a_Contents)
+ m_Pos(a_Pos), m_bFoundPickupsAbove(false), m_Contents(a_Contents)
{
}
- bool operator () (cEntity & a_Entity)
+ bool operator()(cEntity & a_Entity)
{
if (!a_Entity.IsPickup())
{
@@ -222,7 +222,11 @@ bool cHopperEntity::MovePickupsIn(cChunk & a_Chunk)
}
Vector3f EntityPos = a_Entity.GetPosition();
- Vector3f BlockPos(m_Pos.x + 0.5f, static_cast<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,
+ static_cast<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)
@@ -256,7 +260,8 @@ bool cHopperEntity::MovePickupsIn(cChunk & a_Chunk)
auto 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())
{
@@ -268,12 +273,9 @@ bool cHopperEntity::MovePickupsIn(cChunk & a_Chunk)
return false;
}
- bool FoundPickupsAbove(void) const
- {
- return m_bFoundPickupsAbove;
- }
+ bool FoundPickupsAbove(void) const { return m_bFoundPickupsAbove; }
- protected:
+ protected:
Vector3i m_Pos;
bool m_bFoundPickupsAbove;
cItemGrid & m_Contents;
diff --git a/src/BlockEntities/HopperEntity.h b/src/BlockEntities/HopperEntity.h
index 8eb0196a3..3e70e1bbf 100644
--- a/src/BlockEntities/HopperEntity.h
+++ b/src/BlockEntities/HopperEntity.h
@@ -16,8 +16,7 @@
// tolua_begin
-class cHopperEntity :
- public cBlockEntityWithItems
+class cHopperEntity : public cBlockEntityWithItems
{
// tolua_end
@@ -25,13 +24,12 @@ class cHopperEntity :
// tolua_begin
-public:
-
+ public:
enum
{
ContentsHeight = 1,
- ContentsWidth = 5
- } ;
+ ContentsWidth = 5
+ };
// tolua_end
@@ -45,8 +43,7 @@ public:
void SetLocked(bool a_Value);
-protected:
-
+ protected:
cTickTimeLong m_LastMoveItemsInTick;
cTickTimeLong m_LastMoveItemsOutTick;
@@ -77,7 +74,8 @@ protected:
/** Moves items from the specified a_Entity's Contents into this hopper. Returns true if contents have changed. */
bool MoveItemsFromGrid(cBlockEntityWithItems & a_Entity);
- /** Moves one piece from the specified itemstack into this hopper. Returns true if contents have changed. Doesn't change the itemstack. */
+ /** Moves one piece from the specified itemstack into this hopper. Returns true if contents have changed. Doesn't
+ * change the itemstack. */
bool MoveItemsFromSlot(cBlockEntityWithItems & a_Entity, int a_SrcSlotNum);
/** Moves items to the chest at the specified absolute coords. Returns true if contents have changed */
@@ -92,7 +90,6 @@ protected:
/** Moves one piece to the specified entity's contents' slot. Returns true if contents have changed. */
bool MoveItemsToSlot(cBlockEntityWithItems & a_Entity, int a_DstSlotNum);
-private:
-
+ private:
bool m_Locked;
-} ; // tolua_export
+}; // tolua_export
diff --git a/src/BlockEntities/JukeboxEntity.cpp b/src/BlockEntities/JukeboxEntity.cpp
index 065f9cb46..d99ed07f3 100644
--- a/src/BlockEntities/JukeboxEntity.cpp
+++ b/src/BlockEntities/JukeboxEntity.cpp
@@ -13,9 +13,8 @@
-cJukeboxEntity::cJukeboxEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World):
- Super(a_BlockType, a_BlockMeta, a_Pos, a_World),
- m_Record(0)
+cJukeboxEntity::cJukeboxEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World) :
+ Super(a_BlockType, a_BlockMeta, a_Pos, a_World), m_Record(0)
{
ASSERT(a_BlockType == E_BLOCK_JUKEBOX);
}
diff --git a/src/BlockEntities/JukeboxEntity.h b/src/BlockEntities/JukeboxEntity.h
index 744012fe6..8ccc11d80 100644
--- a/src/BlockEntities/JukeboxEntity.h
+++ b/src/BlockEntities/JukeboxEntity.h
@@ -10,20 +10,18 @@
// tolua_begin
-class cJukeboxEntity :
- public cBlockEntity
+class cJukeboxEntity : public cBlockEntity
{
// tolua_end
using Super = cBlockEntity;
-public: // tolua_export
-
+ public: // tolua_export
cJukeboxEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
// tolua_begin
- int GetRecord(void);
+ int GetRecord(void);
void SetRecord(int a_Record);
/** Plays the specified Record. Return false if a_Record isn't a playable Record (E_ITEM_XXX_DISC).
@@ -36,10 +34,7 @@ public: // tolua_export
/** Is in the Jukebox a Record? */
bool IsPlayingRecord(void) const;
- static bool IsRecordItem(int a_Item)
- {
- return ((a_Item >= E_ITEM_FIRST_DISC) && (a_Item <= E_ITEM_LAST_DISC));
- }
+ static bool IsRecordItem(int a_Item) { return ((a_Item >= E_ITEM_FIRST_DISC) && (a_Item <= E_ITEM_LAST_DISC)); }
// tolua_end
@@ -50,6 +45,6 @@ public: // tolua_export
virtual bool UsedBy(cPlayer * a_Player) override;
virtual void SendTo(cClientHandle &) override {}
-private:
+ private:
int m_Record;
-} ; // tolua_end
+}; // tolua_end
diff --git a/src/BlockEntities/MobHeadEntity.cpp b/src/BlockEntities/MobHeadEntity.cpp
index ef717513d..aa840f030 100644
--- a/src/BlockEntities/MobHeadEntity.cpp
+++ b/src/BlockEntities/MobHeadEntity.cpp
@@ -13,10 +13,8 @@
-cMobHeadEntity::cMobHeadEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World):
- Super(a_BlockType, a_BlockMeta, a_Pos, a_World),
- m_Type(SKULL_TYPE_SKELETON),
- m_Rotation(SKULL_ROTATION_NORTH)
+cMobHeadEntity::cMobHeadEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World) :
+ Super(a_BlockType, a_BlockMeta, a_Pos, a_World), m_Type(SKULL_TYPE_SKELETON), m_Rotation(SKULL_ROTATION_NORTH)
{
ASSERT(a_BlockType == E_BLOCK_HEAD);
}
@@ -30,7 +28,7 @@ void cMobHeadEntity::SetType(const eMobHeadType & a_Type)
if ((!m_OwnerName.empty()) && (a_Type != SKULL_TYPE_PLAYER))
{
m_OwnerName = m_OwnerTexture = m_OwnerTextureSignature = "";
- m_OwnerUUID = cUUID{};
+ m_OwnerUUID = cUUID {};
}
m_Type = a_Type;
}
@@ -74,7 +72,12 @@ void cMobHeadEntity::SetOwner(const cPlayer & a_Owner)
-void cMobHeadEntity::SetOwner(const cUUID & a_OwnerUUID, const AString & a_OwnerName, const AString & a_OwnerTexture, const AString & a_OwnerTextureSignature)
+void cMobHeadEntity::SetOwner(
+ const cUUID & a_OwnerUUID,
+ const AString & a_OwnerName,
+ const AString & a_OwnerTexture,
+ const AString & a_OwnerTextureSignature
+)
{
if (m_Type != SKULL_TYPE_PLAYER)
{
diff --git a/src/BlockEntities/MobHeadEntity.h b/src/BlockEntities/MobHeadEntity.h
index fcc7fc4c4..791caa08d 100644
--- a/src/BlockEntities/MobHeadEntity.h
+++ b/src/BlockEntities/MobHeadEntity.h
@@ -18,15 +18,13 @@
// tolua_begin
-class cMobHeadEntity :
- public cBlockEntity
+class cMobHeadEntity : public cBlockEntity
{
// tolua_end
using Super = cBlockEntity;
-public: // tolua_export
-
+ public: // tolua_export
/** Creates a new mob head entity at the specified block coords. a_World may be nullptr */
cMobHeadEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
@@ -60,20 +58,21 @@ public: // tolua_export
/** Sets the player components for the mob heads with player type. */
void SetOwner(
- const cUUID & a_OwnerUUID, const AString & a_OwnerName,
- const AString & a_OwnerTexture, const AString & a_OwnerTextureSignature
+ const cUUID & a_OwnerUUID,
+ const AString & a_OwnerName,
+ const AString & a_OwnerTexture,
+ const AString & a_OwnerTextureSignature
); // Exported in ManualBindings.cpp
/** Returns the player UUID of the mob head */
cUUID GetOwnerUUID(void) const { return m_OwnerUUID; } // Exported in ManualBindings.cpp
-private:
-
+ private:
eMobHeadType m_Type;
eMobHeadRotation m_Rotation;
AString m_OwnerName;
- cUUID m_OwnerUUID;
+ cUUID m_OwnerUUID;
AString m_OwnerTexture;
AString m_OwnerTextureSignature;
@@ -82,4 +81,4 @@ private:
virtual void CopyFrom(const cBlockEntity & a_Src) override;
virtual void SendTo(cClientHandle & a_Client) override;
virtual bool UsedBy(cPlayer * a_Player) override;
-} ; // tolua_export
+}; // tolua_export
diff --git a/src/BlockEntities/MobSpawnerEntity.cpp b/src/BlockEntities/MobSpawnerEntity.cpp
index 5778fb706..3da5718d7 100644
--- a/src/BlockEntities/MobSpawnerEntity.cpp
+++ b/src/BlockEntities/MobSpawnerEntity.cpp
@@ -13,11 +13,8 @@
-cMobSpawnerEntity::cMobSpawnerEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World):
- Super(a_BlockType, a_BlockMeta, a_Pos, a_World),
- m_Entity(mtPig),
- m_SpawnDelay(100),
- m_IsActive(false)
+cMobSpawnerEntity::cMobSpawnerEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World) :
+ Super(a_BlockType, a_BlockMeta, a_Pos, a_World), m_Entity(mtPig), m_SpawnDelay(100), m_IsActive(false)
{
ASSERT(a_BlockType == E_BLOCK_MOB_SPAWNER);
}
@@ -58,7 +55,8 @@ bool cMobSpawnerEntity::UsedBy(cPlayer * a_Player)
{
if (a_Player->GetEquippedItem().m_ItemType == E_ITEM_SPAWN_EGG)
{
- eMonsterType MonsterType = cItemSpawnEggHandler::ItemDamageToMonsterType(a_Player->GetEquippedItem().m_ItemDamage);
+ eMonsterType MonsterType =
+ cItemSpawnEggHandler::ItemDamageToMonsterType(a_Player->GetEquippedItem().m_ItemDamage);
if (MonsterType == eMonsterType::mtInvalidType)
{
return false;
@@ -140,7 +138,10 @@ void cMobSpawnerEntity::SpawnEntity(void)
return;
}
- bool EntitiesSpawned = m_World->DoWithChunk(GetChunkX(), GetChunkZ(), [this, NearbyEntities](cChunk & a_Chunk)
+ bool EntitiesSpawned = m_World->DoWithChunk(
+ GetChunkX(),
+ GetChunkZ(),
+ [this, NearbyEntities](cChunk & a_Chunk)
{
auto & Random = GetRandomProvider();
auto EntitySpawnTally = NearbyEntities;
@@ -155,9 +156,13 @@ void cMobSpawnerEntity::SpawnEntity(void)
auto SpawnRelPos(GetRelPos());
SpawnRelPos += Vector3i(
- static_cast<int>((Random.RandReal<double>() - Random.RandReal<double>()) * static_cast<double>(m_SpawnRange)),
+ static_cast<int>(
+ (Random.RandReal<double>() - Random.RandReal<double>()) * static_cast<double>(m_SpawnRange)
+ ),
Random.RandInt(-1, 1),
- static_cast<int>((Random.RandReal<double>() - Random.RandReal<double>()) * static_cast<double>(m_SpawnRange))
+ static_cast<int>(
+ (Random.RandReal<double>() - Random.RandReal<double>()) * static_cast<double>(m_SpawnRange)
+ )
);
auto Chunk = a_Chunk.GetRelNeighborChunkAdjustCoords(SpawnRelPos);
@@ -216,7 +221,11 @@ int cMobSpawnerEntity::GetNearbyPlayersNum(void)
return false;
};
- const cBoundingBox PlayerBoundingBox(Vector3d(m_Pos.x, m_Pos.y - m_RequiredPlayerRange, m_Pos.z), m_RequiredPlayerRange, m_RequiredPlayerRange * 2);
+ const cBoundingBox PlayerBoundingBox(
+ Vector3d(m_Pos.x, m_Pos.y - m_RequiredPlayerRange, m_Pos.z),
+ m_RequiredPlayerRange,
+ m_RequiredPlayerRange * 2
+ );
m_World->ForEachEntityInBox(PlayerBoundingBox, Callback);
return NumPlayers;
diff --git a/src/BlockEntities/MobSpawnerEntity.h b/src/BlockEntities/MobSpawnerEntity.h
index 3cd178d81..864c9a1eb 100644
--- a/src/BlockEntities/MobSpawnerEntity.h
+++ b/src/BlockEntities/MobSpawnerEntity.h
@@ -16,15 +16,13 @@
// tolua_begin
-class cMobSpawnerEntity :
- public cBlockEntity
+class cMobSpawnerEntity : public cBlockEntity
{
// tolua_end
using Super = cBlockEntity;
-public: // tolua_export
-
+ public: // tolua_export
cMobSpawnerEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
// cBlockEntity overrides:
@@ -35,7 +33,8 @@ public: // tolua_export
// tolua_begin
- /** Update the active flag from the mob spawner. This function will called every 5 seconds from the Tick() function. */
+ /** Update the active flag from the mob spawner. This function will called every 5 seconds from the Tick() function.
+ */
void UpdateActiveState(void);
/** Sets the spawn delay to a new random value. */
@@ -48,29 +47,28 @@ public: // tolua_export
int GetNearbyMonsterNum(eMonsterType a_EntityType);
int GetNearbyPlayersNum(void);
- eMonsterType GetEntity(void) const { return m_Entity; }
- short GetSpawnCount(void) const { return m_SpawnCount; }
- short GetSpawnRange(void) const { return m_SpawnRange; }
- short GetSpawnDelay(void) const { return m_SpawnDelay; }
- short GetMinSpawnDelay(void) const { return m_MinSpawnDelay; }
- short GetMaxSpawnDelay(void) const { return m_MaxSpawnDelay; }
- short GetMaxNearbyEntities(void) const { return m_MaxNearbyEntities; }
+ eMonsterType GetEntity(void) const { return m_Entity; }
+ short GetSpawnCount(void) const { return m_SpawnCount; }
+ short GetSpawnRange(void) const { return m_SpawnRange; }
+ short GetSpawnDelay(void) const { return m_SpawnDelay; }
+ short GetMinSpawnDelay(void) const { return m_MinSpawnDelay; }
+ short GetMaxSpawnDelay(void) const { return m_MaxSpawnDelay; }
+ short GetMaxNearbyEntities(void) const { return m_MaxNearbyEntities; }
short GetRequiredPlayerRange(void) const { return m_RequiredPlayerRange; }
// Setters
- void SetEntity(eMonsterType a_EntityType) { m_Entity = a_EntityType; }
- void SetSpawnDelay(short a_Delay) { m_SpawnDelay = a_Delay; }
- void SetSpawnCount(short a_SpawnCount) { m_SpawnCount = a_SpawnCount; }
- void SetSpawnRange(short a_SpawnRange) { m_SpawnRange = a_SpawnRange; }
- void SetMinSpawnDelay(short a_Min) { m_MinSpawnDelay = a_Min; }
- void SetMaxSpawnDelay(short a_Max) { m_MaxSpawnDelay = a_Max; }
- void SetMaxNearbyEntities(short a_MaxNearbyEntities) { m_MaxNearbyEntities = a_MaxNearbyEntities; }
+ void SetEntity(eMonsterType a_EntityType) { m_Entity = a_EntityType; }
+ void SetSpawnDelay(short a_Delay) { m_SpawnDelay = a_Delay; }
+ void SetSpawnCount(short a_SpawnCount) { m_SpawnCount = a_SpawnCount; }
+ void SetSpawnRange(short a_SpawnRange) { m_SpawnRange = a_SpawnRange; }
+ void SetMinSpawnDelay(short a_Min) { m_MinSpawnDelay = a_Min; }
+ void SetMaxSpawnDelay(short a_Max) { m_MaxSpawnDelay = a_Max; }
+ void SetMaxNearbyEntities(short a_MaxNearbyEntities) { m_MaxNearbyEntities = a_MaxNearbyEntities; }
void SetRequiredPlayerRange(short a_RequiredPlayerRange) { m_RequiredPlayerRange = a_RequiredPlayerRange; }
// tolua_end
-private:
-
+ private:
/** The entity to spawn. */
eMonsterType m_Entity;
@@ -95,4 +93,4 @@ private:
/** Maximum distance to player for activation */
short m_RequiredPlayerRange = 16;
-} ; // tolua_end
+}; // tolua_end
diff --git a/src/BlockEntities/NoteEntity.cpp b/src/BlockEntities/NoteEntity.cpp
index b4696f7b1..f86316041 100644
--- a/src/BlockEntities/NoteEntity.cpp
+++ b/src/BlockEntities/NoteEntity.cpp
@@ -10,9 +10,8 @@
-cNoteEntity::cNoteEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World):
- Super(a_BlockType, a_BlockMeta, a_Pos, a_World),
- m_Note(0)
+cNoteEntity::cNoteEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World) :
+ Super(a_BlockType, a_BlockMeta, a_Pos, a_World), m_Note(0)
{
ASSERT(a_BlockType == E_BLOCK_NOTE_BLOCK);
}
@@ -246,12 +245,7 @@ void cNoteEntity::MakeSound(void)
m_World->BroadcastBlockAction(m_Pos, static_cast<Byte>(Instrument), static_cast<Byte>(m_Note), E_BLOCK_NOTE_BLOCK);
- m_World->BroadcastSoundEffect(
- SampleName,
- m_Pos,
- 3.0f,
- PitchFromNote(m_Note)
- );
+ m_World->BroadcastSoundEffect(SampleName, m_Pos, 3.0f, PitchFromNote(m_Note));
}
@@ -292,16 +286,16 @@ float cNoteEntity::PitchFromNote(unsigned char a_Pitch)
// So 2 ^ ((m_Note - 12) / 12)
switch (a_Pitch)
{
- case 0: return 0.5f;
- case 1: return 0.5297315471796477f;
- case 2: return 0.5612310241546865f;
- case 3: return 0.5946035575013605f;
- case 4: return 0.6299605249474366f;
- case 5: return 0.6674199270850172f;
- case 6: return 0.7071067811865476f;
- case 7: return 0.7491535384383408f;
- case 8: return 0.7937005259840998f;
- case 9: return 0.8408964152537145f;
+ case 0: return 0.5f;
+ case 1: return 0.5297315471796477f;
+ case 2: return 0.5612310241546865f;
+ case 3: return 0.5946035575013605f;
+ case 4: return 0.6299605249474366f;
+ case 5: return 0.6674199270850172f;
+ case 6: return 0.7071067811865476f;
+ case 7: return 0.7491535384383408f;
+ case 8: return 0.7937005259840998f;
+ case 9: return 0.8408964152537145f;
case 10: return 0.8908987181403393f;
case 11: return 0.9438743126816935f;
case 12: return 1.0f;
diff --git a/src/BlockEntities/NoteEntity.h b/src/BlockEntities/NoteEntity.h
index 8579ba930..c2d57de74 100644
--- a/src/BlockEntities/NoteEntity.h
+++ b/src/BlockEntities/NoteEntity.h
@@ -9,16 +9,16 @@
enum ENUM_NOTE_INSTRUMENTS
{
- E_INST_HARP_PIANO = 0,
+ E_INST_HARP_PIANO = 0,
E_INST_DOUBLE_BASS = 1,
- E_INST_SNARE_DRUM = 2,
- E_INST_CLICKS = 3,
- E_INST_BASS_DRUM = 4,
- E_INST_FLUTE = 5,
- E_INST_BELL = 6,
- E_INST_GUITAR = 7,
- E_INST_CHIME = 8,
- E_INST_XYLOPHONE = 9
+ E_INST_SNARE_DRUM = 2,
+ E_INST_CLICKS = 3,
+ E_INST_BASS_DRUM = 4,
+ E_INST_FLUTE = 5,
+ E_INST_BELL = 6,
+ E_INST_GUITAR = 7,
+ E_INST_CHIME = 8,
+ E_INST_XYLOPHONE = 9
};
@@ -27,15 +27,13 @@ enum ENUM_NOTE_INSTRUMENTS
// tolua_begin
-class cNoteEntity :
- public cBlockEntity
+class cNoteEntity : public cBlockEntity
{
// tolua_end
using Super = cBlockEntity;
-public: // tolua_export
-
+ public: // tolua_export
/** Creates a new note entity. a_World may be nullptr */
cNoteEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
@@ -57,7 +55,6 @@ public: // tolua_export
from a note value between 0 and 24 (used in m_Note). */
static float PitchFromNote(unsigned char a_Note);
-private:
-
+ private:
unsigned char m_Note;
-} ; // tolua_export
+}; // tolua_export
diff --git a/src/BlockEntities/SignEntity.cpp b/src/BlockEntities/SignEntity.cpp
index fc96e06f5..e37c8ac47 100644
--- a/src/BlockEntities/SignEntity.cpp
+++ b/src/BlockEntities/SignEntity.cpp
@@ -12,10 +12,10 @@
-cSignEntity::cSignEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World):
+cSignEntity::cSignEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World) :
Super(a_BlockType, a_BlockMeta, a_Pos, a_World)
{
- ASSERT((a_BlockType == E_BLOCK_WALLSIGN) || (a_BlockType == E_BLOCK_SIGN_POST));
+ ASSERT((a_BlockType == E_BLOCK_WALLSIGN) || (a_BlockType == E_BLOCK_SIGN_POST));
ASSERT(cChunkDef::IsValidHeight(a_Pos));
}
@@ -44,7 +44,12 @@ bool cSignEntity::UsedBy(cPlayer * a_Player)
-void cSignEntity::SetLines(const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4)
+void cSignEntity::SetLines(
+ const AString & a_Line1,
+ const AString & a_Line2,
+ const AString & a_Line3,
+ const AString & a_Line4
+)
{
m_Line[0] = a_Line1;
m_Line[1] = a_Line2;
diff --git a/src/BlockEntities/SignEntity.h b/src/BlockEntities/SignEntity.h
index 4cc69ee22..700056680 100644
--- a/src/BlockEntities/SignEntity.h
+++ b/src/BlockEntities/SignEntity.h
@@ -16,16 +16,15 @@
// tolua_begin
-class cSignEntity :
- public cBlockEntity
+class cSignEntity : public cBlockEntity
{
// tolua_end
using Super = cBlockEntity;
-public: // tolua_export
-
- /** Creates a new empty sign entity at the specified block coords and block type (wall or standing). a_World may be nullptr */
+ public: // tolua_export
+ /** Creates a new empty sign entity at the specified block coords and block type (wall or standing). a_World may be
+ * nullptr */
cSignEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
// tolua_begin
@@ -46,7 +45,6 @@ public: // tolua_export
virtual bool UsedBy(cPlayer * a_Player) override;
virtual void SendTo(cClientHandle & a_Client) override;
-private:
-
+ private:
std::array<AString, 4> m_Line;
-} ; // tolua_export
+}; // tolua_export