![]() |
Cuberite
A lightweight, fast and extensible game server for Minecraft
|
#include <VanillaFluidSimulator.h>
Public Member Functions | |
cVanillaFluidSimulator (cWorld &a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid, NIBBLETYPE a_Falloff, int a_TickDelay, int a_NumNeighborsForSource) | |
![]() | |
cFloodyFluidSimulator (cWorld &a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid, NIBBLETYPE a_Falloff, int a_TickDelay, int a_NumNeighborsForSource) | |
![]() | |
virtual void | AddBlock (Vector3i a_Block, cChunk *a_Chunk) override |
Called to simulate a new block. More... | |
cDelayedFluidSimulator (cWorld &a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid, int a_TickDelay) | |
virtual cFluidSimulatorData * | CreateChunkData (void) override |
Creates a ChunkData object for the simulator to use. More... | |
virtual void | Simulate (float a_Dt) override |
Called in each tick, a_Dt is the time passed since the last tick, in msec. More... | |
virtual void | SimulateChunk (std::chrono::milliseconds a_Dt, int a_ChunkX, int a_ChunkZ, cChunk *a_Chunk) override |
Called in each tick for each chunk, a_Dt is the time passed since the last tick, in msec; direct access to chunk data available. More... | |
![]() | |
cFluidSimulator (cWorld &a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid) | |
virtual Vector3f | GetFlowingDirection (int a_X, int a_Y, int a_Z) |
Returns a unit vector in the direction the fluid is flowing or a zero-vector if not flowing. More... | |
virtual bool | IsAllowedBlock (BLOCKTYPE a_BlockType) override |
Returns true if the specified block type is "interesting" for this simulator. More... | |
bool | IsAnyFluidBlock (BLOCKTYPE a_BlockType) const |
bool | IsFluidBlock (BLOCKTYPE a_BlockType) const |
bool | IsHigherMeta (NIBBLETYPE a_Meta1, NIBBLETYPE a_Meta2) |
Returns true if a_Meta1 is a higher fluid than a_Meta2. More... | |
bool | IsPassableForFluid (BLOCKTYPE a_BlockType) |
bool | IsSolidBlock (BLOCKTYPE a_BlockType) |
bool | IsStationaryFluidBlock (BLOCKTYPE a_BlockType) const |
![]() | |
cSimulator (cWorld &a_World) | |
void | WakeUp (Vector3i a_Block, cChunk *a_Chunk) |
Called when a block changes. More... | |
void | WakeUpArea (const cCuboid &a_Area) |
Does the same processing as WakeUp, but for all blocks within the specified area. More... | |
virtual | ~cSimulator () |
Protected Member Functions | |
int | CalculateFlowCost (cChunk *a_Chunk, int a_RelX, int a_RelY, int a_RelZ, Direction a_Dir, unsigned a_Iteration=0) |
Recursively calculates the minimum number of blocks needed to descend a level. More... | |
virtual void | SpreadXZ (cChunk *a_Chunk, int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_NewMeta) override |
Spread fluid to XZ neighbors. More... | |
![]() | |
bool | CheckNeighborsForSource (cChunk *a_Chunk, int a_RelX, int a_RelY, int a_RelZ) |
Checks if there are enough neighbors to create a source at the coords specified; turns into source and returns true if so. More... | |
bool | CheckTributaries (cChunk *a_Chunk, int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_MyMeta) |
Checks tributaries, if not fed, decreases the block's level and returns true. More... | |
bool | HardenBlock (cChunk *a_Chunk, Vector3i a_RelPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta) |
Checks if the specified block should harden (Water / Lava interaction) and if so, converts it to a suitable block. More... | |
virtual void | SimulateBlock (cChunk *a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override |
Called from SimulateChunk() to simulate each block in one slot of blocks. More... | |
void | SpreadToNeighbor (cChunk *a_NearChunk, int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_NewMeta) |
Spreads into the specified block, if the blocktype there allows. More... | |
Private Types | |
typedef cFloodyFluidSimulator | super |
Additional Inherited Members | |
![]() | |
static bool | CanWashAway (BLOCKTYPE a_BlockType) |
![]() | |
NIBBLETYPE | m_Falloff |
int | m_NumNeighborsForSource |
![]() | |
int | m_AddSlotNum |
int | m_SimSlotNum |
int | m_TickDelay |
int | m_TotalBlocks |
![]() | |
BLOCKTYPE | m_FluidBlock |
BLOCKTYPE | m_StationaryFluidBlock |
![]() | |
cWorld & | m_World |
Definition at line 16 of file VanillaFluidSimulator.h.
|
private |
Definition at line 19 of file VanillaFluidSimulator.h.
cVanillaFluidSimulator::cVanillaFluidSimulator | ( | cWorld & | a_World, |
BLOCKTYPE | a_Fluid, | ||
BLOCKTYPE | a_StationaryFluid, | ||
NIBBLETYPE | a_Falloff, | ||
int | a_TickDelay, | ||
int | a_NumNeighborsForSource | ||
) |
Definition at line 23 of file VanillaFluidSimulator.cpp.
|
protected |
Recursively calculates the minimum number of blocks needed to descend a level.
Definition at line 80 of file VanillaFluidSimulator.cpp.
|
overrideprotectedvirtual |
Spread fluid to XZ neighbors.
The coords are of the block currently being processed; a_NewMeta is the new meta for the new fluid block. Descendants may overridde to provide more sophisticated algorithms.
Reimplemented from cFloodyFluidSimulator.
Definition at line 38 of file VanillaFluidSimulator.cpp.