Botcraft 1.21.8
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#endif
118
119 // Play clientbound
129#if PROTOCOL_VERSION < 755 /* < 1.17 */
130 DEFINE_PACKET_CLASS(ClientboundPlayerCombatPacket);
131#endif
132#if PROTOCOL_VERSION == 755 /* 1.17 */
133 DEFINE_PACKET_CLASS(ClientboundRemoveEntityPacket);
134#else
136#endif
137#if PROTOCOL_VERSION > 345 /* > 1.12.2 */
139#endif
140#if PROTOCOL_VERSION > 347 /* > 1.12.2 */
142#endif
143#if PROTOCOL_VERSION > 351 /* > 1.12.2 */
145#endif
149#if PROTOCOL_VERSION < 755 /* < 1.17 */
150 DEFINE_PACKET_CLASS(ClientboundContainerAckPacket);
151#endif
158#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
159 DEFINE_PACKET_CLASS(ClientboundCustomSoundPacket);
160#endif
161#if PROTOCOL_VERSION > 388 /* > 1.12.2 */
163#endif
165#if PROTOCOL_VERSION > 451 /* > 1.13.2 */
167#endif
168#if PROTOCOL_VERSION > 450 /* > 1.13.2 */
170#endif
171#if PROTOCOL_VERSION < 757 /* < 1.18 */
172 DEFINE_PACKET_CLASS(ClientboundLevelChunkPacket);
173#endif
176#if PROTOCOL_VERSION < 755 /* < 1.17 */
177 DEFINE_PACKET_CLASS(ClientboundMoveEntityPacket);
178#endif
188#if PROTOCOL_VERSION > 450 /* > 1.13.2 */
190#endif
200#if PROTOCOL_VERSION < 759 /* < 1.19 */
201 DEFINE_PACKET_CLASS(ClientboundChatPacket);
202#endif
204#if PROTOCOL_VERSION > 404 /* > 1.13.2 */
206#endif
207#if PROTOCOL_VERSION > 493 /* > 1.14.3 */ && PROTOCOL_VERSION < 759 /* < 1.19 */
208 DEFINE_PACKET_CLASS(ClientboundBlockBreakAckPacket);
209#endif
211#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
212 DEFINE_PACKET_CLASS(ClientboundPlayerInfoPacket);
213#endif
217#if PROTOCOL_VERSION < 765 /* < 1.20.3 */
218 DEFINE_PACKET_CLASS(ClientboundResourcePackPacket);
219#endif
227#if PROTOCOL_VERSION < 770 /* < 1.21.5 */
228 DEFINE_PACKET_CLASS(ClientboundAddExperienceOrbPacket);
229#endif
230#if PROTOCOL_VERSION < 721 /* < 1.16 */
231 DEFINE_PACKET_CLASS(ClientboundAddGlobalEntityPacket);
232#endif
233#if PROTOCOL_VERSION < 759 /* < 1.19 */
234 DEFINE_PACKET_CLASS(ClientboundAddMobPacket);
235#endif
237#if PROTOCOL_VERSION < 759 /* < 1.19 */
238 DEFINE_PACKET_CLASS(ClientboundAddPaintingPacket);
239#endif
240#if PROTOCOL_VERSION < 764 /* < 1.20.2 */
241 DEFINE_PACKET_CLASS(ClientboundAddPlayerPacket);
242#endif
245#if PROTOCOL_VERSION > 342 /* > 1.12.2 */
247#endif
248#if PROTOCOL_VERSION > 348 /* > 1.12.2 */
250#endif
253#if PROTOCOL_VERSION < 755 /* < 1.17 */
254 DEFINE_PACKET_CLASS(ClientboundSetTitlesPacket);
255#endif
256#if PROTOCOL_VERSION < 461 /* < 1.14 */
257 DEFINE_PACKET_CLASS(ClientboundUseBedPacket);
258#endif
259#if PROTOCOL_VERSION > 451 /* > 1.13.2 */
261#endif
262#if PROTOCOL_VERSION < 768 /* < 1.21.2 */
263 DEFINE_PACKET_CLASS(ClientboundRecipePacket);
264#endif
266#if PROTOCOL_VERSION > 471 /* > 1.13.2 */
269#endif
274#if PROTOCOL_VERSION < 768 /* < 1.21.2 */
275 DEFINE_PACKET_CLASS(ClientboundSetCarriedItemPacket);
276#endif
277#if PROTOCOL_VERSION < 755 /* < 1.17 */
278 DEFINE_PACKET_CLASS(ClientboundSetBorderPacket);
279#endif
280#if PROTOCOL_VERSION > 754 /* > 1.16.5 */
281#if PROTOCOL_VERSION < 759 /* < 1.19 */
282 DEFINE_PACKET_CLASS(ClientboundAddVibrationSignalPacket);
283#endif
299#endif
300#if PROTOCOL_VERSION > 756 /* > 1.17.1 */
303#endif
304#if PROTOCOL_VERSION > 758 /* > 1.18.2 */
306#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
307 DEFINE_PACKET_CLASS(ClientboundChatPreviewPacket);
308#endif
311#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
312 DEFINE_PACKET_CLASS(ClientboundSetDisplayChatPreviewPacket);
313#endif
315#endif
316#if PROTOCOL_VERSION > 759 /* > 1.19 */
319#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
320 DEFINE_PACKET_CLASS(ClientboundPlayerChatHeaderPacket);
321#endif
322#endif
323#if PROTOCOL_VERSION > 760 /* > 1.19.2 */
327#if PROTOCOL_VERSION < 764 /* < 1.20.2 */
329#endif
330#endif
331#if PROTOCOL_VERSION > 761 /* > 1.19.3 */
336#endif
337#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
342#endif
343#if PROTOCOL_VERSION > 764 /* > 1.20.2 */
349#endif
350#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
356#endif
357#if PROTOCOL_VERSION > 766 /* > 1.20.6 */
360#endif
361#if PROTOCOL_VERSION > 767 /* > 1.21.1 */
371#endif
372#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
374#endif
375#if PROTOCOL_VERSION > 770 /* > 1.21.5 */
379#endif
380
381
382 // Explicit instantiation for each serverbound packet class
383 // Handshaking serverbound
385
386 // Login serverbound
387#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
389#endif
390#if PROTOCOL_VERSION > 340 /* > 1.12.2 */ && PROTOCOL_VERSION < 764 /* < 1.20.2 */
391 DEFINE_PACKET_CLASS(ServerboundCustomQueryPacket);
392#endif
395#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
398#endif
399
400 // Status serverbound
403
404#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
405 // Configuration serverbound
407#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
410#endif
416#if PROTOCOL_VERSION > 770 /* > 1.21.5 */
418#endif
419#endif
420
421 // Play serverbound
426#if PROTOCOL_VERSION > 476 /* > 1.13.2 */
428#endif
432#if PROTOCOL_VERSION < 755 /* < 1.17 */
433 DEFINE_PACKET_CLASS(ServerboundContainerAckPacket);
434#endif
437#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
439#endif
440#if PROTOCOL_VERSION < 476 /* < 1.14 */
441 DEFINE_PACKET_CLASS(ServerboundEnchantItemPacket);
442#endif
444#if PROTOCOL_VERSION > 711 /* > 1.15.2 */
446#endif
450#if PROTOCOL_VERSION > 463 /* > 1.13.2 */
452#endif
453#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
455#endif
456#if PROTOCOL_VERSION > 768 /* > 1.21.3 */
459#endif
460#if PROTOCOL_VERSION > 385 /* > 1.12.2 */ && PROTOCOL_VERSION < 769 /* < 1.21.4 */
461 DEFINE_PACKET_CLASS(ServerboundPickItemPacket);
462#endif
467#if PROTOCOL_VERSION > 754 /* > 1.16.5 */
469#endif
470#if PROTOCOL_VERSION < 755 /* < 1.17 */
471 DEFINE_PACKET_CLASS(ServerboundMovePlayerPacket);
472#endif
476#if PROTOCOL_VERSION > 388 /* > 1.12.2 */
479#endif
480#if PROTOCOL_VERSION > 736 /* > 1.16.1 */
483#else
484 DEFINE_PACKET_CLASS(ServerboundRecipeBookUpdatePacket);
485#endif
487#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
490#endif
491#if PROTOCOL_VERSION > 463 /* > 1.13.2 */
493#endif
497#if PROTOCOL_VERSION > 768 /* > 1.21.3 */
499#endif
500#if PROTOCOL_VERSION > 754 /* > 1.16.5 */
502#endif
505#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
508#endif
509#if PROTOCOL_VERSION > 471 /* > 1.13.2 */
511#endif
513#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
515#endif
518#if PROTOCOL_VERSION > 758 /* > 1.18.2 */
520#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
521 DEFINE_PACKET_CLASS(ServerboundChatPreviewPacket);
522#endif
523#endif
524#if PROTOCOL_VERSION > 759 /* > 1.19 */
526#endif
527#if PROTOCOL_VERSION > 760 /* > 1.19.2 */
529#endif
530#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
534#endif
535#if PROTOCOL_VERSION > 764 /* > 1.20.2 */
537#endif
538#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
542#endif
543#if PROTOCOL_VERSION > 767 /* > 1.21.1 */
546#endif
547#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
550#endif
551#if PROTOCOL_VERSION > 770 /* > 1.21.5 */
554#endif
555}
#define DEFINE_PACKET_CLASS(ClassName)
virtual void DispatchImpl(Handler *handler) override
virtual int GetId() const override