summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol_1_8.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Protocol/Protocol_1_8.h')
-rw-r--r--src/Protocol/Protocol_1_8.h74
1 files changed, 37 insertions, 37 deletions
diff --git a/src/Protocol/Protocol_1_8.h b/src/Protocol/Protocol_1_8.h
index d4aa0c899..652ef69c5 100644
--- a/src/Protocol/Protocol_1_8.h
+++ b/src/Protocol/Protocol_1_8.h
@@ -141,11 +141,12 @@ protected:
/** State of the protocol. */
State m_State;
- /** Get the packet ID for a given packet. */
- virtual UInt32 GetPacketID(ePacketType a_Packet) override;
+ /** Converts the BlockFace received by the protocol into eBlockFace constants.
+ If the received value doesn't match any of our eBlockFace constants, BLOCK_FACE_NONE is returned. */
+ static eBlockFace FaceIntToBlockFace(Int32 a_FaceInt);
- /** Returns 1.8. */
- virtual Version GetProtocolVersion() override;
+ /** Get the packet ID for a given packet. */
+ virtual UInt32 GetPacketID(ePacketType a_Packet) const override;
/** Converts an animation into an ID suitable for use with the Entity Animation packet.
Returns (uchar)-1 if the protocol version doesn't support this animation. */
@@ -156,7 +157,10 @@ protected:
virtual signed char GetProtocolEntityStatus(EntityAnimation a_Animation) const;
/** Converts eMonsterType to protocol-specific mob types */
- virtual UInt32 GetProtocolMobType(eMonsterType a_MobType);
+ virtual UInt32 GetProtocolMobType(eMonsterType a_MobType) const;
+
+ /** Returns the protocol version. */
+ virtual Version GetProtocolVersion() const override;
/** Reads and handles the packet. The packet length and type have already been read.
Returns true if the packet was understood, false if it was an unknown packet. */
@@ -201,43 +205,37 @@ protected:
The message payload is still in the bytebuffer, the handler reads it specifically for each handled channel */
virtual void HandleVanillaPluginMessage(cByteBuffer & a_ByteBuffer, const AString & a_Channel);
- /** Sends the data to the client, encrypting them if needed. */
- virtual void SendData(ContiguousByteBufferView a_Size) override;
-
- /** Sends the packet to the client. Called by the cPacketizer's destructor. */
- virtual void SendPacket(cPacketizer & a_Packet) override;
+ /** Parses item metadata as read by ReadItem(), into the item enchantments. */
+ virtual void ParseItemMetadata(cItem & a_Item, ContiguousByteBufferView a_Metadata) const;
/** Reads an item out of the received data, sets a_Item to the values read.
Returns false if not enough received data.
a_KeepRemainingBytes tells the function to keep that many bytes at the end of the buffer. */
- virtual bool ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item, size_t a_KeepRemainingBytes = 0);
-
- /** Parses item metadata as read by ReadItem(), into the item enchantments. */
- virtual void ParseItemMetadata(cItem & a_Item, ContiguousByteBufferView a_Metadata);
-
- virtual void StartEncryption(const Byte * a_Key);
-
- /** Converts the BlockFace received by the protocol into eBlockFace constants.
- If the received value doesn't match any of our eBlockFace constants, BLOCK_FACE_NONE is returned. */
- static eBlockFace FaceIntToBlockFace(Int32 a_FaceInt);
+ virtual bool ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item, size_t a_KeepRemainingBytes = 0) const;
/** Sends the entity type and entity-dependent data required for the entity to initially spawn. */
virtual void SendEntitySpawn(const cEntity & a_Entity, const UInt8 a_ObjectType, const Int32 a_ObjectData);
- /** Writes the block entity data for the specified block entity into the packet. */
- virtual void WriteBlockEntity(cFastNBTWriter & a_Writer, const cBlockEntity & a_BlockEntity);
+ /** Sends the data to the client, encrypting them if needed. */
+ virtual void SendData(ContiguousByteBufferView a_Size) override;
- /** Writes the item data into a packet. */
- virtual void WriteItem(cPacketizer & a_Pkt, const cItem & a_Item);
+ /** Sends the packet to the client. Called by the cPacketizer's destructor. */
+ virtual void SendPacket(cPacketizer & a_Packet) override;
- /** Writes the metadata for the specified entity, not including the terminating 0x7f. */
- virtual void WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_Entity);
+ /** Writes the block entity data for the specified block entity into the packet. */
+ virtual void WriteBlockEntity(cFastNBTWriter & a_Writer, const cBlockEntity & a_BlockEntity) const;
- /** Writes the mob-specific metadata for the specified mob */
- virtual void WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob);
+ /** Writes the metadata for the specified entity, not including the terminating 0x7f. */
+ virtual void WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_Entity) const;
/** Writes the entity properties for the specified entity, including the Count field. */
- virtual void WriteEntityProperties(cPacketizer & a_Pkt, const cEntity & a_Entity);
+ virtual void WriteEntityProperties(cPacketizer & a_Pkt, const cEntity & a_Entity) const;
+
+ /** Writes the item data into a packet. */
+ virtual void WriteItem(cPacketizer & a_Pkt, const cItem & a_Item) const;
+
+ /** Writes the mob-specific metadata for the specified mob */
+ virtual void WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob) const;
private:
@@ -259,14 +257,6 @@ private:
/** Adds the received (unencrypted) data to m_ReceivedData, parses complete packets */
void AddReceivedData(cByteBuffer & a_Buffer, ContiguousByteBufferView a_Data);
- /** Handle a complete packet stored in the given buffer. */
- void HandlePacket(cByteBuffer & a_Buffer);
-
- /** Sends an entity teleport packet.
- Mitigates a 1.8 bug where the position in the entity spawn packet is ignored,
- and so entities don't show up until a teleport is sent. */
- void SendEntityTeleport(const cEntity & a_Entity);
-
/** Converts an entity to a protocol-specific entity type.
Only entities that the Send Spawn Entity packet supports are valid inputs to this method */
static UInt8 GetProtocolEntityType(const cEntity & a_Entity);
@@ -278,4 +268,14 @@ private:
Protocols <= 1.12 use strings, hence this is a static as the string-mapping was append-only for the versions that used it.
Returns an empty string, handled correctly by the client, for newer, unsupported statistics. */
static const char * GetProtocolStatisticName(Statistic a_Statistic);
+
+ /** Handle a complete packet stored in the given buffer. */
+ void HandlePacket(cByteBuffer & a_Buffer);
+
+ /** Sends an entity teleport packet.
+ Mitigates a 1.8 bug where the position in the entity spawn packet is ignored,
+ and so entities don't show up until a teleport is sent. */
+ void SendEntityTeleport(const cEntity & a_Entity);
+
+ void StartEncryption(const Byte * a_Key);
} ;