Botcraft 26.3
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#if PROTOCOL_VERSION > 776 /* > 26.2 */
122#endif
123#endif
124
125 // Play clientbound
126#if PROTOCOL_VERSION < 107 /* < 1.9 */
127 DEFINE_PACKET_CLASS(ClientboundMapChunkBulkPacket);
128 DEFINE_PACKET_CLASS(ClientboundPlayCompressionPacket);
129 DEFINE_PACKET_CLASS(ClientboundSetEntityNBTPacket);
130#endif
131#if PROTOCOL_VERSION < 110 /* < 1.9.3 */
132 DEFINE_PACKET_CLASS(ClientboundUpdateSignPacket);
133#endif
134#if PROTOCOL_VERSION > 316 /* > 1.11.2 */
136#endif
141#if PROTOCOL_VERSION > 47 /* > 1.8.9 */
143#endif
147#if PROTOCOL_VERSION < 755 /* < 1.17 */
148 DEFINE_PACKET_CLASS(ClientboundPlayerCombatPacket);
149#endif
150#if PROTOCOL_VERSION == 755 /* 1.17 */
151 DEFINE_PACKET_CLASS(ClientboundRemoveEntityPacket);
152#else
154#endif
155#if PROTOCOL_VERSION > 345 /* > 1.12.2 */
157#endif
158#if PROTOCOL_VERSION > 347 /* > 1.12.2 */
160#endif
161#if PROTOCOL_VERSION > 351 /* > 1.12.2 */
163#endif
167#if PROTOCOL_VERSION < 755 /* < 1.17 */
168 DEFINE_PACKET_CLASS(ClientboundContainerAckPacket);
169#endif
171#if PROTOCOL_VERSION > 335 /* > 1.12 */
173#endif
176#if PROTOCOL_VERSION > 47 /* > 1.8.9 */
178#endif
180#if PROTOCOL_VERSION > 47 /* > 1.8.9 */ && PROTOCOL_VERSION < 761 /* < 1.19.3 */
181 DEFINE_PACKET_CLASS(ClientboundCustomSoundPacket);
182#endif
183#if PROTOCOL_VERSION > 388 /* > 1.12.2 */
185#endif
187#if PROTOCOL_VERSION > 451 /* > 1.13.2 */ && PROTOCOL_VERSION < 774 /* < 1.21.11 */
188 DEFINE_PACKET_CLASS(ClientboundHorseScreenOpenPacket);
189#endif
190#if PROTOCOL_VERSION > 773 /* > 1.21.10 */
192#endif
193#if PROTOCOL_VERSION > 450 /* > 1.13.2 */
195#endif
196#if PROTOCOL_VERSION < 757 /* < 1.18 */
197 DEFINE_PACKET_CLASS(ClientboundLevelChunkPacket);
198#endif
201#if PROTOCOL_VERSION < 755 /* < 1.17 */
202 DEFINE_PACKET_CLASS(ClientboundMoveEntityPacket);
203#endif
213#if PROTOCOL_VERSION > 450 /* > 1.13.2 */
215#endif
225#if PROTOCOL_VERSION < 759 /* < 1.19 */
226 DEFINE_PACKET_CLASS(ClientboundChatPacket);
227#endif
229#if PROTOCOL_VERSION > 404 /* > 1.13.2 */
231#endif
232#if PROTOCOL_VERSION > 493 /* > 1.14.3 */ && PROTOCOL_VERSION < 759 /* < 1.19 */
233 DEFINE_PACKET_CLASS(ClientboundBlockBreakAckPacket);
234#endif
236#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
237 DEFINE_PACKET_CLASS(ClientboundPlayerInfoPacket);
238#endif
242#if PROTOCOL_VERSION < 765 /* < 1.20.3 */
243 DEFINE_PACKET_CLASS(ClientboundResourcePackPacket);
244#endif
246#if PROTOCOL_VERSION > 316 /* > 1.11.2 */
248#endif
251#if PROTOCOL_VERSION > 47 /* > 1.8.9 */
253#endif
254#if PROTOCOL_VERSION > 47 /* > 1.8.9 */
256#endif
258#if PROTOCOL_VERSION < 770 /* < 1.21.5 */
259 DEFINE_PACKET_CLASS(ClientboundAddExperienceOrbPacket);
260#endif
261#if PROTOCOL_VERSION < 721 /* < 1.16 */
262 DEFINE_PACKET_CLASS(ClientboundAddGlobalEntityPacket);
263#endif
264#if PROTOCOL_VERSION < 759 /* < 1.19 */
265 DEFINE_PACKET_CLASS(ClientboundAddMobPacket);
266#endif
268#if PROTOCOL_VERSION < 759 /* < 1.19 */
269 DEFINE_PACKET_CLASS(ClientboundAddPaintingPacket);
270#endif
271#if PROTOCOL_VERSION < 764 /* < 1.20.2 */
272 DEFINE_PACKET_CLASS(ClientboundAddPlayerPacket);
273#endif
276#if PROTOCOL_VERSION > 342 /* > 1.12.2 */
278#endif
279#if PROTOCOL_VERSION > 348 /* > 1.12.2 */
281#endif
284#if PROTOCOL_VERSION < 755 /* < 1.17 */
285 DEFINE_PACKET_CLASS(ClientboundSetTitlesPacket);
286#endif
287#if PROTOCOL_VERSION < 461 /* < 1.14 */
288 DEFINE_PACKET_CLASS(ClientboundUseBedPacket);
289#endif
290#if PROTOCOL_VERSION > 451 /* > 1.13.2 */
292#endif
293#if PROTOCOL_VERSION > 316 /* > 1.11.2 */ && PROTOCOL_VERSION < 768 /* < 1.21.2 */
294 DEFINE_PACKET_CLASS(ClientboundRecipePacket);
295#endif
297#if PROTOCOL_VERSION > 471 /* > 1.13.2 */
300#endif
301#if PROTOCOL_VERSION > 47 /* > 1.8.9 */
303#endif
307#if PROTOCOL_VERSION < 768 /* < 1.21.2 */
308 DEFINE_PACKET_CLASS(ClientboundSetCarriedItemPacket);
309#endif
310#if PROTOCOL_VERSION < 755 /* < 1.17 */
311 DEFINE_PACKET_CLASS(ClientboundSetBorderPacket);
312#endif
313#if PROTOCOL_VERSION > 754 /* > 1.16.5 */
314#if PROTOCOL_VERSION < 759 /* < 1.19 */
315 DEFINE_PACKET_CLASS(ClientboundAddVibrationSignalPacket);
316#endif
332#endif
333#if PROTOCOL_VERSION > 756 /* > 1.17.1 */
336#endif
337#if PROTOCOL_VERSION > 758 /* > 1.18.2 */
339#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
340 DEFINE_PACKET_CLASS(ClientboundChatPreviewPacket);
341#endif
344#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
345 DEFINE_PACKET_CLASS(ClientboundSetDisplayChatPreviewPacket);
346#endif
348#endif
349#if PROTOCOL_VERSION > 759 /* > 1.19 */
352#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
353 DEFINE_PACKET_CLASS(ClientboundPlayerChatHeaderPacket);
354#endif
355#endif
356#if PROTOCOL_VERSION > 760 /* > 1.19.2 */
360#if PROTOCOL_VERSION < 764 /* < 1.20.2 */
362#endif
363#endif
364#if PROTOCOL_VERSION > 761 /* > 1.19.3 */
369#endif
370#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
375#endif
376#if PROTOCOL_VERSION > 764 /* > 1.20.2 */
382#endif
383#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
389#endif
390#if PROTOCOL_VERSION > 766 /* > 1.20.6 */
393#endif
394#if PROTOCOL_VERSION > 767 /* > 1.21.1 */
404#endif
405#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
407#endif
408#if PROTOCOL_VERSION > 770 /* > 1.21.5 */
412#endif
413#if PROTOCOL_VERSION > 772 /* > 1.21.8 */
419#endif
420#if PROTOCOL_VERSION > 774 /* > 1.21.11 */
423#endif
424#if PROTOCOL_VERSION > 776 /* > 26.2 */
428#endif
429
430
431 // Explicit instantiation for each serverbound packet class
432 // Handshaking serverbound
434
435 // Login serverbound
436#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
438#endif
439#if PROTOCOL_VERSION > 340 /* > 1.12.2 */ && PROTOCOL_VERSION < 764 /* < 1.20.2 */
440 DEFINE_PACKET_CLASS(ServerboundCustomQueryPacket);
441#endif
444#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
447#endif
448
449 // Status serverbound
452
453#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
454 // Configuration serverbound
456#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
459#endif
465#if PROTOCOL_VERSION > 770 /* > 1.21.5 */
467#endif
468#if PROTOCOL_VERSION > 772 /* > 1.21.8 */
470#endif
471#endif
472
473 // Play serverbound
474#if PROTOCOL_VERSION > 316 /* > 1.11.2 */ && PROTOCOL_VERSION < 338 /* < 1.12.1 */
475 DEFINE_PACKET_CLASS(ServerboundRecipePlacementPacket);
476#endif
477#if PROTOCOL_VERSION > 316 /* > 1.11.2 */
479#endif
480#if PROTOCOL_VERSION < 777 /* < 26.3 */
481 DEFINE_PACKET_CLASS(ServerboundSwingPacket);
482#endif
485#if PROTOCOL_VERSION > 476 /* > 1.13.2 */
487#endif
491#if PROTOCOL_VERSION < 755 /* < 1.17 */
492 DEFINE_PACKET_CLASS(ServerboundContainerAckPacket);
493#endif
494#if PROTOCOL_VERSION > 335 /* > 1.12 */
496#endif
498#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
500#endif
501#if PROTOCOL_VERSION < 476 /* < 1.14 */
502 DEFINE_PACKET_CLASS(ServerboundEnchantItemPacket);
503#endif
505#if PROTOCOL_VERSION > 711 /* > 1.15.2 */
507#endif
511#if PROTOCOL_VERSION > 463 /* > 1.13.2 */
513#endif
514#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
516#endif
517#if PROTOCOL_VERSION > 768 /* > 1.21.3 */
520#endif
521#if PROTOCOL_VERSION > 385 /* > 1.12.2 */ && PROTOCOL_VERSION < 769 /* < 1.21.4 */
522 DEFINE_PACKET_CLASS(ServerboundPickItemPacket);
523#endif
528#if PROTOCOL_VERSION > 754 /* > 1.16.5 */
530#endif
531#if PROTOCOL_VERSION < 755 /* < 1.17 */
532 DEFINE_PACKET_CLASS(ServerboundMovePlayerPacket);
533#endif
537#if PROTOCOL_VERSION > 388 /* > 1.12.2 */
540#endif
541#if PROTOCOL_VERSION > 736 /* > 1.16.1 */
544#elif PROTOCOL_VERSION > 316 /* > 1.11.2 */
545 DEFINE_PACKET_CLASS(ServerboundRecipeBookUpdatePacket);
546#endif
548#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
551#endif
552#if PROTOCOL_VERSION > 463 /* > 1.13.2 */
554#endif
556#if PROTOCOL_VERSION > 47 /* > 1.8.9 */
558#endif
560#if PROTOCOL_VERSION > 768 /* > 1.21.3 */
562#endif
563#if PROTOCOL_VERSION > 754 /* > 1.16.5 */
565#endif
567#if PROTOCOL_VERSION > 47 /* > 1.8.9 */
569#endif
570#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
573#endif
574#if PROTOCOL_VERSION > 471 /* > 1.13.2 */
576#endif
578#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
580#endif
581#if PROTOCOL_VERSION > 47 /* > 1.8.9 */
583#endif
584#if PROTOCOL_VERSION > 47 /* > 1.8.9 */
586#endif
587#if PROTOCOL_VERSION > 758 /* > 1.18.2 */
589#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
590 DEFINE_PACKET_CLASS(ServerboundChatPreviewPacket);
591#endif
592#endif
593#if PROTOCOL_VERSION > 759 /* > 1.19 */
595#endif
596#if PROTOCOL_VERSION > 760 /* > 1.19.2 */
598#endif
599#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
603#endif
604#if PROTOCOL_VERSION > 764 /* > 1.20.2 */
606#endif
607#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
610#endif
611#if PROTOCOL_VERSION > 765 /* > 1.20.4 */ && PROTOCOL_VERSION < 773 /* < 1.21.9 */
612 DEFINE_PACKET_CLASS(ServerboundDebugSampleSubscriptionPacket);
613#endif
614#if PROTOCOL_VERSION > 772 /* > 1.21.8 */
616#endif
617#if PROTOCOL_VERSION > 767 /* > 1.21.1 */
620#endif
621#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
624#endif
625#if PROTOCOL_VERSION > 770 /* > 1.21.5 */
628#endif
629#if PROTOCOL_VERSION > 774 /* > 1.21.11 */
632#if PROTOCOL_VERSION < 776 /* < 26.2 */
633 DEFINE_PACKET_CLASS(ServerboundSpectateEntityPacket);
634#endif
635#endif
636#if PROTOCOL_VERSION > 775 /* > 26.1.2 */
638#endif
639#if PROTOCOL_VERSION > 776 /* > 26.2 */
641#endif
642}
#define DEFINE_PACKET_CLASS(ClassName)
virtual void DispatchImpl(Handler *handler) override
virtual int GetId() const override