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  - cProtocol_1_13_1
9  - release 1.13.1 protocol (#401)
10  - cProtocol_1_13_2
11  - release 1.13.2 protocol (#404)
12 */
13 
14 
15 
16 
17 
18 #pragma once
19 
20 #include "Protocol_1_12.h"
21 #include "Packetizer.h"
22 #include "Palettes/Upgrade.h"
23 
24 
25 
26 
27 
29  public cProtocol_1_12_2
30 {
32 
33 public:
34 
35  using Super::Super;
36 
37 protected:
38 
39  virtual void SendBlockChange (Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
40  virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) override;
41  virtual void SendMapData (const cMap & a_Map, int a_DataStartX, int a_DataStartY) override;
42  virtual void SendPaintingSpawn (const cPainting & a_Painting) override;
43  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;
44  virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override;
45  virtual void SendStatistics (const StatisticsManager & a_Manager) override;
46  virtual void SendTabCompletionResults (const AStringVector & a_Results) override;
47  virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override;
48  virtual UInt8 GetEntityMetadataID(EntityMetadata a_Metadata) const;
49  virtual UInt8 GetEntityMetadataID(EntityMetadataType a_FieldType) const;
50  virtual std::pair<short, short> GetItemFromProtocolID(UInt32 a_ProtocolID) const;
51  virtual UInt32 GetPacketID(ePacketType a_PacketType) const override;
52  virtual UInt32 GetProtocolBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta) const;
53  virtual signed char GetProtocolEntityStatus(EntityAnimation a_Animation) const override;
54  virtual UInt32 GetProtocolItemType(short a_ItemID, short a_ItemDamage) const;
55  virtual UInt32 GetProtocolMobType(eMonsterType a_MobType) const override;
56  virtual UInt32 GetProtocolStatisticType(CustomStatistic a_Statistic) const;
57  virtual Version GetProtocolVersion() const override;
58 
59  virtual bool HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType) override;
60  virtual void HandlePacketNameItem(cByteBuffer & a_ByteBuffer);
61  virtual void HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer) override;
62  virtual void HandlePacketSetBeaconEffect(cByteBuffer & a_ByteBuffer);
63  virtual void HandleVanillaPluginMessage(cByteBuffer & a_ByteBuffer, std::string_view a_Channel) override;
64 
65  virtual bool ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item, size_t a_KeepRemainingBytes) const override;
66  virtual void WriteEntityMetadata(cPacketizer & a_Pkt, EntityMetadata a_Metadata, EntityMetadataType a_FieldType) const;
67  virtual void WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_Entity) const override;
68  virtual void WriteItem(cPacketizer & a_Pkt, const cItem & a_Item) const override;
69  virtual void WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob) const override;
70 };
71 
72 
73 
74 
75 
77  public cProtocol_1_13
78 {
80 
81 public:
82 
83  using Super::Super;
84 
85 protected:
86 
87  virtual void SendBossBarAdd(UInt32 a_UniqueID, const cCompositeChat & a_Title, float a_FractionFilled, BossBarColor a_Color, BossBarDivisionType a_DivisionType, bool a_DarkenSky, bool a_PlayEndMusic, bool a_CreateFog) override;
88  virtual void SendBossBarUpdateFlags(UInt32 a_UniqueID, bool a_DarkenSky, bool a_PlayEndMusic, bool a_CreateFog) override;
89 
90  virtual std::pair<short, short> GetItemFromProtocolID(UInt32 a_ProtocolID) const override;
91  virtual UInt32 GetProtocolBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta) const override;
92  virtual UInt32 GetProtocolItemType(short a_ItemID, short a_ItemDamage) const override;
93  virtual UInt32 GetProtocolStatisticType(CustomStatistic a_Statistic) const override;
94  virtual Version GetProtocolVersion() const override;
95 };
96 
97 
98 
99 
100 
102  public cProtocol_1_13_1
103 {
105 
106 public:
107 
108  using Super::Super;
109 
110 protected:
111 
112  virtual Version GetProtocolVersion() const override;
113  virtual bool ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item, size_t a_KeepRemainingBytes) const override;
114  virtual void WriteItem(cPacketizer & a_Pkt, const cItem & a_Item) const override;
115 };
std::vector< sSetBlock > sSetBlockVector
Definition: ChunkDef.h:441
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
Definition: ChunkDef.h:44
unsigned char BLOCKTYPE
The datatype used by blockdata.
Definition: ChunkDef.h:41
BossBarDivisionType
Definition: Defines.h:443
EntityAnimation
Definition: Defines.h:458
BossBarColor
Definition: Defines.h:428
unsigned int UInt32
Definition: Globals.h:157
unsigned char UInt8
Definition: Globals.h:159
unsigned char Byte
Definition: Globals.h:161
eMonsterType
Identifies individual monster type.
Definition: MonsterTypes.h:11
CustomStatistic
std::vector< AString > AStringVector
Definition: StringUtils.h:12
std::string AString
Definition: StringUtils.h:11
An object that can store incoming bytes and lets its clients read the bytes sequentially The bytes ar...
Definition: ByteBuffer.h:32
Container for a single chat message composed of multiple functional parts.
Definition: CompositeChat.h:34
Definition: Entity.h:76
Definition: Item.h:37
Encapsulates an in-game world map.
Definition: Map.h:83
Composes an individual packet in the protocol's m_OutPacketBuffer; sends it just before being destruc...
Definition: Packetizer.h:60
EntityMetadataType
Definition: Protocol.h:311
ePacketType
Logical types of outgoing packets.
Definition: Protocol.h:57
Version
The protocol version number, received from the client in the Handshake packet.
Definition: Protocol.h:335
EntityMetadata
Definition: Protocol.h:138
cProtocol_1_12_1 Super
Definition: Protocol_1_12.h:79
virtual void WriteItem(cPacketizer &a_Pkt, const cItem &a_Item) const override
Writes the item data into a packet.
virtual std::pair< short, short > GetItemFromProtocolID(UInt32 a_ProtocolID) const
virtual void SendUpdateBlockEntity(cBlockEntity &a_BlockEntity) override
virtual Version GetProtocolVersion() const override
Returns the protocol version.
virtual void HandlePacketNameItem(cByteBuffer &a_ByteBuffer)
virtual void SendStatistics(const StatisticsManager &a_Manager) override
virtual UInt32 GetProtocolBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta) const
virtual void SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlockVector &a_Changes) override
virtual void HandlePacketSetBeaconEffect(cByteBuffer &a_ByteBuffer)
virtual void WriteMobMetadata(cPacketizer &a_Pkt, const cMonster &a_Mob) const override
Writes the mob-specific metadata for the specified mob.
virtual void SendTabCompletionResults(const AStringVector &a_Results) override
virtual void SendPaintingSpawn(const cPainting &a_Painting) override
virtual void WriteEntityMetadata(cPacketizer &a_Pkt, EntityMetadata a_Metadata, EntityMetadataType a_FieldType) const
virtual bool ReadItem(cByteBuffer &a_ByteBuffer, cItem &a_Item, size_t a_KeepRemainingBytes) const override
Reads an item out of the received data, sets a_Item to the values read.
virtual bool HandlePacket(cByteBuffer &a_ByteBuffer, UInt32 a_PacketType) override
Reads and handles the packet.
cProtocol_1_12_2 Super
Definition: Protocol_1_13.h:31
virtual UInt8 GetEntityMetadataID(EntityMetadata a_Metadata) const
virtual void HandlePacketPluginMessage(cByteBuffer &a_ByteBuffer) override
virtual UInt32 GetProtocolItemType(short a_ItemID, short a_ItemDamage) const
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
virtual UInt32 GetProtocolStatisticType(CustomStatistic a_Statistic) const
virtual void SendMapData(const cMap &a_Map, int a_DataStartX, int a_DataStartY) override
virtual UInt32 GetProtocolMobType(eMonsterType a_MobType) const override
Converts eMonsterType to protocol-specific mob types.
virtual signed char GetProtocolEntityStatus(EntityAnimation a_Animation) const override
Converts an animation into an ID suitable for use with the Entity Status packet.
virtual void SendScoreboardObjective(const AString &a_Name, const AString &a_DisplayName, Byte a_Mode) override
virtual UInt32 GetPacketID(ePacketType a_PacketType) const override
Get the packet ID for a given packet.
virtual void SendBlockChange(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override
virtual void HandleVanillaPluginMessage(cByteBuffer &a_ByteBuffer, std::string_view a_Channel) override
Parses Vanilla plugin messages into specific ClientHandle calls.
cProtocol_1_13 Super
Definition: Protocol_1_13.h:79
virtual UInt32 GetProtocolBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta) const override
virtual UInt32 GetProtocolItemType(short a_ItemID, short a_ItemDamage) const override
virtual void SendBossBarUpdateFlags(UInt32 a_UniqueID, bool a_DarkenSky, bool a_PlayEndMusic, bool a_CreateFog) override
virtual void SendBossBarAdd(UInt32 a_UniqueID, const cCompositeChat &a_Title, float a_FractionFilled, BossBarColor a_Color, BossBarDivisionType a_DivisionType, bool a_DarkenSky, bool a_PlayEndMusic, bool a_CreateFog) override
virtual std::pair< short, short > GetItemFromProtocolID(UInt32 a_ProtocolID) const override
virtual UInt32 GetProtocolStatisticType(CustomStatistic a_Statistic) const override
virtual Version GetProtocolVersion() const override
Returns the protocol version.
virtual bool ReadItem(cByteBuffer &a_ByteBuffer, cItem &a_Item, size_t a_KeepRemainingBytes) const override
Reads an item out of the received data, sets a_Item to the values read.
virtual Version GetProtocolVersion() const override
Returns the protocol version.
virtual void WriteItem(cPacketizer &a_Pkt, const cItem &a_Item) const override
Writes the item data into a packet.
The version 110 protocol, used by 1.9.3 and 1.9.4.
Definition: Protocol_1_9.h:170
Class that manages the statistics and achievements of a single player.