Botcraft 26.1.2
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#if PROTOCOL_VERSION > 774 /* > 1.21.11 */
396#endif
397
398
399 // Explicit instantiation for each serverbound packet class
400 // Handshaking serverbound
402
403 // Login serverbound
404#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
406#endif
407#if PROTOCOL_VERSION > 340 /* > 1.12.2 */ && PROTOCOL_VERSION < 764 /* < 1.20.2 */
408 DEFINE_PACKET_CLASS(ServerboundCustomQueryPacket);
409#endif
412#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
415#endif
416
417 // Status serverbound
420
421#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
422 // Configuration serverbound
424#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
427#endif
433#if PROTOCOL_VERSION > 770 /* > 1.21.5 */
435#endif
436#if PROTOCOL_VERSION > 772 /* > 1.21.8 */
438#endif
439#endif
440
441 // Play serverbound
446#if PROTOCOL_VERSION > 476 /* > 1.13.2 */
448#endif
452#if PROTOCOL_VERSION < 755 /* < 1.17 */
453 DEFINE_PACKET_CLASS(ServerboundContainerAckPacket);
454#endif
457#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
459#endif
460#if PROTOCOL_VERSION < 476 /* < 1.14 */
461 DEFINE_PACKET_CLASS(ServerboundEnchantItemPacket);
462#endif
464#if PROTOCOL_VERSION > 711 /* > 1.15.2 */
466#endif
470#if PROTOCOL_VERSION > 463 /* > 1.13.2 */
472#endif
473#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
475#endif
476#if PROTOCOL_VERSION > 768 /* > 1.21.3 */
479#endif
480#if PROTOCOL_VERSION > 385 /* > 1.12.2 */ && PROTOCOL_VERSION < 769 /* < 1.21.4 */
481 DEFINE_PACKET_CLASS(ServerboundPickItemPacket);
482#endif
487#if PROTOCOL_VERSION > 754 /* > 1.16.5 */
489#endif
490#if PROTOCOL_VERSION < 755 /* < 1.17 */
491 DEFINE_PACKET_CLASS(ServerboundMovePlayerPacket);
492#endif
496#if PROTOCOL_VERSION > 388 /* > 1.12.2 */
499#endif
500#if PROTOCOL_VERSION > 736 /* > 1.16.1 */
503#else
504 DEFINE_PACKET_CLASS(ServerboundRecipeBookUpdatePacket);
505#endif
507#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
510#endif
511#if PROTOCOL_VERSION > 463 /* > 1.13.2 */
513#endif
517#if PROTOCOL_VERSION > 768 /* > 1.21.3 */
519#endif
520#if PROTOCOL_VERSION > 754 /* > 1.16.5 */
522#endif
525#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
528#endif
529#if PROTOCOL_VERSION > 471 /* > 1.13.2 */
531#endif
533#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
535#endif
538#if PROTOCOL_VERSION > 758 /* > 1.18.2 */
540#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
541 DEFINE_PACKET_CLASS(ServerboundChatPreviewPacket);
542#endif
543#endif
544#if PROTOCOL_VERSION > 759 /* > 1.19 */
546#endif
547#if PROTOCOL_VERSION > 760 /* > 1.19.2 */
549#endif
550#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
554#endif
555#if PROTOCOL_VERSION > 764 /* > 1.20.2 */
557#endif
558#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
561#endif
562#if PROTOCOL_VERSION > 765 /* > 1.20.4 */ && PROTOCOL_VERSION < 773 /* < 1.21.9 */
563 DEFINE_PACKET_CLASS(ServerboundDebugSampleSubscriptionPacket);
564#endif
565#if PROTOCOL_VERSION > 772 /* > 1.21.8 */
567#endif
568#if PROTOCOL_VERSION > 767 /* > 1.21.1 */
571#endif
572#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
575#endif
576#if PROTOCOL_VERSION > 770 /* > 1.21.5 */
579#endif
580#if PROTOCOL_VERSION > 774 /* > 1.21.11 */
584#endif
585}
#define DEFINE_PACKET_CLASS(ClassName)
virtual void DispatchImpl(Handler *handler) override
virtual int GetId() const override