Cuberite
A lightweight, fast and extensible game server for Minecraft
SetChunkData.h
Go to the documentation of this file.
1 
2 // SetChunkData.h
3 
4 // Declares the cSetChunkData class used for sending loaded / generated chunk data into cWorld
5 
6 #pragma once
7 
8 #include "ChunkData.h"
9 
10 
11 
12 
13 
15 {
16 public:
21  cSetChunkData(int a_ChunkX, int a_ChunkZ, bool a_ShouldMarkDirty);
22 
37  int a_ChunkX, int a_ChunkZ,
38  const BLOCKTYPE * a_BlockTypes,
39  const NIBBLETYPE * a_BlockMetas,
40  const NIBBLETYPE * a_BlockLight,
41  const NIBBLETYPE * a_SkyLight,
42  const cChunkDef::HeightMap * a_HeightMap,
43  const cChunkDef::BiomeMap * a_Biomes,
44  cEntityList && a_Entities,
45  cBlockEntities && a_BlockEntities,
46  bool a_ShouldMarkDirty
47  );
48 
49  int GetChunkX(void) const { return m_ChunkX; }
50  int GetChunkZ(void) const { return m_ChunkZ; }
51 
53  cChunkData & GetChunkData(void) { return m_ChunkData; }
54 
56  const cChunkDef::HeightMap & GetHeightMap(void) const { return m_HeightMap; }
57 
60 
62  cEntityList & GetEntities(void) { return m_Entities; }
63 
66 
68  bool IsLightValid(void) const { return m_IsLightValid; }
69 
71  bool IsHeightMapValid(void) const { return m_IsHeightMapValid; }
72 
74  bool AreBiomesValid(void) const { return m_AreBiomesValid; }
75 
78  bool ShouldMarkDirty(void) const { return m_ShouldMarkDirty; }
79 
81  void MarkBiomesValid(void) { m_AreBiomesValid = true; }
82 
84  void CalculateHeightMap(void);
85 
87  void RemoveInvalidBlockEntities(void);
88 
89 protected:
90  int m_ChunkX;
91  int m_ChunkZ;
92 
99 
104 };
std::map< size_t, cBlockEntity * > cBlockEntities
Definition: ChunkDef.h:34
cBlockEntities m_BlockEntities
Definition: SetChunkData.h:98
cChunkDef::HeightMap m_HeightMap
Definition: SetChunkData.h:95
bool ShouldMarkDirty(void) const
Returns whether the chunk should be marked as dirty after its data is set.
Definition: SetChunkData.h:78
bool m_ShouldMarkDirty
Definition: SetChunkData.h:103
unsigned char BLOCKTYPE
The datatype used by blockdata.
Definition: ChunkDef.h:42
cBlockEntities & GetBlockEntities(void)
Returns the internal storage for block entities, read-write.
Definition: SetChunkData.h:65
bool m_IsHeightMapValid
Definition: SetChunkData.h:101
bool IsLightValid(void) const
Returns whether both light arrays stored in this object are valid.
Definition: SetChunkData.h:68
cListAllocationPool< cChunkData::sChunkSection > m_Pool
Definition: SetChunkData.h:93
int GetChunkX(void) const
Definition: SetChunkData.h:49
bool IsHeightMapValid(void) const
Returns whether the heightmap stored in this object is valid.
Definition: SetChunkData.h:71
cChunkDef::BiomeMap & GetBiomes(void)
Returns the internal storage for biomes, read-write.
Definition: SetChunkData.h:59
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
Definition: ChunkDef.h:45
void CalculateHeightMap(void)
Calculates the heightmap based on the contained blocktypes and marks it valid.
cSetChunkData(int a_ChunkX, int a_ChunkZ, bool a_ShouldMarkDirty)
Constructs a new instance with empty data.
std::vector< OwnedEntity > cEntityList
Definition: ChunkDef.h:33
bool m_AreBiomesValid
Definition: SetChunkData.h:102
cChunkDef::BiomeMap m_Biomes
Definition: SetChunkData.h:96
cEntityList & GetEntities(void)
Returns the internal storage for entities, read-write.
Definition: SetChunkData.h:62
cEntityList m_Entities
Definition: SetChunkData.h:97
void RemoveInvalidBlockEntities(void)
Removes the block entities that don&#39;t have a proper blocktype at their corresponding coords...
bool AreBiomesValid(void) const
Returns whether the biomes stored in this object are valid.
Definition: SetChunkData.h:74
int GetChunkZ(void) const
Definition: SetChunkData.h:50
void MarkBiomesValid(void)
Marks the biomes stored in this object as valid.
Definition: SetChunkData.h:81
cChunkData m_ChunkData
Definition: SetChunkData.h:94
cChunkData & GetChunkData(void)
Returns the internal storage of block types, metas and lighting.
Definition: SetChunkData.h:53
HEIGHTTYPE HeightMap[Width *Width]
The type used for any heightmap operations and storage; idx = x + Width * z; Height points to the hig...
Definition: ChunkDef.h:142
const cChunkDef::HeightMap & GetHeightMap(void) const
Returns the internal storage for heightmap, read-only.
Definition: SetChunkData.h:56
EMCSBiome BiomeMap[Width *Width]
The type used for any biomemap operations and storage inside Cuberite, using Cuberite biomes (need no...
Definition: ChunkDef.h:147