summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockSponge.h
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/Blocks/BlockSponge.h
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/Blocks/BlockSponge.h')
-rw-r--r--src/Blocks/BlockSponge.h38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/Blocks/BlockSponge.h b/src/Blocks/BlockSponge.h
index 0e4865a8e..5cb445787 100644
--- a/src/Blocks/BlockSponge.h
+++ b/src/Blocks/BlockSponge.h
@@ -7,29 +7,36 @@
-class cBlockSpongeHandler final :
- public cBlockHandler
+class cBlockSpongeHandler final : public cBlockHandler
{
using Super = cBlockHandler;
-public:
-
+ public:
using Super::Super;
-private:
-
+ private:
virtual void OnPlaced(
- cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface,
+ cChunkInterface & a_ChunkInterface,
+ cWorldInterface & a_WorldInterface,
Vector3i a_BlockPos,
- BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
+ BLOCKTYPE a_BlockType,
+ NIBBLETYPE a_BlockMeta
) const override
{
OnNeighborChanged(a_ChunkInterface, a_BlockPos, BLOCK_FACE_NONE);
}
- virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, Vector3i a_BlockPos, eBlockFace a_WhichNeighbor) const override
+ virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, Vector3i a_BlockPos, eBlockFace a_WhichNeighbor)
+ const override
{
- a_ChunkInterface.DoWithChunkAt(a_BlockPos, [&](cChunk & a_Chunk) { CheckSoaked(cChunkDef::AbsoluteToRelative(a_BlockPos), a_Chunk); return true; });
+ a_ChunkInterface.DoWithChunkAt(
+ a_BlockPos,
+ [&](cChunk & a_Chunk)
+ {
+ CheckSoaked(cChunkDef::AbsoluteToRelative(a_BlockPos), a_Chunk);
+ return true;
+ }
+ );
}
/** Check blocks around the sponge to see if they are water.
@@ -56,10 +63,11 @@ private:
}
const auto & WaterCheck = cSimulator::AdjacentOffsets;
- const bool ShouldSoak = std::any_of(WaterCheck.cbegin(), WaterCheck.cend(), [a_Rel, &a_Chunk](Vector3i a_Offset)
- {
- return IsWet(a_Rel + a_Offset, a_Chunk);
- });
+ const bool ShouldSoak = std::any_of(
+ WaterCheck.cbegin(),
+ WaterCheck.cend(),
+ [a_Rel, &a_Chunk](Vector3i a_Offset) { return IsWet(a_Rel + a_Offset, a_Chunk); }
+ );
// Early return if the sponge isn't touching any water.
if (!ShouldSoak)
@@ -113,7 +121,7 @@ private:
{
// TODO: support detecting waterlogged blocks.
BLOCKTYPE Type;
- return(a_Chunk.UnboundedRelGetBlockType(a_Rel.x, a_Rel.y, a_Rel.z, Type) && IsBlockWater(Type));
+ return (a_Chunk.UnboundedRelGetBlockType(a_Rel.x, a_Rel.y, a_Rel.z, Type) && IsBlockWater(Type));
}
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override