summaryrefslogtreecommitdiffstats
path: root/src/BlockEntities/ChestEntity.cpp
diff options
context:
space:
mode:
authorAlexander Harkness <me@bearbin.net>2024-11-02 22:27:47 +0100
committerAlexander Harkness <me@bearbin.net>2024-11-02 22:27:47 +0100
commitcb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a (patch)
treef647b20e1823f1846af88e832cf82a4a02e96e69 /src/BlockEntities/ChestEntity.cpp
parentImprove clang-format config file, remove automatically enforced code style from contrib guide. (diff)
downloadcuberite-clang-format-codebase.tar
cuberite-clang-format-codebase.tar.gz
cuberite-clang-format-codebase.tar.bz2
cuberite-clang-format-codebase.tar.lz
cuberite-clang-format-codebase.tar.xz
cuberite-clang-format-codebase.tar.zst
cuberite-clang-format-codebase.zip
Diffstat (limited to 'src/BlockEntities/ChestEntity.cpp')
-rw-r--r--src/BlockEntities/ChestEntity.cpp28
1 files changed, 10 insertions, 18 deletions
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?
}
}