Cuberite
A lightweight, fast and extensible game server for Minecraft
FluidSimulator.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "Simulator.h"
5 
6 
7 class cWorld;
8 
9 
11 {
19 };
20 
21 
22 
23 
24 
28 {
29 public:
30  virtual ~cFluidSimulatorData() {}
31 };
32 
33 
34 
35 
36 
38  public cSimulator
39 {
40  typedef cSimulator super;
41 
42 public:
43  cFluidSimulator(cWorld & a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid);
44 
45  // cSimulator overrides:
46  virtual bool IsAllowedBlock(BLOCKTYPE a_BlockType) override;
47 
49  virtual Vector3f GetFlowingDirection(int a_X, int a_Y, int a_Z);
50 
52  virtual cFluidSimulatorData * CreateChunkData(void) { return nullptr; }
53 
54  bool IsFluidBlock (BLOCKTYPE a_BlockType) const { return (a_BlockType == m_FluidBlock); }
55  bool IsStationaryFluidBlock(BLOCKTYPE a_BlockType) const { return (a_BlockType == m_StationaryFluidBlock); }
56  bool IsAnyFluidBlock (BLOCKTYPE a_BlockType) const { return ((a_BlockType == m_FluidBlock) || (a_BlockType == m_StationaryFluidBlock)); }
57 
58  static bool CanWashAway(BLOCKTYPE a_BlockType);
59 
60  bool IsSolidBlock (BLOCKTYPE a_BlockType);
61  bool IsPassableForFluid(BLOCKTYPE a_BlockType);
62 
64  bool IsHigherMeta(NIBBLETYPE a_Meta1, NIBBLETYPE a_Meta2);
65 
66 protected:
67  BLOCKTYPE m_FluidBlock; // The fluid block type that needs simulating
68  BLOCKTYPE m_StationaryFluidBlock; // The fluid block type that indicates no simulation is needed
69 };
70 
71 
72 
73 
74 
virtual cFluidSimulatorData * CreateChunkData(void)
Creates a ChunkData object for the simulator to use.
BLOCKTYPE m_FluidBlock
unsigned char BLOCKTYPE
The datatype used by blockdata.
Definition: ChunkDef.h:42
BLOCKTYPE m_StationaryFluidBlock
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
Definition: ChunkDef.h:45
bool IsFluidBlock(BLOCKTYPE a_BlockType) const
Base class for all block-based physics simulators (such as fluid, fire, falling blocks etc...
Definition: Simulator.h:19
Direction
Definition: World.h:65
cSimulator super
This is a base class for all fluid simulator data classes.
bool IsAnyFluidBlock(BLOCKTYPE a_BlockType) const
bool IsStationaryFluidBlock(BLOCKTYPE a_BlockType) const
virtual ~cFluidSimulatorData()