Botcraft 1.21.5
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#endif
114
115 // Play clientbound
125#if PROTOCOL_VERSION < 755 /* < 1.17 */
126 DEFINE_PACKET_CLASS(ClientboundPlayerCombatPacket);
127#endif
128#if PROTOCOL_VERSION == 755 /* 1.17 */
129 DEFINE_PACKET_CLASS(ClientboundRemoveEntityPacket);
130#else
132#endif
133#if PROTOCOL_VERSION > 345 /* > 1.12.2 */
135#endif
136#if PROTOCOL_VERSION > 347 /* > 1.12.2 */
138#endif
139#if PROTOCOL_VERSION > 351 /* > 1.12.2 */
141#endif
145#if PROTOCOL_VERSION < 755 /* < 1.17 */
146 DEFINE_PACKET_CLASS(ClientboundContainerAckPacket);
147#endif
154#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
155 DEFINE_PACKET_CLASS(ClientboundCustomSoundPacket);
156#endif
157#if PROTOCOL_VERSION > 388 /* > 1.12.2 */
159#endif
161#if PROTOCOL_VERSION > 451 /* > 1.13.2 */
163#endif
164#if PROTOCOL_VERSION > 450 /* > 1.13.2 */
166#endif
167#if PROTOCOL_VERSION < 757 /* < 1.18 */
168 DEFINE_PACKET_CLASS(ClientboundLevelChunkPacket);
169#endif
172#if PROTOCOL_VERSION < 755 /* < 1.17 */
173 DEFINE_PACKET_CLASS(ClientboundMoveEntityPacket);
174#endif
184#if PROTOCOL_VERSION > 450 /* > 1.13.2 */
186#endif
196#if PROTOCOL_VERSION < 759 /* < 1.19 */
197 DEFINE_PACKET_CLASS(ClientboundChatPacket);
198#endif
200#if PROTOCOL_VERSION > 404 /* > 1.13.2 */
202#endif
203#if PROTOCOL_VERSION > 493 /* > 1.14.3 */ && PROTOCOL_VERSION < 759 /* < 1.19 */
204 DEFINE_PACKET_CLASS(ClientboundBlockBreakAckPacket);
205#endif
207#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
208 DEFINE_PACKET_CLASS(ClientboundPlayerInfoPacket);
209#endif
213#if PROTOCOL_VERSION < 765 /* < 1.20.3 */
214 DEFINE_PACKET_CLASS(ClientboundResourcePackPacket);
215#endif
223#if PROTOCOL_VERSION < 770 /* < 1.21.5 */
224 DEFINE_PACKET_CLASS(ClientboundAddExperienceOrbPacket);
225#endif
226#if PROTOCOL_VERSION < 721 /* < 1.16 */
227 DEFINE_PACKET_CLASS(ClientboundAddGlobalEntityPacket);
228#endif
229#if PROTOCOL_VERSION < 759 /* < 1.19 */
230 DEFINE_PACKET_CLASS(ClientboundAddMobPacket);
231#endif
233#if PROTOCOL_VERSION < 759 /* < 1.19 */
234 DEFINE_PACKET_CLASS(ClientboundAddPaintingPacket);
235#endif
236#if PROTOCOL_VERSION < 764 /* < 1.20.2 */
237 DEFINE_PACKET_CLASS(ClientboundAddPlayerPacket);
238#endif
241#if PROTOCOL_VERSION > 342 /* > 1.12.2 */
243#endif
244#if PROTOCOL_VERSION > 348 /* > 1.12.2 */
246#endif
249#if PROTOCOL_VERSION < 755 /* < 1.17 */
250 DEFINE_PACKET_CLASS(ClientboundSetTitlesPacket);
251#endif
252#if PROTOCOL_VERSION < 461 /* < 1.14 */
253 DEFINE_PACKET_CLASS(ClientboundUseBedPacket);
254#endif
255#if PROTOCOL_VERSION > 451 /* > 1.13.2 */
257#endif
258#if PROTOCOL_VERSION < 768 /* < 1.21.2 */
259 DEFINE_PACKET_CLASS(ClientboundRecipePacket);
260#endif
262#if PROTOCOL_VERSION > 471 /* > 1.13.2 */
265#endif
270#if PROTOCOL_VERSION < 768 /* < 1.21.2 */
271 DEFINE_PACKET_CLASS(ClientboundSetCarriedItemPacket);
272#endif
273#if PROTOCOL_VERSION < 755 /* < 1.17 */
274 DEFINE_PACKET_CLASS(ClientboundSetBorderPacket);
275#endif
276#if PROTOCOL_VERSION > 754 /* > 1.16.5 */
277#if PROTOCOL_VERSION < 759 /* < 1.19 */
278 DEFINE_PACKET_CLASS(ClientboundAddVibrationSignalPacket);
279#endif
295#endif
296#if PROTOCOL_VERSION > 756 /* > 1.17.1 */
299#endif
300#if PROTOCOL_VERSION > 758 /* > 1.18.2 */
302#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
303 DEFINE_PACKET_CLASS(ClientboundChatPreviewPacket);
304#endif
307#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
308 DEFINE_PACKET_CLASS(ClientboundSetDisplayChatPreviewPacket);
309#endif
311#endif
312#if PROTOCOL_VERSION > 759 /* > 1.19 */
315#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
316 DEFINE_PACKET_CLASS(ClientboundPlayerChatHeaderPacket);
317#endif
318#endif
319#if PROTOCOL_VERSION > 760 /* > 1.19.2 */
323#if PROTOCOL_VERSION < 764 /* < 1.20.2 */
325#endif
326#endif
327#if PROTOCOL_VERSION > 761 /* > 1.19.3 */
332#endif
333#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
338#endif
339#if PROTOCOL_VERSION > 764 /* > 1.20.2 */
345#endif
346#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
352#endif
353#if PROTOCOL_VERSION > 766 /* > 1.20.6 */
356#endif
357#if PROTOCOL_VERSION > 767 /* > 1.21.1 */
367#endif
368#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
370#endif
371
372
373 // Explicit instantiation for each serverbound packet class
374 // Handshaking serverbound
376
377 // Login serverbound
378#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
380#endif
381#if PROTOCOL_VERSION > 340 /* > 1.12.2 */ && PROTOCOL_VERSION < 764 /* < 1.20.2 */
382 DEFINE_PACKET_CLASS(ServerboundCustomQueryPacket);
383#endif
386#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
389#endif
390
391 // Status serverbound
394
395#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
396 // Configuration serverbound
398#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
401#endif
407#endif
408
409 // Play serverbound
414#if PROTOCOL_VERSION > 476 /* > 1.13.2 */
416#endif
420#if PROTOCOL_VERSION < 755 /* < 1.17 */
421 DEFINE_PACKET_CLASS(ServerboundContainerAckPacket);
422#endif
425#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
427#endif
428#if PROTOCOL_VERSION < 476 /* < 1.14 */
429 DEFINE_PACKET_CLASS(ServerboundEnchantItemPacket);
430#endif
432#if PROTOCOL_VERSION > 711 /* > 1.15.2 */
434#endif
438#if PROTOCOL_VERSION > 463 /* > 1.13.2 */
440#endif
441#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
443#endif
444#if PROTOCOL_VERSION > 768 /* > 1.21.3 */
447#endif
448#if PROTOCOL_VERSION > 385 /* > 1.12.2 */ && PROTOCOL_VERSION < 769 /* < 1.21.4 */
449 DEFINE_PACKET_CLASS(ServerboundPickItemPacket);
450#endif
455#if PROTOCOL_VERSION > 754 /* > 1.16.5 */
457#endif
458#if PROTOCOL_VERSION < 755 /* < 1.17 */
459 DEFINE_PACKET_CLASS(ServerboundMovePlayerPacket);
460#endif
464#if PROTOCOL_VERSION > 388 /* > 1.12.2 */
467#endif
468#if PROTOCOL_VERSION > 736 /* > 1.16.1 */
471#else
472 DEFINE_PACKET_CLASS(ServerboundRecipeBookUpdatePacket);
473#endif
475#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
478#endif
479#if PROTOCOL_VERSION > 463 /* > 1.13.2 */
481#endif
485#if PROTOCOL_VERSION > 768 /* > 1.21.3 */
487#endif
488#if PROTOCOL_VERSION > 754 /* > 1.16.5 */
490#endif
493#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
496#endif
497#if PROTOCOL_VERSION > 471 /* > 1.13.2 */
499#endif
501#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
503#endif
506#if PROTOCOL_VERSION > 758 /* > 1.18.2 */
508#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
509 DEFINE_PACKET_CLASS(ServerboundChatPreviewPacket);
510#endif
511#endif
512#if PROTOCOL_VERSION > 759 /* > 1.19 */
514#endif
515#if PROTOCOL_VERSION > 760 /* > 1.19.2 */
517#endif
518#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
522#endif
523#if PROTOCOL_VERSION > 764 /* > 1.20.2 */
525#endif
526#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
530#endif
531#if PROTOCOL_VERSION > 767 /* > 1.21.1 */
534#endif
535#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
538#endif
539}
#define DEFINE_PACKET_CLASS(ClassName)
virtual void DispatchImpl(Handler *handler) override
virtual int GetId() const override