67 for (
int i = 0; i < 5; i++)
83 int x = (rnd % 3) - 1;
84 int y = ((rnd / 4) % 4) - 1;
85 int z = ((rnd / 16) % 3) - 1;
86 auto Pos = a_RelPos +
Vector3i(x, y, z);
109 for (
size_t i = 0; i <
ARRAYCOUNT(CrossCoords); i++)
111 auto NeighborPos = Pos + CrossCoords[i];
155 using cBlockFluidHandler::cBlockFluidHandler;
166 ASSERT(!
"Unhandled blocktype in fluid/water handler!");
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.
#define ARRAYCOUNT(X)
Evaluates to the number of elements in an array (compile-time!)
~cBlockFluidHandler()=default
virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem *const a_Tool) const override
Returns the pickups that would result if the block was mined by a_Digger using a_Tool.
virtual bool DoesIgnoreBuildCollision(const cWorld &a_World, const cItem &a_HeldItem, const Vector3i a_Position, const NIBBLETYPE a_Meta, const eBlockFace a_ClickedBlockFace, const bool a_ClickedDirectly) const override
Checks if the player can build "inside" this block.
virtual void OnUpdate(cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, cBlockPluginInterface &a_PluginInterface, cChunk &a_Chunk, const Vector3i a_RelPos) const override
Called when the block gets ticked either by a random tick or by a queued tick.
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...
virtual bool CanSustainPlant(BLOCKTYPE a_Plant) const override
Checks whether the block has an effect on growing the plant.
static bool TryStartFireNear(const Vector3i a_RelPos, cChunk &a_Chunk)
Tries to start a fire near the lava at given coords.
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...
virtual bool CanSustainPlant(BLOCKTYPE a_Plant) const override
Checks whether the block has an effect on growing the plant.
constexpr cBlockHandler(BLOCKTYPE a_BlockType)
const BLOCKTYPE m_BlockType
This interface is used to decouple block handlers from the cPluginManager dependency through cWorld.
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 ...
cWorld * GetWorld(void) const
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 bool IsValidHeight(Vector3i a_BlockPosition)
Validates a height-coordinate.
static const int NumBlocks
This class bridges a vector of cItem for safe access via Lua.
static bool IsFuel(BLOCKTYPE a_BlockType)
bool ShouldLavaSpawnFire(void) const
int GetTickRandomNumber(int a_Range)
Returns a random number in range [0 .