Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Member Functions | Protected Member Functions | Private Types | List of all members
cVanillaFluidSimulator Class Reference

#include <VanillaFluidSimulator.h>

Inheritance diagram for cVanillaFluidSimulator:
Inheritance graph
[legend]
Collaboration diagram for cVanillaFluidSimulator:
Collaboration graph
[legend]

Public Member Functions

 cVanillaFluidSimulator (cWorld &a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid, NIBBLETYPE a_Falloff, int a_TickDelay, int a_NumNeighborsForSource)
 
- Public Member Functions inherited from cFloodyFluidSimulator
 cFloodyFluidSimulator (cWorld &a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid, NIBBLETYPE a_Falloff, int a_TickDelay, int a_NumNeighborsForSource)
 
- Public Member Functions inherited from cDelayedFluidSimulator
 cDelayedFluidSimulator (cWorld &a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid, int a_TickDelay)
 
- Public Member Functions inherited from cFluidSimulator
 cFluidSimulator (cWorld &a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid)
 
virtual Vector3f GetFlowingDirection (Vector3i a_Pos)
 Returns a unit vector in the direction the fluid is flowing or a zero-vector if not flowing. 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
 
- Public Member Functions inherited from cSimulator
 cSimulator (cWorld &a_World)
 
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...
 
- Protected Member Functions inherited from cFloodyFluidSimulator
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...
 
- Protected Member Functions inherited from cDelayedFluidSimulator
virtual void AddBlock (cChunk &a_Chunk, Vector3i a_Position, BLOCKTYPE a_Block) override
 Called to simulate a new block. More...
 
virtual cFluidSimulatorDataCreateChunkData (void) override
 Creates a ChunkData object for the simulator to use. More...
 
virtual void Simulate (float a_Dt) override
 
virtual void SimulateChunk (std::chrono::milliseconds a_Dt, int a_ChunkX, int a_ChunkZ, cChunk *a_Chunk) override
 
- Protected Member Functions inherited from cFluidSimulator
bool IsAllowedBlock (BLOCKTYPE a_BlockType)
 
- Protected Member Functions inherited from cSimulator
virtual void WakeUp (cChunk &a_Chunk, Vector3i a_Position, BLOCKTYPE a_Block)
 Called to simulate a single new block, typically as a result of a single block break or change. More...
 
virtual void WakeUp (cChunk &a_Chunk, Vector3i a_Position, Vector3i a_Offset, BLOCKTYPE a_Block)
 Called to simulate a single block, synthesised by the simulator manager. More...
 

Private Types

using Super = cFloodyFluidSimulator
 

Additional Inherited Members

- Static Public Member Functions inherited from cFluidSimulator
static bool CanWashAway (BLOCKTYPE a_BlockType)
 
- Static Public Member Functions inherited from cSimulator
static std::array< Vector3i, 5 > GetLinkedOffsets (Vector3i Offset)
 For a given offset from a position, return the offsets that represent the adjacents of the newly offset position, excluding the old position. More...
 
- Static Public Attributes inherited from cSimulator
static constexpr std::array< Vector3i, 6 > AdjacentOffsets
 Contains offsets for direct adjacents of any position. More...
 
- Protected Attributes inherited from cFloodyFluidSimulator
NIBBLETYPE m_Falloff
 
int m_NumNeighborsForSource
 
- Protected Attributes inherited from cDelayedFluidSimulator
int m_AddSlotNum
 
int m_SimSlotNum
 
int m_TickDelay
 
int m_TotalBlocks
 
- Protected Attributes inherited from cFluidSimulator
BLOCKTYPE m_FluidBlock
 
BLOCKTYPE m_StationaryFluidBlock
 
- Protected Attributes inherited from cSimulator
cWorldm_World
 

Detailed Description

Definition at line 16 of file VanillaFluidSimulator.h.

Member Typedef Documentation

◆ Super

Definition at line 19 of file VanillaFluidSimulator.h.

Constructor & Destructor Documentation

◆ cVanillaFluidSimulator()

cVanillaFluidSimulator::cVanillaFluidSimulator ( cWorld a_World,
BLOCKTYPE  a_Fluid,
BLOCKTYPE  a_StationaryFluid,
NIBBLETYPE  a_Falloff,
int  a_TickDelay,
int  a_NumNeighborsForSource 
)

Definition at line 24 of file VanillaFluidSimulator.cpp.

Member Function Documentation

◆ CalculateFlowCost()

int cVanillaFluidSimulator::CalculateFlowCost ( cChunk a_Chunk,
int  a_RelX,
int  a_RelY,
int  a_RelZ,
Direction  a_Dir,
unsigned  a_Iteration = 0 
)
protected

Recursively calculates the minimum number of blocks needed to descend a level.

Definition at line 82 of file VanillaFluidSimulator.cpp.

◆ SpreadXZ()

void cVanillaFluidSimulator::SpreadXZ ( cChunk a_Chunk,
int  a_RelX,
int  a_RelY,
int  a_RelZ,
NIBBLETYPE  a_NewMeta 
)
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 40 of file VanillaFluidSimulator.cpp.


The documentation for this class was generated from the following files: