Cuberite
A lightweight, fast and extensible game server for Minecraft
Protocol_1_13.h
Go to the documentation of this file.
1 
2 // Protocol_1_13.h
3 
4 /*
5 Declares the 1.13 protocol classes:
6  - cProtocol_1_13
7  - release 1.13 protocol (#393)
8 (others may be added later in the future for the 1.13 release series)
9 */
10 
11 
12 
13 
14 
15 #pragma once
16 
17 #include "Protocol_1_12.h"
18 
19 
20 
21 
22 
23 // fwd:
24 class BlockTypePalette;
25 
26 
27 
28 
29 
31  public cProtocol_1_12_2
32 {
34 
35 public:
36  cProtocol_1_13(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State);
37 
38  virtual void Initialize(cClientHandle & a_Client) override;
39 
40 
41 protected:
42 
44  std::shared_ptr<const BlockTypePalette> m_BlockTypePalette;
45 
48  std::map<UInt32, UInt32> m_BlockTypeMap;
49 
50 
53  virtual AString GetPaletteVersion() const;
54 
55  // Outgoing packet type translation:
56  virtual UInt32 GetPacketID(ePacketType a_PacketType) override;
57 
58  // Packet receiving:
59  virtual bool HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType) override;
60  virtual void HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) override;
61  virtual void HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer) override;
62 
63  // Packet sending:
64  virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
65  virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) override;
66  virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override;
67  virtual void SendMapData (const cMap & a_Map, int a_DataStartX, int a_DataStartY) override;
68  virtual void SendPaintingSpawn (const cPainting & a_Painting) override;
69  virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) override;
70  virtual void SendParticleEffect (const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data) override;
71  virtual void SendPluginMessage (const AString & a_Channel, const AString & a_Message) override;
72  virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override;
73  virtual void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) override;
74  virtual void SendStatistics (const cStatManager & a_Manager) override;
75  virtual void SendTabCompletionResults (const AStringVector & a_Results) override;
76  virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override;
77 
78  virtual bool ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item, size_t a_KeepRemainingBytes) override;
79  virtual void WriteItem(cPacketizer & a_Pkt, const cItem & a_Item) override;
80  virtual void WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_Entity) override;
81 };
virtual void SendParticleEffect(const AString &a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) override
virtual void SendMapData(const cMap &a_Map, int a_DataStartX, int a_DataStartY) override
virtual void WriteItem(cPacketizer &a_Pkt, const cItem &a_Item) override
Writes the item data into a packet.
virtual void SendBlockChange(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override
virtual void SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer &a_Serializer) override
virtual UInt32 GetPacketID(ePacketType a_PacketType) override
Get the packet ID for a given packet.
virtual void HandlePacketPluginMessage(cByteBuffer &a_ByteBuffer) override
Class that manages the statistics and achievements of a single player.
Definition: Statistics.h:127
cProtocol_1_13(cClientHandle *a_Client, const AString &a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State)
virtual void Initialize(cClientHandle &a_Client) override
Called after construction so that the protocol class can initialize itself.
virtual void SendSoundEffect(const AString &a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) override
virtual void SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlockVector &a_Changes) override
unsigned char BLOCKTYPE
The datatype used by blockdata.
Definition: ChunkDef.h:42
Encapsulates an in-game world map.
Definition: Map.h:80
virtual void SendScoreboardObjective(const AString &a_Name, const AString &a_DisplayName, Byte a_Mode) override
virtual void SendPaintingSpawn(const cPainting &a_Painting) override
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
Definition: ChunkDef.h:45
virtual void HandlePacketStatusRequest(cByteBuffer &a_ByteBuffer) override
virtual void SendTabCompletionResults(const AStringVector &a_Results) override
Holds a palette that maps between block type + state and numbers.
std::vector< AString > AStringVector
Definition: StringUtils.h:14
virtual void WriteEntityMetadata(cPacketizer &a_Pkt, const cEntity &a_Entity) override
Writes the metadata for the specified entity, not including the terminating 0xff. ...
Serializes one chunk&#39;s data to (possibly multiple) protocol versions.
virtual void SendStatistics(const cStatManager &a_Manager) override
An object that can store incoming bytes and lets its clients read the bytes sequentially The bytes ar...
Definition: ByteBuffer.h:29
virtual void SendPluginMessage(const AString &a_Channel, const AString &a_Message) override
std::shared_ptr< const BlockTypePalette > m_BlockTypePalette
The palette used to transform internal block type palette into the protocol-specific ID...
Definition: Protocol_1_13.h:44
unsigned short UInt16
Definition: Globals.h:114
std::string AString
Definition: StringUtils.h:13
virtual bool ReadItem(cByteBuffer &a_ByteBuffer, cItem &a_Item, size_t a_KeepRemainingBytes) override
Reads an item out of the received data, sets a_Item to the values read.
std::map< UInt32, UInt32 > m_BlockTypeMap
Temporary hack for initial 1.13+ support while keeping BLOCKTYPE data: Map of the BLOCKTYPE::META to ...
Definition: Protocol_1_13.h:48
Composes an individual packet in the protocol&#39;s m_OutPacketBuffer; sends it just before being destruc...
Definition: Packetizer.h:28
Definition: Entity.h:73
unsigned int UInt32
Definition: Globals.h:113
unsigned char Byte
Definition: Globals.h:117
virtual AString GetPaletteVersion() const
Returns the string identifying the palettes&#39; version, such as "1.13" or "1.14.4". ...
virtual void SendUpdateBlockEntity(cBlockEntity &a_BlockEntity) override
ePacketType
Logical types of outgoing packets.
Definition: Protocol.h:68
Definition: Item.h:36
virtual bool HandlePacket(cByteBuffer &a_ByteBuffer, UInt32 a_PacketType) override
Reads and handles the packet.
std::vector< sSetBlock > sSetBlockVector
Definition: ChunkDef.h:564
cProtocol_1_12_2 Super
Definition: Protocol_1_13.h:33