59 const bool ShouldSoak = std::any_of(WaterCheck.cbegin(), WaterCheck.cend(), [a_Rel, &a_Chunk](
Vector3i a_Offset)
61 return IsWet(a_Rel + a_Offset, a_Chunk);
71 std::queue<sSeed> Seeds;
74 const int maxDepth = 7;
76 for (
unsigned int i = 0; i < 6; i++)
78 Seeds.emplace(a_Rel + WaterCheck[i], maxDepth - 1);
82 while (!Seeds.empty() && count < 65)
84 sSeed seed = Seeds.front();
86 if (
IsWet(checkRel, a_Chunk))
89 DryUp(checkRel, a_Chunk);
94 for (
unsigned int i = 0; i < 6; i++)
96 Seeds.emplace(checkRel + WaterCheck[i], seed.m_Depth - 1);
bool IsBlockWater(BLOCKTYPE a_BlockType)
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
unsigned char BLOCKTYPE
The datatype used by blockdata.
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc.
constexpr cBlockHandler(BLOCKTYPE a_BlockType)
virtual void OnPlaced(cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) const override
Called by cWorld::SetBlock() after the block has been set.
virtual void OnNeighborChanged(cChunkInterface &a_ChunkInterface, Vector3i a_BlockPos, eBlockFace a_WhichNeighbor) const override
Called when a direct neighbor of this block has been changed.
static void DryUp(Vector3i a_Rel, cChunk &a_Chunk)
static void CheckSoaked(Vector3i a_Rel, cChunk &a_Chunk)
Check blocks around the sponge to see if they are water.
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
Returns the base colour ID of the block, as will be represented on a map, as per documentation: https...
static bool IsWet(Vector3i a_Rel, cChunk &a_Chunk)
bool DoWithChunkAt(Vector3i a_BlockPos, cFunctionRef< bool(cChunk &)> a_Callback)
NIBBLETYPE GetMeta(int a_RelX, int a_RelY, int a_RelZ) const
void SetBlock(Vector3i a_RelBlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
bool UnboundedRelSetBlock(Vector3i a_RelPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Same as SetBlock(), but relative coords needn't be in this chunk (uses m_Neighbor-s or m_ChunkMap in ...
bool UnboundedRelGetBlockType(Vector3i a_RelCoords, BLOCKTYPE &a_BlockType) const
Same as GetBlockType(), but relative coords needn't be in this chunk (uses m_Neighbor-s or m_ChunkMap...
static void AbsoluteToRelative(int &a_X, int &a_Y, int &a_Z, int &a_ChunkX, int &a_ChunkZ)
Converts absolute block coords into relative (chunk + block) coords:
static constexpr std::array< Vector3i, 6 > AdjacentOffsets
Contains offsets for direct adjacents of any position.