Botcraft 1.21.11
Loading...
Searching...
No Matches
BasePacket.cpp
Go to the documentation of this file.
4
7
8namespace ProtocolCraft
9{
10 template<typename TDerived>
12 {
13 if constexpr (Internal::tuple_contains_type<TDerived, AllClientboundPlayPackets>)
14 {
15 return Internal::get_tuple_index<TDerived, AllClientboundPlayPackets>;
16 }
17 else if constexpr (Internal::tuple_contains_type<TDerived, AllServerboundPlayPackets>)
18 {
19 return Internal::get_tuple_index<TDerived, AllServerboundPlayPackets>;
20 }
21 else if constexpr (Internal::tuple_contains_type<TDerived, AllClientboundStatusPackets>)
22 {
23 return Internal::get_tuple_index<TDerived, AllClientboundStatusPackets>;
24 }
25 else if constexpr (Internal::tuple_contains_type<TDerived, AllServerboundStatusPackets>)
26 {
27 return Internal::get_tuple_index<TDerived, AllServerboundStatusPackets>;
28 }
29 else if constexpr (Internal::tuple_contains_type<TDerived, AllClientboundLoginPackets>)
30 {
31 return Internal::get_tuple_index<TDerived, AllClientboundLoginPackets>;
32 }
33 else if constexpr (Internal::tuple_contains_type<TDerived, AllServerboundLoginPackets>)
34 {
35 return Internal::get_tuple_index<TDerived, AllServerboundLoginPackets>;
36 }
37 else if constexpr (Internal::tuple_contains_type<TDerived, AllServerboundHandshakingPackets>)
38 {
39 return Internal::get_tuple_index<TDerived, AllServerboundHandshakingPackets>;
40 }
41#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
42 else if constexpr (Internal::tuple_contains_type<TDerived, AllServerboundConfigurationPackets>)
43 {
44 return Internal::get_tuple_index<TDerived, AllServerboundConfigurationPackets>;
45 }
46 else if constexpr (Internal::tuple_contains_type<TDerived, AllClientboundConfigurationPackets>)
47 {
48 return Internal::get_tuple_index<TDerived, AllClientboundConfigurationPackets>;
49 }
50#endif
51 else
52 {
53 static_assert(Internal::dependant_false<TDerived>, "Trying to define a packet which is not in protocol tuples");
54 }
55 }
56
57 template <typename TDerived>
59 {
60 handler->Handle(static_cast<TDerived&>(*this));
61 }
62
63 // Explicit instantiation for each clientbound packet class
64
65 // Login clientbound
66#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
68#endif
69#if PROTOCOL_VERSION > 340 /* > 1.12.2 */
71#endif
74#if PROTOCOL_VERSION < 768 /* < 1.21.2 */
75 DEFINE_PACKET_CLASS(ClientboundGameProfilePacket);
76#else
78#endif
80
81 // Status clientbound
84
85#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
86 // Configuration clientbound
93#if PROTOCOL_VERSION < 765 /* < 1.20.3 */
94 DEFINE_PACKET_CLASS(ClientboundResourcePackConfigurationPacket);
95#endif
96#if PROTOCOL_VERSION > 764 /* > 1.20.2 */
99#endif
102#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
108#endif
109#if PROTOCOL_VERSION > 766 /* > 1.21 */
112#endif
113#if PROTOCOL_VERSION > 770 /* > 1.21.5 */
116#endif
117#if PROTOCOL_VERSION > 772 /* > 1.21.8 */
119#endif
120#endif
121
122 // Play clientbound
132#if PROTOCOL_VERSION < 755 /* < 1.17 */
133 DEFINE_PACKET_CLASS(ClientboundPlayerCombatPacket);
134#endif
135#if PROTOCOL_VERSION == 755 /* 1.17 */
136 DEFINE_PACKET_CLASS(ClientboundRemoveEntityPacket);
137#else
139#endif
140#if PROTOCOL_VERSION > 345 /* > 1.12.2 */
142#endif
143#if PROTOCOL_VERSION > 347 /* > 1.12.2 */
145#endif
146#if PROTOCOL_VERSION > 351 /* > 1.12.2 */
148#endif
152#if PROTOCOL_VERSION < 755 /* < 1.17 */
153 DEFINE_PACKET_CLASS(ClientboundContainerAckPacket);
154#endif
161#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
162 DEFINE_PACKET_CLASS(ClientboundCustomSoundPacket);
163#endif
164#if PROTOCOL_VERSION > 388 /* > 1.12.2 */
166#endif
168#if PROTOCOL_VERSION > 451 /* > 1.13.2 */ && PROTOCOL_VERSION < 774 /* < 1.21.11 */
169 DEFINE_PACKET_CLASS(ClientboundHorseScreenOpenPacket);
170#endif
171#if PROTOCOL_VERSION > 773 /* > 1.21.10 */
173#endif
174#if PROTOCOL_VERSION > 450 /* > 1.13.2 */
176#endif
177#if PROTOCOL_VERSION < 757 /* < 1.18 */
178 DEFINE_PACKET_CLASS(ClientboundLevelChunkPacket);
179#endif
182#if PROTOCOL_VERSION < 755 /* < 1.17 */
183 DEFINE_PACKET_CLASS(ClientboundMoveEntityPacket);
184#endif
194#if PROTOCOL_VERSION > 450 /* > 1.13.2 */
196#endif
206#if PROTOCOL_VERSION < 759 /* < 1.19 */
207 DEFINE_PACKET_CLASS(ClientboundChatPacket);
208#endif
210#if PROTOCOL_VERSION > 404 /* > 1.13.2 */
212#endif
213#if PROTOCOL_VERSION > 493 /* > 1.14.3 */ && PROTOCOL_VERSION < 759 /* < 1.19 */
214 DEFINE_PACKET_CLASS(ClientboundBlockBreakAckPacket);
215#endif
217#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
218 DEFINE_PACKET_CLASS(ClientboundPlayerInfoPacket);
219#endif
223#if PROTOCOL_VERSION < 765 /* < 1.20.3 */
224 DEFINE_PACKET_CLASS(ClientboundResourcePackPacket);
225#endif
233#if PROTOCOL_VERSION < 770 /* < 1.21.5 */
234 DEFINE_PACKET_CLASS(ClientboundAddExperienceOrbPacket);
235#endif
236#if PROTOCOL_VERSION < 721 /* < 1.16 */
237 DEFINE_PACKET_CLASS(ClientboundAddGlobalEntityPacket);
238#endif
239#if PROTOCOL_VERSION < 759 /* < 1.19 */
240 DEFINE_PACKET_CLASS(ClientboundAddMobPacket);
241#endif
243#if PROTOCOL_VERSION < 759 /* < 1.19 */
244 DEFINE_PACKET_CLASS(ClientboundAddPaintingPacket);
245#endif
246#if PROTOCOL_VERSION < 764 /* < 1.20.2 */
247 DEFINE_PACKET_CLASS(ClientboundAddPlayerPacket);
248#endif
251#if PROTOCOL_VERSION > 342 /* > 1.12.2 */
253#endif
254#if PROTOCOL_VERSION > 348 /* > 1.12.2 */
256#endif
259#if PROTOCOL_VERSION < 755 /* < 1.17 */
260 DEFINE_PACKET_CLASS(ClientboundSetTitlesPacket);
261#endif
262#if PROTOCOL_VERSION < 461 /* < 1.14 */
263 DEFINE_PACKET_CLASS(ClientboundUseBedPacket);
264#endif
265#if PROTOCOL_VERSION > 451 /* > 1.13.2 */
267#endif
268#if PROTOCOL_VERSION < 768 /* < 1.21.2 */
269 DEFINE_PACKET_CLASS(ClientboundRecipePacket);
270#endif
272#if PROTOCOL_VERSION > 471 /* > 1.13.2 */
275#endif
280#if PROTOCOL_VERSION < 768 /* < 1.21.2 */
281 DEFINE_PACKET_CLASS(ClientboundSetCarriedItemPacket);
282#endif
283#if PROTOCOL_VERSION < 755 /* < 1.17 */
284 DEFINE_PACKET_CLASS(ClientboundSetBorderPacket);
285#endif
286#if PROTOCOL_VERSION > 754 /* > 1.16.5 */
287#if PROTOCOL_VERSION < 759 /* < 1.19 */
288 DEFINE_PACKET_CLASS(ClientboundAddVibrationSignalPacket);
289#endif
305#endif
306#if PROTOCOL_VERSION > 756 /* > 1.17.1 */
309#endif
310#if PROTOCOL_VERSION > 758 /* > 1.18.2 */
312#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
313 DEFINE_PACKET_CLASS(ClientboundChatPreviewPacket);
314#endif
317#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
318 DEFINE_PACKET_CLASS(ClientboundSetDisplayChatPreviewPacket);
319#endif
321#endif
322#if PROTOCOL_VERSION > 759 /* > 1.19 */
325#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
326 DEFINE_PACKET_CLASS(ClientboundPlayerChatHeaderPacket);
327#endif
328#endif
329#if PROTOCOL_VERSION > 760 /* > 1.19.2 */
333#if PROTOCOL_VERSION < 764 /* < 1.20.2 */
335#endif
336#endif
337#if PROTOCOL_VERSION > 761 /* > 1.19.3 */
342#endif
343#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
348#endif
349#if PROTOCOL_VERSION > 764 /* > 1.20.2 */
355#endif
356#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
362#endif
363#if PROTOCOL_VERSION > 766 /* > 1.20.6 */
366#endif
367#if PROTOCOL_VERSION > 767 /* > 1.21.1 */
377#endif
378#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
380#endif
381#if PROTOCOL_VERSION > 770 /* > 1.21.5 */
385#endif
386#if PROTOCOL_VERSION > 772 /* > 1.21.8 */
392#endif
393
394
395 // Explicit instantiation for each serverbound packet class
396 // Handshaking serverbound
398
399 // Login serverbound
400#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
402#endif
403#if PROTOCOL_VERSION > 340 /* > 1.12.2 */ && PROTOCOL_VERSION < 764 /* < 1.20.2 */
404 DEFINE_PACKET_CLASS(ServerboundCustomQueryPacket);
405#endif
408#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
411#endif
412
413 // Status serverbound
416
417#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
418 // Configuration serverbound
420#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
423#endif
429#if PROTOCOL_VERSION > 770 /* > 1.21.5 */
431#endif
432#if PROTOCOL_VERSION > 772 /* > 1.21.8 */
434#endif
435#endif
436
437 // Play serverbound
442#if PROTOCOL_VERSION > 476 /* > 1.13.2 */
444#endif
448#if PROTOCOL_VERSION < 755 /* < 1.17 */
449 DEFINE_PACKET_CLASS(ServerboundContainerAckPacket);
450#endif
453#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
455#endif
456#if PROTOCOL_VERSION < 476 /* < 1.14 */
457 DEFINE_PACKET_CLASS(ServerboundEnchantItemPacket);
458#endif
460#if PROTOCOL_VERSION > 711 /* > 1.15.2 */
462#endif
466#if PROTOCOL_VERSION > 463 /* > 1.13.2 */
468#endif
469#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
471#endif
472#if PROTOCOL_VERSION > 768 /* > 1.21.3 */
475#endif
476#if PROTOCOL_VERSION > 385 /* > 1.12.2 */ && PROTOCOL_VERSION < 769 /* < 1.21.4 */
477 DEFINE_PACKET_CLASS(ServerboundPickItemPacket);
478#endif
483#if PROTOCOL_VERSION > 754 /* > 1.16.5 */
485#endif
486#if PROTOCOL_VERSION < 755 /* < 1.17 */
487 DEFINE_PACKET_CLASS(ServerboundMovePlayerPacket);
488#endif
492#if PROTOCOL_VERSION > 388 /* > 1.12.2 */
495#endif
496#if PROTOCOL_VERSION > 736 /* > 1.16.1 */
499#else
500 DEFINE_PACKET_CLASS(ServerboundRecipeBookUpdatePacket);
501#endif
503#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
506#endif
507#if PROTOCOL_VERSION > 463 /* > 1.13.2 */
509#endif
513#if PROTOCOL_VERSION > 768 /* > 1.21.3 */
515#endif
516#if PROTOCOL_VERSION > 754 /* > 1.16.5 */
518#endif
521#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
524#endif
525#if PROTOCOL_VERSION > 471 /* > 1.13.2 */
527#endif
529#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
531#endif
534#if PROTOCOL_VERSION > 758 /* > 1.18.2 */
536#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
537 DEFINE_PACKET_CLASS(ServerboundChatPreviewPacket);
538#endif
539#endif
540#if PROTOCOL_VERSION > 759 /* > 1.19 */
542#endif
543#if PROTOCOL_VERSION > 760 /* > 1.19.2 */
545#endif
546#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
550#endif
551#if PROTOCOL_VERSION > 764 /* > 1.20.2 */
553#endif
554#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
557#endif
558#if PROTOCOL_VERSION > 765 /* > 1.20.4 */ && PROTOCOL_VERSION < 773 /* < 1.21.9 */
559 DEFINE_PACKET_CLASS(ServerboundDebugSampleSubscriptionPacket);
560#endif
561#if PROTOCOL_VERSION > 772 /* > 1.21.8 */
563#endif
564#if PROTOCOL_VERSION > 767 /* > 1.21.1 */
567#endif
568#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
571#endif
572#if PROTOCOL_VERSION > 770 /* > 1.21.5 */
575#endif
576}
#define DEFINE_PACKET_CLASS(ClassName)
virtual void DispatchImpl(Handler *handler) override
virtual int GetId() const override