1#![allow(
9 unused_imports,
10 unused_variables,
11 unused_mut,
12 unused_parens,
13 unused_braces,
14 clippy::all,
15 clippy::pedantic,
16 non_camel_case_types,
17 non_snake_case
18)]
19use crate::codec::{Decode, DecodeResult, Encode, EncodeResult, McWrite, Reader, decode_exact};
20use crate::error::{DecodeError, EncodeError};
21use crate::nbt::{AnonNbt, RawNbt};
22use crate::packet::{Direction, PacketSet, RawPacket, State};
23#[cfg(feature = "testgen")]
24use crate::testgen::{Gen, Generate};
25use crate::types::{BlockPos, ByteString, Holder, HolderSet, LpVec3, PositionLayout, Uuid};
26use bytes::{BufMut, Bytes, BytesMut};
27
28#[cfg(feature = "v26_1")]
29#[derive(Debug, Clone, PartialEq)]
31pub struct CookieRequest<const V: i32> {
32 pub cookie: ByteString,
34}
35#[cfg(feature = "v26_1")]
36impl<const V: i32> Decode for CookieRequest<V> {
37 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
38 Ok({
39 let v1 = r.read_string()?;
40 Self { cookie: v1 }
41 })
42 }
43}
44#[cfg(feature = "v26_1")]
45impl<const V: i32> Encode for CookieRequest<V> {
46 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
47 w.put_string(&(*self).cookie)?;
48 Ok(())
49 }
50}
51#[cfg(feature = "v26_1")]
52#[cfg(feature = "testgen")]
53impl<const V: i32> Generate for CookieRequest<V> {
54 fn generate(g: &mut Gen) -> Self {
55 {
56 let v1 = g.string();
57 Self { cookie: v1 }
58 }
59 }
60}
61
62#[cfg(feature = "v26_1")]
63#[derive(Debug, Clone, PartialEq)]
65pub struct CustomPayload<const V: i32> {
66 pub channel: ByteString,
68 pub data: Bytes,
70}
71#[cfg(feature = "v26_1")]
72impl<const V: i32> Decode for CustomPayload<V> {
73 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
74 Ok({
75 let v1 = r.read_string()?;
76 let v2 = r.read_rest();
77 Self {
78 channel: v1,
79 data: v2,
80 }
81 })
82 }
83}
84#[cfg(feature = "v26_1")]
85impl<const V: i32> Encode for CustomPayload<V> {
86 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
87 w.put_string(&(*self).channel)?;
88 w.put_slice(&(*self).data);
89 Ok(())
90 }
91}
92#[cfg(feature = "v26_1")]
93#[cfg(feature = "testgen")]
94impl<const V: i32> Generate for CustomPayload<V> {
95 fn generate(g: &mut Gen) -> Self {
96 {
97 let v1 = g.string();
98 let v2 = g.bytes();
99 Self {
100 channel: v1,
101 data: v2,
102 }
103 }
104 }
105}
106
107#[cfg(feature = "v26_1")]
108#[derive(Debug, Clone, PartialEq)]
110pub struct Disconnect<const V: i32> {
111 pub reason: AnonNbt,
113}
114#[cfg(feature = "v26_1")]
115impl<const V: i32> Decode for Disconnect<V> {
116 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
117 Ok({
118 let v1 = AnonNbt::read(r)?;
119 Self { reason: v1 }
120 })
121 }
122}
123#[cfg(feature = "v26_1")]
124impl<const V: i32> Encode for Disconnect<V> {
125 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
126 (*self).reason.write(w);
127 Ok(())
128 }
129}
130#[cfg(feature = "v26_1")]
131#[cfg(feature = "testgen")]
132impl<const V: i32> Generate for Disconnect<V> {
133 fn generate(g: &mut Gen) -> Self {
134 {
135 let v1 = g.anon_nbt();
136 Self { reason: v1 }
137 }
138 }
139}
140
141#[cfg(feature = "v26_1")]
142#[derive(Debug, Clone, PartialEq)]
144pub struct FinishConfiguration<const V: i32> {}
145#[cfg(feature = "v26_1")]
146impl<const V: i32> Decode for FinishConfiguration<V> {
147 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
148 Ok({ Self {} })
149 }
150}
151#[cfg(feature = "v26_1")]
152impl<const V: i32> Encode for FinishConfiguration<V> {
153 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
154 Ok(())
155 }
156}
157#[cfg(feature = "v26_1")]
158#[cfg(feature = "testgen")]
159impl<const V: i32> Generate for FinishConfiguration<V> {
160 fn generate(g: &mut Gen) -> Self {
161 { Self {} }
162 }
163}
164
165#[cfg(feature = "v26_1")]
166#[derive(Debug, Clone, PartialEq)]
168pub struct KeepAlive<const V: i32> {
169 pub keep_alive_id: i64,
171}
172#[cfg(feature = "v26_1")]
173impl<const V: i32> Decode for KeepAlive<V> {
174 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
175 Ok({
176 let v1 = r.read_i64()?;
177 Self { keep_alive_id: v1 }
178 })
179 }
180}
181#[cfg(feature = "v26_1")]
182impl<const V: i32> Encode for KeepAlive<V> {
183 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
184 w.put_i64((*self).keep_alive_id);
185 Ok(())
186 }
187}
188#[cfg(feature = "v26_1")]
189#[cfg(feature = "testgen")]
190impl<const V: i32> Generate for KeepAlive<V> {
191 fn generate(g: &mut Gen) -> Self {
192 {
193 let v1 = g.i64();
194 Self { keep_alive_id: v1 }
195 }
196 }
197}
198
199#[cfg(feature = "v26_1")]
200#[derive(Debug, Clone, PartialEq)]
202pub struct Ping<const V: i32> {
203 pub id: i32,
205}
206#[cfg(feature = "v26_1")]
207impl<const V: i32> Decode for Ping<V> {
208 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
209 Ok({
210 let v1 = r.read_i32()?;
211 Self { id: v1 }
212 })
213 }
214}
215#[cfg(feature = "v26_1")]
216impl<const V: i32> Encode for Ping<V> {
217 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
218 w.put_i32((*self).id);
219 Ok(())
220 }
221}
222#[cfg(feature = "v26_1")]
223#[cfg(feature = "testgen")]
224impl<const V: i32> Generate for Ping<V> {
225 fn generate(g: &mut Gen) -> Self {
226 {
227 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
228 Self { id: v1 }
229 }
230 }
231}
232
233#[cfg(feature = "v26_1")]
234#[derive(Debug, Clone, PartialEq)]
236pub struct ResetChat<const V: i32> {}
237#[cfg(feature = "v26_1")]
238impl<const V: i32> Decode for ResetChat<V> {
239 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
240 Ok({ Self {} })
241 }
242}
243#[cfg(feature = "v26_1")]
244impl<const V: i32> Encode for ResetChat<V> {
245 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
246 Ok(())
247 }
248}
249#[cfg(feature = "v26_1")]
250#[cfg(feature = "testgen")]
251impl<const V: i32> Generate for ResetChat<V> {
252 fn generate(g: &mut Gen) -> Self {
253 { Self {} }
254 }
255}
256
257#[cfg(feature = "v26_1")]
258#[derive(Debug, Clone, PartialEq)]
260pub struct RegistryDataEntries {
261 pub key: ByteString,
263 pub value: Option<AnonNbt>,
265}
266
267#[cfg(feature = "v26_1")]
268#[derive(Debug, Clone, PartialEq)]
270pub struct RegistryData<const V: i32> {
271 pub id: ByteString,
273 pub entries: Vec<crate::defs::p775::configuration::clientbound::RegistryDataEntries>,
275}
276#[cfg(feature = "v26_1")]
277impl<const V: i32> Decode for RegistryData<V> {
278 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
279 Ok({
280 let v1 = r.read_string()?;
281 let v2 = {
282 let v3 = {
283 let c = r.read_varint()?;
284 r.check_count(i64::from(c), 2)?
285 };
286 let mut v4 = Vec::with_capacity(v3.min(crate::codec::PREALLOC_LIMIT));
287 for _ in 0..v3 {
288 v4.push({
289 let v5 = r.read_string()?;
290 let v6 = if r.read_bool()? {
291 Some(AnonNbt::read(r)?)
292 } else {
293 None
294 };
295 crate::defs::p775::configuration::clientbound::RegistryDataEntries {
296 key: v5,
297 value: v6,
298 }
299 });
300 }
301 v4
302 };
303 Self {
304 id: v1,
305 entries: v2,
306 }
307 })
308 }
309}
310#[cfg(feature = "v26_1")]
311impl<const V: i32> Encode for RegistryData<V> {
312 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
313 w.put_string(&(*self).id)?;
314 w.put_len_varint((*self).entries.len())?;
315 for v1 in (*self).entries.iter() {
316 w.put_string(&(*v1).key)?;
317 match &(*v1).value {
318 Some(v2) => {
319 w.put_u8(1);
320 (*v2).write(w);
321 }
322 None => w.put_u8(0),
323 }
324 }
325 Ok(())
326 }
327}
328#[cfg(feature = "v26_1")]
329#[cfg(feature = "testgen")]
330impl<const V: i32> Generate for RegistryData<V> {
331 fn generate(g: &mut Gen) -> Self {
332 {
333 let v1 = g.string();
334 let v2 = {
335 let v3 = g.count();
336 let mut v4 = Vec::with_capacity(v3.min(crate::codec::PREALLOC_LIMIT));
337 for _ in 0..v3 {
338 v4.push({
339 let v5 = g.string();
340 let v6 = if g.bool() { Some(g.anon_nbt()) } else { None };
341 crate::defs::p775::configuration::clientbound::RegistryDataEntries {
342 key: v5,
343 value: v6,
344 }
345 });
346 }
347 v4
348 };
349 Self {
350 id: v1,
351 entries: v2,
352 }
353 }
354 }
355}
356
357#[cfg(feature = "v26_1")]
358#[derive(Debug, Clone, PartialEq)]
360pub struct RemoveResourcePack<const V: i32> {
361 pub uuid: Option<Uuid>,
363}
364#[cfg(feature = "v26_1")]
365impl<const V: i32> Decode for RemoveResourcePack<V> {
366 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
367 Ok({
368 let v1 = if r.read_bool()? {
369 Some(r.read_uuid()?)
370 } else {
371 None
372 };
373 Self { uuid: v1 }
374 })
375 }
376}
377#[cfg(feature = "v26_1")]
378impl<const V: i32> Encode for RemoveResourcePack<V> {
379 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
380 match &(*self).uuid {
381 Some(v1) => {
382 w.put_u8(1);
383 w.put_uuid(&(*v1));
384 }
385 None => w.put_u8(0),
386 }
387 Ok(())
388 }
389}
390#[cfg(feature = "v26_1")]
391#[cfg(feature = "testgen")]
392impl<const V: i32> Generate for RemoveResourcePack<V> {
393 fn generate(g: &mut Gen) -> Self {
394 {
395 let v1 = if g.bool() { Some(g.uuid()) } else { None };
396 Self { uuid: v1 }
397 }
398 }
399}
400
401#[cfg(feature = "v26_1")]
402#[derive(Debug, Clone, PartialEq)]
404pub struct AddResourcePack<const V: i32> {
405 pub uuid: Uuid,
407 pub url: ByteString,
409 pub hash: ByteString,
411 pub forced: bool,
413 pub prompt_message: Option<AnonNbt>,
415}
416#[cfg(feature = "v26_1")]
417impl<const V: i32> Decode for AddResourcePack<V> {
418 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
419 Ok({
420 let v1 = r.read_uuid()?;
421 let v2 = r.read_string()?;
422 let v3 = r.read_string()?;
423 let v4 = r.read_bool()?;
424 let v5 = if r.read_bool()? {
425 Some(AnonNbt::read(r)?)
426 } else {
427 None
428 };
429 Self {
430 uuid: v1,
431 url: v2,
432 hash: v3,
433 forced: v4,
434 prompt_message: v5,
435 }
436 })
437 }
438}
439#[cfg(feature = "v26_1")]
440impl<const V: i32> Encode for AddResourcePack<V> {
441 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
442 w.put_uuid(&(*self).uuid);
443 w.put_string(&(*self).url)?;
444 w.put_string(&(*self).hash)?;
445 w.put_bool((*self).forced);
446 match &(*self).prompt_message {
447 Some(v1) => {
448 w.put_u8(1);
449 (*v1).write(w);
450 }
451 None => w.put_u8(0),
452 }
453 Ok(())
454 }
455}
456#[cfg(feature = "v26_1")]
457#[cfg(feature = "testgen")]
458impl<const V: i32> Generate for AddResourcePack<V> {
459 fn generate(g: &mut Gen) -> Self {
460 {
461 let v1 = g.uuid();
462 let v2 = g.string();
463 let v3 = g.string();
464 let v4 = g.bool();
465 let v5 = if g.bool() { Some(g.anon_nbt()) } else { None };
466 Self {
467 uuid: v1,
468 url: v2,
469 hash: v3,
470 forced: v4,
471 prompt_message: v5,
472 }
473 }
474 }
475}
476
477#[cfg(feature = "v26_1")]
478#[derive(Debug, Clone, PartialEq)]
480pub struct StoreCookie<const V: i32> {
481 pub key: ByteString,
483 pub value: Bytes,
485}
486#[cfg(feature = "v26_1")]
487impl<const V: i32> Decode for StoreCookie<V> {
488 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
489 Ok({
490 let v1 = r.read_string()?;
491 let v2 = r.read_byte_array()?;
492 Self { key: v1, value: v2 }
493 })
494 }
495}
496#[cfg(feature = "v26_1")]
497impl<const V: i32> Encode for StoreCookie<V> {
498 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
499 w.put_string(&(*self).key)?;
500 w.put_byte_array(&(*self).value)?;
501 Ok(())
502 }
503}
504#[cfg(feature = "v26_1")]
505#[cfg(feature = "testgen")]
506impl<const V: i32> Generate for StoreCookie<V> {
507 fn generate(g: &mut Gen) -> Self {
508 {
509 let v1 = g.string();
510 let v2 = g.bytes();
511 Self { key: v1, value: v2 }
512 }
513 }
514}
515
516#[cfg(feature = "v26_1")]
517#[derive(Debug, Clone, PartialEq)]
519pub struct Transfer<const V: i32> {
520 pub host: ByteString,
522 pub port: i32,
524}
525#[cfg(feature = "v26_1")]
526impl<const V: i32> Decode for Transfer<V> {
527 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
528 Ok({
529 let v1 = r.read_string()?;
530 let v2 = r.read_varint()?;
531 Self { host: v1, port: v2 }
532 })
533 }
534}
535#[cfg(feature = "v26_1")]
536impl<const V: i32> Encode for Transfer<V> {
537 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
538 w.put_string(&(*self).host)?;
539 w.put_varint((*self).port);
540 Ok(())
541 }
542}
543#[cfg(feature = "v26_1")]
544#[cfg(feature = "testgen")]
545impl<const V: i32> Generate for Transfer<V> {
546 fn generate(g: &mut Gen) -> Self {
547 {
548 let v1 = g.string();
549 let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
550 Self { host: v1, port: v2 }
551 }
552 }
553}
554
555#[cfg(feature = "v26_1")]
556#[derive(Debug, Clone, PartialEq)]
558pub struct FeatureFlags<const V: i32> {
559 pub features: Vec<ByteString>,
561}
562#[cfg(feature = "v26_1")]
563impl<const V: i32> Decode for FeatureFlags<V> {
564 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
565 Ok({
566 let v1 = {
567 let v2 = {
568 let c = r.read_varint()?;
569 r.check_count(i64::from(c), 1)?
570 };
571 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
572 for _ in 0..v2 {
573 v3.push(r.read_string()?);
574 }
575 v3
576 };
577 Self { features: v1 }
578 })
579 }
580}
581#[cfg(feature = "v26_1")]
582impl<const V: i32> Encode for FeatureFlags<V> {
583 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
584 w.put_len_varint((*self).features.len())?;
585 for v1 in (*self).features.iter() {
586 w.put_string(&(*v1))?;
587 }
588 Ok(())
589 }
590}
591#[cfg(feature = "v26_1")]
592#[cfg(feature = "testgen")]
593impl<const V: i32> Generate for FeatureFlags<V> {
594 fn generate(g: &mut Gen) -> Self {
595 {
596 let v1 = {
597 let v2 = g.count();
598 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
599 for _ in 0..v2 {
600 v3.push(g.string());
601 }
602 v3
603 };
604 Self { features: v1 }
605 }
606 }
607}
608
609#[cfg(feature = "v26_1")]
610#[derive(Debug, Clone, PartialEq)]
612pub struct TagsTags {
613 pub tag_type: ByteString,
615 pub tags: Vec<crate::defs::p754::types::Tags>,
617}
618
619#[cfg(feature = "v26_1")]
620#[derive(Debug, Clone, PartialEq)]
622pub struct Tags<const V: i32> {
623 pub tags: Vec<crate::defs::p775::configuration::clientbound::TagsTags>,
625}
626#[cfg(feature = "v26_1")]
627impl<const V: i32> Decode for Tags<V> {
628 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
629 Ok({
630 let v1 = {
631 let v2 = {
632 let c = r.read_varint()?;
633 r.check_count(i64::from(c), 2)?
634 };
635 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
636 for _ in 0..v2 {
637 v3.push({
638 let v4 = r.read_string()?;
639 let v5 = {
640 let v6 = {
641 let c = r.read_varint()?;
642 r.check_count(i64::from(c), 2)?
643 };
644 let mut v7 = Vec::with_capacity(v6.min(crate::codec::PREALLOC_LIMIT));
645 for _ in 0..v6 {
646 v7.push({
647 let v8 = r.read_string()?;
648 let v9 = {
649 let v10 = {
650 let c = r.read_varint()?;
651 r.check_count(i64::from(c), 1)?
652 };
653 let mut v11 = Vec::with_capacity(
654 v10.min(crate::codec::PREALLOC_LIMIT),
655 );
656 for _ in 0..v10 {
657 v11.push(r.read_varint()?);
658 }
659 v11
660 };
661 crate::defs::p754::types::Tags {
662 tag_name: v8,
663 entries: v9,
664 }
665 });
666 }
667 v7
668 };
669 crate::defs::p775::configuration::clientbound::TagsTags {
670 tag_type: v4,
671 tags: v5,
672 }
673 });
674 }
675 v3
676 };
677 Self { tags: v1 }
678 })
679 }
680}
681#[cfg(feature = "v26_1")]
682impl<const V: i32> Encode for Tags<V> {
683 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
684 w.put_len_varint((*self).tags.len())?;
685 for v1 in (*self).tags.iter() {
686 w.put_string(&(*v1).tag_type)?;
687 w.put_len_varint((*v1).tags.len())?;
688 for v2 in (*v1).tags.iter() {
689 w.put_string(&(*v2).tag_name)?;
690 w.put_len_varint((*v2).entries.len())?;
691 for v3 in (*v2).entries.iter() {
692 w.put_varint((*v3));
693 }
694 }
695 }
696 Ok(())
697 }
698}
699#[cfg(feature = "v26_1")]
700#[cfg(feature = "testgen")]
701impl<const V: i32> Generate for Tags<V> {
702 fn generate(g: &mut Gen) -> Self {
703 {
704 let v1 = {
705 let v2 = g.count();
706 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
707 for _ in 0..v2 {
708 v3.push({
709 let v4 = g.string();
710 let v5 = {
711 let v6 = g.count();
712 let mut v7 = Vec::with_capacity(v6.min(crate::codec::PREALLOC_LIMIT));
713 for _ in 0..v6 {
714 v7.push({
715 let v8 = g.string();
716 let v9 = {
717 let v10 = g.count();
718 let mut v11 = Vec::with_capacity(
719 v10.min(crate::codec::PREALLOC_LIMIT),
720 );
721 for _ in 0..v10 {
722 v11.push(
723 (g.int_in(-2147483648, 2147483647, &[]) as i32),
724 );
725 }
726 v11
727 };
728 crate::defs::p754::types::Tags {
729 tag_name: v8,
730 entries: v9,
731 }
732 });
733 }
734 v7
735 };
736 crate::defs::p775::configuration::clientbound::TagsTags {
737 tag_type: v4,
738 tags: v5,
739 }
740 });
741 }
742 v3
743 };
744 Self { tags: v1 }
745 }
746 }
747}
748
749#[cfg(feature = "v26_1")]
750#[derive(Debug, Clone, PartialEq)]
752pub struct SelectKnownPacksPacks {
753 pub namespace: ByteString,
755 pub id: ByteString,
757 pub version: ByteString,
759}
760
761#[cfg(feature = "v26_1")]
762#[derive(Debug, Clone, PartialEq)]
764pub struct SelectKnownPacks<const V: i32> {
765 pub packs: Vec<crate::defs::p775::configuration::clientbound::SelectKnownPacksPacks>,
767}
768#[cfg(feature = "v26_1")]
769impl<const V: i32> Decode for SelectKnownPacks<V> {
770 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
771 Ok({
772 let v1 = {
773 let v2 = {
774 let c = r.read_varint()?;
775 r.check_count(i64::from(c), 3)?
776 };
777 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
778 for _ in 0..v2 {
779 v3.push({
780 let v4 = r.read_string()?;
781 let v5 = r.read_string()?;
782 let v6 = r.read_string()?;
783 crate::defs::p775::configuration::clientbound::SelectKnownPacksPacks {
784 namespace: v4,
785 id: v5,
786 version: v6,
787 }
788 });
789 }
790 v3
791 };
792 Self { packs: v1 }
793 })
794 }
795}
796#[cfg(feature = "v26_1")]
797impl<const V: i32> Encode for SelectKnownPacks<V> {
798 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
799 w.put_len_varint((*self).packs.len())?;
800 for v1 in (*self).packs.iter() {
801 w.put_string(&(*v1).namespace)?;
802 w.put_string(&(*v1).id)?;
803 w.put_string(&(*v1).version)?;
804 }
805 Ok(())
806 }
807}
808#[cfg(feature = "v26_1")]
809#[cfg(feature = "testgen")]
810impl<const V: i32> Generate for SelectKnownPacks<V> {
811 fn generate(g: &mut Gen) -> Self {
812 {
813 let v1 = {
814 let v2 = g.count();
815 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
816 for _ in 0..v2 {
817 v3.push({
818 let v4 = g.string();
819 let v5 = g.string();
820 let v6 = g.string();
821 crate::defs::p775::configuration::clientbound::SelectKnownPacksPacks {
822 namespace: v4,
823 id: v5,
824 version: v6,
825 }
826 });
827 }
828 v3
829 };
830 Self { packs: v1 }
831 }
832 }
833}
834
835#[cfg(feature = "v26_1")]
836#[derive(Debug, Clone, PartialEq)]
838pub struct CustomReportDetailsDetails {
839 pub key: ByteString,
841 pub value: ByteString,
843}
844
845#[cfg(feature = "v26_1")]
846#[derive(Debug, Clone, PartialEq)]
848pub struct CustomReportDetails<const V: i32> {
849 pub details: Vec<crate::defs::p775::configuration::clientbound::CustomReportDetailsDetails>,
851}
852#[cfg(feature = "v26_1")]
853impl<const V: i32> Decode for CustomReportDetails<V> {
854 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
855 Ok({
856 let v1 = {
857 let v2 = {
858 let c = r.read_varint()?;
859 r.check_count(i64::from(c), 2)?
860 };
861 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
862 for _ in 0..v2 {
863 v3.push({
864 let v4 = r.read_string()?;
865 let v5 = r.read_string()?;
866 crate::defs::p775::configuration::clientbound::CustomReportDetailsDetails {
867 key: v4,
868 value: v5,
869 }
870 });
871 }
872 v3
873 };
874 Self { details: v1 }
875 })
876 }
877}
878#[cfg(feature = "v26_1")]
879impl<const V: i32> Encode for CustomReportDetails<V> {
880 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
881 w.put_len_varint((*self).details.len())?;
882 for v1 in (*self).details.iter() {
883 w.put_string(&(*v1).key)?;
884 w.put_string(&(*v1).value)?;
885 }
886 Ok(())
887 }
888}
889#[cfg(feature = "v26_1")]
890#[cfg(feature = "testgen")]
891impl<const V: i32> Generate for CustomReportDetails<V> {
892 fn generate(g: &mut Gen) -> Self {
893 {
894 let v1 = {
895 let v2 = g.count();
896 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
897 for _ in 0..v2 {
898 v3.push({
899 let v4 = g.string();
900 let v5 = g.string();
901 crate::defs::p775::configuration::clientbound::CustomReportDetailsDetails {
902 key: v4,
903 value: v5,
904 }
905 });
906 }
907 v3
908 };
909 Self { details: v1 }
910 }
911 }
912}
913
914#[cfg(feature = "v26_1")]
915#[derive(Debug, Clone, PartialEq)]
917pub struct ServerLinksLinks {
918 pub has_known_type: bool,
920 pub known_type: Option<crate::defs::p775::types::ServerLinkType>,
922 pub unknown_type: Option<AnonNbt>,
924 pub link: ByteString,
926}
927
928#[cfg(feature = "v26_1")]
929#[derive(Debug, Clone, PartialEq)]
931pub struct ServerLinks<const V: i32> {
932 pub links: Vec<crate::defs::p775::configuration::clientbound::ServerLinksLinks>,
934}
935#[cfg(feature = "v26_1")]
936impl<const V: i32> Decode for ServerLinks<V> {
937 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
938 Ok({
939 let v1 = {
940 let v2 = {
941 let c = r.read_varint()?;
942 r.check_count(i64::from(c), 2)?
943 };
944 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
945 for _ in 0..v2 {
946 v3.push({
947 let v4 = r.read_bool()?;
948 let v5 = if v4 {
949 Some(crate::defs::p775::types::ServerLinkType(r.read_varint()?))
950 } else {
951 None
952 };
953 let v6 = if (!v4) { Some(AnonNbt::read(r)?) } else { None };
954 let v7 = r.read_string()?;
955 crate::defs::p775::configuration::clientbound::ServerLinksLinks {
956 has_known_type: v4,
957 known_type: v5,
958 unknown_type: v6,
959 link: v7,
960 }
961 });
962 }
963 v3
964 };
965 Self { links: v1 }
966 })
967 }
968}
969#[cfg(feature = "v26_1")]
970impl<const V: i32> Encode for ServerLinks<V> {
971 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
972 w.put_len_varint((*self).links.len())?;
973 for v1 in (*self).links.iter() {
974 w.put_bool((*v1).has_known_type);
975 match (&(*v1).known_type, (*v1).has_known_type) {
976 (Some(v2), true) => {
977 w.put_varint((*v2).0);
978 }
979 (None, false) => {}
980 _ => {
981 return Err(EncodeError::SwitchMismatch(
982 "configuration.clientbound.server_links.links.knownType",
983 ));
984 }
985 }
986 match (&(*v1).unknown_type, (!(*v1).has_known_type)) {
987 (Some(v3), true) => {
988 (*v3).write(w);
989 }
990 (None, false) => {}
991 _ => {
992 return Err(EncodeError::SwitchMismatch(
993 "configuration.clientbound.server_links.links.unknownType",
994 ));
995 }
996 }
997 w.put_string(&(*v1).link)?;
998 }
999 Ok(())
1000 }
1001}
1002#[cfg(feature = "v26_1")]
1003#[cfg(feature = "testgen")]
1004impl<const V: i32> Generate for ServerLinks<V> {
1005 fn generate(g: &mut Gen) -> Self {
1006 {
1007 let v1 = {
1008 let v2 = g.count();
1009 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
1010 for _ in 0..v2 {
1011 v3.push({
1012 let v4 = g.bool();
1013 let v5 = if v4 {
1014 Some(crate::defs::p775::types::ServerLinkType(g.int_in(
1015 -2147483648,
1016 2147483647,
1017 &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
1018 )
1019 as i32))
1020 } else {
1021 None
1022 };
1023 let v6 = if (!v4) { Some(g.anon_nbt()) } else { None };
1024 let v7 = g.string();
1025 crate::defs::p775::configuration::clientbound::ServerLinksLinks {
1026 has_known_type: v4,
1027 known_type: v5,
1028 unknown_type: v6,
1029 link: v7,
1030 }
1031 });
1032 }
1033 v3
1034 };
1035 Self { links: v1 }
1036 }
1037 }
1038}
1039
1040#[cfg(feature = "v26_1")]
1041#[derive(Debug, Clone, PartialEq)]
1043pub struct ClearDialog<const V: i32> {}
1044#[cfg(feature = "v26_1")]
1045impl<const V: i32> Decode for ClearDialog<V> {
1046 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1047 Ok({ Self {} })
1048 }
1049}
1050#[cfg(feature = "v26_1")]
1051impl<const V: i32> Encode for ClearDialog<V> {
1052 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1053 Ok(())
1054 }
1055}
1056#[cfg(feature = "v26_1")]
1057#[cfg(feature = "testgen")]
1058impl<const V: i32> Generate for ClearDialog<V> {
1059 fn generate(g: &mut Gen) -> Self {
1060 { Self {} }
1061 }
1062}
1063
1064#[cfg(feature = "v26_1")]
1065#[derive(Debug, Clone, PartialEq)]
1067pub struct ShowDialog<const V: i32> {
1068 pub dialog: AnonNbt,
1070}
1071#[cfg(feature = "v26_1")]
1072impl<const V: i32> Decode for ShowDialog<V> {
1073 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1074 Ok({
1075 let v1 = AnonNbt::read(r)?;
1076 Self { dialog: v1 }
1077 })
1078 }
1079}
1080#[cfg(feature = "v26_1")]
1081impl<const V: i32> Encode for ShowDialog<V> {
1082 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1083 (*self).dialog.write(w);
1084 Ok(())
1085 }
1086}
1087#[cfg(feature = "v26_1")]
1088#[cfg(feature = "testgen")]
1089impl<const V: i32> Generate for ShowDialog<V> {
1090 fn generate(g: &mut Gen) -> Self {
1091 {
1092 let v1 = g.anon_nbt();
1093 Self { dialog: v1 }
1094 }
1095 }
1096}
1097
1098#[cfg(feature = "v26_1")]
1099#[derive(Debug, Clone, PartialEq)]
1101pub struct CodeOfConduct<const V: i32> {
1102 pub contents: ByteString,
1104}
1105#[cfg(feature = "v26_1")]
1106impl<const V: i32> Decode for CodeOfConduct<V> {
1107 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1108 Ok({
1109 let v1 = r.read_string()?;
1110 Self { contents: v1 }
1111 })
1112 }
1113}
1114#[cfg(feature = "v26_1")]
1115impl<const V: i32> Encode for CodeOfConduct<V> {
1116 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1117 w.put_string(&(*self).contents)?;
1118 Ok(())
1119 }
1120}
1121#[cfg(feature = "v26_1")]
1122#[cfg(feature = "testgen")]
1123impl<const V: i32> Generate for CodeOfConduct<V> {
1124 fn generate(g: &mut Gen) -> Self {
1125 {
1126 let v1 = g.string();
1127 Self { contents: v1 }
1128 }
1129 }
1130}