Botcraft 26.3
Loading...
Searching...
No Matches
ClientboundSetTitlesPacket.hpp
Go to the documentation of this file.
1#if PROTOCOL_VERSION < 755 /* < 1.17 */
2#pragma once
3
6
7namespace ProtocolCraft
8{
9 enum class SetTitlesType
10 {
11 Title = 0,
12 Subtitle,
13#if PROTOCOL_VERSION > 210 /* > 1.10.2 */
14 ActionBar,
15#endif
16 Times,
17 Clear,
18 Reset
19 };
20
21 class ClientboundSetTitlesPacket : public BasePacket<ClientboundSetTitlesPacket>
22 {
23 public:
24 static constexpr std::string_view packet_name = "Set Titles";
25
26#if PROTOCOL_VERSION > 210 /* > 1.10.2 */
27 DEFINE_CONDITION(HasText, GetType() == SetTitlesType::Title || GetType() == SetTitlesType::Subtitle || GetType() == SetTitlesType::ActionBar);
28#else
29 DEFINE_CONDITION(HasText, GetType() == SetTitlesType::Title || GetType() == SetTitlesType::Subtitle);
30#endif
31 DEFINE_CONDITION(HasTimes, GetType() == SetTitlesType::Times);
32
33 SERIALIZED_FIELD(Type, Internal::DiffType<SetTitlesType, VarInt>);
34 SERIALIZED_FIELD(Text, Internal::Conditioned<Chat, &THIS::HasText>);
35 SERIALIZED_FIELD(FadeInTime, Internal::Conditioned<int, &THIS::HasTimes>);
36 SERIALIZED_FIELD(StayTime, Internal::Conditioned<int, &THIS::HasTimes>);
37 SERIALIZED_FIELD(FadeOutTime, Internal::Conditioned<int, &THIS::HasTimes>);
38
40 };
41} //ProtocolCraft
42#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,...)