Cuberite
A lightweight, fast and extensible game server for Minecraft
VaporizeFluidSimulator.cpp
Go to the documentation of this file.
1 
2 // VaporizeFluidSimulator.cpp
3 
4 // Implements the cVaporizeFluidSimulator class representing a fluid simulator that replaces all fluid blocks with air
5 
6 #include "Globals.h"
8 #include "BlockType.h"
9 #include "../OpaqueWorld.h"
10 #include "../Chunk.h"
11 #include "../Blocks/BroadcastInterface.h"
12 
13 
14 
15 
16 
17 void cVaporizeFluidSimulator::SimulateChunk(std::chrono::milliseconds a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk)
18 {
19  // Nothing needed
20 
21  UNUSED(a_Dt);
22  UNUSED(a_ChunkX);
23  UNUSED(a_ChunkZ);
24  UNUSED(a_Chunk);
25 }
26 
27 
28 
29 
30 
31 void cVaporizeFluidSimulator::AddBlock(cChunk & a_Chunk, Vector3i a_Position, BLOCKTYPE a_Block)
32 {
33  if ((a_Block == m_FluidBlock) || (a_Block == m_StationaryFluidBlock))
34  {
35  a_Chunk.FastSetBlock(a_Position, E_BLOCK_AIR, 0);
37  "block.fire.extinguish",
38  Vector3d(a_Position),
39  1.0f,
40  0.6f
41  );
42  }
43 }
@ E_BLOCK_AIR
Definition: BlockType.h:10
unsigned char BLOCKTYPE
The datatype used by blockdata.
Definition: ChunkDef.h:41
#define UNUSED
Definition: Globals.h:72
Vector3< double > Vector3d
Definition: Vector3.h:485
cBroadcastInterface * GetBroadcastInterface(cWorld *a_World)
Definition: World.cpp:69
virtual void BroadcastSoundEffect(const AString &a_SoundName, Vector3d a_Position, float a_Volume, float a_Pitch, const cClientHandle *a_Exclude=nullptr)=0
Definition: Chunk.h:36
void FastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, BLOCKTYPE a_BlockMeta)
Definition: Chunk.cpp:1296
BLOCKTYPE m_StationaryFluidBlock
BLOCKTYPE m_FluidBlock
cWorld & m_World
Definition: Simulator.h:71
virtual void AddBlock(cChunk &a_Chunk, Vector3i a_Position, BLOCKTYPE a_Block) override
Called to simulate a new block.
virtual void SimulateChunk(std::chrono::milliseconds a_Dt, int a_ChunkX, int a_ChunkZ, cChunk *a_Chunk) override