Botcraft 26.3
Loading...
Searching...
No Matches
ClientboundPlayerCombatPacket.hpp
Go to the documentation of this file.
1#if PROTOCOL_VERSION < 755 /* < 1.17 */
2#pragma once
3
6
7#if PROTOCOL_VERSION < 107 /* < 1.9 */
8#include <string>
9#endif
10
11namespace ProtocolCraft
12{
13 class ClientboundPlayerCombatPacket : public BasePacket<ClientboundPlayerCombatPacket>
14 {
15 public:
16 static constexpr std::string_view packet_name = "Player Combat";
17
18 DEFINE_CONDITION(Event1, GetEvent() == 1);
19 DEFINE_CONDITION(Event12, GetEvent() == 1 || GetEvent() == 2);
20 DEFINE_CONDITION(Event2, GetEvent() == 2);
21
22 SERIALIZED_FIELD(Event, VarInt);
23 SERIALIZED_FIELD(Duration, Internal::Conditioned<VarInt, &THIS::Event1>);
24 SERIALIZED_FIELD(PlayerId, Internal::Conditioned<VarInt, &THIS::Event2>);
25 SERIALIZED_FIELD(KillerId, Internal::Conditioned<int, &THIS::Event12>);
26#if PROTOCOL_VERSION < 107 /* < 1.9 */
27 SERIALIZED_FIELD(Message, Internal::Conditioned<std::string, &THIS::Event2>);
28#else
29 SERIALIZED_FIELD(Message, Internal::Conditioned<Chat, &THIS::Event2>);
30#endif
31
33 };
34} //ProtocolCraft
35#endif
#define DEFINE_CONDITION(Name,...)
Define a condition that can be used later inside an Internal::Conditioned type.
#define DECLARE_READ_WRITE_SERIALIZE
Define auto serializable utilities and declare ReadImpl, WriteImpl and SerializeImpl virtual function...
#define SERIALIZED_FIELD(Name,...)