Botcraft 1.21.10
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 */
170#endif
171#if PROTOCOL_VERSION > 450 /* > 1.13.2 */
173#endif
174#if PROTOCOL_VERSION < 757 /* < 1.18 */
175 DEFINE_PACKET_CLASS(ClientboundLevelChunkPacket);
176#endif
179#if PROTOCOL_VERSION < 755 /* < 1.17 */
180 DEFINE_PACKET_CLASS(ClientboundMoveEntityPacket);
181#endif
191#if PROTOCOL_VERSION > 450 /* > 1.13.2 */
193#endif
203#if PROTOCOL_VERSION < 759 /* < 1.19 */
204 DEFINE_PACKET_CLASS(ClientboundChatPacket);
205#endif
207#if PROTOCOL_VERSION > 404 /* > 1.13.2 */
209#endif
210#if PROTOCOL_VERSION > 493 /* > 1.14.3 */ && PROTOCOL_VERSION < 759 /* < 1.19 */
211 DEFINE_PACKET_CLASS(ClientboundBlockBreakAckPacket);
212#endif
214#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
215 DEFINE_PACKET_CLASS(ClientboundPlayerInfoPacket);
216#endif
220#if PROTOCOL_VERSION < 765 /* < 1.20.3 */
221 DEFINE_PACKET_CLASS(ClientboundResourcePackPacket);
222#endif
230#if PROTOCOL_VERSION < 770 /* < 1.21.5 */
231 DEFINE_PACKET_CLASS(ClientboundAddExperienceOrbPacket);
232#endif
233#if PROTOCOL_VERSION < 721 /* < 1.16 */
234 DEFINE_PACKET_CLASS(ClientboundAddGlobalEntityPacket);
235#endif
236#if PROTOCOL_VERSION < 759 /* < 1.19 */
237 DEFINE_PACKET_CLASS(ClientboundAddMobPacket);
238#endif
240#if PROTOCOL_VERSION < 759 /* < 1.19 */
241 DEFINE_PACKET_CLASS(ClientboundAddPaintingPacket);
242#endif
243#if PROTOCOL_VERSION < 764 /* < 1.20.2 */
244 DEFINE_PACKET_CLASS(ClientboundAddPlayerPacket);
245#endif
248#if PROTOCOL_VERSION > 342 /* > 1.12.2 */
250#endif
251#if PROTOCOL_VERSION > 348 /* > 1.12.2 */
253#endif
256#if PROTOCOL_VERSION < 755 /* < 1.17 */
257 DEFINE_PACKET_CLASS(ClientboundSetTitlesPacket);
258#endif
259#if PROTOCOL_VERSION < 461 /* < 1.14 */
260 DEFINE_PACKET_CLASS(ClientboundUseBedPacket);
261#endif
262#if PROTOCOL_VERSION > 451 /* > 1.13.2 */
264#endif
265#if PROTOCOL_VERSION < 768 /* < 1.21.2 */
266 DEFINE_PACKET_CLASS(ClientboundRecipePacket);
267#endif
269#if PROTOCOL_VERSION > 471 /* > 1.13.2 */
272#endif
277#if PROTOCOL_VERSION < 768 /* < 1.21.2 */
278 DEFINE_PACKET_CLASS(ClientboundSetCarriedItemPacket);
279#endif
280#if PROTOCOL_VERSION < 755 /* < 1.17 */
281 DEFINE_PACKET_CLASS(ClientboundSetBorderPacket);
282#endif
283#if PROTOCOL_VERSION > 754 /* > 1.16.5 */
284#if PROTOCOL_VERSION < 759 /* < 1.19 */
285 DEFINE_PACKET_CLASS(ClientboundAddVibrationSignalPacket);
286#endif
302#endif
303#if PROTOCOL_VERSION > 756 /* > 1.17.1 */
306#endif
307#if PROTOCOL_VERSION > 758 /* > 1.18.2 */
309#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
310 DEFINE_PACKET_CLASS(ClientboundChatPreviewPacket);
311#endif
314#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
315 DEFINE_PACKET_CLASS(ClientboundSetDisplayChatPreviewPacket);
316#endif
318#endif
319#if PROTOCOL_VERSION > 759 /* > 1.19 */
322#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
323 DEFINE_PACKET_CLASS(ClientboundPlayerChatHeaderPacket);
324#endif
325#endif
326#if PROTOCOL_VERSION > 760 /* > 1.19.2 */
330#if PROTOCOL_VERSION < 764 /* < 1.20.2 */
332#endif
333#endif
334#if PROTOCOL_VERSION > 761 /* > 1.19.3 */
339#endif
340#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
345#endif
346#if PROTOCOL_VERSION > 764 /* > 1.20.2 */
352#endif
353#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
359#endif
360#if PROTOCOL_VERSION > 766 /* > 1.20.6 */
363#endif
364#if PROTOCOL_VERSION > 767 /* > 1.21.1 */
374#endif
375#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
377#endif
378#if PROTOCOL_VERSION > 770 /* > 1.21.5 */
382#endif
383#if PROTOCOL_VERSION > 772 /* > 1.21.8 */
389#endif
390
391
392 // Explicit instantiation for each serverbound packet class
393 // Handshaking serverbound
395
396 // Login serverbound
397#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
399#endif
400#if PROTOCOL_VERSION > 340 /* > 1.12.2 */ && PROTOCOL_VERSION < 764 /* < 1.20.2 */
401 DEFINE_PACKET_CLASS(ServerboundCustomQueryPacket);
402#endif
405#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
408#endif
409
410 // Status serverbound
413
414#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
415 // Configuration serverbound
417#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
420#endif
426#if PROTOCOL_VERSION > 770 /* > 1.21.5 */
428#endif
429#if PROTOCOL_VERSION > 772 /* > 1.21.8 */
431#endif
432#endif
433
434 // Play serverbound
439#if PROTOCOL_VERSION > 476 /* > 1.13.2 */
441#endif
445#if PROTOCOL_VERSION < 755 /* < 1.17 */
446 DEFINE_PACKET_CLASS(ServerboundContainerAckPacket);
447#endif
450#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
452#endif
453#if PROTOCOL_VERSION < 476 /* < 1.14 */
454 DEFINE_PACKET_CLASS(ServerboundEnchantItemPacket);
455#endif
457#if PROTOCOL_VERSION > 711 /* > 1.15.2 */
459#endif
463#if PROTOCOL_VERSION > 463 /* > 1.13.2 */
465#endif
466#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
468#endif
469#if PROTOCOL_VERSION > 768 /* > 1.21.3 */
472#endif
473#if PROTOCOL_VERSION > 385 /* > 1.12.2 */ && PROTOCOL_VERSION < 769 /* < 1.21.4 */
474 DEFINE_PACKET_CLASS(ServerboundPickItemPacket);
475#endif
480#if PROTOCOL_VERSION > 754 /* > 1.16.5 */
482#endif
483#if PROTOCOL_VERSION < 755 /* < 1.17 */
484 DEFINE_PACKET_CLASS(ServerboundMovePlayerPacket);
485#endif
489#if PROTOCOL_VERSION > 388 /* > 1.12.2 */
492#endif
493#if PROTOCOL_VERSION > 736 /* > 1.16.1 */
496#else
497 DEFINE_PACKET_CLASS(ServerboundRecipeBookUpdatePacket);
498#endif
500#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
503#endif
504#if PROTOCOL_VERSION > 463 /* > 1.13.2 */
506#endif
510#if PROTOCOL_VERSION > 768 /* > 1.21.3 */
512#endif
513#if PROTOCOL_VERSION > 754 /* > 1.16.5 */
515#endif
518#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
521#endif
522#if PROTOCOL_VERSION > 471 /* > 1.13.2 */
524#endif
526#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
528#endif
531#if PROTOCOL_VERSION > 758 /* > 1.18.2 */
533#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
534 DEFINE_PACKET_CLASS(ServerboundChatPreviewPacket);
535#endif
536#endif
537#if PROTOCOL_VERSION > 759 /* > 1.19 */
539#endif
540#if PROTOCOL_VERSION > 760 /* > 1.19.2 */
542#endif
543#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
547#endif
548#if PROTOCOL_VERSION > 764 /* > 1.20.2 */
550#endif
551#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
554#endif
555#if PROTOCOL_VERSION > 765 /* > 1.20.4 */ && PROTOCOL_VERSION < 773 /* < 1.21.9 */
556 DEFINE_PACKET_CLASS(ServerboundDebugSampleSubscriptionPacket);
557#endif
558#if PROTOCOL_VERSION > 772 /* > 1.21.8 */
560#endif
561#if PROTOCOL_VERSION > 767 /* > 1.21.1 */
564#endif
565#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
568#endif
569#if PROTOCOL_VERSION > 770 /* > 1.21.5 */
572#endif
573}
#define DEFINE_PACKET_CLASS(ClassName)
virtual void DispatchImpl(Handler *handler) override
virtual int GetId() const override