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

#include <FluidSimulator.h>

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

Public Member Functions

 cFluidSimulator (cWorld &a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid)
 
virtual cFluidSimulatorDataCreateChunkData (void)=0
 Creates a ChunkData object for the simulator to use. More...
 
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 ()
 

Static Public Member Functions

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

Protected Member Functions

bool IsAllowedBlock (BLOCKTYPE a_BlockType)
 
- Protected Member Functions inherited from cSimulator
virtual void AddBlock (cChunk &a_Chunk, Vector3i a_Position, BLOCKTYPE a_Block)=0
 Called to simulate a new block. More...
 
virtual void Simulate (float a_Dt)
 
virtual void SimulateChunk (std::chrono::milliseconds a_Dt, int a_ChunkX, int a_ChunkZ, cChunk *a_Chunk)=0
 
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

BLOCKTYPE m_FluidBlock
 
BLOCKTYPE m_StationaryFluidBlock
 
- Protected Attributes inherited from cSimulator
cWorldm_World
 

Private Types

using Super = cSimulator
 

Additional Inherited Members

- 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 37 of file FluidSimulator.h.

Member Typedef Documentation

◆ Super

Definition at line 40 of file FluidSimulator.h.

Constructor & Destructor Documentation

◆ cFluidSimulator()

cFluidSimulator::cFluidSimulator ( cWorld a_World,
BLOCKTYPE  a_Fluid,
BLOCKTYPE  a_StationaryFluid 
)

Definition at line 10 of file FluidSimulator.cpp.

Member Function Documentation

◆ CanWashAway()

bool cFluidSimulator::CanWashAway ( BLOCKTYPE  a_BlockType)
static

Definition at line 30 of file FluidSimulator.cpp.

◆ CreateChunkData()

virtual cFluidSimulatorData* cFluidSimulator::CreateChunkData ( void  )
pure virtual

Creates a ChunkData object for the simulator to use.

The simulator returns the correct object type.

Implemented in cVaporizeFluidSimulator, cNoopFluidSimulator, and cDelayedFluidSimulator.

◆ GetFlowingDirection()

Vector3f cFluidSimulator::GetFlowingDirection ( Vector3i  a_Pos)
virtual

Returns a unit vector in the direction the fluid is flowing or a zero-vector if not flowing.

Definition at line 133 of file FluidSimulator.cpp.

◆ IsAllowedBlock()

bool cFluidSimulator::IsAllowedBlock ( BLOCKTYPE  a_BlockType)
protected

Definition at line 21 of file FluidSimulator.cpp.

◆ IsAnyFluidBlock()

bool cFluidSimulator::IsAnyFluidBlock ( BLOCKTYPE  a_BlockType) const
inline

Definition at line 54 of file FluidSimulator.h.

◆ IsFluidBlock()

bool cFluidSimulator::IsFluidBlock ( BLOCKTYPE  a_BlockType) const
inline

Definition at line 52 of file FluidSimulator.h.

◆ IsHigherMeta()

bool cFluidSimulator::IsHigherMeta ( NIBBLETYPE  a_Meta1,
NIBBLETYPE  a_Meta2 
)

Returns true if a_Meta1 is a higher fluid than a_Meta2.

Takes source blocks into account.

Definition at line 101 of file FluidSimulator.cpp.

◆ IsPassableForFluid()

bool cFluidSimulator::IsPassableForFluid ( BLOCKTYPE  a_BlockType)

Definition at line 87 of file FluidSimulator.cpp.

◆ IsSolidBlock()

bool cFluidSimulator::IsSolidBlock ( BLOCKTYPE  a_BlockType)

Definition at line 78 of file FluidSimulator.cpp.

◆ IsStationaryFluidBlock()

bool cFluidSimulator::IsStationaryFluidBlock ( BLOCKTYPE  a_BlockType) const
inline

Definition at line 53 of file FluidSimulator.h.

Member Data Documentation

◆ m_FluidBlock

BLOCKTYPE cFluidSimulator::m_FluidBlock
protected

Definition at line 68 of file FluidSimulator.h.

◆ m_StationaryFluidBlock

BLOCKTYPE cFluidSimulator::m_StationaryFluidBlock
protected

Definition at line 69 of file FluidSimulator.h.


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