Botcraft 1.21.4
Loading...
Searching...
No Matches
BaseMessage.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, AllClientboundPlayMessages>)
14 {
15 return Internal::get_tuple_index<TDerived, AllClientboundPlayMessages>;
16 }
17 else if constexpr (Internal::tuple_contains_type<TDerived, AllServerboundPlayMessages>)
18 {
19 return Internal::get_tuple_index<TDerived, AllServerboundPlayMessages>;
20 }
21 else if constexpr (Internal::tuple_contains_type<TDerived, AllClientboundStatusMessages>)
22 {
23 return Internal::get_tuple_index<TDerived, AllClientboundStatusMessages>;
24 }
25 else if constexpr (Internal::tuple_contains_type<TDerived, AllServerboundStatusMessages>)
26 {
27 return Internal::get_tuple_index<TDerived, AllServerboundStatusMessages>;
28 }
29 else if constexpr (Internal::tuple_contains_type<TDerived, AllClientboundLoginMessages>)
30 {
31 return Internal::get_tuple_index<TDerived, AllClientboundLoginMessages>;
32 }
33 else if constexpr (Internal::tuple_contains_type<TDerived, AllServerboundLoginMessages>)
34 {
35 return Internal::get_tuple_index<TDerived, AllServerboundLoginMessages>;
36 }
37 else if constexpr (Internal::tuple_contains_type<TDerived, AllServerboundHandshakingMessages>)
38 {
39 return Internal::get_tuple_index<TDerived, AllServerboundHandshakingMessages>;
40 }
41#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
42 else if constexpr (Internal::tuple_contains_type<TDerived, AllServerboundConfigurationMessages>)
43 {
44 return Internal::get_tuple_index<TDerived, AllServerboundConfigurationMessages>;
45 }
46 else if constexpr (Internal::tuple_contains_type<TDerived, AllClientboundConfigurationMessages>)
47 {
48 return Internal::get_tuple_index<TDerived, AllClientboundConfigurationMessages>;
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 message 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_MESSAGE_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_MESSAGE_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_MESSAGE_CLASS(ClientboundPlayerCombatPacket);
127#endif
128#if PROTOCOL_VERSION == 755 /* 1.17 */
129 DEFINE_MESSAGE_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_MESSAGE_CLASS(ClientboundContainerAckPacket);
147#endif
154#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
155 DEFINE_MESSAGE_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_MESSAGE_CLASS(ClientboundLevelChunkPacket);
169#endif
172#if PROTOCOL_VERSION < 755 /* < 1.17 */
173 DEFINE_MESSAGE_CLASS(ClientboundMoveEntityPacket);
174#endif
184#if PROTOCOL_VERSION > 450 /* > 1.13.2 */
186#endif
196#if PROTOCOL_VERSION < 759 /* < 1.19 */
197 DEFINE_MESSAGE_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_MESSAGE_CLASS(ClientboundBlockBreakAckPacket);
205#endif
207#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
208 DEFINE_MESSAGE_CLASS(ClientboundPlayerInfoPacket);
209#endif
213#if PROTOCOL_VERSION < 765 /* < 1.20.3 */
214 DEFINE_MESSAGE_CLASS(ClientboundResourcePackPacket);
215#endif
224#if PROTOCOL_VERSION < 721 /* < 1.16 */
225 DEFINE_MESSAGE_CLASS(ClientboundAddGlobalEntityPacket);
226#endif
227#if PROTOCOL_VERSION < 759 /* < 1.19 */
228 DEFINE_MESSAGE_CLASS(ClientboundAddMobPacket);
229#endif
231#if PROTOCOL_VERSION < 759 /* < 1.19 */
232 DEFINE_MESSAGE_CLASS(ClientboundAddPaintingPacket);
233#endif
234#if PROTOCOL_VERSION < 764 /* < 1.20.2 */
235 DEFINE_MESSAGE_CLASS(ClientboundAddPlayerPacket);
236#endif
239#if PROTOCOL_VERSION > 342 /* > 1.12.2 */
241#endif
242#if PROTOCOL_VERSION > 348 /* > 1.12.2 */
244#endif
247#if PROTOCOL_VERSION < 755 /* < 1.17 */
248 DEFINE_MESSAGE_CLASS(ClientboundSetTitlesPacket);
249#endif
250#if PROTOCOL_VERSION < 461 /* < 1.14 */
251 DEFINE_MESSAGE_CLASS(ClientboundUseBedPacket);
252#endif
253#if PROTOCOL_VERSION > 451 /* > 1.13.2 */
255#endif
256#if PROTOCOL_VERSION < 768 /* < 1.21.2 */
257 DEFINE_MESSAGE_CLASS(ClientboundRecipePacket);
258#endif
260#if PROTOCOL_VERSION > 471 /* > 1.13.2 */
263#endif
268#if PROTOCOL_VERSION < 768 /* < 1.21.2 */
269 DEFINE_MESSAGE_CLASS(ClientboundSetCarriedItemPacket);
270#endif
271#if PROTOCOL_VERSION < 755 /* < 1.17 */
272 DEFINE_MESSAGE_CLASS(ClientboundSetBorderPacket);
273#endif
274#if PROTOCOL_VERSION > 754 /* > 1.16.5 */
275#if PROTOCOL_VERSION < 759 /* < 1.19 */
276 DEFINE_MESSAGE_CLASS(ClientboundAddVibrationSignalPacket);
277#endif
293#endif
294#if PROTOCOL_VERSION > 756 /* > 1.17.1 */
297#endif
298#if PROTOCOL_VERSION > 758 /* > 1.18.2 */
300#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
301 DEFINE_MESSAGE_CLASS(ClientboundChatPreviewPacket);
302#endif
305#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
306 DEFINE_MESSAGE_CLASS(ClientboundSetDisplayChatPreviewPacket);
307#endif
309#endif
310#if PROTOCOL_VERSION > 759 /* > 1.19 */
313#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
314 DEFINE_MESSAGE_CLASS(ClientboundPlayerChatHeaderPacket);
315#endif
316#endif
317#if PROTOCOL_VERSION > 760 /* > 1.19.2 */
321#if PROTOCOL_VERSION < 764 /* < 1.20.2 */
323#endif
324#endif
325#if PROTOCOL_VERSION > 761 /* > 1.19.3 */
330#endif
331#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
336#endif
337#if PROTOCOL_VERSION > 764 /* > 1.20.2 */
343#endif
344#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
350#endif
351#if PROTOCOL_VERSION > 766 /* > 1.20.6 */
354#endif
355#if PROTOCOL_VERSION > 767 /* > 1.21.1 */
365#endif
366
367
368 // Explicit instantiation for each serverbound message class
369 // Handshaking serverbound
371
372 // Login serverbound
373#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
375#endif
376#if PROTOCOL_VERSION > 340 /* > 1.12.2 */ && PROTOCOL_VERSION < 764 /* < 1.20.2 */
377 DEFINE_MESSAGE_CLASS(ServerboundCustomQueryPacket);
378#endif
381#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
384#endif
385
386 // Status serverbound
389
390#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
391 // Configuration serverbound
393#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
396#endif
402#endif
403
404 // Play serverbound
409#if PROTOCOL_VERSION > 476 /* > 1.13.2 */
411#endif
415#if PROTOCOL_VERSION < 755 /* < 1.17 */
416 DEFINE_MESSAGE_CLASS(ServerboundContainerAckPacket);
417#endif
420#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
422#endif
423#if PROTOCOL_VERSION < 476 /* < 1.14 */
424 DEFINE_MESSAGE_CLASS(ServerboundEnchantItemPacket);
425#endif
427#if PROTOCOL_VERSION > 711 /* > 1.15.2 */
429#endif
433#if PROTOCOL_VERSION > 463 /* > 1.13.2 */
435#endif
436#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
438#endif
439#if PROTOCOL_VERSION > 768 /* > 1.21.3 */
442#endif
443#if PROTOCOL_VERSION > 385 /* > 1.12.2 */ && PROTOCOL_VERSION < 769 /* < 1.21.4 */
444 DEFINE_MESSAGE_CLASS(ServerboundPickItemPacket);
445#endif
450#if PROTOCOL_VERSION > 754 /* > 1.16.5 */
452#endif
453#if PROTOCOL_VERSION < 755 /* < 1.17 */
454 DEFINE_MESSAGE_CLASS(ServerboundMovePlayerPacket);
455#endif
459#if PROTOCOL_VERSION > 388 /* > 1.12.2 */
462#endif
463#if PROTOCOL_VERSION > 736 /* > 1.16.1 */
466#else
467 DEFINE_MESSAGE_CLASS(ServerboundRecipeBookUpdatePacket);
468#endif
470#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
473#endif
474#if PROTOCOL_VERSION > 463 /* > 1.13.2 */
476#endif
480#if PROTOCOL_VERSION > 768 /* > 1.21.3 */
482#endif
483#if PROTOCOL_VERSION > 754 /* > 1.16.5 */
485#endif
488#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
491#endif
492#if PROTOCOL_VERSION > 471 /* > 1.13.2 */
494#endif
496#if PROTOCOL_VERSION > 385 /* > 1.12.2 */
498#endif
501#if PROTOCOL_VERSION > 758 /* > 1.18.2 */
503#if PROTOCOL_VERSION < 761 /* < 1.19.3 */
504 DEFINE_MESSAGE_CLASS(ServerboundChatPreviewPacket);
505#endif
506#endif
507#if PROTOCOL_VERSION > 759 /* > 1.19 */
509#endif
510#if PROTOCOL_VERSION > 760 /* > 1.19.2 */
512#endif
513#if PROTOCOL_VERSION > 763 /* > 1.20.1 */
517#endif
518#if PROTOCOL_VERSION > 764 /* > 1.20.2 */
520#endif
521#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
525#endif
526#if PROTOCOL_VERSION > 767 /* > 1.21.1 */
529#endif
530}
#define DEFINE_MESSAGE_CLASS(ClassName)
virtual int GetId() const override
virtual void DispatchImpl(Handler *handler) override