Cuberite
A lightweight, fast and extensible game server for Minecraft
ChunkDataSerializer.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../ChunkData.h"
4 
5 
6 
7 
8 
13 {
14 public:
15  enum
16  {
20  RELEASE_1_13 = 393,
21  } ;
22 
24  const cChunkData & a_Data,
25  const unsigned char * a_BiomeData,
26  const eDimension a_Dimension
27  );
28 
32  const AString & Serialize(int a_Version, int a_ChunkX, int a_ChunkZ, const std::map<UInt32, UInt32> & a_BlockTypeMap);
33 
34 
35 protected:
36 
37  using Serializations = std::map<int, AString>;
38 
39 
41  const cChunkData & m_Data;
42 
44  const unsigned char * m_BiomeData;
45 
48 
51 
52 
53  void Serialize47 (AString & a_Data, int a_ChunkX, int a_ChunkZ); // Release 1.8
54  void Serialize107(AString & a_Data, int a_ChunkX, int a_ChunkZ); // Release 1.9
55  void Serialize110(AString & a_Data, int a_ChunkX, int a_ChunkZ); // Release 1.9.4
56  void Serialize393(AString & a_Data, int a_ChunkX, int a_ChunkZ, const std::map<UInt32, UInt32> & a_BlockTypeMap); // Release 1.13
57 } ;
58 
59 
60 
61 
eDimension
Dimension of a world.
Definition: BlockID.h:1127
void Serialize393(AString &a_Data, int a_ChunkX, int a_ChunkZ, const std::map< UInt32, UInt32 > &a_BlockTypeMap)
void Serialize107(AString &a_Data, int a_ChunkX, int a_ChunkZ)
void Serialize47(AString &a_Data, int a_ChunkX, int a_ChunkZ)
Serializes one chunk&#39;s data to (possibly multiple) protocol versions.
cChunkDataSerializer(const cChunkData &a_Data, const unsigned char *a_BiomeData, const eDimension a_Dimension)
const AString & Serialize(int a_Version, int a_ChunkX, int a_ChunkZ, const std::map< UInt32, UInt32 > &a_BlockTypeMap)
Serializes the contained chunk data into the specified protocol version.
std::string AString
Definition: StringUtils.h:13
std::map< int, AString > Serializations
const unsigned char * m_BiomeData
The biomes in the chunk, to be serialized.
const cChunkData & m_Data
The data read from the chunk, to be serialized.
void Serialize110(AString &a_Data, int a_ChunkX, int a_ChunkZ)
Serializations m_Serializations
The per-protocol serialized data, cached for reuse for other clients.
const eDimension m_Dimension
The dimension where the chunk resides.