Botcraft 1.21.4
Loading...
Searching...
No Matches
ClientboundSetBorderPacket.hpp
Go to the documentation of this file.
1#if PROTOCOL_VERSION < 755 /* < 1.17 */
2#pragma once
3
5
6namespace ProtocolCraft
7{
8 enum class SetBorderType
9 {
10 SetSize = 0,
11 LerpSize = 1,
12 SetCenter = 2,
13 Initialize = 3,
14 SetWarningTime = 4,
15 SetWarningBlocks = 5
16 };
17
18 class ClientboundSetBorderPacket : public BaseMessage<ClientboundSetBorderPacket>
19 {
20 public:
21 static constexpr std::string_view packet_name = "Set Border";
22
23 DEFINE_CONDITION(SetLerpInit, GetAction() == SetBorderType::SetSize || GetAction() == SetBorderType::LerpSize || GetAction() == SetBorderType::Initialize);
24 DEFINE_CONDITION(LerpInit, GetAction() == SetBorderType::LerpSize || GetAction() == SetBorderType::Initialize);
25 DEFINE_CONDITION(CenterInit, GetAction() == SetBorderType::SetCenter || GetAction() == SetBorderType::Initialize);
26 DEFINE_CONDITION(Init, GetAction() == SetBorderType::Initialize);
27 DEFINE_CONDITION(InitWarnTime, GetAction() == SetBorderType::Initialize || GetAction() == SetBorderType::SetWarningTime);
28 DEFINE_CONDITION(InitWarnBlock, GetAction() == SetBorderType::Initialize || GetAction() == SetBorderType::SetWarningBlocks);
29
30 SERIALIZED_FIELD(Action, Internal::DiffType<SetBorderType, VarInt>);
31 SERIALIZED_FIELD(NewCenterX, Internal::Conditioned<double, &THIS::CenterInit>);
32 SERIALIZED_FIELD(NewCenterZ, Internal::Conditioned<double, &THIS::CenterInit>);
33 SERIALIZED_FIELD(OldSize, Internal::Conditioned<double, &THIS::LerpInit>);
34 SERIALIZED_FIELD(NewSize, Internal::Conditioned<double, &THIS::SetLerpInit>);
35 SERIALIZED_FIELD(LerpTime, Internal::Conditioned<VarLong, &THIS::LerpInit>);
36 SERIALIZED_FIELD(NewAbsoluteMaxSize, Internal::Conditioned<VarInt, &THIS::Init>);
37 SERIALIZED_FIELD(WarningTime, Internal::Conditioned<VarInt, &THIS::InitWarnTime>);
38 SERIALIZED_FIELD(WarningBlocks, Internal::Conditioned<VarInt, &THIS::InitWarnBlock>);
39
41 };
42} //ProtocolCraft
43#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,...)