Botcraft 1.21.4
Loading...
Searching...
No Matches
ServerboundPlayerInputPacket.hpp
Go to the documentation of this file.
1#pragma once
2
4
5namespace ProtocolCraft
6{
7 class ServerboundPlayerInputPacket : public BaseMessage<ServerboundPlayerInputPacket>
8 {
9 public:
10 static constexpr std::string_view packet_name = "Player Input";
11
12#if PROTOCOL_VERSION < 768 /* < 1.21.2 */
13 SERIALIZED_FIELD(Xxa, float);
14 SERIALIZED_FIELD(Zza, float);
15 SERIALIZED_FIELD(Flags, unsigned char);
16#else
18
19 public:
20 bool GetForward() const { return Flags[0]; }
21 bool GetBackward() const { return Flags[1]; }
22 bool GetLeft() const { return Flags[2]; }
23 bool GetRight() const { return Flags[3]; }
24 bool GetJump() const { return Flags[4]; }
25 bool GetShift() const { return Flags[5]; }
26 bool GetSprint() const { return Flags[6]; }
27 THIS& SetForward (const bool b) { Flags.set(0, b); return *this; }
28 THIS& SetBackward(const bool b) { Flags.set(1, b); return *this; }
29 THIS& SetLeft (const bool b) { Flags.set(2, b); return *this; }
30 THIS& SetRight (const bool b) { Flags.set(3, b); return *this; }
31 THIS& SetJump (const bool b) { Flags.set(4, b); return *this; }
32 THIS& SetShift (const bool b) { Flags.set(5, b); return *this; }
33 THIS& SetSprint (const bool b) { Flags.set(6, b); return *this; }
34#endif
35
37 };
38} //ProtocolCraft
#define SERIALIZED_FIELD(Name,...)
SERIALIZED_FIELD_WITHOUT_GETTER_SETTER(Flags, std::bitset< 7 >)