diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2021-04-10 16:57:16 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@outlook.com> | 2021-04-12 23:35:07 +0200 |
commit | a999c5d845bd759c6d83b356c7b39e67473dc452 (patch) | |
tree | c8da72f5192293648f30b3228e7563fa7c79d13e /src/Protocol/Protocol_1_9.h | |
parent | Add animations for shield/item block & break (diff) | |
download | cuberite-a999c5d845bd759c6d83b356c7b39e67473dc452.tar cuberite-a999c5d845bd759c6d83b356c7b39e67473dc452.tar.gz cuberite-a999c5d845bd759c6d83b356c7b39e67473dc452.tar.bz2 cuberite-a999c5d845bd759c6d83b356c7b39e67473dc452.tar.lz cuberite-a999c5d845bd759c6d83b356c7b39e67473dc452.tar.xz cuberite-a999c5d845bd759c6d83b356c7b39e67473dc452.tar.zst cuberite-a999c5d845bd759c6d83b356c7b39e67473dc452.zip |
Diffstat (limited to 'src/Protocol/Protocol_1_9.h')
-rw-r--r-- | src/Protocol/Protocol_1_9.h | 109 |
1 files changed, 39 insertions, 70 deletions
diff --git a/src/Protocol/Protocol_1_9.h b/src/Protocol/Protocol_1_9.h index 00d6c477a..c2005c4b9 100644 --- a/src/Protocol/Protocol_1_9.h +++ b/src/Protocol/Protocol_1_9.h @@ -21,10 +21,6 @@ Declares the 1.9 protocol classes: #include "Protocol.h" #include "Protocol_1_8.h" -#include "../ByteBuffer.h" - -#include "../mbedTLS++/AesCfb128Decryptor.h" -#include "../mbedTLS++/AesCfb128Encryptor.h" @@ -39,54 +35,45 @@ public: cProtocol_1_9_0(cClientHandle * a_Client, const AString & a_ServerAddress, State a_State); - /** Sending stuff to clients (alphabetically sorted): */ - virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity & a_Vehicle) 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 void SendBossBarRemove (UInt32 a_UniqueID) override; - virtual void SendBossBarUpdateFlags (UInt32 a_UniqueID, bool a_DarkenSky, bool a_PlayEndMusic, bool a_CreateFog) override; - virtual void SendBossBarUpdateHealth (UInt32 a_UniqueID, float a_FractionFilled) override; - virtual void SendBossBarUpdateStyle (UInt32 a_UniqueID, BossBarColor a_Color, BossBarDivisionType a_DivisionType) override; - virtual void SendBossBarUpdateTitle (UInt32 a_UniqueID, const cCompositeChat & a_Title) override; - virtual void SendDetachEntity (const cEntity & a_Entity, const cEntity & a_PreviousVehicle) override; - virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override; - virtual void SendEntityMetadata (const cEntity & a_Entity) override; - virtual void SendEntityPosition (const cEntity & a_Entity) override; - virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) override; - virtual void SendKeepAlive (UInt32 a_PingID) override; - virtual void SendLeashEntity (const cEntity & a_Entity, const cEntity & a_EntityLeashedTo) override; - virtual void SendMapData (const cMap & a_Map, int a_DataStartX, int a_DataStartY) override; - virtual void SendPaintingSpawn (const cPainting & a_Painting) override; - virtual void SendPlayerMoveLook (void) override; - virtual void SendPlayerSpawn (const cPlayer & a_Player) override; - 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 SendSpawnMob (const cMonster & a_Mob) override; - virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override; - virtual void SendUnleashEntity (const cEntity & a_Entity) override; - virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override; + virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity & a_Vehicle) 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 void SendBossBarRemove (UInt32 a_UniqueID) override; + virtual void SendBossBarUpdateFlags (UInt32 a_UniqueID, bool a_DarkenSky, bool a_PlayEndMusic, bool a_CreateFog) override; + virtual void SendBossBarUpdateHealth(UInt32 a_UniqueID, float a_FractionFilled) override; + virtual void SendBossBarUpdateStyle (UInt32 a_UniqueID, BossBarColor a_Color, BossBarDivisionType a_DivisionType) override; + virtual void SendBossBarUpdateTitle (UInt32 a_UniqueID, const cCompositeChat & a_Title) override; + virtual void SendDetachEntity (const cEntity & a_Entity, const cEntity & a_PreviousVehicle) override; + virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override; + virtual void SendEntityMetadata (const cEntity & a_Entity) override; + virtual void SendEntityPosition (const cEntity & a_Entity) override; + virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) override; + virtual void SendKeepAlive (UInt32 a_PingID) override; + virtual void SendLeashEntity (const cEntity & a_Entity, const cEntity & a_EntityLeashedTo) override; + virtual void SendMapData (const cMap & a_Map, int a_DataStartX, int a_DataStartY) override; + virtual void SendPaintingSpawn (const cPainting & a_Painting) override; + virtual void SendPlayerMoveLook (void) override; + virtual void SendPlayerSpawn (const cPlayer & a_Player) override; + 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 SendSpawnMob (const cMonster & a_Mob) override; + virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override; + virtual void SendUnleashEntity (const cEntity & a_Entity) override; + virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override; protected: - /** The current teleport ID, and whether it has been confirmed by the client */ + /** The current teleport ID. */ bool m_IsTeleportIdConfirmed; - UInt32 m_OutstandingTeleportId; - /** Get the packet ID for a given packet. */ - virtual UInt32 GetPacketID(ePacketType a_Packet) override; + /** Whether the current teleport ID has been confirmed by the client. */ + UInt32 m_OutstandingTeleportId; + virtual UInt32 GetPacketID(ePacketType a_Packet) const override; virtual unsigned char GetProtocolEntityAnimation(EntityAnimation a_Animation) const override; virtual signed char GetProtocolEntityStatus(EntityAnimation a_Animation) const override; + virtual UInt32 GetProtocolMobType(eMonsterType a_MobType) const override; + virtual Version GetProtocolVersion() const override; - /** Returns 1.9. */ - virtual Version GetProtocolVersion() override; - - /** Converts eMonsterType to protocol-specific mob types */ - virtual UInt32 GetProtocolMobType(eMonsterType a_MobType) 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. */ - virtual bool HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType) override; - - // Packet handlers while in the Game state (m_State == 3): + virtual bool HandlePacket (cByteBuffer & a_ByteBuffer, UInt32 a_PacketType) override; virtual void HandlePacketAnimation (cByteBuffer & a_ByteBuffer) override; virtual void HandlePacketBlockDig (cByteBuffer & a_ByteBuffer) override; virtual void HandlePacketBlockPlace (cByteBuffer & a_ByteBuffer) override; @@ -104,27 +91,12 @@ protected: virtual void HandlePacketVehicleMove (cByteBuffer & a_ByteBuffer); virtual void HandlePacketWindowClick (cByteBuffer & a_ByteBuffer) override; - /** Parses item metadata as read by ReadItem(), into the item enchantments. */ - virtual void ParseItemMetadata(cItem & a_Item, ContiguousByteBufferView a_Metadata) override; - - /** Converts the hand parameter received by the protocol into eHand constants. - If the received value doesn't match any of the know value, raise an assertion fail or return hMain. */ - static eHand HandIntToEnum(Int32 a_Hand); - - /** Sends the entity type and entity-dependent data required for the entity to initially spawn. */ + virtual void ParseItemMetadata(cItem & a_Item, ContiguousByteBufferView a_Metadata) const override; virtual void SendEntitySpawn(const cEntity & a_Entity, const UInt8 a_ObjectType, const Int32 a_ObjectData) override; - - /** Writes the block entity data for the specified block entity into the packet. */ - virtual void WriteBlockEntity(cFastNBTWriter & a_Writer, const cBlockEntity & a_BlockEntity) override; - - /** Writes the item data into a packet. */ - virtual void WriteItem(cPacketizer & a_Pkt, const cItem & a_Item) override; - - /** Writes the metadata for the specified entity, not including the terminating 0xff. */ - virtual void WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_Entity) override; - - /** Writes the mob-specific metadata for the specified mob */ - virtual void WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob) override; + virtual void WriteBlockEntity(cFastNBTWriter & a_Writer, const cBlockEntity & a_BlockEntity) const override; + virtual void WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_Entity) const override; + virtual void WriteItem(cPacketizer & a_Pkt, const cItem & a_Item) const override; + virtual void WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob) const override; /** Types used within metadata */ enum eMetadataType @@ -163,8 +135,7 @@ protected: virtual void SendLogin(const cPlayer & a_Player, const cWorld & a_World) override; - /** Returns 1.9.1. */ - virtual Version GetProtocolVersion() override; + virtual Version GetProtocolVersion() const override; } ; @@ -183,8 +154,7 @@ public: protected: - /** Returns 1.9.2. */ - virtual Version GetProtocolVersion() override; + virtual Version GetProtocolVersion() const override; } ; @@ -205,7 +175,6 @@ protected: virtual void SendUpdateSign(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) override; - /** Returns 1.9.4. */ - virtual Version GetProtocolVersion() override; - virtual UInt32 GetPacketID(ePacketType a_Packet) override; + virtual UInt32 GetPacketID(ePacketType a_Packet) const override; + virtual Version GetProtocolVersion() const override; } ; |