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

#include <DelayedFluidSimulator.h>

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

Public Member Functions

 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

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 SimulateBlock (cChunk *a_Chunk, int a_RelX, int a_RelY, int a_RelZ)=0
 Called from SimulateChunk() to simulate each block in one slot of blocks. More...
 
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...
 

Protected Attributes

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
 

Private Types

using Super = cFluidSimulator
 

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...
 

Detailed Description

Definition at line 48 of file DelayedFluidSimulator.h.

Member Typedef Documentation

◆ Super

Definition at line 51 of file DelayedFluidSimulator.h.

Constructor & Destructor Documentation

◆ cDelayedFluidSimulator()

cDelayedFluidSimulator::cDelayedFluidSimulator ( cWorld a_World,
BLOCKTYPE  a_Fluid,
BLOCKTYPE  a_StationaryFluid,
int  a_TickDelay 
)

Definition at line 68 of file DelayedFluidSimulator.cpp.

Member Function Documentation

◆ AddBlock()

void cDelayedFluidSimulator::AddBlock ( cChunk a_Chunk,
Vector3i  a_Position,
BLOCKTYPE  a_Block 
)
overrideprotectedvirtual

Called to simulate a new block.

Unlike WakeUp this function will perform minimal checking. It queues the block to be simulated as fast as possible, suitable for area wakeups.

Implements cSimulator.

Definition at line 122 of file DelayedFluidSimulator.cpp.

◆ CreateChunkData()

virtual cFluidSimulatorData* cDelayedFluidSimulator::CreateChunkData ( void  )
inlineoverrideprotectedvirtual

Creates a ChunkData object for the simulator to use.

The simulator returns the correct object type.

Implements cFluidSimulator.

Definition at line 62 of file DelayedFluidSimulator.h.

◆ Simulate()

void cDelayedFluidSimulator::Simulate ( float  a_Dt)
overrideprotectedvirtual

Reimplemented from cSimulator.

Definition at line 81 of file DelayedFluidSimulator.cpp.

◆ SimulateBlock()

virtual void cDelayedFluidSimulator::SimulateBlock ( cChunk a_Chunk,
int  a_RelX,
int  a_RelY,
int  a_RelZ 
)
protectedpure virtual

Called from SimulateChunk() to simulate each block in one slot of blocks.

Descendants override this method to provide custom simulation.

Implemented in cFloodyFluidSimulator.

◆ SimulateChunk()

void cDelayedFluidSimulator::SimulateChunk ( std::chrono::milliseconds  a_Dt,
int  a_ChunkX,
int  a_ChunkZ,
cChunk a_Chunk 
)
overrideprotectedvirtual

Implements cSimulator.

Definition at line 95 of file DelayedFluidSimulator.cpp.

Member Data Documentation

◆ m_AddSlotNum

int cDelayedFluidSimulator::m_AddSlotNum
protected

Definition at line 65 of file DelayedFluidSimulator.h.

◆ m_SimSlotNum

int cDelayedFluidSimulator::m_SimSlotNum
protected

Definition at line 66 of file DelayedFluidSimulator.h.

◆ m_TickDelay

int cDelayedFluidSimulator::m_TickDelay
protected

Definition at line 64 of file DelayedFluidSimulator.h.

◆ m_TotalBlocks

int cDelayedFluidSimulator::m_TotalBlocks
protected

Definition at line 68 of file DelayedFluidSimulator.h.


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