Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
cChunkDataSerializer Class Reference

Serializes one chunk's data to (possibly multiple) protocol versions. More...

#include <ChunkDataSerializer.h>

Collaboration diagram for cChunkDataSerializer:
Collaboration graph
[legend]

Public Types

enum  { RELEASE_1_8_0 = 47, RELEASE_1_9_0 = 107, RELEASE_1_9_4 = 110, RELEASE_1_13 = 393 }
 

Public Member Functions

 cChunkDataSerializer (const cChunkData &a_Data, const unsigned char *a_BiomeData, const eDimension a_Dimension)
 
const AStringSerialize (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. More...
 

Protected Types

using Serializations = std::map< int, AString >
 

Protected Member Functions

void Serialize107 (AString &a_Data, int a_ChunkX, int a_ChunkZ)
 
void Serialize110 (AString &a_Data, int a_ChunkX, int a_ChunkZ)
 
void Serialize393 (AString &a_Data, int a_ChunkX, int a_ChunkZ, const std::map< UInt32, UInt32 > &a_BlockTypeMap)
 
void Serialize47 (AString &a_Data, int a_ChunkX, int a_ChunkZ)
 

Protected Attributes

const unsigned char * m_BiomeData
 The biomes in the chunk, to be serialized. More...
 
const cChunkDatam_Data
 The data read from the chunk, to be serialized. More...
 
const eDimension m_Dimension
 The dimension where the chunk resides. More...
 
Serializations m_Serializations
 The per-protocol serialized data, cached for reuse for other clients. More...
 

Detailed Description

Serializes one chunk's data to (possibly multiple) protocol versions.

Caches the serialized data for as long as this object lives, so that the same data can be sent to other clients using the same protocol.

Definition at line 12 of file ChunkDataSerializer.h.

Member Typedef Documentation

using cChunkDataSerializer::Serializations = std::map<int, AString>
protected

Definition at line 37 of file ChunkDataSerializer.h.

Member Enumeration Documentation

anonymous enum
Enumerator
RELEASE_1_8_0 
RELEASE_1_9_0 
RELEASE_1_9_4 
RELEASE_1_13 

Definition at line 15 of file ChunkDataSerializer.h.

Constructor & Destructor Documentation

cChunkDataSerializer::cChunkDataSerializer ( const cChunkData a_Data,
const unsigned char *  a_BiomeData,
const eDimension  a_Dimension 
)

Definition at line 33 of file ChunkDataSerializer.cpp.

Member Function Documentation

const AString & cChunkDataSerializer::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.

TEMPORARY: a_BlockTypeMap is used for the 1.13+ protocols to map from BLOCKTYPE::META to NetBlockID. a_BlockTypeMap is ignored for pre-1.13 protocols.

Definition at line 48 of file ChunkDataSerializer.cpp.

void cChunkDataSerializer::Serialize107 ( AString a_Data,
int  a_ChunkX,
int  a_ChunkZ 
)
protected

Definition at line 168 of file ChunkDataSerializer.cpp.

void cChunkDataSerializer::Serialize110 ( AString a_Data,
int  a_ChunkX,
int  a_ChunkZ 
)
protected

Definition at line 301 of file ChunkDataSerializer.cpp.

void cChunkDataSerializer::Serialize393 ( AString a_Data,
int  a_ChunkX,
int  a_ChunkZ,
const std::map< UInt32, UInt32 > &  a_BlockTypeMap 
)
protected

Definition at line 437 of file ChunkDataSerializer.cpp.

void cChunkDataSerializer::Serialize47 ( AString a_Data,
int  a_ChunkX,
int  a_ChunkZ 
)
protected

Definition at line 82 of file ChunkDataSerializer.cpp.

Member Data Documentation

const unsigned char* cChunkDataSerializer::m_BiomeData
protected

The biomes in the chunk, to be serialized.

Definition at line 44 of file ChunkDataSerializer.h.

const cChunkData& cChunkDataSerializer::m_Data
protected

The data read from the chunk, to be serialized.

Definition at line 41 of file ChunkDataSerializer.h.

const eDimension cChunkDataSerializer::m_Dimension
protected

The dimension where the chunk resides.

Definition at line 47 of file ChunkDataSerializer.h.

Serializations cChunkDataSerializer::m_Serializations
protected

The per-protocol serialized data, cached for reuse for other clients.

Definition at line 50 of file ChunkDataSerializer.h.


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