Cuberite
A lightweight, fast and extensible game server for Minecraft
Protocol_1_12.h
Go to the documentation of this file.
1 
2 // Protocol_1_12.h
3 
4 /*
5 Declares the 1.12 protocol classes:
6  - cProtocol_1_12
7  - release 1.12 protocol (#335)
8  - cProtocol_1_12_1
9  - release 1.12.1 protocol (#338)
10  - cProtocol_1_12_2
11  - release 1.12.2 protocol (#340)
12 */
13 
14 
15 
16 
17 
18 #pragma once
19 
20 #include "Protocol_1_11.h"
21 
22 #include "RecipeMapper.h"
23 
24 
25 
27  public cProtocol_1_11_1
28 {
30 
31 public:
32 
33  using Super::Super;
34 
35 protected:
36 
37  virtual UInt32 GetPacketID(ePacketType a_Packet) const override;
38  virtual signed char GetProtocolEntityStatus(EntityAnimation a_Animation) const override;
39  virtual UInt32 GetProtocolMobType(eMonsterType a_MobType) const override;
40  virtual Version GetProtocolVersion() const override;
41 
42  virtual bool HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType) override;
43  virtual void HandlePacketAdvancementTab(cByteBuffer & a_ByteBuffer);
44  virtual void HandleCraftRecipe(cByteBuffer & a_ByteBuffer);
45  virtual void HandlePacketCraftingBookData(cByteBuffer & a_ByteBuffer);
46 
47  virtual void WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_Entity) const override;
48  virtual void WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob) const override;
49 };
50 
51 
52 
53 
54 
56  public cProtocol_1_12
57 {
59 
60 public:
61 
62  using Super::Super;
63 
64 protected:
65 
66  virtual UInt32 GetPacketID(ePacketType a_Packet) const override;
67  virtual Version GetProtocolVersion() const override;
68 
69  virtual bool HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType) override;
70 };
71 
72 
73 
74 
75 
77  public cProtocol_1_12_1
78 {
80 
81 public:
82 
83  using Super::Super;
84 
85 protected:
86 
87  virtual Version GetProtocolVersion() const override;
88 
89  virtual void HandlePacketKeepAlive(cByteBuffer & a_ByteBuffer) override;
90 
91  virtual void SendKeepAlive(UInt32 a_PingID) override;
92  virtual void SendUnlockRecipe(UInt32 a_RecipeID) override;
93  virtual void SendInitRecipes(UInt32 a_RecipeID) override;
94 };
EntityAnimation
Definition: Defines.h:458
unsigned int UInt32
Definition: Globals.h:157
eMonsterType
Identifies individual monster type.
Definition: MonsterTypes.h:11
An object that can store incoming bytes and lets its clients read the bytes sequentially The bytes ar...
Definition: ByteBuffer.h:32
Definition: Entity.h:76
Composes an individual packet in the protocol's m_OutPacketBuffer; sends it just before being destruc...
Definition: Packetizer.h:60
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
cProtocol_1_11_0 Super
Definition: Protocol_1_11.h:61
cProtocol_1_11_1 Super
Definition: Protocol_1_12.h:29
virtual void HandleCraftRecipe(cByteBuffer &a_ByteBuffer)
virtual void HandlePacketAdvancementTab(cByteBuffer &a_ByteBuffer)
virtual void HandlePacketCraftingBookData(cByteBuffer &a_ByteBuffer)
virtual Version GetProtocolVersion() const override
Returns the protocol version.
virtual void WriteMobMetadata(cPacketizer &a_Pkt, const cMonster &a_Mob) const override
Writes the mob-specific metadata for the specified mob.
virtual signed char GetProtocolEntityStatus(EntityAnimation a_Animation) const override
Converts an animation into an ID suitable for use with the Entity Status packet.
virtual UInt32 GetPacketID(ePacketType a_Packet) const override
Get the packet ID for a given packet.
virtual void WriteEntityMetadata(cPacketizer &a_Pkt, const cEntity &a_Entity) const override
Writes the metadata for the specified entity, not including the terminating 0x7f.
virtual UInt32 GetProtocolMobType(eMonsterType a_MobType) const override
Converts eMonsterType to protocol-specific mob types.
virtual bool HandlePacket(cByteBuffer &a_ByteBuffer, UInt32 a_PacketType) override
Reads and handles the packet.
cProtocol_1_12 Super
Definition: Protocol_1_12.h:58
virtual bool HandlePacket(cByteBuffer &a_ByteBuffer, UInt32 a_PacketType) override
Reads and handles the packet.
virtual Version GetProtocolVersion() const override
Returns the protocol version.
virtual UInt32 GetPacketID(ePacketType a_Packet) const override
Get the packet ID for a given packet.
virtual void HandlePacketKeepAlive(cByteBuffer &a_ByteBuffer) override
virtual Version GetProtocolVersion() const override
Returns the protocol version.
virtual void SendKeepAlive(UInt32 a_PingID) override
virtual void SendInitRecipes(UInt32 a_RecipeID) override
virtual void SendUnlockRecipe(UInt32 a_RecipeID) override
The version 110 protocol, used by 1.9.3 and 1.9.4.
Definition: Protocol_1_9.h:170