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(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
31pub struct ChatTypeParameterType(pub i32);
32#[cfg(feature = "v26_1")]
33impl ChatTypeParameterType {
34 pub const CONTENT: Self = Self(0);
36 pub const SENDER: Self = Self(1);
38 pub const TARGET: Self = Self(2);
40 pub const fn name(self) -> Option<&'static str> {
42 match self.0 {
43 0 => Some("content"),
44 1 => Some("sender"),
45 2 => Some("target"),
46 _ => None,
47 }
48 }
49}
50#[cfg(feature = "v26_1")]
51impl std::fmt::Debug for ChatTypeParameterType {
52 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
53 match self.name() {
54 Some(n) => write!(f, "ChatTypeParameterType::{n}"),
55 None => write!(f, "ChatTypeParameterType({})", self.0),
56 }
57 }
58}
59
60#[cfg(feature = "v26_1")]
61#[derive(Debug, Clone, PartialEq)]
63pub struct ChatType {
64 pub translation_key: ByteString,
66 pub parameters: Vec<crate::defs::p775::play::clientbound::ChatTypeParameterType>,
68 pub style: AnonNbt,
70}
71#[cfg(feature = "v26_1")]
72impl Decode for ChatType {
73 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
74 Ok({
75 let v1 = r.read_string()?;
76 let v2 = {
77 let v3 = {
78 let c = r.read_varint()?;
79 r.check_count(i64::from(c), 1)?
80 };
81 let mut v4 = Vec::with_capacity(v3.min(crate::codec::PREALLOC_LIMIT));
82 for _ in 0..v3 {
83 v4.push(crate::defs::p775::play::clientbound::ChatTypeParameterType(
84 r.read_varint()?,
85 ));
86 }
87 v4
88 };
89 let v5 = AnonNbt::read(r)?;
90 Self {
91 translation_key: v1,
92 parameters: v2,
93 style: v5,
94 }
95 })
96 }
97}
98#[cfg(feature = "v26_1")]
99impl Encode for ChatType {
100 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
101 w.put_string(&(*self).translation_key)?;
102 w.put_len_varint((*self).parameters.len())?;
103 for v1 in (*self).parameters.iter() {
104 w.put_varint((*v1).0);
105 }
106 (*self).style.write(w);
107 Ok(())
108 }
109}
110#[cfg(feature = "v26_1")]
111#[cfg(feature = "testgen")]
112impl Generate for ChatType {
113 fn generate(g: &mut Gen) -> Self {
114 {
115 let v1 = g.string();
116 let v2 = {
117 let v3 = g.count();
118 let mut v4 = Vec::with_capacity(v3.min(crate::codec::PREALLOC_LIMIT));
119 for _ in 0..v3 {
120 v4.push(crate::defs::p775::play::clientbound::ChatTypeParameterType(
121 g.int_in(-2147483648, 2147483647, &[0, 1, 2]) as i32,
122 ));
123 }
124 v4
125 };
126 let v5 = g.anon_nbt();
127 Self {
128 translation_key: v1,
129 parameters: v2,
130 style: v5,
131 }
132 }
133 }
134}
135
136#[cfg(feature = "v26_1")]
137#[derive(Debug, Clone, PartialEq)]
139pub struct ChatTypes {
140 pub chat: crate::defs::p775::play::clientbound::ChatType,
142 pub narration: crate::defs::p775::play::clientbound::ChatType,
144}
145#[cfg(feature = "v26_1")]
146impl Decode for ChatTypes {
147 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
148 Ok({
149 let v1 = <crate::defs::p775::play::clientbound::ChatType as Decode>::decode(r)?;
150 let v2 = <crate::defs::p775::play::clientbound::ChatType as Decode>::decode(r)?;
151 Self {
152 chat: v1,
153 narration: v2,
154 }
155 })
156 }
157}
158#[cfg(feature = "v26_1")]
159impl Encode for ChatTypes {
160 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
161 (*self).chat.encode(w)?;
162 (*self).narration.encode(w)?;
163 Ok(())
164 }
165}
166#[cfg(feature = "v26_1")]
167#[cfg(feature = "testgen")]
168impl Generate for ChatTypes {
169 fn generate(g: &mut Gen) -> Self {
170 {
171 let v1 = <crate::defs::p775::play::clientbound::ChatType as Generate>::generate(g);
172 let v2 = <crate::defs::p775::play::clientbound::ChatType as Generate>::generate(g);
173 Self {
174 chat: v1,
175 narration: v2,
176 }
177 }
178 }
179}
180
181#[cfg(feature = "v26_1")]
182#[derive(Debug, Clone, PartialEq)]
184pub struct ExplosionParticleEntry {
185 pub data: crate::defs::p775::play::clientbound::ExplosionParticleInfo,
187 pub weight: i32,
189}
190#[cfg(feature = "v26_1")]
191impl Decode for ExplosionParticleEntry {
192 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
193 Ok({
194 let v1 =
195 <crate::defs::p775::play::clientbound::ExplosionParticleInfo as Decode>::decode(r)?;
196 let v2 = r.read_varint()?;
197 Self {
198 data: v1,
199 weight: v2,
200 }
201 })
202 }
203}
204#[cfg(feature = "v26_1")]
205impl Encode for ExplosionParticleEntry {
206 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
207 (*self).data.encode(w)?;
208 w.put_varint((*self).weight);
209 Ok(())
210 }
211}
212#[cfg(feature = "v26_1")]
213#[cfg(feature = "testgen")]
214impl Generate for ExplosionParticleEntry {
215 fn generate(g: &mut Gen) -> Self {
216 {
217 let v1 =
218 <crate::defs::p775::play::clientbound::ExplosionParticleInfo as Generate>::generate(
219 g,
220 );
221 let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
222 Self {
223 data: v1,
224 weight: v2,
225 }
226 }
227 }
228}
229
230#[cfg(feature = "v26_1")]
231#[derive(Debug, Clone, PartialEq)]
233pub struct ExplosionParticleInfo {
234 pub particle: crate::defs::p775::types::Particle,
236 pub scaling: f32,
238 pub speed: f32,
240}
241#[cfg(feature = "v26_1")]
242impl Decode for ExplosionParticleInfo {
243 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
244 Ok({
245 let v1 = <crate::defs::p775::types::Particle as Decode>::decode(r)?;
246 let v2 = r.read_f32()?;
247 let v3 = r.read_f32()?;
248 Self {
249 particle: v1,
250 scaling: v2,
251 speed: v3,
252 }
253 })
254 }
255}
256#[cfg(feature = "v26_1")]
257impl Encode for ExplosionParticleInfo {
258 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
259 (*self).particle.encode(w)?;
260 w.put_f32((*self).scaling);
261 w.put_f32((*self).speed);
262 Ok(())
263 }
264}
265#[cfg(feature = "v26_1")]
266#[cfg(feature = "testgen")]
267impl Generate for ExplosionParticleInfo {
268 fn generate(g: &mut Gen) -> Self {
269 {
270 let v1 = <crate::defs::p775::types::Particle as Generate>::generate(g);
271 let v2 = g.f32();
272 let v3 = g.f32();
273 Self {
274 particle: v1,
275 scaling: v2,
276 speed: v3,
277 }
278 }
279 }
280}
281
282#[cfg(feature = "v26_1")]
283#[derive(Debug, Clone, PartialEq)]
285pub struct RecipeBookSetting {
286 pub open: bool,
288 pub filtering: bool,
290}
291#[cfg(feature = "v26_1")]
292impl Decode for RecipeBookSetting {
293 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
294 Ok({
295 let v1 = r.read_bool()?;
296 let v2 = r.read_bool()?;
297 Self {
298 open: v1,
299 filtering: v2,
300 }
301 })
302 }
303}
304#[cfg(feature = "v26_1")]
305impl Encode for RecipeBookSetting {
306 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
307 w.put_bool((*self).open);
308 w.put_bool((*self).filtering);
309 Ok(())
310 }
311}
312#[cfg(feature = "v26_1")]
313#[cfg(feature = "testgen")]
314impl Generate for RecipeBookSetting {
315 fn generate(g: &mut Gen) -> Self {
316 {
317 let v1 = g.bool();
318 let v2 = g.bool();
319 Self {
320 open: v1,
321 filtering: v2,
322 }
323 }
324 }
325}
326
327#[cfg(feature = "v26_1")]
328#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
330pub struct RecipeDisplayType(pub i32);
331#[cfg(feature = "v26_1")]
332impl RecipeDisplayType {
333 pub const CRAFTING_SHAPELESS: Self = Self(0);
335 pub const CRAFTING_SHAPED: Self = Self(1);
337 pub const FURNACE: Self = Self(2);
339 pub const STONECUTTER: Self = Self(3);
341 pub const SMITHING: Self = Self(4);
343 pub const fn name(self) -> Option<&'static str> {
345 match self.0 {
346 0 => Some("crafting_shapeless"),
347 1 => Some("crafting_shaped"),
348 2 => Some("furnace"),
349 3 => Some("stonecutter"),
350 4 => Some("smithing"),
351 _ => None,
352 }
353 }
354}
355#[cfg(feature = "v26_1")]
356impl std::fmt::Debug for RecipeDisplayType {
357 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
358 match self.name() {
359 Some(n) => write!(f, "RecipeDisplayType::{n}"),
360 None => write!(f, "RecipeDisplayType({})", self.0),
361 }
362 }
363}
364
365#[cfg(feature = "v26_1")]
366#[derive(Debug, Clone, PartialEq)]
368pub struct RecipeDisplayDataCraftingShapeless {
369 pub ingredients: Vec<crate::defs::p775::play::clientbound::SlotDisplay>,
371 pub result: crate::defs::p775::play::clientbound::SlotDisplay,
373 pub crafting_station: crate::defs::p775::play::clientbound::SlotDisplay,
375}
376
377#[cfg(feature = "v26_1")]
378#[derive(Debug, Clone, PartialEq)]
380pub struct RecipeDisplayDataCraftingShaped {
381 pub width: i32,
383 pub height: i32,
385 pub ingredients: Vec<crate::defs::p775::play::clientbound::SlotDisplay>,
387 pub result: crate::defs::p775::play::clientbound::SlotDisplay,
389 pub crafting_station: crate::defs::p775::play::clientbound::SlotDisplay,
391}
392
393#[cfg(feature = "v26_1")]
394#[derive(Debug, Clone, PartialEq)]
396pub struct RecipeDisplayDataFurnace {
397 pub ingredient: crate::defs::p775::play::clientbound::SlotDisplay,
399 pub fuel: crate::defs::p775::play::clientbound::SlotDisplay,
401 pub result: crate::defs::p775::play::clientbound::SlotDisplay,
403 pub crafting_station: crate::defs::p775::play::clientbound::SlotDisplay,
405 pub duration: i32,
407 pub experience: f32,
409}
410
411#[cfg(feature = "v26_1")]
412#[derive(Debug, Clone, PartialEq)]
414pub struct RecipeDisplayDataStonecutter {
415 pub ingredient: crate::defs::p775::play::clientbound::SlotDisplay,
417 pub result: crate::defs::p775::play::clientbound::SlotDisplay,
419 pub crafting_station: crate::defs::p775::play::clientbound::SlotDisplay,
421}
422
423#[cfg(feature = "v26_1")]
424#[derive(Debug, Clone, PartialEq)]
426pub struct RecipeDisplayDataSmithing {
427 pub template: crate::defs::p775::play::clientbound::SlotDisplay,
429 pub base: crate::defs::p775::play::clientbound::SlotDisplay,
431 pub addition: crate::defs::p775::play::clientbound::SlotDisplay,
433 pub result: crate::defs::p775::play::clientbound::SlotDisplay,
435 pub crafting_station: crate::defs::p775::play::clientbound::SlotDisplay,
437}
438
439#[cfg(feature = "v26_1")]
440#[derive(Debug, Clone, PartialEq)]
442pub enum RecipeDisplayData {
443 CraftingShapeless(crate::defs::p775::play::clientbound::RecipeDisplayDataCraftingShapeless),
445 CraftingShaped(crate::defs::p775::play::clientbound::RecipeDisplayDataCraftingShaped),
447 Furnace(crate::defs::p775::play::clientbound::RecipeDisplayDataFurnace),
449 Stonecutter(crate::defs::p775::play::clientbound::RecipeDisplayDataStonecutter),
451 Smithing(crate::defs::p775::play::clientbound::RecipeDisplayDataSmithing),
453 Other,
455}
456
457#[cfg(feature = "v26_1")]
458#[derive(Debug, Clone, PartialEq)]
460pub struct RecipeDisplay {
461 pub r#type: crate::defs::p775::play::clientbound::RecipeDisplayType,
463 pub data: crate::defs::p775::play::clientbound::RecipeDisplayData,
465}
466#[cfg(feature = "v26_1")]
467impl Decode for RecipeDisplay {
468 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
469 Ok({
470 let v1 = crate::defs::p775::play::clientbound::RecipeDisplayType(r.read_varint()?);
471 let v2 = (if (v1.0 == 0) {
472 crate::defs::p775::play::clientbound::RecipeDisplayData::CraftingShapeless({
473 let v3 = {
474 let v4 = {
475 let c = r.read_varint()?;
476 r.check_count(i64::from(c), 1)?
477 };
478 let mut v5 = Vec::with_capacity(v4.min(crate::codec::PREALLOC_LIMIT));
479 for _ in 0..v4 {
480 v5.push(<crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?);
481 }
482 v5
483 };
484 let v6 =
485 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?;
486 let v7 =
487 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?;
488 crate::defs::p775::play::clientbound::RecipeDisplayDataCraftingShapeless {
489 ingredients: v3,
490 result: v6,
491 crafting_station: v7,
492 }
493 })
494 } else if (v1.0 == 1) {
495 crate::defs::p775::play::clientbound::RecipeDisplayData::CraftingShaped({
496 let v8 = r.read_varint()?;
497 let v9 = r.read_varint()?;
498 let v10 = {
499 let v11 = {
500 let c = r.read_varint()?;
501 r.check_count(i64::from(c), 1)?
502 };
503 let mut v12 = Vec::with_capacity(v11.min(crate::codec::PREALLOC_LIMIT));
504 for _ in 0..v11 {
505 v12.push(<crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?);
506 }
507 v12
508 };
509 let v13 =
510 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?;
511 let v14 =
512 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?;
513 crate::defs::p775::play::clientbound::RecipeDisplayDataCraftingShaped {
514 width: v8,
515 height: v9,
516 ingredients: v10,
517 result: v13,
518 crafting_station: v14,
519 }
520 })
521 } else if (v1.0 == 2) {
522 crate::defs::p775::play::clientbound::RecipeDisplayData::Furnace({
523 let v15 =
524 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?;
525 let v16 =
526 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?;
527 let v17 =
528 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?;
529 let v18 =
530 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?;
531 let v19 = r.read_varint()?;
532 let v20 = r.read_f32()?;
533 crate::defs::p775::play::clientbound::RecipeDisplayDataFurnace {
534 ingredient: v15,
535 fuel: v16,
536 result: v17,
537 crafting_station: v18,
538 duration: v19,
539 experience: v20,
540 }
541 })
542 } else if (v1.0 == 3) {
543 crate::defs::p775::play::clientbound::RecipeDisplayData::Stonecutter({
544 let v21 =
545 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?;
546 let v22 =
547 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?;
548 let v23 =
549 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?;
550 crate::defs::p775::play::clientbound::RecipeDisplayDataStonecutter {
551 ingredient: v21,
552 result: v22,
553 crafting_station: v23,
554 }
555 })
556 } else if (v1.0 == 4) {
557 crate::defs::p775::play::clientbound::RecipeDisplayData::Smithing({
558 let v24 =
559 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?;
560 let v25 =
561 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?;
562 let v26 =
563 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?;
564 let v27 =
565 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?;
566 let v28 =
567 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?;
568 crate::defs::p775::play::clientbound::RecipeDisplayDataSmithing {
569 template: v24,
570 base: v25,
571 addition: v26,
572 result: v27,
573 crafting_station: v28,
574 }
575 })
576 } else {
577 crate::defs::p775::play::clientbound::RecipeDisplayData::Other
578 });
579 Self {
580 r#type: v1,
581 data: v2,
582 }
583 })
584 }
585}
586#[cfg(feature = "v26_1")]
587impl Encode for RecipeDisplay {
588 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
589 w.put_varint((*self).r#type.0);
590 match &(*self).data {
591 crate::defs::p775::play::clientbound::RecipeDisplayData::CraftingShapeless(v1) => {
592 if !((*self).r#type.0 == 0) {
593 return Err(EncodeError::SwitchMismatch(
594 "play.clientbound.RecipeDisplay.data",
595 ));
596 }
597 w.put_len_varint((*v1).ingredients.len())?;
598 for v2 in (*v1).ingredients.iter() {
599 (*v2).encode(w)?;
600 }
601 (*v1).result.encode(w)?;
602 (*v1).crafting_station.encode(w)?;
603 }
604 crate::defs::p775::play::clientbound::RecipeDisplayData::CraftingShaped(v3) => {
605 if !((*self).r#type.0 == 1) {
606 return Err(EncodeError::SwitchMismatch(
607 "play.clientbound.RecipeDisplay.data",
608 ));
609 }
610 w.put_varint((*v3).width);
611 w.put_varint((*v3).height);
612 w.put_len_varint((*v3).ingredients.len())?;
613 for v4 in (*v3).ingredients.iter() {
614 (*v4).encode(w)?;
615 }
616 (*v3).result.encode(w)?;
617 (*v3).crafting_station.encode(w)?;
618 }
619 crate::defs::p775::play::clientbound::RecipeDisplayData::Furnace(v5) => {
620 if !((*self).r#type.0 == 2) {
621 return Err(EncodeError::SwitchMismatch(
622 "play.clientbound.RecipeDisplay.data",
623 ));
624 }
625 (*v5).ingredient.encode(w)?;
626 (*v5).fuel.encode(w)?;
627 (*v5).result.encode(w)?;
628 (*v5).crafting_station.encode(w)?;
629 w.put_varint((*v5).duration);
630 w.put_f32((*v5).experience);
631 }
632 crate::defs::p775::play::clientbound::RecipeDisplayData::Stonecutter(v6) => {
633 if !((*self).r#type.0 == 3) {
634 return Err(EncodeError::SwitchMismatch(
635 "play.clientbound.RecipeDisplay.data",
636 ));
637 }
638 (*v6).ingredient.encode(w)?;
639 (*v6).result.encode(w)?;
640 (*v6).crafting_station.encode(w)?;
641 }
642 crate::defs::p775::play::clientbound::RecipeDisplayData::Smithing(v7) => {
643 if !((*self).r#type.0 == 4) {
644 return Err(EncodeError::SwitchMismatch(
645 "play.clientbound.RecipeDisplay.data",
646 ));
647 }
648 (*v7).template.encode(w)?;
649 (*v7).base.encode(w)?;
650 (*v7).addition.encode(w)?;
651 (*v7).result.encode(w)?;
652 (*v7).crafting_station.encode(w)?;
653 }
654 crate::defs::p775::play::clientbound::RecipeDisplayData::Other => {
655 if !(!(((*self).r#type.0 == 0)
656 || ((*self).r#type.0 == 1)
657 || ((*self).r#type.0 == 2)
658 || ((*self).r#type.0 == 3)
659 || ((*self).r#type.0 == 4)))
660 {
661 return Err(EncodeError::SwitchMismatch(
662 "play.clientbound.RecipeDisplay.data",
663 ));
664 }
665 }
666 }
667 Ok(())
668 }
669}
670#[cfg(feature = "v26_1")]
671#[cfg(feature = "testgen")]
672impl Generate for RecipeDisplay {
673 fn generate(g: &mut Gen) -> Self {
674 {
675 let v1 = crate::defs::p775::play::clientbound::RecipeDisplayType(g.int_in(
676 -2147483648,
677 2147483647,
678 &[0, 1, 2, 3, 4],
679 ) as i32);
680 let v2 = (if (v1.0 == 0) {
681 crate::defs::p775::play::clientbound::RecipeDisplayData::CraftingShapeless({
682 let v3 = {
683 let v4 = g.count();
684 let mut v5 = Vec::with_capacity(v4.min(crate::codec::PREALLOC_LIMIT));
685 for _ in 0..v4 {
686 v5.push(<crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(g));
687 }
688 v5
689 };
690 let v6 =
691 <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(
692 g,
693 );
694 let v7 =
695 <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(
696 g,
697 );
698 crate::defs::p775::play::clientbound::RecipeDisplayDataCraftingShapeless {
699 ingredients: v3,
700 result: v6,
701 crafting_station: v7,
702 }
703 })
704 } else if (v1.0 == 1) {
705 crate::defs::p775::play::clientbound::RecipeDisplayData::CraftingShaped({
706 let v8 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
707 let v9 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
708 let v10 = {
709 let v11 = g.count();
710 let mut v12 = Vec::with_capacity(v11.min(crate::codec::PREALLOC_LIMIT));
711 for _ in 0..v11 {
712 v12.push(<crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(g));
713 }
714 v12
715 };
716 let v13 =
717 <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(
718 g,
719 );
720 let v14 =
721 <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(
722 g,
723 );
724 crate::defs::p775::play::clientbound::RecipeDisplayDataCraftingShaped {
725 width: v8,
726 height: v9,
727 ingredients: v10,
728 result: v13,
729 crafting_station: v14,
730 }
731 })
732 } else if (v1.0 == 2) {
733 crate::defs::p775::play::clientbound::RecipeDisplayData::Furnace({
734 let v15 =
735 <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(
736 g,
737 );
738 let v16 =
739 <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(
740 g,
741 );
742 let v17 =
743 <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(
744 g,
745 );
746 let v18 =
747 <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(
748 g,
749 );
750 let v19 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
751 let v20 = g.f32();
752 crate::defs::p775::play::clientbound::RecipeDisplayDataFurnace {
753 ingredient: v15,
754 fuel: v16,
755 result: v17,
756 crafting_station: v18,
757 duration: v19,
758 experience: v20,
759 }
760 })
761 } else if (v1.0 == 3) {
762 crate::defs::p775::play::clientbound::RecipeDisplayData::Stonecutter({
763 let v21 =
764 <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(
765 g,
766 );
767 let v22 =
768 <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(
769 g,
770 );
771 let v23 =
772 <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(
773 g,
774 );
775 crate::defs::p775::play::clientbound::RecipeDisplayDataStonecutter {
776 ingredient: v21,
777 result: v22,
778 crafting_station: v23,
779 }
780 })
781 } else if (v1.0 == 4) {
782 crate::defs::p775::play::clientbound::RecipeDisplayData::Smithing({
783 let v24 =
784 <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(
785 g,
786 );
787 let v25 =
788 <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(
789 g,
790 );
791 let v26 =
792 <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(
793 g,
794 );
795 let v27 =
796 <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(
797 g,
798 );
799 let v28 =
800 <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(
801 g,
802 );
803 crate::defs::p775::play::clientbound::RecipeDisplayDataSmithing {
804 template: v24,
805 base: v25,
806 addition: v26,
807 result: v27,
808 crafting_station: v28,
809 }
810 })
811 } else {
812 crate::defs::p775::play::clientbound::RecipeDisplayData::Other
813 });
814 Self {
815 r#type: v1,
816 data: v2,
817 }
818 }
819 }
820}
821
822#[cfg(feature = "v26_1")]
823#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
825pub struct SlotDisplayType(pub i32);
826#[cfg(feature = "v26_1")]
827impl SlotDisplayType {
828 pub const EMPTY: Self = Self(0);
830 pub const ANY_FUEL: Self = Self(1);
832 pub const WITH_ANY_POTION: Self = Self(2);
834 pub const ONLY_WITH_COMPONENT: Self = Self(3);
836 pub const ITEM: Self = Self(4);
838 pub const ITEM_STACK: Self = Self(5);
840 pub const TAG: Self = Self(6);
842 pub const DYED_SLOT_DEMO: Self = Self(7);
844 pub const SMITHING_TRIM: Self = Self(8);
846 pub const WITH_REMAINDER: Self = Self(9);
848 pub const COMPOSITE: Self = Self(10);
850 pub const fn name(self) -> Option<&'static str> {
852 match self.0 {
853 0 => Some("empty"),
854 1 => Some("any_fuel"),
855 2 => Some("with_any_potion"),
856 3 => Some("only_with_component"),
857 4 => Some("item"),
858 5 => Some("item_stack"),
859 6 => Some("tag"),
860 7 => Some("dyed_slot_demo"),
861 8 => Some("smithing_trim"),
862 9 => Some("with_remainder"),
863 10 => Some("composite"),
864 _ => None,
865 }
866 }
867}
868#[cfg(feature = "v26_1")]
869impl std::fmt::Debug for SlotDisplayType {
870 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
871 match self.name() {
872 Some(n) => write!(f, "SlotDisplayType::{n}"),
873 None => write!(f, "SlotDisplayType({})", self.0),
874 }
875 }
876}
877
878#[cfg(feature = "v26_1")]
879#[derive(Debug, Clone, PartialEq)]
881pub struct SlotDisplayDataWithAnyPotion {
882 pub base: Box<crate::defs::p775::play::clientbound::SlotDisplay>,
884}
885
886#[cfg(feature = "v26_1")]
887#[derive(Debug, Clone, PartialEq)]
889pub struct SlotDisplayDataOnlyWithComponent {
890 pub source: Box<crate::defs::p775::play::clientbound::SlotDisplay>,
892 pub component: crate::defs::p775::types::SlotComponentType,
894}
895
896#[cfg(feature = "v26_1")]
897#[derive(Debug, Clone, PartialEq)]
899pub struct SlotDisplayDataDyedSlotDemo {
900 pub dye: Box<crate::defs::p775::play::clientbound::SlotDisplay>,
902 pub target: Box<crate::defs::p775::play::clientbound::SlotDisplay>,
904}
905
906#[cfg(feature = "v26_1")]
907#[derive(Debug, Clone, PartialEq)]
909pub struct SlotDisplayDataSmithingTrim {
910 pub base: Box<crate::defs::p775::play::clientbound::SlotDisplay>,
912 pub material: Box<crate::defs::p775::play::clientbound::SlotDisplay>,
914 pub pattern: Holder<crate::defs::p775::types::ArmorTrimPattern>,
916}
917
918#[cfg(feature = "v26_1")]
919#[derive(Debug, Clone, PartialEq)]
921pub struct SlotDisplayDataWithRemainder {
922 pub input: Box<crate::defs::p775::play::clientbound::SlotDisplay>,
924 pub remainder: Box<crate::defs::p775::play::clientbound::SlotDisplay>,
926}
927
928#[cfg(feature = "v26_1")]
929#[derive(Debug, Clone, PartialEq)]
931pub enum SlotDisplayData {
932 Empty,
934 AnyFuel,
936 WithAnyPotion(crate::defs::p775::play::clientbound::SlotDisplayDataWithAnyPotion),
938 OnlyWithComponent(crate::defs::p775::play::clientbound::SlotDisplayDataOnlyWithComponent),
940 Item(i32),
942 ItemStack(crate::defs::p775::types::ItemStackTemplate),
944 Tag(ByteString),
946 DyedSlotDemo(crate::defs::p775::play::clientbound::SlotDisplayDataDyedSlotDemo),
948 SmithingTrim(crate::defs::p775::play::clientbound::SlotDisplayDataSmithingTrim),
950 WithRemainder(crate::defs::p775::play::clientbound::SlotDisplayDataWithRemainder),
952 Composite(Vec<crate::defs::p775::play::clientbound::SlotDisplay>),
954 Other,
956}
957
958#[cfg(feature = "v26_1")]
959#[derive(Debug, Clone, PartialEq)]
961pub struct SlotDisplay {
962 pub r#type: crate::defs::p775::play::clientbound::SlotDisplayType,
964 pub data: crate::defs::p775::play::clientbound::SlotDisplayData,
966}
967#[cfg(feature = "v26_1")]
968impl Decode for SlotDisplay {
969 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
970 Ok({
971 let v1 = crate::defs::p775::play::clientbound::SlotDisplayType(r.read_varint()?);
972 let v2 = (if (v1.0 == 0) {
973 crate::defs::p775::play::clientbound::SlotDisplayData::Empty
974 } else if (v1.0 == 1) {
975 crate::defs::p775::play::clientbound::SlotDisplayData::AnyFuel
976 } else if (v1.0 == 2) {
977 crate::defs::p775::play::clientbound::SlotDisplayData::WithAnyPotion({
978 let v3 = Box::new(
979 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?,
980 );
981 crate::defs::p775::play::clientbound::SlotDisplayDataWithAnyPotion { base: v3 }
982 })
983 } else if (v1.0 == 3) {
984 crate::defs::p775::play::clientbound::SlotDisplayData::OnlyWithComponent({
985 let v4 = Box::new(
986 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?,
987 );
988 let v5 = crate::defs::p775::types::SlotComponentType(r.read_varint()?);
989 crate::defs::p775::play::clientbound::SlotDisplayDataOnlyWithComponent {
990 source: v4,
991 component: v5,
992 }
993 })
994 } else if (v1.0 == 4) {
995 crate::defs::p775::play::clientbound::SlotDisplayData::Item(r.read_varint()?)
996 } else if (v1.0 == 5) {
997 crate::defs::p775::play::clientbound::SlotDisplayData::ItemStack(
998 <crate::defs::p775::types::ItemStackTemplate as Decode>::decode(r)?,
999 )
1000 } else if (v1.0 == 6) {
1001 crate::defs::p775::play::clientbound::SlotDisplayData::Tag(r.read_string()?)
1002 } else if (v1.0 == 7) {
1003 crate::defs::p775::play::clientbound::SlotDisplayData::DyedSlotDemo({
1004 let v6 = Box::new(
1005 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?,
1006 );
1007 let v7 = Box::new(
1008 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?,
1009 );
1010 crate::defs::p775::play::clientbound::SlotDisplayDataDyedSlotDemo {
1011 dye: v6,
1012 target: v7,
1013 }
1014 })
1015 } else if (v1.0 == 8) {
1016 crate::defs::p775::play::clientbound::SlotDisplayData::SmithingTrim({
1017 let v8 = Box::new(
1018 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?,
1019 );
1020 let v9 = Box::new(
1021 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?,
1022 );
1023 let v10 = {
1024 let id = r.read_varint()?;
1025 if id == 0 {
1026 Holder::Inline(
1027 <crate::defs::p775::types::ArmorTrimPattern as Decode>::decode(r)?,
1028 )
1029 } else {
1030 Holder::Id(id.wrapping_sub(1))
1031 }
1032 };
1033 crate::defs::p775::play::clientbound::SlotDisplayDataSmithingTrim {
1034 base: v8,
1035 material: v9,
1036 pattern: v10,
1037 }
1038 })
1039 } else if (v1.0 == 9) {
1040 crate::defs::p775::play::clientbound::SlotDisplayData::WithRemainder({
1041 let v11 = Box::new(
1042 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?,
1043 );
1044 let v12 = Box::new(
1045 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(r)?,
1046 );
1047 crate::defs::p775::play::clientbound::SlotDisplayDataWithRemainder {
1048 input: v11,
1049 remainder: v12,
1050 }
1051 })
1052 } else if (v1.0 == 10) {
1053 crate::defs::p775::play::clientbound::SlotDisplayData::Composite({
1054 let v13 = {
1055 let c = r.read_varint()?;
1056 r.check_count(i64::from(c), 1)?
1057 };
1058 let mut v14 = Vec::with_capacity(v13.min(crate::codec::PREALLOC_LIMIT));
1059 for _ in 0..v13 {
1060 v14.push(
1061 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(
1062 r,
1063 )?,
1064 );
1065 }
1066 v14
1067 })
1068 } else {
1069 crate::defs::p775::play::clientbound::SlotDisplayData::Other
1070 });
1071 Self {
1072 r#type: v1,
1073 data: v2,
1074 }
1075 })
1076 }
1077}
1078#[cfg(feature = "v26_1")]
1079impl Encode for SlotDisplay {
1080 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1081 w.put_varint((*self).r#type.0);
1082 match &(*self).data {
1083 crate::defs::p775::play::clientbound::SlotDisplayData::Empty => {
1084 if !((*self).r#type.0 == 0) {
1085 return Err(EncodeError::SwitchMismatch(
1086 "play.clientbound.SlotDisplay.data",
1087 ));
1088 }
1089 }
1090 crate::defs::p775::play::clientbound::SlotDisplayData::AnyFuel => {
1091 if !((*self).r#type.0 == 1) {
1092 return Err(EncodeError::SwitchMismatch(
1093 "play.clientbound.SlotDisplay.data",
1094 ));
1095 }
1096 }
1097 crate::defs::p775::play::clientbound::SlotDisplayData::WithAnyPotion(v1) => {
1098 if !((*self).r#type.0 == 2) {
1099 return Err(EncodeError::SwitchMismatch(
1100 "play.clientbound.SlotDisplay.data",
1101 ));
1102 }
1103 (*(*v1).base).encode(w)?;
1104 }
1105 crate::defs::p775::play::clientbound::SlotDisplayData::OnlyWithComponent(v2) => {
1106 if !((*self).r#type.0 == 3) {
1107 return Err(EncodeError::SwitchMismatch(
1108 "play.clientbound.SlotDisplay.data",
1109 ));
1110 }
1111 (*(*v2).source).encode(w)?;
1112 w.put_varint((*v2).component.0);
1113 }
1114 crate::defs::p775::play::clientbound::SlotDisplayData::Item(v3) => {
1115 if !((*self).r#type.0 == 4) {
1116 return Err(EncodeError::SwitchMismatch(
1117 "play.clientbound.SlotDisplay.data",
1118 ));
1119 }
1120 w.put_varint((*v3));
1121 }
1122 crate::defs::p775::play::clientbound::SlotDisplayData::ItemStack(v4) => {
1123 if !((*self).r#type.0 == 5) {
1124 return Err(EncodeError::SwitchMismatch(
1125 "play.clientbound.SlotDisplay.data",
1126 ));
1127 }
1128 (*v4).encode(w)?;
1129 }
1130 crate::defs::p775::play::clientbound::SlotDisplayData::Tag(v5) => {
1131 if !((*self).r#type.0 == 6) {
1132 return Err(EncodeError::SwitchMismatch(
1133 "play.clientbound.SlotDisplay.data",
1134 ));
1135 }
1136 w.put_string(&(*v5))?;
1137 }
1138 crate::defs::p775::play::clientbound::SlotDisplayData::DyedSlotDemo(v6) => {
1139 if !((*self).r#type.0 == 7) {
1140 return Err(EncodeError::SwitchMismatch(
1141 "play.clientbound.SlotDisplay.data",
1142 ));
1143 }
1144 (*(*v6).dye).encode(w)?;
1145 (*(*v6).target).encode(w)?;
1146 }
1147 crate::defs::p775::play::clientbound::SlotDisplayData::SmithingTrim(v7) => {
1148 if !((*self).r#type.0 == 8) {
1149 return Err(EncodeError::SwitchMismatch(
1150 "play.clientbound.SlotDisplay.data",
1151 ));
1152 }
1153 (*(*v7).base).encode(w)?;
1154 (*(*v7).material).encode(w)?;
1155 match &(*v7).pattern {
1156 Holder::Id(v9) => {
1157 if *v9 == -1 {
1158 return Err(EncodeError::OutOfRange("holder id"));
1159 }
1160 w.put_varint(v9.wrapping_add(1));
1161 }
1162 Holder::Inline(v8) => {
1163 w.put_varint(0);
1164 (*v8).encode(w)?;
1165 }
1166 }
1167 }
1168 crate::defs::p775::play::clientbound::SlotDisplayData::WithRemainder(v10) => {
1169 if !((*self).r#type.0 == 9) {
1170 return Err(EncodeError::SwitchMismatch(
1171 "play.clientbound.SlotDisplay.data",
1172 ));
1173 }
1174 (*(*v10).input).encode(w)?;
1175 (*(*v10).remainder).encode(w)?;
1176 }
1177 crate::defs::p775::play::clientbound::SlotDisplayData::Composite(v11) => {
1178 if !((*self).r#type.0 == 10) {
1179 return Err(EncodeError::SwitchMismatch(
1180 "play.clientbound.SlotDisplay.data",
1181 ));
1182 }
1183 w.put_len_varint((*v11).len())?;
1184 for v12 in (*v11).iter() {
1185 (*v12).encode(w)?;
1186 }
1187 }
1188 crate::defs::p775::play::clientbound::SlotDisplayData::Other => {
1189 if !(!(((*self).r#type.0 == 0)
1190 || ((*self).r#type.0 == 1)
1191 || ((*self).r#type.0 == 2)
1192 || ((*self).r#type.0 == 3)
1193 || ((*self).r#type.0 == 4)
1194 || ((*self).r#type.0 == 5)
1195 || ((*self).r#type.0 == 6)
1196 || ((*self).r#type.0 == 7)
1197 || ((*self).r#type.0 == 8)
1198 || ((*self).r#type.0 == 9)
1199 || ((*self).r#type.0 == 10)))
1200 {
1201 return Err(EncodeError::SwitchMismatch(
1202 "play.clientbound.SlotDisplay.data",
1203 ));
1204 }
1205 }
1206 }
1207 Ok(())
1208 }
1209}
1210#[cfg(feature = "v26_1")]
1211#[cfg(feature = "testgen")]
1212impl Generate for SlotDisplay {
1213 fn generate(g: &mut Gen) -> Self {
1214 {
1215 let v1 = crate::defs::p775::play::clientbound::SlotDisplayType(g.int_in(
1216 -2147483648,
1217 2147483647,
1218 &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
1219 ) as i32);
1220 let v2 = (if (v1.0 == 0) {
1221 crate::defs::p775::play::clientbound::SlotDisplayData::Empty
1222 } else if (v1.0 == 1) {
1223 crate::defs::p775::play::clientbound::SlotDisplayData::AnyFuel
1224 } else if (v1.0 == 2) {
1225 crate::defs::p775::play::clientbound::SlotDisplayData::WithAnyPotion({
1226 let v3 = Box::new(
1227 <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(
1228 g,
1229 ),
1230 );
1231 crate::defs::p775::play::clientbound::SlotDisplayDataWithAnyPotion { base: v3 }
1232 })
1233 } else if (v1.0 == 3) {
1234 crate::defs::p775::play::clientbound::SlotDisplayData::OnlyWithComponent({
1235 let v4 = Box::new(
1236 <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(
1237 g,
1238 ),
1239 );
1240 let v5 = crate::defs::p775::types::SlotComponentType(g.int_in(
1241 -2147483648,
1242 2147483647,
1243 &[
1244 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1245 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
1246 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
1247 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
1248 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
1249 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
1250 108, 109,
1251 ],
1252 )
1253 as i32);
1254 crate::defs::p775::play::clientbound::SlotDisplayDataOnlyWithComponent {
1255 source: v4,
1256 component: v5,
1257 }
1258 })
1259 } else if (v1.0 == 4) {
1260 crate::defs::p775::play::clientbound::SlotDisplayData::Item(
1261 (g.int_in(-2147483648, 2147483647, &[]) as i32),
1262 )
1263 } else if (v1.0 == 5) {
1264 crate::defs::p775::play::clientbound::SlotDisplayData::ItemStack(
1265 <crate::defs::p775::types::ItemStackTemplate as Generate>::generate(g),
1266 )
1267 } else if (v1.0 == 6) {
1268 crate::defs::p775::play::clientbound::SlotDisplayData::Tag(g.string())
1269 } else if (v1.0 == 7) {
1270 crate::defs::p775::play::clientbound::SlotDisplayData::DyedSlotDemo({
1271 let v6 = Box::new(
1272 <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(
1273 g,
1274 ),
1275 );
1276 let v7 = Box::new(
1277 <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(
1278 g,
1279 ),
1280 );
1281 crate::defs::p775::play::clientbound::SlotDisplayDataDyedSlotDemo {
1282 dye: v6,
1283 target: v7,
1284 }
1285 })
1286 } else if (v1.0 == 8) {
1287 crate::defs::p775::play::clientbound::SlotDisplayData::SmithingTrim({
1288 let v8 = Box::new(
1289 <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(
1290 g,
1291 ),
1292 );
1293 let v9 = Box::new(
1294 <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(
1295 g,
1296 ),
1297 );
1298 let v10 = if g.bool() {
1299 Holder::Id(match g.int_in(-2147483648, 2147483647, &[0, 1, 2]) as i32 {
1300 -1 => 0,
1301 v => v,
1302 })
1303 } else {
1304 Holder::Inline(
1305 <crate::defs::p775::types::ArmorTrimPattern as Generate>::generate(g),
1306 )
1307 };
1308 crate::defs::p775::play::clientbound::SlotDisplayDataSmithingTrim {
1309 base: v8,
1310 material: v9,
1311 pattern: v10,
1312 }
1313 })
1314 } else if (v1.0 == 9) {
1315 crate::defs::p775::play::clientbound::SlotDisplayData::WithRemainder({
1316 let v11 = Box::new(
1317 <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(
1318 g,
1319 ),
1320 );
1321 let v12 = Box::new(
1322 <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(
1323 g,
1324 ),
1325 );
1326 crate::defs::p775::play::clientbound::SlotDisplayDataWithRemainder {
1327 input: v11,
1328 remainder: v12,
1329 }
1330 })
1331 } else if (v1.0 == 10) {
1332 crate::defs::p775::play::clientbound::SlotDisplayData::Composite({
1333 let v13 = g.count();
1334 let mut v14 = Vec::with_capacity(v13.min(crate::codec::PREALLOC_LIMIT));
1335 for _ in 0..v13 {
1336 v14.push(<crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(g));
1337 }
1338 v14
1339 })
1340 } else {
1341 crate::defs::p775::play::clientbound::SlotDisplayData::Other
1342 });
1343 Self {
1344 r#type: v1,
1345 data: v2,
1346 }
1347 }
1348 }
1349}
1350
1351#[cfg(feature = "v26_1")]
1352#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
1354pub struct SpawnInfoGamemode(pub i8);
1355#[cfg(feature = "v26_1")]
1356impl SpawnInfoGamemode {
1357 pub const SURVIVAL: Self = Self(0);
1359 pub const CREATIVE: Self = Self(1);
1361 pub const ADVENTURE: Self = Self(2);
1363 pub const SPECTATOR: Self = Self(3);
1365 pub const fn name(self) -> Option<&'static str> {
1367 match self.0 {
1368 0 => Some("survival"),
1369 1 => Some("creative"),
1370 2 => Some("adventure"),
1371 3 => Some("spectator"),
1372 _ => None,
1373 }
1374 }
1375}
1376#[cfg(feature = "v26_1")]
1377impl std::fmt::Debug for SpawnInfoGamemode {
1378 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1379 match self.name() {
1380 Some(n) => write!(f, "SpawnInfoGamemode::{n}"),
1381 None => write!(f, "SpawnInfoGamemode({})", self.0),
1382 }
1383 }
1384}
1385
1386#[cfg(feature = "v26_1")]
1387#[derive(Debug, Clone, PartialEq)]
1389pub struct SpawnInfo {
1390 pub dimension: i32,
1392 pub name: ByteString,
1394 pub hashed_seed: i64,
1396 pub gamemode: crate::defs::p775::play::clientbound::SpawnInfoGamemode,
1398 pub previous_gamemode: u8,
1400 pub is_debug: bool,
1402 pub is_flat: bool,
1404 pub death: Option<crate::defs::p775::types::GlobalPos>,
1406 pub portal_cooldown: i32,
1408 pub sea_level: i32,
1410}
1411#[cfg(feature = "v26_1")]
1412impl Decode for SpawnInfo {
1413 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1414 Ok({
1415 let v1 = r.read_varint()?;
1416 let v2 = r.read_string()?;
1417 let v3 = r.read_i64()?;
1418 let v4 = crate::defs::p775::play::clientbound::SpawnInfoGamemode(r.read_i8()?);
1419 let v5 = r.read_u8()?;
1420 let v6 = r.read_bool()?;
1421 let v7 = r.read_bool()?;
1422 let v8 = if r.read_bool()? {
1423 Some(<crate::defs::p775::types::GlobalPos as Decode>::decode(r)?)
1424 } else {
1425 None
1426 };
1427 let v9 = r.read_varint()?;
1428 let v10 = r.read_varint()?;
1429 Self {
1430 dimension: v1,
1431 name: v2,
1432 hashed_seed: v3,
1433 gamemode: v4,
1434 previous_gamemode: v5,
1435 is_debug: v6,
1436 is_flat: v7,
1437 death: v8,
1438 portal_cooldown: v9,
1439 sea_level: v10,
1440 }
1441 })
1442 }
1443}
1444#[cfg(feature = "v26_1")]
1445impl Encode for SpawnInfo {
1446 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1447 w.put_varint((*self).dimension);
1448 w.put_string(&(*self).name)?;
1449 w.put_i64((*self).hashed_seed);
1450 w.put_i8((*self).gamemode.0);
1451 w.put_u8((*self).previous_gamemode);
1452 w.put_bool((*self).is_debug);
1453 w.put_bool((*self).is_flat);
1454 match &(*self).death {
1455 Some(v1) => {
1456 w.put_u8(1);
1457 (*v1).encode(w)?;
1458 }
1459 None => w.put_u8(0),
1460 }
1461 w.put_varint((*self).portal_cooldown);
1462 w.put_varint((*self).sea_level);
1463 Ok(())
1464 }
1465}
1466#[cfg(feature = "v26_1")]
1467#[cfg(feature = "testgen")]
1468impl Generate for SpawnInfo {
1469 fn generate(g: &mut Gen) -> Self {
1470 {
1471 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1472 let v2 = g.string();
1473 let v3 = g.i64();
1474 let v4 = crate::defs::p775::play::clientbound::SpawnInfoGamemode(g.int_in(
1475 -128,
1476 127,
1477 &[0, 1, 2, 3],
1478 ) as i8);
1479 let v5 = (g.int_in(0, 255, &[]) as u8);
1480 let v6 = g.bool();
1481 let v7 = g.bool();
1482 let v8 = if g.bool() {
1483 Some(<crate::defs::p775::types::GlobalPos as Generate>::generate(
1484 g,
1485 ))
1486 } else {
1487 None
1488 };
1489 let v9 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1490 let v10 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1491 Self {
1492 dimension: v1,
1493 name: v2,
1494 hashed_seed: v3,
1495 gamemode: v4,
1496 previous_gamemode: v5,
1497 is_debug: v6,
1498 is_flat: v7,
1499 death: v8,
1500 portal_cooldown: v9,
1501 sea_level: v10,
1502 }
1503 }
1504 }
1505}
1506
1507#[cfg(feature = "v26_1")]
1508#[derive(Debug, Clone, PartialEq)]
1510pub struct BundleDelimiter<const V: i32> {}
1511#[cfg(feature = "v26_1")]
1512impl<const V: i32> Decode for BundleDelimiter<V> {
1513 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1514 Ok({ Self {} })
1515 }
1516}
1517#[cfg(feature = "v26_1")]
1518impl<const V: i32> Encode for BundleDelimiter<V> {
1519 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1520 Ok(())
1521 }
1522}
1523#[cfg(feature = "v26_1")]
1524#[cfg(feature = "testgen")]
1525impl<const V: i32> Generate for BundleDelimiter<V> {
1526 fn generate(g: &mut Gen) -> Self {
1527 { Self {} }
1528 }
1529}
1530
1531#[cfg(feature = "v26_1")]
1532#[derive(Debug, Clone, PartialEq)]
1534pub struct SpawnEntity<const V: i32> {
1535 pub entity_id: i32,
1537 pub object_uuid: Uuid,
1539 pub r#type: i32,
1541 pub x: f64,
1543 pub y: f64,
1545 pub z: f64,
1547 pub velocity: LpVec3,
1549 pub pitch: i8,
1551 pub yaw: i8,
1553 pub head_pitch: i8,
1555 pub object_data: i32,
1557}
1558#[cfg(feature = "v26_1")]
1559impl<const V: i32> Decode for SpawnEntity<V> {
1560 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1561 Ok({
1562 let v1 = r.read_varint()?;
1563 let v2 = r.read_uuid()?;
1564 let v3 = r.read_varint()?;
1565 let v4 = r.read_f64()?;
1566 let v5 = r.read_f64()?;
1567 let v6 = r.read_f64()?;
1568 let v7 = LpVec3::read(r)?;
1569 let v8 = r.read_i8()?;
1570 let v9 = r.read_i8()?;
1571 let v10 = r.read_i8()?;
1572 let v11 = r.read_varint()?;
1573 Self {
1574 entity_id: v1,
1575 object_uuid: v2,
1576 r#type: v3,
1577 x: v4,
1578 y: v5,
1579 z: v6,
1580 velocity: v7,
1581 pitch: v8,
1582 yaw: v9,
1583 head_pitch: v10,
1584 object_data: v11,
1585 }
1586 })
1587 }
1588}
1589#[cfg(feature = "v26_1")]
1590impl<const V: i32> Encode for SpawnEntity<V> {
1591 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1592 w.put_varint((*self).entity_id);
1593 w.put_uuid(&(*self).object_uuid);
1594 w.put_varint((*self).r#type);
1595 w.put_f64((*self).x);
1596 w.put_f64((*self).y);
1597 w.put_f64((*self).z);
1598 (*self).velocity.write(w);
1599 w.put_i8((*self).pitch);
1600 w.put_i8((*self).yaw);
1601 w.put_i8((*self).head_pitch);
1602 w.put_varint((*self).object_data);
1603 Ok(())
1604 }
1605}
1606#[cfg(feature = "v26_1")]
1607#[cfg(feature = "testgen")]
1608impl<const V: i32> Generate for SpawnEntity<V> {
1609 fn generate(g: &mut Gen) -> Self {
1610 {
1611 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1612 let v2 = g.uuid();
1613 let v3 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1614 let v4 = g.f64();
1615 let v5 = g.f64();
1616 let v6 = g.f64();
1617 let v7 = <LpVec3 as Generate>::generate(g);
1618 let v8 = (g.int_in(-128, 127, &[]) as i8);
1619 let v9 = (g.int_in(-128, 127, &[]) as i8);
1620 let v10 = (g.int_in(-128, 127, &[]) as i8);
1621 let v11 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1622 Self {
1623 entity_id: v1,
1624 object_uuid: v2,
1625 r#type: v3,
1626 x: v4,
1627 y: v5,
1628 z: v6,
1629 velocity: v7,
1630 pitch: v8,
1631 yaw: v9,
1632 head_pitch: v10,
1633 object_data: v11,
1634 }
1635 }
1636 }
1637}
1638
1639#[cfg(feature = "v26_1")]
1640#[derive(Debug, Clone, PartialEq)]
1642pub struct AcknowledgePlayerDigging<const V: i32> {
1643 pub sequence_id: i32,
1645}
1646#[cfg(feature = "v26_1")]
1647impl<const V: i32> Decode for AcknowledgePlayerDigging<V> {
1648 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1649 Ok({
1650 let v1 = r.read_varint()?;
1651 Self { sequence_id: v1 }
1652 })
1653 }
1654}
1655#[cfg(feature = "v26_1")]
1656impl<const V: i32> Encode for AcknowledgePlayerDigging<V> {
1657 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1658 w.put_varint((*self).sequence_id);
1659 Ok(())
1660 }
1661}
1662#[cfg(feature = "v26_1")]
1663#[cfg(feature = "testgen")]
1664impl<const V: i32> Generate for AcknowledgePlayerDigging<V> {
1665 fn generate(g: &mut Gen) -> Self {
1666 {
1667 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1668 Self { sequence_id: v1 }
1669 }
1670 }
1671}
1672
1673#[cfg(feature = "v26_1")]
1674#[derive(Debug, Clone, PartialEq)]
1676pub struct TileEntityData<const V: i32> {
1677 pub location: BlockPos,
1679 pub action: i32,
1681 pub nbt_data: Option<AnonNbt>,
1683}
1684#[cfg(feature = "v26_1")]
1685impl<const V: i32> Decode for TileEntityData<V> {
1686 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1687 Ok({
1688 let v1 = BlockPos::read(r, PositionLayout::Xzy)?;
1689 let v2 = r.read_varint()?;
1690 let v3 = AnonNbt::read_optional(r)?;
1691 Self {
1692 location: v1,
1693 action: v2,
1694 nbt_data: v3,
1695 }
1696 })
1697 }
1698}
1699#[cfg(feature = "v26_1")]
1700impl<const V: i32> Encode for TileEntityData<V> {
1701 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1702 (*self).location.write(w, PositionLayout::Xzy)?;
1703 w.put_varint((*self).action);
1704 AnonNbt::write_optional(&(*self).nbt_data, w);
1705 Ok(())
1706 }
1707}
1708#[cfg(feature = "v26_1")]
1709#[cfg(feature = "testgen")]
1710impl<const V: i32> Generate for TileEntityData<V> {
1711 fn generate(g: &mut Gen) -> Self {
1712 {
1713 let v1 = g.position();
1714 let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1715 let v3 = g.anon_opt_nbt();
1716 Self {
1717 location: v1,
1718 action: v2,
1719 nbt_data: v3,
1720 }
1721 }
1722 }
1723}
1724
1725#[cfg(feature = "v26_1")]
1726#[derive(Debug, Clone, PartialEq)]
1728pub struct BossBar<const V: i32> {
1729 pub entity_uuid: Uuid,
1731 pub action: i32,
1733 pub title: Option<AnonNbt>,
1735 pub health: Option<f32>,
1737 pub color: Option<i32>,
1739 pub dividers: Option<i32>,
1741 pub flags: Option<u8>,
1743}
1744#[cfg(feature = "v26_1")]
1745impl<const V: i32> Decode for BossBar<V> {
1746 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1747 Ok({
1748 let v1 = r.read_uuid()?;
1749 let v2 = r.read_varint()?;
1750 let v3 = if (v2 == 0) || (v2 == 3) {
1751 Some(AnonNbt::read(r)?)
1752 } else {
1753 None
1754 };
1755 let v4 = if (v2 == 0) || (v2 == 2) {
1756 Some(r.read_f32()?)
1757 } else {
1758 None
1759 };
1760 let v5 = if (v2 == 0) || (v2 == 4) {
1761 Some(r.read_varint()?)
1762 } else {
1763 None
1764 };
1765 let v6 = if (v2 == 0) || (v2 == 4) {
1766 Some(r.read_varint()?)
1767 } else {
1768 None
1769 };
1770 let v7 = if (v2 == 0) || (v2 == 5) {
1771 Some(r.read_u8()?)
1772 } else {
1773 None
1774 };
1775 Self {
1776 entity_uuid: v1,
1777 action: v2,
1778 title: v3,
1779 health: v4,
1780 color: v5,
1781 dividers: v6,
1782 flags: v7,
1783 }
1784 })
1785 }
1786}
1787#[cfg(feature = "v26_1")]
1788impl<const V: i32> Encode for BossBar<V> {
1789 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1790 w.put_uuid(&(*self).entity_uuid);
1791 w.put_varint((*self).action);
1792 match (
1793 &(*self).title,
1794 ((*self).action == 0) || ((*self).action == 3),
1795 ) {
1796 (Some(v1), true) => {
1797 (*v1).write(w);
1798 }
1799 (None, false) => {}
1800 _ => {
1801 return Err(EncodeError::SwitchMismatch(
1802 "play.clientbound.boss_bar.title",
1803 ));
1804 }
1805 }
1806 match (
1807 &(*self).health,
1808 ((*self).action == 0) || ((*self).action == 2),
1809 ) {
1810 (Some(v2), true) => {
1811 w.put_f32((*v2));
1812 }
1813 (None, false) => {}
1814 _ => {
1815 return Err(EncodeError::SwitchMismatch(
1816 "play.clientbound.boss_bar.health",
1817 ));
1818 }
1819 }
1820 match (
1821 &(*self).color,
1822 ((*self).action == 0) || ((*self).action == 4),
1823 ) {
1824 (Some(v3), true) => {
1825 w.put_varint((*v3));
1826 }
1827 (None, false) => {}
1828 _ => {
1829 return Err(EncodeError::SwitchMismatch(
1830 "play.clientbound.boss_bar.color",
1831 ));
1832 }
1833 }
1834 match (
1835 &(*self).dividers,
1836 ((*self).action == 0) || ((*self).action == 4),
1837 ) {
1838 (Some(v4), true) => {
1839 w.put_varint((*v4));
1840 }
1841 (None, false) => {}
1842 _ => {
1843 return Err(EncodeError::SwitchMismatch(
1844 "play.clientbound.boss_bar.dividers",
1845 ));
1846 }
1847 }
1848 match (
1849 &(*self).flags,
1850 ((*self).action == 0) || ((*self).action == 5),
1851 ) {
1852 (Some(v5), true) => {
1853 w.put_u8((*v5));
1854 }
1855 (None, false) => {}
1856 _ => {
1857 return Err(EncodeError::SwitchMismatch(
1858 "play.clientbound.boss_bar.flags",
1859 ));
1860 }
1861 }
1862 Ok(())
1863 }
1864}
1865#[cfg(feature = "v26_1")]
1866#[cfg(feature = "testgen")]
1867impl<const V: i32> Generate for BossBar<V> {
1868 fn generate(g: &mut Gen) -> Self {
1869 {
1870 let v1 = g.uuid();
1871 let v2 = (g.int_in(-2147483648, 2147483647, &[0, 3, 0, 2, 0, 4, 0, 4, 0, 5]) as i32);
1872 let v3 = if (v2 == 0) || (v2 == 3) {
1873 Some(g.anon_nbt())
1874 } else {
1875 None
1876 };
1877 let v4 = if (v2 == 0) || (v2 == 2) {
1878 Some(g.f32())
1879 } else {
1880 None
1881 };
1882 let v5 = if (v2 == 0) || (v2 == 4) {
1883 Some((g.int_in(-2147483648, 2147483647, &[]) as i32))
1884 } else {
1885 None
1886 };
1887 let v6 = if (v2 == 0) || (v2 == 4) {
1888 Some((g.int_in(-2147483648, 2147483647, &[]) as i32))
1889 } else {
1890 None
1891 };
1892 let v7 = if (v2 == 0) || (v2 == 5) {
1893 Some((g.int_in(0, 255, &[]) as u8))
1894 } else {
1895 None
1896 };
1897 Self {
1898 entity_uuid: v1,
1899 action: v2,
1900 title: v3,
1901 health: v4,
1902 color: v5,
1903 dividers: v6,
1904 flags: v7,
1905 }
1906 }
1907 }
1908}
1909
1910#[cfg(feature = "v26_1")]
1911#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
1913pub struct DifficultyDifficulty(pub i32);
1914#[cfg(feature = "v26_1")]
1915impl DifficultyDifficulty {
1916 pub const PEACEFUL: Self = Self(0);
1918 pub const EASY: Self = Self(1);
1920 pub const NORMAL: Self = Self(2);
1922 pub const HARD: Self = Self(3);
1924 pub const fn name(self) -> Option<&'static str> {
1926 match self.0 {
1927 0 => Some("peaceful"),
1928 1 => Some("easy"),
1929 2 => Some("normal"),
1930 3 => Some("hard"),
1931 _ => None,
1932 }
1933 }
1934}
1935#[cfg(feature = "v26_1")]
1936impl std::fmt::Debug for DifficultyDifficulty {
1937 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1938 match self.name() {
1939 Some(n) => write!(f, "DifficultyDifficulty::{n}"),
1940 None => write!(f, "DifficultyDifficulty({})", self.0),
1941 }
1942 }
1943}
1944
1945#[cfg(feature = "v26_1")]
1946#[derive(Debug, Clone, PartialEq)]
1948pub struct Difficulty<const V: i32> {
1949 pub difficulty: crate::defs::p775::play::clientbound::DifficultyDifficulty,
1951 pub difficulty_locked: bool,
1953}
1954#[cfg(feature = "v26_1")]
1955impl<const V: i32> Decode for Difficulty<V> {
1956 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1957 Ok({
1958 let v1 = crate::defs::p775::play::clientbound::DifficultyDifficulty(r.read_varint()?);
1959 let v2 = r.read_bool()?;
1960 Self {
1961 difficulty: v1,
1962 difficulty_locked: v2,
1963 }
1964 })
1965 }
1966}
1967#[cfg(feature = "v26_1")]
1968impl<const V: i32> Encode for Difficulty<V> {
1969 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1970 w.put_varint((*self).difficulty.0);
1971 w.put_bool((*self).difficulty_locked);
1972 Ok(())
1973 }
1974}
1975#[cfg(feature = "v26_1")]
1976#[cfg(feature = "testgen")]
1977impl<const V: i32> Generate for Difficulty<V> {
1978 fn generate(g: &mut Gen) -> Self {
1979 {
1980 let v1 = crate::defs::p775::play::clientbound::DifficultyDifficulty(g.int_in(
1981 -2147483648,
1982 2147483647,
1983 &[0, 1, 2, 3],
1984 )
1985 as i32);
1986 let v2 = g.bool();
1987 Self {
1988 difficulty: v1,
1989 difficulty_locked: v2,
1990 }
1991 }
1992 }
1993}
1994
1995#[cfg(feature = "v26_1")]
1996#[derive(Debug, Clone, PartialEq)]
1998pub struct ChunkBatchFinished<const V: i32> {
1999 pub batch_size: i32,
2001}
2002#[cfg(feature = "v26_1")]
2003impl<const V: i32> Decode for ChunkBatchFinished<V> {
2004 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2005 Ok({
2006 let v1 = r.read_varint()?;
2007 Self { batch_size: v1 }
2008 })
2009 }
2010}
2011#[cfg(feature = "v26_1")]
2012impl<const V: i32> Encode for ChunkBatchFinished<V> {
2013 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2014 w.put_varint((*self).batch_size);
2015 Ok(())
2016 }
2017}
2018#[cfg(feature = "v26_1")]
2019#[cfg(feature = "testgen")]
2020impl<const V: i32> Generate for ChunkBatchFinished<V> {
2021 fn generate(g: &mut Gen) -> Self {
2022 {
2023 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2024 Self { batch_size: v1 }
2025 }
2026 }
2027}
2028
2029#[cfg(feature = "v26_1")]
2030#[derive(Debug, Clone, PartialEq)]
2032pub struct ChunkBatchStart<const V: i32> {}
2033#[cfg(feature = "v26_1")]
2034impl<const V: i32> Decode for ChunkBatchStart<V> {
2035 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2036 Ok({ Self {} })
2037 }
2038}
2039#[cfg(feature = "v26_1")]
2040impl<const V: i32> Encode for ChunkBatchStart<V> {
2041 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2042 Ok(())
2043 }
2044}
2045#[cfg(feature = "v26_1")]
2046#[cfg(feature = "testgen")]
2047impl<const V: i32> Generate for ChunkBatchStart<V> {
2048 fn generate(g: &mut Gen) -> Self {
2049 { Self {} }
2050 }
2051}
2052
2053#[cfg(feature = "v26_1")]
2054#[derive(Debug, Clone, PartialEq)]
2056pub struct ChunkBiomesBiomes {
2057 pub position: crate::defs::p775::types::PackedChunkPos,
2059 pub data: Bytes,
2061}
2062
2063#[cfg(feature = "v26_1")]
2064#[derive(Debug, Clone, PartialEq)]
2066pub struct ChunkBiomes<const V: i32> {
2067 pub biomes: Vec<crate::defs::p775::play::clientbound::ChunkBiomesBiomes>,
2069}
2070#[cfg(feature = "v26_1")]
2071impl<const V: i32> Decode for ChunkBiomes<V> {
2072 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2073 Ok({
2074 let v1 = {
2075 let v2 = {
2076 let c = r.read_varint()?;
2077 r.check_count(i64::from(c), 9)?
2078 };
2079 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
2080 for _ in 0..v2 {
2081 v3.push({
2082 let v4 = <crate::defs::p775::types::PackedChunkPos as Decode>::decode(r)?;
2083 let v5 = r.read_byte_array()?;
2084 crate::defs::p775::play::clientbound::ChunkBiomesBiomes {
2085 position: v4,
2086 data: v5,
2087 }
2088 });
2089 }
2090 v3
2091 };
2092 Self { biomes: v1 }
2093 })
2094 }
2095}
2096#[cfg(feature = "v26_1")]
2097impl<const V: i32> Encode for ChunkBiomes<V> {
2098 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2099 w.put_len_varint((*self).biomes.len())?;
2100 for v1 in (*self).biomes.iter() {
2101 (*v1).position.encode(w)?;
2102 w.put_byte_array(&(*v1).data)?;
2103 }
2104 Ok(())
2105 }
2106}
2107#[cfg(feature = "v26_1")]
2108#[cfg(feature = "testgen")]
2109impl<const V: i32> Generate for ChunkBiomes<V> {
2110 fn generate(g: &mut Gen) -> Self {
2111 {
2112 let v1 = {
2113 let v2 = g.count();
2114 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
2115 for _ in 0..v2 {
2116 v3.push({
2117 let v4 =
2118 <crate::defs::p775::types::PackedChunkPos as Generate>::generate(g);
2119 let v5 = g.bytes();
2120 crate::defs::p775::play::clientbound::ChunkBiomesBiomes {
2121 position: v4,
2122 data: v5,
2123 }
2124 });
2125 }
2126 v3
2127 };
2128 Self { biomes: v1 }
2129 }
2130 }
2131}
2132
2133#[cfg(feature = "v26_1")]
2134#[derive(Debug, Clone, PartialEq)]
2136pub struct ClearTitles<const V: i32> {
2137 pub reset: bool,
2139}
2140#[cfg(feature = "v26_1")]
2141impl<const V: i32> Decode for ClearTitles<V> {
2142 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2143 Ok({
2144 let v1 = r.read_bool()?;
2145 Self { reset: v1 }
2146 })
2147 }
2148}
2149#[cfg(feature = "v26_1")]
2150impl<const V: i32> Encode for ClearTitles<V> {
2151 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2152 w.put_bool((*self).reset);
2153 Ok(())
2154 }
2155}
2156#[cfg(feature = "v26_1")]
2157#[cfg(feature = "testgen")]
2158impl<const V: i32> Generate for ClearTitles<V> {
2159 fn generate(g: &mut Gen) -> Self {
2160 {
2161 let v1 = g.bool();
2162 Self { reset: v1 }
2163 }
2164 }
2165}
2166
2167#[cfg(feature = "v26_1")]
2168#[derive(Debug, Clone, PartialEq)]
2170pub struct TabCompleteMatches {
2171 pub r#match: ByteString,
2173 pub tooltip: Option<AnonNbt>,
2175}
2176
2177#[cfg(feature = "v26_1")]
2178#[derive(Debug, Clone, PartialEq)]
2180pub struct TabComplete<const V: i32> {
2181 pub transaction_id: i32,
2183 pub start: i32,
2185 pub length: i32,
2187 pub matches: Vec<crate::defs::p775::play::clientbound::TabCompleteMatches>,
2189}
2190#[cfg(feature = "v26_1")]
2191impl<const V: i32> Decode for TabComplete<V> {
2192 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2193 Ok({
2194 let v1 = r.read_varint()?;
2195 let v2 = r.read_varint()?;
2196 let v3 = r.read_varint()?;
2197 let v4 = {
2198 let v5 = {
2199 let c = r.read_varint()?;
2200 r.check_count(i64::from(c), 2)?
2201 };
2202 let mut v6 = Vec::with_capacity(v5.min(crate::codec::PREALLOC_LIMIT));
2203 for _ in 0..v5 {
2204 v6.push({
2205 let v7 = r.read_string()?;
2206 let v8 = if r.read_bool()? {
2207 Some(AnonNbt::read(r)?)
2208 } else {
2209 None
2210 };
2211 crate::defs::p775::play::clientbound::TabCompleteMatches {
2212 r#match: v7,
2213 tooltip: v8,
2214 }
2215 });
2216 }
2217 v6
2218 };
2219 Self {
2220 transaction_id: v1,
2221 start: v2,
2222 length: v3,
2223 matches: v4,
2224 }
2225 })
2226 }
2227}
2228#[cfg(feature = "v26_1")]
2229impl<const V: i32> Encode for TabComplete<V> {
2230 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2231 w.put_varint((*self).transaction_id);
2232 w.put_varint((*self).start);
2233 w.put_varint((*self).length);
2234 w.put_len_varint((*self).matches.len())?;
2235 for v1 in (*self).matches.iter() {
2236 w.put_string(&(*v1).r#match)?;
2237 match &(*v1).tooltip {
2238 Some(v2) => {
2239 w.put_u8(1);
2240 (*v2).write(w);
2241 }
2242 None => w.put_u8(0),
2243 }
2244 }
2245 Ok(())
2246 }
2247}
2248#[cfg(feature = "v26_1")]
2249#[cfg(feature = "testgen")]
2250impl<const V: i32> Generate for TabComplete<V> {
2251 fn generate(g: &mut Gen) -> Self {
2252 {
2253 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2254 let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2255 let v3 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2256 let v4 = {
2257 let v5 = g.count();
2258 let mut v6 = Vec::with_capacity(v5.min(crate::codec::PREALLOC_LIMIT));
2259 for _ in 0..v5 {
2260 v6.push({
2261 let v7 = g.string();
2262 let v8 = if g.bool() { Some(g.anon_nbt()) } else { None };
2263 crate::defs::p775::play::clientbound::TabCompleteMatches {
2264 r#match: v7,
2265 tooltip: v8,
2266 }
2267 });
2268 }
2269 v6
2270 };
2271 Self {
2272 transaction_id: v1,
2273 start: v2,
2274 length: v3,
2275 matches: v4,
2276 }
2277 }
2278 }
2279}
2280
2281#[cfg(feature = "v26_1")]
2282#[derive(Debug, Clone, PartialEq)]
2284pub struct DeclareCommands<const V: i32> {
2285 pub nodes: Vec<crate::defs::p775::types::CommandNode>,
2287 pub root_index: i32,
2289}
2290#[cfg(feature = "v26_1")]
2291impl<const V: i32> Decode for DeclareCommands<V> {
2292 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2293 Ok({
2294 let v1 = {
2295 let v2 = {
2296 let c = r.read_varint()?;
2297 r.check_count(i64::from(c), 2)?
2298 };
2299 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
2300 for _ in 0..v2 {
2301 v3.push(<crate::defs::p775::types::CommandNode as Decode>::decode(
2302 r,
2303 )?);
2304 }
2305 v3
2306 };
2307 let v4 = r.read_varint()?;
2308 Self {
2309 nodes: v1,
2310 root_index: v4,
2311 }
2312 })
2313 }
2314}
2315#[cfg(feature = "v26_1")]
2316impl<const V: i32> Encode for DeclareCommands<V> {
2317 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2318 w.put_len_varint((*self).nodes.len())?;
2319 for v1 in (*self).nodes.iter() {
2320 (*v1).encode(w)?;
2321 }
2322 w.put_varint((*self).root_index);
2323 Ok(())
2324 }
2325}
2326#[cfg(feature = "v26_1")]
2327#[cfg(feature = "testgen")]
2328impl<const V: i32> Generate for DeclareCommands<V> {
2329 fn generate(g: &mut Gen) -> Self {
2330 {
2331 let v1 = {
2332 let v2 = g.count();
2333 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
2334 for _ in 0..v2 {
2335 v3.push(<crate::defs::p775::types::CommandNode as Generate>::generate(g));
2336 }
2337 v3
2338 };
2339 let v4 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2340 Self {
2341 nodes: v1,
2342 root_index: v4,
2343 }
2344 }
2345 }
2346}
2347
2348#[cfg(feature = "v26_1")]
2349#[derive(Debug, Clone, PartialEq)]
2351pub struct CloseWindow<const V: i32> {
2352 pub window_id: i32,
2354}
2355#[cfg(feature = "v26_1")]
2356impl<const V: i32> Decode for CloseWindow<V> {
2357 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2358 Ok({
2359 let v1 = r.read_varint()?;
2360 Self { window_id: v1 }
2361 })
2362 }
2363}
2364#[cfg(feature = "v26_1")]
2365impl<const V: i32> Encode for CloseWindow<V> {
2366 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2367 w.put_varint((*self).window_id);
2368 Ok(())
2369 }
2370}
2371#[cfg(feature = "v26_1")]
2372#[cfg(feature = "testgen")]
2373impl<const V: i32> Generate for CloseWindow<V> {
2374 fn generate(g: &mut Gen) -> Self {
2375 {
2376 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2377 Self { window_id: v1 }
2378 }
2379 }
2380}
2381
2382#[cfg(feature = "v26_1")]
2383#[derive(Debug, Clone, PartialEq)]
2385pub struct WindowItems<const V: i32> {
2386 pub window_id: i32,
2388 pub state_id: i32,
2390 pub items: Vec<crate::defs::p775::types::Slot>,
2392 pub carried_item: crate::defs::p775::types::Slot,
2394}
2395#[cfg(feature = "v26_1")]
2396impl<const V: i32> Decode for WindowItems<V> {
2397 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2398 Ok({
2399 let v1 = r.read_varint()?;
2400 let v2 = r.read_varint()?;
2401 let v3 = {
2402 let v4 = {
2403 let c = r.read_varint()?;
2404 r.check_count(i64::from(c), 1)?
2405 };
2406 let mut v5 = Vec::with_capacity(v4.min(crate::codec::PREALLOC_LIMIT));
2407 for _ in 0..v4 {
2408 v5.push(<crate::defs::p775::types::Slot as Decode>::decode(r)?);
2409 }
2410 v5
2411 };
2412 let v6 = <crate::defs::p775::types::Slot as Decode>::decode(r)?;
2413 Self {
2414 window_id: v1,
2415 state_id: v2,
2416 items: v3,
2417 carried_item: v6,
2418 }
2419 })
2420 }
2421}
2422#[cfg(feature = "v26_1")]
2423impl<const V: i32> Encode for WindowItems<V> {
2424 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2425 w.put_varint((*self).window_id);
2426 w.put_varint((*self).state_id);
2427 w.put_len_varint((*self).items.len())?;
2428 for v1 in (*self).items.iter() {
2429 (*v1).encode(w)?;
2430 }
2431 (*self).carried_item.encode(w)?;
2432 Ok(())
2433 }
2434}
2435#[cfg(feature = "v26_1")]
2436#[cfg(feature = "testgen")]
2437impl<const V: i32> Generate for WindowItems<V> {
2438 fn generate(g: &mut Gen) -> Self {
2439 {
2440 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2441 let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2442 let v3 = {
2443 let v4 = g.count();
2444 let mut v5 = Vec::with_capacity(v4.min(crate::codec::PREALLOC_LIMIT));
2445 for _ in 0..v4 {
2446 v5.push(<crate::defs::p775::types::Slot as Generate>::generate(g));
2447 }
2448 v5
2449 };
2450 let v6 = <crate::defs::p775::types::Slot as Generate>::generate(g);
2451 Self {
2452 window_id: v1,
2453 state_id: v2,
2454 items: v3,
2455 carried_item: v6,
2456 }
2457 }
2458 }
2459}
2460
2461#[cfg(feature = "v26_1")]
2462#[derive(Debug, Clone, PartialEq)]
2464pub struct CraftProgressBar<const V: i32> {
2465 pub window_id: i32,
2467 pub property: i16,
2469 pub value: i16,
2471}
2472#[cfg(feature = "v26_1")]
2473impl<const V: i32> Decode for CraftProgressBar<V> {
2474 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2475 Ok({
2476 let v1 = r.read_varint()?;
2477 let v2 = r.read_i16()?;
2478 let v3 = r.read_i16()?;
2479 Self {
2480 window_id: v1,
2481 property: v2,
2482 value: v3,
2483 }
2484 })
2485 }
2486}
2487#[cfg(feature = "v26_1")]
2488impl<const V: i32> Encode for CraftProgressBar<V> {
2489 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2490 w.put_varint((*self).window_id);
2491 w.put_i16((*self).property);
2492 w.put_i16((*self).value);
2493 Ok(())
2494 }
2495}
2496#[cfg(feature = "v26_1")]
2497#[cfg(feature = "testgen")]
2498impl<const V: i32> Generate for CraftProgressBar<V> {
2499 fn generate(g: &mut Gen) -> Self {
2500 {
2501 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2502 let v2 = (g.int_in(-32768, 32767, &[]) as i16);
2503 let v3 = (g.int_in(-32768, 32767, &[]) as i16);
2504 Self {
2505 window_id: v1,
2506 property: v2,
2507 value: v3,
2508 }
2509 }
2510 }
2511}
2512
2513#[cfg(feature = "v26_1")]
2514#[derive(Debug, Clone, PartialEq)]
2516pub struct SetSlot<const V: i32> {
2517 pub window_id: i32,
2519 pub state_id: i32,
2521 pub slot: i16,
2523 pub item: crate::defs::p775::types::Slot,
2525}
2526#[cfg(feature = "v26_1")]
2527impl<const V: i32> Decode for SetSlot<V> {
2528 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2529 Ok({
2530 let v1 = r.read_varint()?;
2531 let v2 = r.read_varint()?;
2532 let v3 = r.read_i16()?;
2533 let v4 = <crate::defs::p775::types::Slot as Decode>::decode(r)?;
2534 Self {
2535 window_id: v1,
2536 state_id: v2,
2537 slot: v3,
2538 item: v4,
2539 }
2540 })
2541 }
2542}
2543#[cfg(feature = "v26_1")]
2544impl<const V: i32> Encode for SetSlot<V> {
2545 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2546 w.put_varint((*self).window_id);
2547 w.put_varint((*self).state_id);
2548 w.put_i16((*self).slot);
2549 (*self).item.encode(w)?;
2550 Ok(())
2551 }
2552}
2553#[cfg(feature = "v26_1")]
2554#[cfg(feature = "testgen")]
2555impl<const V: i32> Generate for SetSlot<V> {
2556 fn generate(g: &mut Gen) -> Self {
2557 {
2558 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2559 let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2560 let v3 = (g.int_in(-32768, 32767, &[]) as i16);
2561 let v4 = <crate::defs::p775::types::Slot as Generate>::generate(g);
2562 Self {
2563 window_id: v1,
2564 state_id: v2,
2565 slot: v3,
2566 item: v4,
2567 }
2568 }
2569 }
2570}
2571
2572#[cfg(feature = "v26_1")]
2573#[derive(Debug, Clone, PartialEq)]
2575pub struct CookieRequest<const V: i32> {
2576 pub cookie: ByteString,
2578}
2579#[cfg(feature = "v26_1")]
2580impl<const V: i32> Decode for CookieRequest<V> {
2581 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2582 Ok({
2583 let v1 = r.read_string()?;
2584 Self { cookie: v1 }
2585 })
2586 }
2587}
2588#[cfg(feature = "v26_1")]
2589impl<const V: i32> Encode for CookieRequest<V> {
2590 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2591 w.put_string(&(*self).cookie)?;
2592 Ok(())
2593 }
2594}
2595#[cfg(feature = "v26_1")]
2596#[cfg(feature = "testgen")]
2597impl<const V: i32> Generate for CookieRequest<V> {
2598 fn generate(g: &mut Gen) -> Self {
2599 {
2600 let v1 = g.string();
2601 Self { cookie: v1 }
2602 }
2603 }
2604}
2605
2606#[cfg(feature = "v26_1")]
2607#[derive(Debug, Clone, PartialEq)]
2609pub struct SetCooldown<const V: i32> {
2610 pub cooldown_group: ByteString,
2612 pub cooldown_ticks: i32,
2614}
2615#[cfg(feature = "v26_1")]
2616impl<const V: i32> Decode for SetCooldown<V> {
2617 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2618 Ok({
2619 let v1 = r.read_string()?;
2620 let v2 = r.read_varint()?;
2621 Self {
2622 cooldown_group: v1,
2623 cooldown_ticks: v2,
2624 }
2625 })
2626 }
2627}
2628#[cfg(feature = "v26_1")]
2629impl<const V: i32> Encode for SetCooldown<V> {
2630 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2631 w.put_string(&(*self).cooldown_group)?;
2632 w.put_varint((*self).cooldown_ticks);
2633 Ok(())
2634 }
2635}
2636#[cfg(feature = "v26_1")]
2637#[cfg(feature = "testgen")]
2638impl<const V: i32> Generate for SetCooldown<V> {
2639 fn generate(g: &mut Gen) -> Self {
2640 {
2641 let v1 = g.string();
2642 let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2643 Self {
2644 cooldown_group: v1,
2645 cooldown_ticks: v2,
2646 }
2647 }
2648 }
2649}
2650
2651#[cfg(feature = "v26_1")]
2652#[derive(Debug, Clone, PartialEq)]
2654pub struct ChatSuggestions<const V: i32> {
2655 pub action: i32,
2657 pub entries: Vec<ByteString>,
2659}
2660#[cfg(feature = "v26_1")]
2661impl<const V: i32> Decode for ChatSuggestions<V> {
2662 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2663 Ok({
2664 let v1 = r.read_varint()?;
2665 let v2 = {
2666 let v3 = {
2667 let c = r.read_varint()?;
2668 r.check_count(i64::from(c), 1)?
2669 };
2670 let mut v4 = Vec::with_capacity(v3.min(crate::codec::PREALLOC_LIMIT));
2671 for _ in 0..v3 {
2672 v4.push(r.read_string()?);
2673 }
2674 v4
2675 };
2676 Self {
2677 action: v1,
2678 entries: v2,
2679 }
2680 })
2681 }
2682}
2683#[cfg(feature = "v26_1")]
2684impl<const V: i32> Encode for ChatSuggestions<V> {
2685 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2686 w.put_varint((*self).action);
2687 w.put_len_varint((*self).entries.len())?;
2688 for v1 in (*self).entries.iter() {
2689 w.put_string(&(*v1))?;
2690 }
2691 Ok(())
2692 }
2693}
2694#[cfg(feature = "v26_1")]
2695#[cfg(feature = "testgen")]
2696impl<const V: i32> Generate for ChatSuggestions<V> {
2697 fn generate(g: &mut Gen) -> Self {
2698 {
2699 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2700 let v2 = {
2701 let v3 = g.count();
2702 let mut v4 = Vec::with_capacity(v3.min(crate::codec::PREALLOC_LIMIT));
2703 for _ in 0..v3 {
2704 v4.push(g.string());
2705 }
2706 v4
2707 };
2708 Self {
2709 action: v1,
2710 entries: v2,
2711 }
2712 }
2713 }
2714}
2715
2716#[cfg(feature = "v26_1")]
2717#[derive(Debug, Clone, PartialEq)]
2719pub struct DamageEvent<const V: i32> {
2720 pub entity_id: i32,
2722 pub source_type_id: i32,
2724 pub source_cause_id: i32,
2726 pub source_direct_id: i32,
2728 pub source_position: Option<crate::defs::p775::types::Vec3f64>,
2730}
2731#[cfg(feature = "v26_1")]
2732impl<const V: i32> Decode for DamageEvent<V> {
2733 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2734 Ok({
2735 let v1 = r.read_varint()?;
2736 let v2 = r.read_varint()?;
2737 let v3 = r.read_varint()?;
2738 let v4 = r.read_varint()?;
2739 let v5 = if r.read_bool()? {
2740 Some(<crate::defs::p775::types::Vec3f64 as Decode>::decode(r)?)
2741 } else {
2742 None
2743 };
2744 Self {
2745 entity_id: v1,
2746 source_type_id: v2,
2747 source_cause_id: v3,
2748 source_direct_id: v4,
2749 source_position: v5,
2750 }
2751 })
2752 }
2753}
2754#[cfg(feature = "v26_1")]
2755impl<const V: i32> Encode for DamageEvent<V> {
2756 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2757 w.put_varint((*self).entity_id);
2758 w.put_varint((*self).source_type_id);
2759 w.put_varint((*self).source_cause_id);
2760 w.put_varint((*self).source_direct_id);
2761 match &(*self).source_position {
2762 Some(v1) => {
2763 w.put_u8(1);
2764 (*v1).encode(w)?;
2765 }
2766 None => w.put_u8(0),
2767 }
2768 Ok(())
2769 }
2770}
2771#[cfg(feature = "v26_1")]
2772#[cfg(feature = "testgen")]
2773impl<const V: i32> Generate for DamageEvent<V> {
2774 fn generate(g: &mut Gen) -> Self {
2775 {
2776 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2777 let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2778 let v3 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2779 let v4 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2780 let v5 = if g.bool() {
2781 Some(<crate::defs::p775::types::Vec3f64 as Generate>::generate(g))
2782 } else {
2783 None
2784 };
2785 Self {
2786 entity_id: v1,
2787 source_type_id: v2,
2788 source_cause_id: v3,
2789 source_direct_id: v4,
2790 source_position: v5,
2791 }
2792 }
2793 }
2794}
2795
2796#[cfg(feature = "v26_1")]
2797#[derive(Debug, Clone, PartialEq)]
2799pub struct DebugBlockValue<const V: i32> {
2800 pub block_pos: BlockPos,
2802 pub update: crate::defs::p775::types::DebugSubscriptionUpdate,
2804}
2805#[cfg(feature = "v26_1")]
2806impl<const V: i32> Decode for DebugBlockValue<V> {
2807 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2808 Ok({
2809 let v1 = BlockPos::read(r, PositionLayout::Xzy)?;
2810 let v2 = <crate::defs::p775::types::DebugSubscriptionUpdate as Decode>::decode(r)?;
2811 Self {
2812 block_pos: v1,
2813 update: v2,
2814 }
2815 })
2816 }
2817}
2818#[cfg(feature = "v26_1")]
2819impl<const V: i32> Encode for DebugBlockValue<V> {
2820 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2821 (*self).block_pos.write(w, PositionLayout::Xzy)?;
2822 (*self).update.encode(w)?;
2823 Ok(())
2824 }
2825}
2826#[cfg(feature = "v26_1")]
2827#[cfg(feature = "testgen")]
2828impl<const V: i32> Generate for DebugBlockValue<V> {
2829 fn generate(g: &mut Gen) -> Self {
2830 {
2831 let v1 = g.position();
2832 let v2 = <crate::defs::p775::types::DebugSubscriptionUpdate as Generate>::generate(g);
2833 Self {
2834 block_pos: v1,
2835 update: v2,
2836 }
2837 }
2838 }
2839}
2840
2841#[cfg(feature = "v26_1")]
2842#[derive(Debug, Clone, PartialEq)]
2844pub struct DebugChunkValue<const V: i32> {
2845 pub chunk_pos: crate::defs::p775::types::PackedChunkPos,
2847 pub update: crate::defs::p775::types::DebugSubscriptionUpdate,
2849}
2850#[cfg(feature = "v26_1")]
2851impl<const V: i32> Decode for DebugChunkValue<V> {
2852 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2853 Ok({
2854 let v1 = <crate::defs::p775::types::PackedChunkPos as Decode>::decode(r)?;
2855 let v2 = <crate::defs::p775::types::DebugSubscriptionUpdate as Decode>::decode(r)?;
2856 Self {
2857 chunk_pos: v1,
2858 update: v2,
2859 }
2860 })
2861 }
2862}
2863#[cfg(feature = "v26_1")]
2864impl<const V: i32> Encode for DebugChunkValue<V> {
2865 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2866 (*self).chunk_pos.encode(w)?;
2867 (*self).update.encode(w)?;
2868 Ok(())
2869 }
2870}
2871#[cfg(feature = "v26_1")]
2872#[cfg(feature = "testgen")]
2873impl<const V: i32> Generate for DebugChunkValue<V> {
2874 fn generate(g: &mut Gen) -> Self {
2875 {
2876 let v1 = <crate::defs::p775::types::PackedChunkPos as Generate>::generate(g);
2877 let v2 = <crate::defs::p775::types::DebugSubscriptionUpdate as Generate>::generate(g);
2878 Self {
2879 chunk_pos: v1,
2880 update: v2,
2881 }
2882 }
2883 }
2884}
2885
2886#[cfg(feature = "v26_1")]
2887#[derive(Debug, Clone, PartialEq)]
2889pub struct DebugEntityValue<const V: i32> {
2890 pub entity_id: i32,
2892 pub update: crate::defs::p775::types::DebugSubscriptionUpdate,
2894}
2895#[cfg(feature = "v26_1")]
2896impl<const V: i32> Decode for DebugEntityValue<V> {
2897 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2898 Ok({
2899 let v1 = r.read_varint()?;
2900 let v2 = <crate::defs::p775::types::DebugSubscriptionUpdate as Decode>::decode(r)?;
2901 Self {
2902 entity_id: v1,
2903 update: v2,
2904 }
2905 })
2906 }
2907}
2908#[cfg(feature = "v26_1")]
2909impl<const V: i32> Encode for DebugEntityValue<V> {
2910 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2911 w.put_varint((*self).entity_id);
2912 (*self).update.encode(w)?;
2913 Ok(())
2914 }
2915}
2916#[cfg(feature = "v26_1")]
2917#[cfg(feature = "testgen")]
2918impl<const V: i32> Generate for DebugEntityValue<V> {
2919 fn generate(g: &mut Gen) -> Self {
2920 {
2921 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2922 let v2 = <crate::defs::p775::types::DebugSubscriptionUpdate as Generate>::generate(g);
2923 Self {
2924 entity_id: v1,
2925 update: v2,
2926 }
2927 }
2928 }
2929}
2930
2931#[cfg(feature = "v26_1")]
2932#[derive(Debug, Clone, PartialEq)]
2934pub struct DebugEvent<const V: i32> {
2935 pub event: crate::defs::p775::types::DebugSubscriptionEvent,
2937}
2938#[cfg(feature = "v26_1")]
2939impl<const V: i32> Decode for DebugEvent<V> {
2940 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2941 Ok({
2942 let v1 = <crate::defs::p775::types::DebugSubscriptionEvent as Decode>::decode(r)?;
2943 Self { event: v1 }
2944 })
2945 }
2946}
2947#[cfg(feature = "v26_1")]
2948impl<const V: i32> Encode for DebugEvent<V> {
2949 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2950 (*self).event.encode(w)?;
2951 Ok(())
2952 }
2953}
2954#[cfg(feature = "v26_1")]
2955#[cfg(feature = "testgen")]
2956impl<const V: i32> Generate for DebugEvent<V> {
2957 fn generate(g: &mut Gen) -> Self {
2958 {
2959 let v1 = <crate::defs::p775::types::DebugSubscriptionEvent as Generate>::generate(g);
2960 Self { event: v1 }
2961 }
2962 }
2963}
2964
2965#[cfg(feature = "v26_1")]
2966#[derive(Debug, Clone, PartialEq)]
2968pub struct DebugSample<const V: i32> {
2969 pub sample: Vec<i64>,
2971 pub r#type: i32,
2973}
2974#[cfg(feature = "v26_1")]
2975impl<const V: i32> Decode for DebugSample<V> {
2976 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2977 Ok({
2978 let v1 = {
2979 let v2 = {
2980 let c = r.read_varint()?;
2981 r.check_count(i64::from(c), 8)?
2982 };
2983 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
2984 for _ in 0..v2 {
2985 v3.push(r.read_i64()?);
2986 }
2987 v3
2988 };
2989 let v4 = r.read_varint()?;
2990 Self {
2991 sample: v1,
2992 r#type: v4,
2993 }
2994 })
2995 }
2996}
2997#[cfg(feature = "v26_1")]
2998impl<const V: i32> Encode for DebugSample<V> {
2999 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3000 w.put_len_varint((*self).sample.len())?;
3001 for v1 in (*self).sample.iter() {
3002 w.put_i64((*v1));
3003 }
3004 w.put_varint((*self).r#type);
3005 Ok(())
3006 }
3007}
3008#[cfg(feature = "v26_1")]
3009#[cfg(feature = "testgen")]
3010impl<const V: i32> Generate for DebugSample<V> {
3011 fn generate(g: &mut Gen) -> Self {
3012 {
3013 let v1 = {
3014 let v2 = g.count();
3015 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
3016 for _ in 0..v2 {
3017 v3.push(g.i64());
3018 }
3019 v3
3020 };
3021 let v4 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
3022 Self {
3023 sample: v1,
3024 r#type: v4,
3025 }
3026 }
3027 }
3028}
3029
3030#[cfg(feature = "v26_1")]
3031#[derive(Debug, Clone, PartialEq)]
3033pub struct HideMessage<const V: i32> {
3034 pub id: i32,
3036 pub signature: Option<Bytes>,
3038}
3039#[cfg(feature = "v26_1")]
3040impl<const V: i32> Decode for HideMessage<V> {
3041 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
3042 Ok({
3043 let v1 = r.read_varint()?;
3044 let v2 = if (v1 == 0) {
3045 Some(r.read_bytes(256)?)
3046 } else {
3047 None
3048 };
3049 Self {
3050 id: v1,
3051 signature: v2,
3052 }
3053 })
3054 }
3055}
3056#[cfg(feature = "v26_1")]
3057impl<const V: i32> Encode for HideMessage<V> {
3058 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3059 w.put_varint((*self).id);
3060 match (&(*self).signature, ((*self).id == 0)) {
3061 (Some(v1), true) => {
3062 if (*v1).len() != 256 {
3063 return Err(EncodeError::CountMismatch {
3064 field: "fixed buffer",
3065 expected: 256,
3066 actual: (*v1).len(),
3067 });
3068 }
3069 w.put_slice(&(*v1));
3070 }
3071 (None, false) => {}
3072 _ => {
3073 return Err(EncodeError::SwitchMismatch(
3074 "play.clientbound.hide_message.signature",
3075 ));
3076 }
3077 }
3078 Ok(())
3079 }
3080}
3081#[cfg(feature = "v26_1")]
3082#[cfg(feature = "testgen")]
3083impl<const V: i32> Generate for HideMessage<V> {
3084 fn generate(g: &mut Gen) -> Self {
3085 {
3086 let v1 = (g.int_in(-2147483648, 2147483647, &[0]) as i32);
3087 let v2 = if (v1 == 0) {
3088 Some(g.fixed_bytes(256))
3089 } else {
3090 None
3091 };
3092 Self {
3093 id: v1,
3094 signature: v2,
3095 }
3096 }
3097 }
3098}
3099
3100#[cfg(feature = "v26_1")]
3101#[derive(Debug, Clone, PartialEq)]
3103pub struct KickDisconnect<const V: i32> {
3104 pub reason: AnonNbt,
3106}
3107#[cfg(feature = "v26_1")]
3108impl<const V: i32> Decode for KickDisconnect<V> {
3109 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
3110 Ok({
3111 let v1 = AnonNbt::read(r)?;
3112 Self { reason: v1 }
3113 })
3114 }
3115}
3116#[cfg(feature = "v26_1")]
3117impl<const V: i32> Encode for KickDisconnect<V> {
3118 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3119 (*self).reason.write(w);
3120 Ok(())
3121 }
3122}
3123#[cfg(feature = "v26_1")]
3124#[cfg(feature = "testgen")]
3125impl<const V: i32> Generate for KickDisconnect<V> {
3126 fn generate(g: &mut Gen) -> Self {
3127 {
3128 let v1 = g.anon_nbt();
3129 Self { reason: v1 }
3130 }
3131 }
3132}
3133
3134#[cfg(feature = "v26_1")]
3135#[derive(Debug, Clone, PartialEq)]
3137pub struct ProfilelessChat<const V: i32> {
3138 pub message: AnonNbt,
3140 pub r#type: Holder<crate::defs::p775::play::clientbound::ChatTypes>,
3142 pub name: AnonNbt,
3144 pub target: Option<AnonNbt>,
3146}
3147#[cfg(feature = "v26_1")]
3148impl<const V: i32> Decode for ProfilelessChat<V> {
3149 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
3150 Ok({
3151 let v1 = AnonNbt::read(r)?;
3152 let v2 = {
3153 let id = r.read_varint()?;
3154 if id == 0 {
3155 Holder::Inline(
3156 <crate::defs::p775::play::clientbound::ChatTypes as Decode>::decode(r)?,
3157 )
3158 } else {
3159 Holder::Id(id.wrapping_sub(1))
3160 }
3161 };
3162 let v3 = AnonNbt::read(r)?;
3163 let v4 = if r.read_bool()? {
3164 Some(AnonNbt::read(r)?)
3165 } else {
3166 None
3167 };
3168 Self {
3169 message: v1,
3170 r#type: v2,
3171 name: v3,
3172 target: v4,
3173 }
3174 })
3175 }
3176}
3177#[cfg(feature = "v26_1")]
3178impl<const V: i32> Encode for ProfilelessChat<V> {
3179 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3180 (*self).message.write(w);
3181 match &(*self).r#type {
3182 Holder::Id(v2) => {
3183 if *v2 == -1 {
3184 return Err(EncodeError::OutOfRange("holder id"));
3185 }
3186 w.put_varint(v2.wrapping_add(1));
3187 }
3188 Holder::Inline(v1) => {
3189 w.put_varint(0);
3190 (*v1).encode(w)?;
3191 }
3192 }
3193 (*self).name.write(w);
3194 match &(*self).target {
3195 Some(v3) => {
3196 w.put_u8(1);
3197 (*v3).write(w);
3198 }
3199 None => w.put_u8(0),
3200 }
3201 Ok(())
3202 }
3203}
3204#[cfg(feature = "v26_1")]
3205#[cfg(feature = "testgen")]
3206impl<const V: i32> Generate for ProfilelessChat<V> {
3207 fn generate(g: &mut Gen) -> Self {
3208 {
3209 let v1 = g.anon_nbt();
3210 let v2 = if g.bool() {
3211 Holder::Id(match g.int_in(-2147483648, 2147483647, &[0, 1, 2]) as i32 {
3212 -1 => 0,
3213 v => v,
3214 })
3215 } else {
3216 Holder::Inline(
3217 <crate::defs::p775::play::clientbound::ChatTypes as Generate>::generate(g),
3218 )
3219 };
3220 let v3 = g.anon_nbt();
3221 let v4 = if g.bool() { Some(g.anon_nbt()) } else { None };
3222 Self {
3223 message: v1,
3224 r#type: v2,
3225 name: v3,
3226 target: v4,
3227 }
3228 }
3229 }
3230}
3231
3232#[cfg(feature = "v26_1")]
3233#[derive(Debug, Clone, PartialEq)]
3235pub struct SyncEntityPosition<const V: i32> {
3236 pub entity_id: i32,
3238 pub x: f64,
3240 pub y: f64,
3242 pub z: f64,
3244 pub dx: f64,
3246 pub dy: f64,
3248 pub dz: f64,
3250 pub yaw: f32,
3252 pub pitch: f32,
3254 pub on_ground: bool,
3256}
3257#[cfg(feature = "v26_1")]
3258impl<const V: i32> Decode for SyncEntityPosition<V> {
3259 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
3260 Ok({
3261 let v1 = r.read_varint()?;
3262 let v2 = r.read_f64()?;
3263 let v3 = r.read_f64()?;
3264 let v4 = r.read_f64()?;
3265 let v5 = r.read_f64()?;
3266 let v6 = r.read_f64()?;
3267 let v7 = r.read_f64()?;
3268 let v8 = r.read_f32()?;
3269 let v9 = r.read_f32()?;
3270 let v10 = r.read_bool()?;
3271 Self {
3272 entity_id: v1,
3273 x: v2,
3274 y: v3,
3275 z: v4,
3276 dx: v5,
3277 dy: v6,
3278 dz: v7,
3279 yaw: v8,
3280 pitch: v9,
3281 on_ground: v10,
3282 }
3283 })
3284 }
3285}
3286#[cfg(feature = "v26_1")]
3287impl<const V: i32> Encode for SyncEntityPosition<V> {
3288 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3289 w.put_varint((*self).entity_id);
3290 w.put_f64((*self).x);
3291 w.put_f64((*self).y);
3292 w.put_f64((*self).z);
3293 w.put_f64((*self).dx);
3294 w.put_f64((*self).dy);
3295 w.put_f64((*self).dz);
3296 w.put_f32((*self).yaw);
3297 w.put_f32((*self).pitch);
3298 w.put_bool((*self).on_ground);
3299 Ok(())
3300 }
3301}
3302#[cfg(feature = "v26_1")]
3303#[cfg(feature = "testgen")]
3304impl<const V: i32> Generate for SyncEntityPosition<V> {
3305 fn generate(g: &mut Gen) -> Self {
3306 {
3307 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
3308 let v2 = g.f64();
3309 let v3 = g.f64();
3310 let v4 = g.f64();
3311 let v5 = g.f64();
3312 let v6 = g.f64();
3313 let v7 = g.f64();
3314 let v8 = g.f32();
3315 let v9 = g.f32();
3316 let v10 = g.bool();
3317 Self {
3318 entity_id: v1,
3319 x: v2,
3320 y: v3,
3321 z: v4,
3322 dx: v5,
3323 dy: v6,
3324 dz: v7,
3325 yaw: v8,
3326 pitch: v9,
3327 on_ground: v10,
3328 }
3329 }
3330 }
3331}
3332
3333#[cfg(feature = "v26_1")]
3334#[derive(Debug, Clone, PartialEq)]
3336pub struct Explosion<const V: i32> {
3337 pub center: crate::defs::p775::types::Vec3f64,
3339 pub radius: f32,
3341 pub block_count: i32,
3343 pub player_knockback: Option<crate::defs::p775::types::Vec3f64>,
3345 pub explosion_particle: crate::defs::p775::types::Particle,
3347 pub sound: Holder<crate::defs::p775::types::ItemSoundEvent>,
3349 pub block_particles: Vec<crate::defs::p775::play::clientbound::ExplosionParticleEntry>,
3351}
3352#[cfg(feature = "v26_1")]
3353impl<const V: i32> Decode for Explosion<V> {
3354 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
3355 Ok({
3356 let v1 = <crate::defs::p775::types::Vec3f64 as Decode>::decode(r)?;
3357 let v2 = r.read_f32()?;
3358 let v3 = r.read_i32()?;
3359 let v4 = if r.read_bool()? {
3360 Some(<crate::defs::p775::types::Vec3f64 as Decode>::decode(r)?)
3361 } else {
3362 None
3363 };
3364 let v5 = <crate::defs::p775::types::Particle as Decode>::decode(r)?;
3365 let v6 = {
3366 let id = r.read_varint()?;
3367 if id == 0 {
3368 Holder::Inline(<crate::defs::p775::types::ItemSoundEvent as Decode>::decode(r)?)
3369 } else {
3370 Holder::Id(id.wrapping_sub(1))
3371 }
3372 };
3373 let v7 = {
3374 let v8 = {
3375 let c = r.read_varint()?;
3376 r.check_count(i64::from(c), 10)?
3377 };
3378 let mut v9 = Vec::with_capacity(v8.min(crate::codec::PREALLOC_LIMIT));
3379 for _ in 0..v8 {
3380 v9.push(<crate::defs::p775::play::clientbound::ExplosionParticleEntry as Decode>::decode(r)?);
3381 }
3382 v9
3383 };
3384 Self {
3385 center: v1,
3386 radius: v2,
3387 block_count: v3,
3388 player_knockback: v4,
3389 explosion_particle: v5,
3390 sound: v6,
3391 block_particles: v7,
3392 }
3393 })
3394 }
3395}
3396#[cfg(feature = "v26_1")]
3397impl<const V: i32> Encode for Explosion<V> {
3398 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3399 (*self).center.encode(w)?;
3400 w.put_f32((*self).radius);
3401 w.put_i32((*self).block_count);
3402 match &(*self).player_knockback {
3403 Some(v1) => {
3404 w.put_u8(1);
3405 (*v1).encode(w)?;
3406 }
3407 None => w.put_u8(0),
3408 }
3409 (*self).explosion_particle.encode(w)?;
3410 match &(*self).sound {
3411 Holder::Id(v3) => {
3412 if *v3 == -1 {
3413 return Err(EncodeError::OutOfRange("holder id"));
3414 }
3415 w.put_varint(v3.wrapping_add(1));
3416 }
3417 Holder::Inline(v2) => {
3418 w.put_varint(0);
3419 (*v2).encode(w)?;
3420 }
3421 }
3422 w.put_len_varint((*self).block_particles.len())?;
3423 for v4 in (*self).block_particles.iter() {
3424 (*v4).encode(w)?;
3425 }
3426 Ok(())
3427 }
3428}
3429#[cfg(feature = "v26_1")]
3430#[cfg(feature = "testgen")]
3431impl<const V: i32> Generate for Explosion<V> {
3432 fn generate(g: &mut Gen) -> Self {
3433 {
3434 let v1 = <crate::defs::p775::types::Vec3f64 as Generate>::generate(g);
3435 let v2 = g.f32();
3436 let v3 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
3437 let v4 = if g.bool() {
3438 Some(<crate::defs::p775::types::Vec3f64 as Generate>::generate(g))
3439 } else {
3440 None
3441 };
3442 let v5 = <crate::defs::p775::types::Particle as Generate>::generate(g);
3443 let v6 = if g.bool() {
3444 Holder::Id(match g.int_in(-2147483648, 2147483647, &[0, 1, 2]) as i32 {
3445 -1 => 0,
3446 v => v,
3447 })
3448 } else {
3449 Holder::Inline(<crate::defs::p775::types::ItemSoundEvent as Generate>::generate(g))
3450 };
3451 let v7 = {
3452 let v8 = g.count();
3453 let mut v9 = Vec::with_capacity(v8.min(crate::codec::PREALLOC_LIMIT));
3454 for _ in 0..v8 {
3455 v9.push(<crate::defs::p775::play::clientbound::ExplosionParticleEntry as Generate>::generate(g));
3456 }
3457 v9
3458 };
3459 Self {
3460 center: v1,
3461 radius: v2,
3462 block_count: v3,
3463 player_knockback: v4,
3464 explosion_particle: v5,
3465 sound: v6,
3466 block_particles: v7,
3467 }
3468 }
3469 }
3470}
3471
3472#[cfg(feature = "v26_1")]
3473#[derive(Debug, Clone, PartialEq)]
3475pub struct UnloadChunk<const V: i32> {
3476 pub chunk_z: i32,
3478 pub chunk_x: i32,
3480}
3481#[cfg(feature = "v26_1")]
3482impl<const V: i32> Decode for UnloadChunk<V> {
3483 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
3484 Ok({
3485 let v1 = r.read_i32()?;
3486 let v2 = r.read_i32()?;
3487 Self {
3488 chunk_z: v1,
3489 chunk_x: v2,
3490 }
3491 })
3492 }
3493}
3494#[cfg(feature = "v26_1")]
3495impl<const V: i32> Encode for UnloadChunk<V> {
3496 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3497 w.put_i32((*self).chunk_z);
3498 w.put_i32((*self).chunk_x);
3499 Ok(())
3500 }
3501}
3502#[cfg(feature = "v26_1")]
3503#[cfg(feature = "testgen")]
3504impl<const V: i32> Generate for UnloadChunk<V> {
3505 fn generate(g: &mut Gen) -> Self {
3506 {
3507 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
3508 let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
3509 Self {
3510 chunk_z: v1,
3511 chunk_x: v2,
3512 }
3513 }
3514 }
3515}
3516
3517#[cfg(feature = "v26_1")]
3518#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
3520pub struct GameStateChangeReason(pub u8);
3521#[cfg(feature = "v26_1")]
3522impl GameStateChangeReason {
3523 pub const NO_RESPAWN_BLOCK_AVAILABLE: Self = Self(0);
3525 pub const START_RAINING: Self = Self(1);
3527 pub const STOP_RAINING: Self = Self(2);
3529 pub const CHANGE_GAME_MODE: Self = Self(3);
3531 pub const WIN_GAME: Self = Self(4);
3533 pub const DEMO_EVENT: Self = Self(5);
3535 pub const PLAY_ARROW_HIT_SOUND: Self = Self(6);
3537 pub const RAIN_LEVEL_CHANGE: Self = Self(7);
3539 pub const THUNDER_LEVEL_CHANGE: Self = Self(8);
3541 pub const PUFFER_FISH_STING: Self = Self(9);
3543 pub const GUARDIAN_ELDER_EFFECT: Self = Self(10);
3545 pub const IMMEDIATE_RESPAWN: Self = Self(11);
3547 pub const LIMITED_CRAFTING: Self = Self(12);
3549 pub const LEVEL_CHUNKS_LOAD_START: Self = Self(13);
3551 pub const fn name(self) -> Option<&'static str> {
3553 match self.0 {
3554 0 => Some("no_respawn_block_available"),
3555 1 => Some("start_raining"),
3556 2 => Some("stop_raining"),
3557 3 => Some("change_game_mode"),
3558 4 => Some("win_game"),
3559 5 => Some("demo_event"),
3560 6 => Some("play_arrow_hit_sound"),
3561 7 => Some("rain_level_change"),
3562 8 => Some("thunder_level_change"),
3563 9 => Some("puffer_fish_sting"),
3564 10 => Some("guardian_elder_effect"),
3565 11 => Some("immediate_respawn"),
3566 12 => Some("limited_crafting"),
3567 13 => Some("level_chunks_load_start"),
3568 _ => None,
3569 }
3570 }
3571}
3572#[cfg(feature = "v26_1")]
3573impl std::fmt::Debug for GameStateChangeReason {
3574 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3575 match self.name() {
3576 Some(n) => write!(f, "GameStateChangeReason::{n}"),
3577 None => write!(f, "GameStateChangeReason({})", self.0),
3578 }
3579 }
3580}
3581
3582#[cfg(feature = "v26_1")]
3583#[derive(Debug, Clone, PartialEq)]
3585pub struct GameStateChange<const V: i32> {
3586 pub reason: crate::defs::p775::play::clientbound::GameStateChangeReason,
3588 pub game_mode: f32,
3590}
3591#[cfg(feature = "v26_1")]
3592impl<const V: i32> Decode for GameStateChange<V> {
3593 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
3594 Ok({
3595 let v1 = crate::defs::p775::play::clientbound::GameStateChangeReason(r.read_u8()?);
3596 let v2 = r.read_f32()?;
3597 Self {
3598 reason: v1,
3599 game_mode: v2,
3600 }
3601 })
3602 }
3603}
3604#[cfg(feature = "v26_1")]
3605impl<const V: i32> Encode for GameStateChange<V> {
3606 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3607 w.put_u8((*self).reason.0);
3608 w.put_f32((*self).game_mode);
3609 Ok(())
3610 }
3611}
3612#[cfg(feature = "v26_1")]
3613#[cfg(feature = "testgen")]
3614impl<const V: i32> Generate for GameStateChange<V> {
3615 fn generate(g: &mut Gen) -> Self {
3616 {
3617 let v1 = crate::defs::p775::play::clientbound::GameStateChangeReason(g.int_in(
3618 0,
3619 255,
3620 &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
3621 )
3622 as u8);
3623 let v2 = g.f32();
3624 Self {
3625 reason: v1,
3626 game_mode: v2,
3627 }
3628 }
3629 }
3630}
3631
3632#[cfg(feature = "v26_1")]
3633#[derive(Debug, Clone, PartialEq)]
3635pub struct GameRuleValues<const V: i32> {
3636 pub values: Vec<crate::defs::p775::types::GameRule>,
3638}
3639#[cfg(feature = "v26_1")]
3640impl<const V: i32> Decode for GameRuleValues<V> {
3641 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
3642 Ok({
3643 let v1 = {
3644 let v2 = {
3645 let c = r.read_varint()?;
3646 r.check_count(i64::from(c), 2)?
3647 };
3648 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
3649 for _ in 0..v2 {
3650 v3.push(<crate::defs::p775::types::GameRule as Decode>::decode(r)?);
3651 }
3652 v3
3653 };
3654 Self { values: v1 }
3655 })
3656 }
3657}
3658#[cfg(feature = "v26_1")]
3659impl<const V: i32> Encode for GameRuleValues<V> {
3660 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3661 w.put_len_varint((*self).values.len())?;
3662 for v1 in (*self).values.iter() {
3663 (*v1).encode(w)?;
3664 }
3665 Ok(())
3666 }
3667}
3668#[cfg(feature = "v26_1")]
3669#[cfg(feature = "testgen")]
3670impl<const V: i32> Generate for GameRuleValues<V> {
3671 fn generate(g: &mut Gen) -> Self {
3672 {
3673 let v1 = {
3674 let v2 = g.count();
3675 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
3676 for _ in 0..v2 {
3677 v3.push(<crate::defs::p775::types::GameRule as Generate>::generate(
3678 g,
3679 ));
3680 }
3681 v3
3682 };
3683 Self { values: v1 }
3684 }
3685 }
3686}
3687
3688#[cfg(feature = "v26_1")]
3689#[derive(Debug, Clone, PartialEq)]
3691pub struct GameTestHighlightPos<const V: i32> {
3692 pub absolute_pos: BlockPos,
3694 pub relative_pos: BlockPos,
3696}
3697#[cfg(feature = "v26_1")]
3698impl<const V: i32> Decode for GameTestHighlightPos<V> {
3699 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
3700 Ok({
3701 let v1 = BlockPos::read(r, PositionLayout::Xzy)?;
3702 let v2 = BlockPos::read(r, PositionLayout::Xzy)?;
3703 Self {
3704 absolute_pos: v1,
3705 relative_pos: v2,
3706 }
3707 })
3708 }
3709}
3710#[cfg(feature = "v26_1")]
3711impl<const V: i32> Encode for GameTestHighlightPos<V> {
3712 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3713 (*self).absolute_pos.write(w, PositionLayout::Xzy)?;
3714 (*self).relative_pos.write(w, PositionLayout::Xzy)?;
3715 Ok(())
3716 }
3717}
3718#[cfg(feature = "v26_1")]
3719#[cfg(feature = "testgen")]
3720impl<const V: i32> Generate for GameTestHighlightPos<V> {
3721 fn generate(g: &mut Gen) -> Self {
3722 {
3723 let v1 = g.position();
3724 let v2 = g.position();
3725 Self {
3726 absolute_pos: v1,
3727 relative_pos: v2,
3728 }
3729 }
3730 }
3731}
3732
3733#[cfg(feature = "v26_1")]
3734#[derive(Debug, Clone, PartialEq)]
3736pub struct OpenHorseWindow<const V: i32> {
3737 pub window_id: i32,
3739 pub nb_slots: i32,
3741 pub entity_id: i32,
3743}
3744#[cfg(feature = "v26_1")]
3745impl<const V: i32> Decode for OpenHorseWindow<V> {
3746 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
3747 Ok({
3748 let v1 = r.read_varint()?;
3749 let v2 = r.read_varint()?;
3750 let v3 = r.read_i32()?;
3751 Self {
3752 window_id: v1,
3753 nb_slots: v2,
3754 entity_id: v3,
3755 }
3756 })
3757 }
3758}
3759#[cfg(feature = "v26_1")]
3760impl<const V: i32> Encode for OpenHorseWindow<V> {
3761 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3762 w.put_varint((*self).window_id);
3763 w.put_varint((*self).nb_slots);
3764 w.put_i32((*self).entity_id);
3765 Ok(())
3766 }
3767}
3768#[cfg(feature = "v26_1")]
3769#[cfg(feature = "testgen")]
3770impl<const V: i32> Generate for OpenHorseWindow<V> {
3771 fn generate(g: &mut Gen) -> Self {
3772 {
3773 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
3774 let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
3775 let v3 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
3776 Self {
3777 window_id: v1,
3778 nb_slots: v2,
3779 entity_id: v3,
3780 }
3781 }
3782 }
3783}
3784
3785#[cfg(feature = "v26_1")]
3786#[derive(Debug, Clone, PartialEq)]
3788pub struct HurtAnimation<const V: i32> {
3789 pub entity_id: i32,
3791 pub yaw: f32,
3793}
3794#[cfg(feature = "v26_1")]
3795impl<const V: i32> Decode for HurtAnimation<V> {
3796 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
3797 Ok({
3798 let v1 = r.read_varint()?;
3799 let v2 = r.read_f32()?;
3800 Self {
3801 entity_id: v1,
3802 yaw: v2,
3803 }
3804 })
3805 }
3806}
3807#[cfg(feature = "v26_1")]
3808impl<const V: i32> Encode for HurtAnimation<V> {
3809 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3810 w.put_varint((*self).entity_id);
3811 w.put_f32((*self).yaw);
3812 Ok(())
3813 }
3814}
3815#[cfg(feature = "v26_1")]
3816#[cfg(feature = "testgen")]
3817impl<const V: i32> Generate for HurtAnimation<V> {
3818 fn generate(g: &mut Gen) -> Self {
3819 {
3820 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
3821 let v2 = g.f32();
3822 Self {
3823 entity_id: v1,
3824 yaw: v2,
3825 }
3826 }
3827 }
3828}
3829
3830#[cfg(feature = "v26_1")]
3831#[derive(Debug, Clone, PartialEq)]
3833pub struct InitializeWorldBorder<const V: i32> {
3834 pub x: f64,
3836 pub z: f64,
3838 pub old_diameter: f64,
3840 pub new_diameter: f64,
3842 pub speed: i64,
3844 pub portal_teleport_boundary: i32,
3846 pub warning_blocks: i32,
3848 pub warning_time: i32,
3850}
3851#[cfg(feature = "v26_1")]
3852impl<const V: i32> Decode for InitializeWorldBorder<V> {
3853 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
3854 Ok({
3855 let v1 = r.read_f64()?;
3856 let v2 = r.read_f64()?;
3857 let v3 = r.read_f64()?;
3858 let v4 = r.read_f64()?;
3859 let v5 = r.read_varlong()?;
3860 let v6 = r.read_varint()?;
3861 let v7 = r.read_varint()?;
3862 let v8 = r.read_varint()?;
3863 Self {
3864 x: v1,
3865 z: v2,
3866 old_diameter: v3,
3867 new_diameter: v4,
3868 speed: v5,
3869 portal_teleport_boundary: v6,
3870 warning_blocks: v7,
3871 warning_time: v8,
3872 }
3873 })
3874 }
3875}
3876#[cfg(feature = "v26_1")]
3877impl<const V: i32> Encode for InitializeWorldBorder<V> {
3878 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3879 w.put_f64((*self).x);
3880 w.put_f64((*self).z);
3881 w.put_f64((*self).old_diameter);
3882 w.put_f64((*self).new_diameter);
3883 w.put_varlong((*self).speed);
3884 w.put_varint((*self).portal_teleport_boundary);
3885 w.put_varint((*self).warning_blocks);
3886 w.put_varint((*self).warning_time);
3887 Ok(())
3888 }
3889}
3890#[cfg(feature = "v26_1")]
3891#[cfg(feature = "testgen")]
3892impl<const V: i32> Generate for InitializeWorldBorder<V> {
3893 fn generate(g: &mut Gen) -> Self {
3894 {
3895 let v1 = g.f64();
3896 let v2 = g.f64();
3897 let v3 = g.f64();
3898 let v4 = g.f64();
3899 let v5 = g.varlong();
3900 let v6 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
3901 let v7 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
3902 let v8 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
3903 Self {
3904 x: v1,
3905 z: v2,
3906 old_diameter: v3,
3907 new_diameter: v4,
3908 speed: v5,
3909 portal_teleport_boundary: v6,
3910 warning_blocks: v7,
3911 warning_time: v8,
3912 }
3913 }
3914 }
3915}
3916
3917#[cfg(feature = "v26_1")]
3918#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
3920pub struct MapChunkHeightmapsType(pub i32);
3921#[cfg(feature = "v26_1")]
3922impl MapChunkHeightmapsType {
3923 pub const WORLD_SURFACE_WG: Self = Self(0);
3925 pub const WORLD_SURFACE: Self = Self(1);
3927 pub const OCEAN_FLOOR_WG: Self = Self(2);
3929 pub const OCEAN_FLOOR: Self = Self(3);
3931 pub const MOTION_BLOCKING: Self = Self(4);
3933 pub const MOTION_BLOCKING_NO_LEAVES: Self = Self(5);
3935 pub const fn name(self) -> Option<&'static str> {
3937 match self.0 {
3938 0 => Some("world_surface_wg"),
3939 1 => Some("world_surface"),
3940 2 => Some("ocean_floor_wg"),
3941 3 => Some("ocean_floor"),
3942 4 => Some("motion_blocking"),
3943 5 => Some("motion_blocking_no_leaves"),
3944 _ => None,
3945 }
3946 }
3947}
3948#[cfg(feature = "v26_1")]
3949impl std::fmt::Debug for MapChunkHeightmapsType {
3950 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3951 match self.name() {
3952 Some(n) => write!(f, "MapChunkHeightmapsType::{n}"),
3953 None => write!(f, "MapChunkHeightmapsType({})", self.0),
3954 }
3955 }
3956}
3957
3958#[cfg(feature = "v26_1")]
3959#[derive(Debug, Clone, PartialEq)]
3961pub struct MapChunkHeightmaps {
3962 pub r#type: crate::defs::p775::play::clientbound::MapChunkHeightmapsType,
3964 pub data: Vec<i64>,
3966}
3967
3968#[cfg(feature = "v26_1")]
3969#[derive(Debug, Clone, PartialEq)]
3971pub struct MapChunk<const V: i32> {
3972 pub x: i32,
3974 pub z: i32,
3976 pub heightmaps: Vec<crate::defs::p775::play::clientbound::MapChunkHeightmaps>,
3978 pub chunk_data: Bytes,
3980 pub block_entities: Vec<crate::defs::p775::types::ChunkBlockEntity>,
3982 pub sky_light_mask: Vec<i64>,
3984 pub block_light_mask: Vec<i64>,
3986 pub empty_sky_light_mask: Vec<i64>,
3988 pub empty_block_light_mask: Vec<i64>,
3990 pub sky_light: Vec<Vec<u8>>,
3992 pub block_light: Vec<Vec<u8>>,
3994}
3995#[cfg(feature = "v26_1")]
3996impl<const V: i32> Decode for MapChunk<V> {
3997 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
3998 Ok({
3999 let v1 = r.read_i32()?;
4000 let v2 = r.read_i32()?;
4001 let v3 = {
4002 let v4 = {
4003 let c = r.read_varint()?;
4004 r.check_count(i64::from(c), 2)?
4005 };
4006 let mut v5 = Vec::with_capacity(v4.min(crate::codec::PREALLOC_LIMIT));
4007 for _ in 0..v4 {
4008 v5.push({
4009 let v6 = crate::defs::p775::play::clientbound::MapChunkHeightmapsType(
4010 r.read_varint()?,
4011 );
4012 let v7 = {
4013 let v8 = {
4014 let c = r.read_varint()?;
4015 r.check_count(i64::from(c), 8)?
4016 };
4017 let mut v9 = Vec::with_capacity(v8.min(crate::codec::PREALLOC_LIMIT));
4018 for _ in 0..v8 {
4019 v9.push(r.read_i64()?);
4020 }
4021 v9
4022 };
4023 crate::defs::p775::play::clientbound::MapChunkHeightmaps {
4024 r#type: v6,
4025 data: v7,
4026 }
4027 });
4028 }
4029 v5
4030 };
4031 let v10 = r.read_byte_array()?;
4032 let v11 = {
4033 let v12 = {
4034 let c = r.read_varint()?;
4035 r.check_count(i64::from(c), 5)?
4036 };
4037 let mut v13 = Vec::with_capacity(v12.min(crate::codec::PREALLOC_LIMIT));
4038 for _ in 0..v12 {
4039 v13.push(<crate::defs::p775::types::ChunkBlockEntity as Decode>::decode(r)?);
4040 }
4041 v13
4042 };
4043 let v14 = {
4044 let v15 = {
4045 let c = r.read_varint()?;
4046 r.check_count(i64::from(c), 8)?
4047 };
4048 let mut v16 = Vec::with_capacity(v15.min(crate::codec::PREALLOC_LIMIT));
4049 for _ in 0..v15 {
4050 v16.push(r.read_i64()?);
4051 }
4052 v16
4053 };
4054 let v17 = {
4055 let v18 = {
4056 let c = r.read_varint()?;
4057 r.check_count(i64::from(c), 8)?
4058 };
4059 let mut v19 = Vec::with_capacity(v18.min(crate::codec::PREALLOC_LIMIT));
4060 for _ in 0..v18 {
4061 v19.push(r.read_i64()?);
4062 }
4063 v19
4064 };
4065 let v20 = {
4066 let v21 = {
4067 let c = r.read_varint()?;
4068 r.check_count(i64::from(c), 8)?
4069 };
4070 let mut v22 = Vec::with_capacity(v21.min(crate::codec::PREALLOC_LIMIT));
4071 for _ in 0..v21 {
4072 v22.push(r.read_i64()?);
4073 }
4074 v22
4075 };
4076 let v23 = {
4077 let v24 = {
4078 let c = r.read_varint()?;
4079 r.check_count(i64::from(c), 8)?
4080 };
4081 let mut v25 = Vec::with_capacity(v24.min(crate::codec::PREALLOC_LIMIT));
4082 for _ in 0..v24 {
4083 v25.push(r.read_i64()?);
4084 }
4085 v25
4086 };
4087 let v26 = {
4088 let v27 = {
4089 let c = r.read_varint()?;
4090 r.check_count(i64::from(c), 1)?
4091 };
4092 let mut v28 = Vec::with_capacity(v27.min(crate::codec::PREALLOC_LIMIT));
4093 for _ in 0..v27 {
4094 v28.push({
4095 let v29 = {
4096 let c = r.read_varint()?;
4097 r.check_count(i64::from(c), 1)?
4098 };
4099 let mut v30 = Vec::with_capacity(v29.min(crate::codec::PREALLOC_LIMIT));
4100 for _ in 0..v29 {
4101 v30.push(r.read_u8()?);
4102 }
4103 v30
4104 });
4105 }
4106 v28
4107 };
4108 let v31 = {
4109 let v32 = {
4110 let c = r.read_varint()?;
4111 r.check_count(i64::from(c), 1)?
4112 };
4113 let mut v33 = Vec::with_capacity(v32.min(crate::codec::PREALLOC_LIMIT));
4114 for _ in 0..v32 {
4115 v33.push({
4116 let v34 = {
4117 let c = r.read_varint()?;
4118 r.check_count(i64::from(c), 1)?
4119 };
4120 let mut v35 = Vec::with_capacity(v34.min(crate::codec::PREALLOC_LIMIT));
4121 for _ in 0..v34 {
4122 v35.push(r.read_u8()?);
4123 }
4124 v35
4125 });
4126 }
4127 v33
4128 };
4129 Self {
4130 x: v1,
4131 z: v2,
4132 heightmaps: v3,
4133 chunk_data: v10,
4134 block_entities: v11,
4135 sky_light_mask: v14,
4136 block_light_mask: v17,
4137 empty_sky_light_mask: v20,
4138 empty_block_light_mask: v23,
4139 sky_light: v26,
4140 block_light: v31,
4141 }
4142 })
4143 }
4144}
4145#[cfg(feature = "v26_1")]
4146impl<const V: i32> Encode for MapChunk<V> {
4147 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
4148 w.put_i32((*self).x);
4149 w.put_i32((*self).z);
4150 w.put_len_varint((*self).heightmaps.len())?;
4151 for v1 in (*self).heightmaps.iter() {
4152 w.put_varint((*v1).r#type.0);
4153 w.put_len_varint((*v1).data.len())?;
4154 for v2 in (*v1).data.iter() {
4155 w.put_i64((*v2));
4156 }
4157 }
4158 w.put_byte_array(&(*self).chunk_data)?;
4159 w.put_len_varint((*self).block_entities.len())?;
4160 for v3 in (*self).block_entities.iter() {
4161 (*v3).encode(w)?;
4162 }
4163 w.put_len_varint((*self).sky_light_mask.len())?;
4164 for v4 in (*self).sky_light_mask.iter() {
4165 w.put_i64((*v4));
4166 }
4167 w.put_len_varint((*self).block_light_mask.len())?;
4168 for v5 in (*self).block_light_mask.iter() {
4169 w.put_i64((*v5));
4170 }
4171 w.put_len_varint((*self).empty_sky_light_mask.len())?;
4172 for v6 in (*self).empty_sky_light_mask.iter() {
4173 w.put_i64((*v6));
4174 }
4175 w.put_len_varint((*self).empty_block_light_mask.len())?;
4176 for v7 in (*self).empty_block_light_mask.iter() {
4177 w.put_i64((*v7));
4178 }
4179 w.put_len_varint((*self).sky_light.len())?;
4180 for v8 in (*self).sky_light.iter() {
4181 w.put_len_varint((*v8).len())?;
4182 for v9 in (*v8).iter() {
4183 w.put_u8((*v9));
4184 }
4185 }
4186 w.put_len_varint((*self).block_light.len())?;
4187 for v10 in (*self).block_light.iter() {
4188 w.put_len_varint((*v10).len())?;
4189 for v11 in (*v10).iter() {
4190 w.put_u8((*v11));
4191 }
4192 }
4193 Ok(())
4194 }
4195}
4196#[cfg(feature = "v26_1")]
4197#[cfg(feature = "testgen")]
4198impl<const V: i32> Generate for MapChunk<V> {
4199 fn generate(g: &mut Gen) -> Self {
4200 {
4201 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
4202 let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
4203 let v3 = {
4204 let v4 = g.count();
4205 let mut v5 = Vec::with_capacity(v4.min(crate::codec::PREALLOC_LIMIT));
4206 for _ in 0..v4 {
4207 v5.push({
4208 let v6 = crate::defs::p775::play::clientbound::MapChunkHeightmapsType(
4209 g.int_in(-2147483648, 2147483647, &[0, 1, 2, 3, 4, 5]) as i32,
4210 );
4211 let v7 = {
4212 let v8 = g.count();
4213 let mut v9 = Vec::with_capacity(v8.min(crate::codec::PREALLOC_LIMIT));
4214 for _ in 0..v8 {
4215 v9.push(g.i64());
4216 }
4217 v9
4218 };
4219 crate::defs::p775::play::clientbound::MapChunkHeightmaps {
4220 r#type: v6,
4221 data: v7,
4222 }
4223 });
4224 }
4225 v5
4226 };
4227 let v10 = g.bytes();
4228 let v11 = {
4229 let v12 = g.count();
4230 let mut v13 = Vec::with_capacity(v12.min(crate::codec::PREALLOC_LIMIT));
4231 for _ in 0..v12 {
4232 v13.push(<crate::defs::p775::types::ChunkBlockEntity as Generate>::generate(g));
4233 }
4234 v13
4235 };
4236 let v14 = {
4237 let v15 = g.count();
4238 let mut v16 = Vec::with_capacity(v15.min(crate::codec::PREALLOC_LIMIT));
4239 for _ in 0..v15 {
4240 v16.push(g.i64());
4241 }
4242 v16
4243 };
4244 let v17 = {
4245 let v18 = g.count();
4246 let mut v19 = Vec::with_capacity(v18.min(crate::codec::PREALLOC_LIMIT));
4247 for _ in 0..v18 {
4248 v19.push(g.i64());
4249 }
4250 v19
4251 };
4252 let v20 = {
4253 let v21 = g.count();
4254 let mut v22 = Vec::with_capacity(v21.min(crate::codec::PREALLOC_LIMIT));
4255 for _ in 0..v21 {
4256 v22.push(g.i64());
4257 }
4258 v22
4259 };
4260 let v23 = {
4261 let v24 = g.count();
4262 let mut v25 = Vec::with_capacity(v24.min(crate::codec::PREALLOC_LIMIT));
4263 for _ in 0..v24 {
4264 v25.push(g.i64());
4265 }
4266 v25
4267 };
4268 let v26 = {
4269 let v27 = g.count();
4270 let mut v28 = Vec::with_capacity(v27.min(crate::codec::PREALLOC_LIMIT));
4271 for _ in 0..v27 {
4272 v28.push({
4273 let v29 = g.count();
4274 let mut v30 = Vec::with_capacity(v29.min(crate::codec::PREALLOC_LIMIT));
4275 for _ in 0..v29 {
4276 v30.push((g.int_in(0, 255, &[]) as u8));
4277 }
4278 v30
4279 });
4280 }
4281 v28
4282 };
4283 let v31 = {
4284 let v32 = g.count();
4285 let mut v33 = Vec::with_capacity(v32.min(crate::codec::PREALLOC_LIMIT));
4286 for _ in 0..v32 {
4287 v33.push({
4288 let v34 = g.count();
4289 let mut v35 = Vec::with_capacity(v34.min(crate::codec::PREALLOC_LIMIT));
4290 for _ in 0..v34 {
4291 v35.push((g.int_in(0, 255, &[]) as u8));
4292 }
4293 v35
4294 });
4295 }
4296 v33
4297 };
4298 Self {
4299 x: v1,
4300 z: v2,
4301 heightmaps: v3,
4302 chunk_data: v10,
4303 block_entities: v11,
4304 sky_light_mask: v14,
4305 block_light_mask: v17,
4306 empty_sky_light_mask: v20,
4307 empty_block_light_mask: v23,
4308 sky_light: v26,
4309 block_light: v31,
4310 }
4311 }
4312 }
4313}
4314
4315#[cfg(feature = "v26_1")]
4316#[derive(Debug, Clone, PartialEq)]
4318pub struct WorldParticles<const V: i32> {
4319 pub long_distance: bool,
4321 pub always_show: bool,
4323 pub x: f64,
4325 pub y: f64,
4327 pub z: f64,
4329 pub offset_x: f32,
4331 pub offset_y: f32,
4333 pub offset_z: f32,
4335 pub velocity_offset: f32,
4337 pub amount: i32,
4339 pub particle: crate::defs::p775::types::Particle,
4341}
4342#[cfg(feature = "v26_1")]
4343impl<const V: i32> Decode for WorldParticles<V> {
4344 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
4345 Ok({
4346 let v1 = r.read_bool()?;
4347 let v2 = r.read_bool()?;
4348 let v3 = r.read_f64()?;
4349 let v4 = r.read_f64()?;
4350 let v5 = r.read_f64()?;
4351 let v6 = r.read_f32()?;
4352 let v7 = r.read_f32()?;
4353 let v8 = r.read_f32()?;
4354 let v9 = r.read_f32()?;
4355 let v10 = r.read_i32()?;
4356 let v11 = <crate::defs::p775::types::Particle as Decode>::decode(r)?;
4357 Self {
4358 long_distance: v1,
4359 always_show: v2,
4360 x: v3,
4361 y: v4,
4362 z: v5,
4363 offset_x: v6,
4364 offset_y: v7,
4365 offset_z: v8,
4366 velocity_offset: v9,
4367 amount: v10,
4368 particle: v11,
4369 }
4370 })
4371 }
4372}
4373#[cfg(feature = "v26_1")]
4374impl<const V: i32> Encode for WorldParticles<V> {
4375 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
4376 w.put_bool((*self).long_distance);
4377 w.put_bool((*self).always_show);
4378 w.put_f64((*self).x);
4379 w.put_f64((*self).y);
4380 w.put_f64((*self).z);
4381 w.put_f32((*self).offset_x);
4382 w.put_f32((*self).offset_y);
4383 w.put_f32((*self).offset_z);
4384 w.put_f32((*self).velocity_offset);
4385 w.put_i32((*self).amount);
4386 (*self).particle.encode(w)?;
4387 Ok(())
4388 }
4389}
4390#[cfg(feature = "v26_1")]
4391#[cfg(feature = "testgen")]
4392impl<const V: i32> Generate for WorldParticles<V> {
4393 fn generate(g: &mut Gen) -> Self {
4394 {
4395 let v1 = g.bool();
4396 let v2 = g.bool();
4397 let v3 = g.f64();
4398 let v4 = g.f64();
4399 let v5 = g.f64();
4400 let v6 = g.f32();
4401 let v7 = g.f32();
4402 let v8 = g.f32();
4403 let v9 = g.f32();
4404 let v10 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
4405 let v11 = <crate::defs::p775::types::Particle as Generate>::generate(g);
4406 Self {
4407 long_distance: v1,
4408 always_show: v2,
4409 x: v3,
4410 y: v4,
4411 z: v5,
4412 offset_x: v6,
4413 offset_y: v7,
4414 offset_z: v8,
4415 velocity_offset: v9,
4416 amount: v10,
4417 particle: v11,
4418 }
4419 }
4420 }
4421}
4422
4423#[cfg(feature = "v26_1")]
4424#[derive(Debug, Clone, PartialEq)]
4426pub struct UpdateLight<const V: i32> {
4427 pub chunk_x: i32,
4429 pub chunk_z: i32,
4431 pub sky_light_mask: Vec<i64>,
4433 pub block_light_mask: Vec<i64>,
4435 pub empty_sky_light_mask: Vec<i64>,
4437 pub empty_block_light_mask: Vec<i64>,
4439 pub sky_light: Vec<Vec<u8>>,
4441 pub block_light: Vec<Vec<u8>>,
4443}
4444#[cfg(feature = "v26_1")]
4445impl<const V: i32> Decode for UpdateLight<V> {
4446 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
4447 Ok({
4448 let v1 = r.read_varint()?;
4449 let v2 = r.read_varint()?;
4450 let v3 = {
4451 let v4 = {
4452 let c = r.read_varint()?;
4453 r.check_count(i64::from(c), 8)?
4454 };
4455 let mut v5 = Vec::with_capacity(v4.min(crate::codec::PREALLOC_LIMIT));
4456 for _ in 0..v4 {
4457 v5.push(r.read_i64()?);
4458 }
4459 v5
4460 };
4461 let v6 = {
4462 let v7 = {
4463 let c = r.read_varint()?;
4464 r.check_count(i64::from(c), 8)?
4465 };
4466 let mut v8 = Vec::with_capacity(v7.min(crate::codec::PREALLOC_LIMIT));
4467 for _ in 0..v7 {
4468 v8.push(r.read_i64()?);
4469 }
4470 v8
4471 };
4472 let v9 = {
4473 let v10 = {
4474 let c = r.read_varint()?;
4475 r.check_count(i64::from(c), 8)?
4476 };
4477 let mut v11 = Vec::with_capacity(v10.min(crate::codec::PREALLOC_LIMIT));
4478 for _ in 0..v10 {
4479 v11.push(r.read_i64()?);
4480 }
4481 v11
4482 };
4483 let v12 = {
4484 let v13 = {
4485 let c = r.read_varint()?;
4486 r.check_count(i64::from(c), 8)?
4487 };
4488 let mut v14 = Vec::with_capacity(v13.min(crate::codec::PREALLOC_LIMIT));
4489 for _ in 0..v13 {
4490 v14.push(r.read_i64()?);
4491 }
4492 v14
4493 };
4494 let v15 = {
4495 let v16 = {
4496 let c = r.read_varint()?;
4497 r.check_count(i64::from(c), 1)?
4498 };
4499 let mut v17 = Vec::with_capacity(v16.min(crate::codec::PREALLOC_LIMIT));
4500 for _ in 0..v16 {
4501 v17.push({
4502 let v18 = {
4503 let c = r.read_varint()?;
4504 r.check_count(i64::from(c), 1)?
4505 };
4506 let mut v19 = Vec::with_capacity(v18.min(crate::codec::PREALLOC_LIMIT));
4507 for _ in 0..v18 {
4508 v19.push(r.read_u8()?);
4509 }
4510 v19
4511 });
4512 }
4513 v17
4514 };
4515 let v20 = {
4516 let v21 = {
4517 let c = r.read_varint()?;
4518 r.check_count(i64::from(c), 1)?
4519 };
4520 let mut v22 = Vec::with_capacity(v21.min(crate::codec::PREALLOC_LIMIT));
4521 for _ in 0..v21 {
4522 v22.push({
4523 let v23 = {
4524 let c = r.read_varint()?;
4525 r.check_count(i64::from(c), 1)?
4526 };
4527 let mut v24 = Vec::with_capacity(v23.min(crate::codec::PREALLOC_LIMIT));
4528 for _ in 0..v23 {
4529 v24.push(r.read_u8()?);
4530 }
4531 v24
4532 });
4533 }
4534 v22
4535 };
4536 Self {
4537 chunk_x: v1,
4538 chunk_z: v2,
4539 sky_light_mask: v3,
4540 block_light_mask: v6,
4541 empty_sky_light_mask: v9,
4542 empty_block_light_mask: v12,
4543 sky_light: v15,
4544 block_light: v20,
4545 }
4546 })
4547 }
4548}
4549#[cfg(feature = "v26_1")]
4550impl<const V: i32> Encode for UpdateLight<V> {
4551 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
4552 w.put_varint((*self).chunk_x);
4553 w.put_varint((*self).chunk_z);
4554 w.put_len_varint((*self).sky_light_mask.len())?;
4555 for v1 in (*self).sky_light_mask.iter() {
4556 w.put_i64((*v1));
4557 }
4558 w.put_len_varint((*self).block_light_mask.len())?;
4559 for v2 in (*self).block_light_mask.iter() {
4560 w.put_i64((*v2));
4561 }
4562 w.put_len_varint((*self).empty_sky_light_mask.len())?;
4563 for v3 in (*self).empty_sky_light_mask.iter() {
4564 w.put_i64((*v3));
4565 }
4566 w.put_len_varint((*self).empty_block_light_mask.len())?;
4567 for v4 in (*self).empty_block_light_mask.iter() {
4568 w.put_i64((*v4));
4569 }
4570 w.put_len_varint((*self).sky_light.len())?;
4571 for v5 in (*self).sky_light.iter() {
4572 w.put_len_varint((*v5).len())?;
4573 for v6 in (*v5).iter() {
4574 w.put_u8((*v6));
4575 }
4576 }
4577 w.put_len_varint((*self).block_light.len())?;
4578 for v7 in (*self).block_light.iter() {
4579 w.put_len_varint((*v7).len())?;
4580 for v8 in (*v7).iter() {
4581 w.put_u8((*v8));
4582 }
4583 }
4584 Ok(())
4585 }
4586}
4587#[cfg(feature = "v26_1")]
4588#[cfg(feature = "testgen")]
4589impl<const V: i32> Generate for UpdateLight<V> {
4590 fn generate(g: &mut Gen) -> Self {
4591 {
4592 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
4593 let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
4594 let v3 = {
4595 let v4 = g.count();
4596 let mut v5 = Vec::with_capacity(v4.min(crate::codec::PREALLOC_LIMIT));
4597 for _ in 0..v4 {
4598 v5.push(g.i64());
4599 }
4600 v5
4601 };
4602 let v6 = {
4603 let v7 = g.count();
4604 let mut v8 = Vec::with_capacity(v7.min(crate::codec::PREALLOC_LIMIT));
4605 for _ in 0..v7 {
4606 v8.push(g.i64());
4607 }
4608 v8
4609 };
4610 let v9 = {
4611 let v10 = g.count();
4612 let mut v11 = Vec::with_capacity(v10.min(crate::codec::PREALLOC_LIMIT));
4613 for _ in 0..v10 {
4614 v11.push(g.i64());
4615 }
4616 v11
4617 };
4618 let v12 = {
4619 let v13 = g.count();
4620 let mut v14 = Vec::with_capacity(v13.min(crate::codec::PREALLOC_LIMIT));
4621 for _ in 0..v13 {
4622 v14.push(g.i64());
4623 }
4624 v14
4625 };
4626 let v15 = {
4627 let v16 = g.count();
4628 let mut v17 = Vec::with_capacity(v16.min(crate::codec::PREALLOC_LIMIT));
4629 for _ in 0..v16 {
4630 v17.push({
4631 let v18 = g.count();
4632 let mut v19 = Vec::with_capacity(v18.min(crate::codec::PREALLOC_LIMIT));
4633 for _ in 0..v18 {
4634 v19.push((g.int_in(0, 255, &[]) as u8));
4635 }
4636 v19
4637 });
4638 }
4639 v17
4640 };
4641 let v20 = {
4642 let v21 = g.count();
4643 let mut v22 = Vec::with_capacity(v21.min(crate::codec::PREALLOC_LIMIT));
4644 for _ in 0..v21 {
4645 v22.push({
4646 let v23 = g.count();
4647 let mut v24 = Vec::with_capacity(v23.min(crate::codec::PREALLOC_LIMIT));
4648 for _ in 0..v23 {
4649 v24.push((g.int_in(0, 255, &[]) as u8));
4650 }
4651 v24
4652 });
4653 }
4654 v22
4655 };
4656 Self {
4657 chunk_x: v1,
4658 chunk_z: v2,
4659 sky_light_mask: v3,
4660 block_light_mask: v6,
4661 empty_sky_light_mask: v9,
4662 empty_block_light_mask: v12,
4663 sky_light: v15,
4664 block_light: v20,
4665 }
4666 }
4667 }
4668}
4669
4670#[cfg(feature = "v26_1")]
4671#[derive(Debug, Clone, PartialEq)]
4673pub struct Login<const V: i32> {
4674 pub entity_id: i32,
4676 pub is_hardcore: bool,
4678 pub world_names: Vec<ByteString>,
4680 pub max_players: i32,
4682 pub view_distance: i32,
4684 pub simulation_distance: i32,
4686 pub reduced_debug_info: bool,
4688 pub enable_respawn_screen: bool,
4690 pub do_limited_crafting: bool,
4692 pub world_state: crate::defs::p775::play::clientbound::SpawnInfo,
4694 pub enforces_secure_chat: bool,
4696}
4697#[cfg(feature = "v26_1")]
4698impl<const V: i32> Decode for Login<V> {
4699 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
4700 Ok({
4701 let v1 = r.read_i32()?;
4702 let v2 = r.read_bool()?;
4703 let v3 = {
4704 let v4 = {
4705 let c = r.read_varint()?;
4706 r.check_count(i64::from(c), 1)?
4707 };
4708 let mut v5 = Vec::with_capacity(v4.min(crate::codec::PREALLOC_LIMIT));
4709 for _ in 0..v4 {
4710 v5.push(r.read_string()?);
4711 }
4712 v5
4713 };
4714 let v6 = r.read_varint()?;
4715 let v7 = r.read_varint()?;
4716 let v8 = r.read_varint()?;
4717 let v9 = r.read_bool()?;
4718 let v10 = r.read_bool()?;
4719 let v11 = r.read_bool()?;
4720 let v12 = <crate::defs::p775::play::clientbound::SpawnInfo as Decode>::decode(r)?;
4721 let v13 = r.read_bool()?;
4722 Self {
4723 entity_id: v1,
4724 is_hardcore: v2,
4725 world_names: v3,
4726 max_players: v6,
4727 view_distance: v7,
4728 simulation_distance: v8,
4729 reduced_debug_info: v9,
4730 enable_respawn_screen: v10,
4731 do_limited_crafting: v11,
4732 world_state: v12,
4733 enforces_secure_chat: v13,
4734 }
4735 })
4736 }
4737}
4738#[cfg(feature = "v26_1")]
4739impl<const V: i32> Encode for Login<V> {
4740 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
4741 w.put_i32((*self).entity_id);
4742 w.put_bool((*self).is_hardcore);
4743 w.put_len_varint((*self).world_names.len())?;
4744 for v1 in (*self).world_names.iter() {
4745 w.put_string(&(*v1))?;
4746 }
4747 w.put_varint((*self).max_players);
4748 w.put_varint((*self).view_distance);
4749 w.put_varint((*self).simulation_distance);
4750 w.put_bool((*self).reduced_debug_info);
4751 w.put_bool((*self).enable_respawn_screen);
4752 w.put_bool((*self).do_limited_crafting);
4753 (*self).world_state.encode(w)?;
4754 w.put_bool((*self).enforces_secure_chat);
4755 Ok(())
4756 }
4757}
4758#[cfg(feature = "v26_1")]
4759#[cfg(feature = "testgen")]
4760impl<const V: i32> Generate for Login<V> {
4761 fn generate(g: &mut Gen) -> Self {
4762 {
4763 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
4764 let v2 = g.bool();
4765 let v3 = {
4766 let v4 = g.count();
4767 let mut v5 = Vec::with_capacity(v4.min(crate::codec::PREALLOC_LIMIT));
4768 for _ in 0..v4 {
4769 v5.push(g.string());
4770 }
4771 v5
4772 };
4773 let v6 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
4774 let v7 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
4775 let v8 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
4776 let v9 = g.bool();
4777 let v10 = g.bool();
4778 let v11 = g.bool();
4779 let v12 = <crate::defs::p775::play::clientbound::SpawnInfo as Generate>::generate(g);
4780 let v13 = g.bool();
4781 Self {
4782 entity_id: v1,
4783 is_hardcore: v2,
4784 world_names: v3,
4785 max_players: v6,
4786 view_distance: v7,
4787 simulation_distance: v8,
4788 reduced_debug_info: v9,
4789 enable_respawn_screen: v10,
4790 do_limited_crafting: v11,
4791 world_state: v12,
4792 enforces_secure_chat: v13,
4793 }
4794 }
4795 }
4796}
4797
4798#[cfg(feature = "v26_1")]
4799#[derive(Debug, Clone, PartialEq)]
4801pub struct LowDiskSpaceWarning<const V: i32> {}
4802#[cfg(feature = "v26_1")]
4803impl<const V: i32> Decode for LowDiskSpaceWarning<V> {
4804 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
4805 Ok({ Self {} })
4806 }
4807}
4808#[cfg(feature = "v26_1")]
4809impl<const V: i32> Encode for LowDiskSpaceWarning<V> {
4810 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
4811 Ok(())
4812 }
4813}
4814#[cfg(feature = "v26_1")]
4815#[cfg(feature = "testgen")]
4816impl<const V: i32> Generate for LowDiskSpaceWarning<V> {
4817 fn generate(g: &mut Gen) -> Self {
4818 { Self {} }
4819 }
4820}
4821
4822#[cfg(feature = "v26_1")]
4823#[derive(Debug, Clone, PartialEq)]
4825pub struct MapIcons {
4826 pub r#type: i32,
4828 pub x: i8,
4830 pub z: i8,
4832 pub direction: u8,
4834 pub display_name: Option<AnonNbt>,
4836}
4837
4838#[cfg(feature = "v26_1")]
4839#[derive(Debug, Clone, PartialEq)]
4841pub struct Map<const V: i32> {
4842 pub item_damage: i32,
4844 pub scale: i8,
4846 pub locked: bool,
4848 pub icons: Option<Vec<crate::defs::p775::play::clientbound::MapIcons>>,
4850 pub columns: u8,
4852 pub rows: Option<u8>,
4854 pub x: Option<u8>,
4856 pub y: Option<u8>,
4858 pub data: Option<Bytes>,
4860}
4861#[cfg(feature = "v26_1")]
4862impl<const V: i32> Decode for Map<V> {
4863 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
4864 Ok({
4865 let v1 = r.read_varint()?;
4866 let v2 = r.read_i8()?;
4867 let v3 = r.read_bool()?;
4868 let v4 = if r.read_bool()? {
4869 Some({
4870 let v5 = {
4871 let c = r.read_varint()?;
4872 r.check_count(i64::from(c), 5)?
4873 };
4874 let mut v6 = Vec::with_capacity(v5.min(crate::codec::PREALLOC_LIMIT));
4875 for _ in 0..v5 {
4876 v6.push({
4877 let v7 = r.read_varint()?;
4878 let v8 = r.read_i8()?;
4879 let v9 = r.read_i8()?;
4880 let v10 = r.read_u8()?;
4881 let v11 = if r.read_bool()? {
4882 Some(AnonNbt::read(r)?)
4883 } else {
4884 None
4885 };
4886 crate::defs::p775::play::clientbound::MapIcons {
4887 r#type: v7,
4888 x: v8,
4889 z: v9,
4890 direction: v10,
4891 display_name: v11,
4892 }
4893 });
4894 }
4895 v6
4896 })
4897 } else {
4898 None
4899 };
4900 let v12 = r.read_u8()?;
4901 let v13 = if !(v12 == 0) {
4902 Some(r.read_u8()?)
4903 } else {
4904 None
4905 };
4906 let v14 = if !(v12 == 0) {
4907 Some(r.read_u8()?)
4908 } else {
4909 None
4910 };
4911 let v15 = if !(v12 == 0) {
4912 Some(r.read_u8()?)
4913 } else {
4914 None
4915 };
4916 let v16 = if !(v12 == 0) {
4917 Some(r.read_byte_array()?)
4918 } else {
4919 None
4920 };
4921 Self {
4922 item_damage: v1,
4923 scale: v2,
4924 locked: v3,
4925 icons: v4,
4926 columns: v12,
4927 rows: v13,
4928 x: v14,
4929 y: v15,
4930 data: v16,
4931 }
4932 })
4933 }
4934}
4935#[cfg(feature = "v26_1")]
4936impl<const V: i32> Encode for Map<V> {
4937 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
4938 w.put_varint((*self).item_damage);
4939 w.put_i8((*self).scale);
4940 w.put_bool((*self).locked);
4941 match &(*self).icons {
4942 Some(v1) => {
4943 w.put_u8(1);
4944 w.put_len_varint((*v1).len())?;
4945 for v2 in (*v1).iter() {
4946 w.put_varint((*v2).r#type);
4947 w.put_i8((*v2).x);
4948 w.put_i8((*v2).z);
4949 w.put_u8((*v2).direction);
4950 match &(*v2).display_name {
4951 Some(v3) => {
4952 w.put_u8(1);
4953 (*v3).write(w);
4954 }
4955 None => w.put_u8(0),
4956 }
4957 }
4958 }
4959 None => w.put_u8(0),
4960 }
4961 w.put_u8((*self).columns);
4962 match (&(*self).rows, !((*self).columns == 0)) {
4963 (Some(v4), true) => {
4964 w.put_u8((*v4));
4965 }
4966 (None, false) => {}
4967 _ => return Err(EncodeError::SwitchMismatch("play.clientbound.map.rows")),
4968 }
4969 match (&(*self).x, !((*self).columns == 0)) {
4970 (Some(v5), true) => {
4971 w.put_u8((*v5));
4972 }
4973 (None, false) => {}
4974 _ => return Err(EncodeError::SwitchMismatch("play.clientbound.map.x")),
4975 }
4976 match (&(*self).y, !((*self).columns == 0)) {
4977 (Some(v6), true) => {
4978 w.put_u8((*v6));
4979 }
4980 (None, false) => {}
4981 _ => return Err(EncodeError::SwitchMismatch("play.clientbound.map.y")),
4982 }
4983 match (&(*self).data, !((*self).columns == 0)) {
4984 (Some(v7), true) => {
4985 w.put_byte_array(&(*v7))?;
4986 }
4987 (None, false) => {}
4988 _ => return Err(EncodeError::SwitchMismatch("play.clientbound.map.data")),
4989 }
4990 Ok(())
4991 }
4992}
4993#[cfg(feature = "v26_1")]
4994#[cfg(feature = "testgen")]
4995impl<const V: i32> Generate for Map<V> {
4996 fn generate(g: &mut Gen) -> Self {
4997 {
4998 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
4999 let v2 = (g.int_in(-128, 127, &[]) as i8);
5000 let v3 = g.bool();
5001 let v4 = if g.bool() {
5002 Some({
5003 let v5 = g.count();
5004 let mut v6 = Vec::with_capacity(v5.min(crate::codec::PREALLOC_LIMIT));
5005 for _ in 0..v5 {
5006 v6.push({
5007 let v7 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
5008 let v8 = (g.int_in(-128, 127, &[]) as i8);
5009 let v9 = (g.int_in(-128, 127, &[]) as i8);
5010 let v10 = (g.int_in(0, 255, &[]) as u8);
5011 let v11 = if g.bool() { Some(g.anon_nbt()) } else { None };
5012 crate::defs::p775::play::clientbound::MapIcons {
5013 r#type: v7,
5014 x: v8,
5015 z: v9,
5016 direction: v10,
5017 display_name: v11,
5018 }
5019 });
5020 }
5021 v6
5022 })
5023 } else {
5024 None
5025 };
5026 let v12 = (g.int_in(0, 255, &[0, 0, 0, 0]) as u8);
5027 let v13 = if !(v12 == 0) {
5028 Some((g.int_in(0, 255, &[]) as u8))
5029 } else {
5030 None
5031 };
5032 let v14 = if !(v12 == 0) {
5033 Some((g.int_in(0, 255, &[]) as u8))
5034 } else {
5035 None
5036 };
5037 let v15 = if !(v12 == 0) {
5038 Some((g.int_in(0, 255, &[]) as u8))
5039 } else {
5040 None
5041 };
5042 let v16 = if !(v12 == 0) { Some(g.bytes()) } else { None };
5043 Self {
5044 item_damage: v1,
5045 scale: v2,
5046 locked: v3,
5047 icons: v4,
5048 columns: v12,
5049 rows: v13,
5050 x: v14,
5051 y: v15,
5052 data: v16,
5053 }
5054 }
5055 }
5056}
5057
5058#[cfg(feature = "v26_1")]
5059#[derive(Debug, Clone, PartialEq)]
5061pub struct TradeListTradesInputItem1 {
5062 pub item_id: i32,
5064 pub item_count: i32,
5066 pub components: Vec<crate::defs::p775::types::SlotComponent>,
5068}
5069
5070#[cfg(feature = "v26_1")]
5071#[derive(Debug, Clone, PartialEq)]
5073pub struct TradeListTradesInputItem2 {
5074 pub item_id: i32,
5076 pub item_count: i32,
5078 pub components: Vec<crate::defs::p775::types::SlotComponent>,
5080}
5081
5082#[cfg(feature = "v26_1")]
5083#[derive(Debug, Clone, PartialEq)]
5085pub struct TradeListTrades {
5086 pub input_item1: crate::defs::p775::play::clientbound::TradeListTradesInputItem1,
5088 pub output_item: crate::defs::p775::types::Slot,
5090 pub input_item2: Option<crate::defs::p775::play::clientbound::TradeListTradesInputItem2>,
5092 pub trade_disabled: bool,
5094 pub nb_trade_uses: i32,
5096 pub maximum_nb_trade_uses: i32,
5098 pub xp: i32,
5100 pub special_price: i32,
5102 pub price_multiplier: f32,
5104 pub demand: i32,
5106}
5107
5108#[cfg(feature = "v26_1")]
5109#[derive(Debug, Clone, PartialEq)]
5111pub struct TradeList<const V: i32> {
5112 pub window_id: i32,
5114 pub trades: Vec<crate::defs::p775::play::clientbound::TradeListTrades>,
5116 pub villager_level: i32,
5118 pub experience: i32,
5120 pub is_regular_villager: bool,
5122 pub can_restock: bool,
5124}
5125#[cfg(feature = "v26_1")]
5126impl<const V: i32> Decode for TradeList<V> {
5127 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
5128 Ok({
5129 let v1 = r.read_varint()?;
5130 let v2 = {
5131 let v3 = {
5132 let c = r.read_varint()?;
5133 r.check_count(i64::from(c), 30)?
5134 };
5135 let mut v4 = Vec::with_capacity(v3.min(crate::codec::PREALLOC_LIMIT));
5136 for _ in 0..v3 {
5137 v4.push({ let v5 = { let v6 = r.read_varint()?;let v7 = r.read_varint()?;let v8 = { let v9 = { let c = r.read_varint()?; r.check_count(i64::from(c), 1)? }; let mut v10 = Vec::with_capacity(v9.min(crate::codec::PREALLOC_LIMIT)); for _ in 0..v9 { v10.push(<crate::defs::p775::types::SlotComponent as Decode>::decode(r)?); } v10 }; crate::defs::p775::play::clientbound::TradeListTradesInputItem1 { item_id: v6, item_count: v7, components: v8 } };let v11 = <crate::defs::p775::types::Slot as Decode>::decode(r)?;let v12 = if r.read_bool()? { Some({ let v13 = r.read_varint()?;let v14 = r.read_varint()?;let v15 = { let v16 = { let c = r.read_varint()?; r.check_count(i64::from(c), 1)? }; let mut v17 = Vec::with_capacity(v16.min(crate::codec::PREALLOC_LIMIT)); for _ in 0..v16 { v17.push(<crate::defs::p775::types::SlotComponent as Decode>::decode(r)?); } v17 }; crate::defs::p775::play::clientbound::TradeListTradesInputItem2 { item_id: v13, item_count: v14, components: v15 } }) } else { None };let v18 = r.read_bool()?;let v19 = r.read_i32()?;let v20 = r.read_i32()?;let v21 = r.read_i32()?;let v22 = r.read_i32()?;let v23 = r.read_f32()?;let v24 = r.read_i32()?; crate::defs::p775::play::clientbound::TradeListTrades { input_item1: v5, output_item: v11, input_item2: v12, trade_disabled: v18, nb_trade_uses: v19, maximum_nb_trade_uses: v20, xp: v21, special_price: v22, price_multiplier: v23, demand: v24 } });
5138 }
5139 v4
5140 };
5141 let v25 = r.read_varint()?;
5142 let v26 = r.read_varint()?;
5143 let v27 = r.read_bool()?;
5144 let v28 = r.read_bool()?;
5145 Self {
5146 window_id: v1,
5147 trades: v2,
5148 villager_level: v25,
5149 experience: v26,
5150 is_regular_villager: v27,
5151 can_restock: v28,
5152 }
5153 })
5154 }
5155}
5156#[cfg(feature = "v26_1")]
5157impl<const V: i32> Encode for TradeList<V> {
5158 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
5159 w.put_varint((*self).window_id);
5160 w.put_len_varint((*self).trades.len())?;
5161 for v1 in (*self).trades.iter() {
5162 w.put_varint((*v1).input_item1.item_id);
5163 w.put_varint((*v1).input_item1.item_count);
5164 w.put_len_varint((*v1).input_item1.components.len())?;
5165 for v2 in (*v1).input_item1.components.iter() {
5166 (*v2).encode(w)?;
5167 }
5168 (*v1).output_item.encode(w)?;
5169 match &(*v1).input_item2 {
5170 Some(v3) => {
5171 w.put_u8(1);
5172 w.put_varint((*v3).item_id);
5173 w.put_varint((*v3).item_count);
5174 w.put_len_varint((*v3).components.len())?;
5175 for v4 in (*v3).components.iter() {
5176 (*v4).encode(w)?;
5177 }
5178 }
5179 None => w.put_u8(0),
5180 }
5181 w.put_bool((*v1).trade_disabled);
5182 w.put_i32((*v1).nb_trade_uses);
5183 w.put_i32((*v1).maximum_nb_trade_uses);
5184 w.put_i32((*v1).xp);
5185 w.put_i32((*v1).special_price);
5186 w.put_f32((*v1).price_multiplier);
5187 w.put_i32((*v1).demand);
5188 }
5189 w.put_varint((*self).villager_level);
5190 w.put_varint((*self).experience);
5191 w.put_bool((*self).is_regular_villager);
5192 w.put_bool((*self).can_restock);
5193 Ok(())
5194 }
5195}
5196#[cfg(feature = "v26_1")]
5197#[cfg(feature = "testgen")]
5198impl<const V: i32> Generate for TradeList<V> {
5199 fn generate(g: &mut Gen) -> Self {
5200 {
5201 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
5202 let v2 = {
5203 let v3 = g.count();
5204 let mut v4 = Vec::with_capacity(v3.min(crate::codec::PREALLOC_LIMIT));
5205 for _ in 0..v3 {
5206 v4.push({ let v5 = { let v6 = (g.int_in(-2147483648, 2147483647, &[]) as i32);let v7 = (g.int_in(-2147483648, 2147483647, &[]) as i32);let v8 = { let v9 = g.count(); let mut v10 = Vec::with_capacity(v9.min(crate::codec::PREALLOC_LIMIT)); for _ in 0..v9 { v10.push(<crate::defs::p775::types::SlotComponent as Generate>::generate(g)); } v10 }; crate::defs::p775::play::clientbound::TradeListTradesInputItem1 { item_id: v6, item_count: v7, components: v8 } };let v11 = <crate::defs::p775::types::Slot as Generate>::generate(g);let v12 = if g.bool() { Some({ let v13 = (g.int_in(-2147483648, 2147483647, &[]) as i32);let v14 = (g.int_in(-2147483648, 2147483647, &[]) as i32);let v15 = { let v16 = g.count(); let mut v17 = Vec::with_capacity(v16.min(crate::codec::PREALLOC_LIMIT)); for _ in 0..v16 { v17.push(<crate::defs::p775::types::SlotComponent as Generate>::generate(g)); } v17 }; crate::defs::p775::play::clientbound::TradeListTradesInputItem2 { item_id: v13, item_count: v14, components: v15 } }) } else { None };let v18 = g.bool();let v19 = (g.int_in(-2147483648, 2147483647, &[]) as i32);let v20 = (g.int_in(-2147483648, 2147483647, &[]) as i32);let v21 = (g.int_in(-2147483648, 2147483647, &[]) as i32);let v22 = (g.int_in(-2147483648, 2147483647, &[]) as i32);let v23 = g.f32();let v24 = (g.int_in(-2147483648, 2147483647, &[]) as i32); crate::defs::p775::play::clientbound::TradeListTrades { input_item1: v5, output_item: v11, input_item2: v12, trade_disabled: v18, nb_trade_uses: v19, maximum_nb_trade_uses: v20, xp: v21, special_price: v22, price_multiplier: v23, demand: v24 } });
5207 }
5208 v4
5209 };
5210 let v25 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
5211 let v26 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
5212 let v27 = g.bool();
5213 let v28 = g.bool();
5214 Self {
5215 window_id: v1,
5216 trades: v2,
5217 villager_level: v25,
5218 experience: v26,
5219 is_regular_villager: v27,
5220 can_restock: v28,
5221 }
5222 }
5223 }
5224}
5225
5226#[cfg(feature = "v26_1")]
5227#[derive(Debug, Clone, PartialEq)]
5229pub struct MoveMinecartSteps {
5230 pub position: crate::defs::p775::types::Vec3f,
5232 pub velocity: crate::defs::p775::types::Vec3f,
5234 pub yaw: f32,
5236 pub pitch: f32,
5238 pub weight: f32,
5240}
5241
5242#[cfg(feature = "v26_1")]
5243#[derive(Debug, Clone, PartialEq)]
5245pub struct MoveMinecart<const V: i32> {
5246 pub entity_id: i32,
5248 pub steps: Vec<crate::defs::p775::play::clientbound::MoveMinecartSteps>,
5250}
5251#[cfg(feature = "v26_1")]
5252impl<const V: i32> Decode for MoveMinecart<V> {
5253 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
5254 Ok({
5255 let v1 = r.read_varint()?;
5256 let v2 = {
5257 let v3 = {
5258 let c = r.read_varint()?;
5259 r.check_count(i64::from(c), 36)?
5260 };
5261 let mut v4 = Vec::with_capacity(v3.min(crate::codec::PREALLOC_LIMIT));
5262 for _ in 0..v3 {
5263 v4.push({
5264 let v5 = <crate::defs::p775::types::Vec3f as Decode>::decode(r)?;
5265 let v6 = <crate::defs::p775::types::Vec3f as Decode>::decode(r)?;
5266 let v7 = r.read_f32()?;
5267 let v8 = r.read_f32()?;
5268 let v9 = r.read_f32()?;
5269 crate::defs::p775::play::clientbound::MoveMinecartSteps {
5270 position: v5,
5271 velocity: v6,
5272 yaw: v7,
5273 pitch: v8,
5274 weight: v9,
5275 }
5276 });
5277 }
5278 v4
5279 };
5280 Self {
5281 entity_id: v1,
5282 steps: v2,
5283 }
5284 })
5285 }
5286}
5287#[cfg(feature = "v26_1")]
5288impl<const V: i32> Encode for MoveMinecart<V> {
5289 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
5290 w.put_varint((*self).entity_id);
5291 w.put_len_varint((*self).steps.len())?;
5292 for v1 in (*self).steps.iter() {
5293 (*v1).position.encode(w)?;
5294 (*v1).velocity.encode(w)?;
5295 w.put_f32((*v1).yaw);
5296 w.put_f32((*v1).pitch);
5297 w.put_f32((*v1).weight);
5298 }
5299 Ok(())
5300 }
5301}
5302#[cfg(feature = "v26_1")]
5303#[cfg(feature = "testgen")]
5304impl<const V: i32> Generate for MoveMinecart<V> {
5305 fn generate(g: &mut Gen) -> Self {
5306 {
5307 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
5308 let v2 = {
5309 let v3 = g.count();
5310 let mut v4 = Vec::with_capacity(v3.min(crate::codec::PREALLOC_LIMIT));
5311 for _ in 0..v3 {
5312 v4.push({
5313 let v5 = <crate::defs::p775::types::Vec3f as Generate>::generate(g);
5314 let v6 = <crate::defs::p775::types::Vec3f as Generate>::generate(g);
5315 let v7 = g.f32();
5316 let v8 = g.f32();
5317 let v9 = g.f32();
5318 crate::defs::p775::play::clientbound::MoveMinecartSteps {
5319 position: v5,
5320 velocity: v6,
5321 yaw: v7,
5322 pitch: v8,
5323 weight: v9,
5324 }
5325 });
5326 }
5327 v4
5328 };
5329 Self {
5330 entity_id: v1,
5331 steps: v2,
5332 }
5333 }
5334 }
5335}
5336
5337#[cfg(feature = "v26_1")]
5338#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
5340pub struct OpenBookHand(pub i32);
5341#[cfg(feature = "v26_1")]
5342impl OpenBookHand {
5343 pub const MAIN_HAND: Self = Self(0);
5345 pub const OFF_HAND: Self = Self(1);
5347 pub const fn name(self) -> Option<&'static str> {
5349 match self.0 {
5350 0 => Some("main_hand"),
5351 1 => Some("off_hand"),
5352 _ => None,
5353 }
5354 }
5355}
5356#[cfg(feature = "v26_1")]
5357impl std::fmt::Debug for OpenBookHand {
5358 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5359 match self.name() {
5360 Some(n) => write!(f, "OpenBookHand::{n}"),
5361 None => write!(f, "OpenBookHand({})", self.0),
5362 }
5363 }
5364}
5365
5366#[cfg(feature = "v26_1")]
5367#[derive(Debug, Clone, PartialEq)]
5369pub struct OpenBook<const V: i32> {
5370 pub hand: crate::defs::p775::play::clientbound::OpenBookHand,
5372}
5373#[cfg(feature = "v26_1")]
5374impl<const V: i32> Decode for OpenBook<V> {
5375 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
5376 Ok({
5377 let v1 = crate::defs::p775::play::clientbound::OpenBookHand(r.read_varint()?);
5378 Self { hand: v1 }
5379 })
5380 }
5381}
5382#[cfg(feature = "v26_1")]
5383impl<const V: i32> Encode for OpenBook<V> {
5384 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
5385 w.put_varint((*self).hand.0);
5386 Ok(())
5387 }
5388}
5389#[cfg(feature = "v26_1")]
5390#[cfg(feature = "testgen")]
5391impl<const V: i32> Generate for OpenBook<V> {
5392 fn generate(g: &mut Gen) -> Self {
5393 {
5394 let v1 = crate::defs::p775::play::clientbound::OpenBookHand(g.int_in(
5395 -2147483648,
5396 2147483647,
5397 &[0, 1],
5398 ) as i32);
5399 Self { hand: v1 }
5400 }
5401 }
5402}
5403
5404#[cfg(feature = "v26_1")]
5405#[derive(Debug, Clone, PartialEq)]
5407pub struct OpenWindow<const V: i32> {
5408 pub window_id: i32,
5410 pub inventory_type: i32,
5412 pub window_title: AnonNbt,
5414}
5415#[cfg(feature = "v26_1")]
5416impl<const V: i32> Decode for OpenWindow<V> {
5417 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
5418 Ok({
5419 let v1 = r.read_varint()?;
5420 let v2 = r.read_varint()?;
5421 let v3 = AnonNbt::read(r)?;
5422 Self {
5423 window_id: v1,
5424 inventory_type: v2,
5425 window_title: v3,
5426 }
5427 })
5428 }
5429}
5430#[cfg(feature = "v26_1")]
5431impl<const V: i32> Encode for OpenWindow<V> {
5432 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
5433 w.put_varint((*self).window_id);
5434 w.put_varint((*self).inventory_type);
5435 (*self).window_title.write(w);
5436 Ok(())
5437 }
5438}
5439#[cfg(feature = "v26_1")]
5440#[cfg(feature = "testgen")]
5441impl<const V: i32> Generate for OpenWindow<V> {
5442 fn generate(g: &mut Gen) -> Self {
5443 {
5444 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
5445 let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
5446 let v3 = g.anon_nbt();
5447 Self {
5448 window_id: v1,
5449 inventory_type: v2,
5450 window_title: v3,
5451 }
5452 }
5453 }
5454}
5455
5456#[cfg(feature = "v26_1")]
5457#[derive(Debug, Clone, PartialEq)]
5459pub struct OpenSignEntity<const V: i32> {
5460 pub location: BlockPos,
5462 pub is_front_text: bool,
5464}
5465#[cfg(feature = "v26_1")]
5466impl<const V: i32> Decode for OpenSignEntity<V> {
5467 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
5468 Ok({
5469 let v1 = BlockPos::read(r, PositionLayout::Xzy)?;
5470 let v2 = r.read_bool()?;
5471 Self {
5472 location: v1,
5473 is_front_text: v2,
5474 }
5475 })
5476 }
5477}
5478#[cfg(feature = "v26_1")]
5479impl<const V: i32> Encode for OpenSignEntity<V> {
5480 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
5481 (*self).location.write(w, PositionLayout::Xzy)?;
5482 w.put_bool((*self).is_front_text);
5483 Ok(())
5484 }
5485}
5486#[cfg(feature = "v26_1")]
5487#[cfg(feature = "testgen")]
5488impl<const V: i32> Generate for OpenSignEntity<V> {
5489 fn generate(g: &mut Gen) -> Self {
5490 {
5491 let v1 = g.position();
5492 let v2 = g.bool();
5493 Self {
5494 location: v1,
5495 is_front_text: v2,
5496 }
5497 }
5498 }
5499}
5500
5501#[cfg(feature = "v26_1")]
5502#[derive(Debug, Clone, PartialEq)]
5504pub struct Ping<const V: i32> {
5505 pub id: i32,
5507}
5508#[cfg(feature = "v26_1")]
5509impl<const V: i32> Decode for Ping<V> {
5510 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
5511 Ok({
5512 let v1 = r.read_i32()?;
5513 Self { id: v1 }
5514 })
5515 }
5516}
5517#[cfg(feature = "v26_1")]
5518impl<const V: i32> Encode for Ping<V> {
5519 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
5520 w.put_i32((*self).id);
5521 Ok(())
5522 }
5523}
5524#[cfg(feature = "v26_1")]
5525#[cfg(feature = "testgen")]
5526impl<const V: i32> Generate for Ping<V> {
5527 fn generate(g: &mut Gen) -> Self {
5528 {
5529 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
5530 Self { id: v1 }
5531 }
5532 }
5533}
5534
5535#[cfg(feature = "v26_1")]
5536#[derive(Debug, Clone, PartialEq)]
5538pub struct PingResponse<const V: i32> {
5539 pub id: i64,
5541}
5542#[cfg(feature = "v26_1")]
5543impl<const V: i32> Decode for PingResponse<V> {
5544 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
5545 Ok({
5546 let v1 = r.read_i64()?;
5547 Self { id: v1 }
5548 })
5549 }
5550}
5551#[cfg(feature = "v26_1")]
5552impl<const V: i32> Encode for PingResponse<V> {
5553 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
5554 w.put_i64((*self).id);
5555 Ok(())
5556 }
5557}
5558#[cfg(feature = "v26_1")]
5559#[cfg(feature = "testgen")]
5560impl<const V: i32> Generate for PingResponse<V> {
5561 fn generate(g: &mut Gen) -> Self {
5562 {
5563 let v1 = g.i64();
5564 Self { id: v1 }
5565 }
5566 }
5567}
5568
5569#[cfg(feature = "v26_1")]
5570#[derive(Debug, Clone, PartialEq)]
5572pub struct CraftRecipeResponse<const V: i32> {
5573 pub window_id: i32,
5575 pub recipe_display: crate::defs::p775::play::clientbound::RecipeDisplay,
5577}
5578#[cfg(feature = "v26_1")]
5579impl<const V: i32> Decode for CraftRecipeResponse<V> {
5580 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
5581 Ok({
5582 let v1 = r.read_varint()?;
5583 let v2 = <crate::defs::p775::play::clientbound::RecipeDisplay as Decode>::decode(r)?;
5584 Self {
5585 window_id: v1,
5586 recipe_display: v2,
5587 }
5588 })
5589 }
5590}
5591#[cfg(feature = "v26_1")]
5592impl<const V: i32> Encode for CraftRecipeResponse<V> {
5593 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
5594 w.put_varint((*self).window_id);
5595 (*self).recipe_display.encode(w)?;
5596 Ok(())
5597 }
5598}
5599#[cfg(feature = "v26_1")]
5600#[cfg(feature = "testgen")]
5601impl<const V: i32> Generate for CraftRecipeResponse<V> {
5602 fn generate(g: &mut Gen) -> Self {
5603 {
5604 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
5605 let v2 = <crate::defs::p775::play::clientbound::RecipeDisplay as Generate>::generate(g);
5606 Self {
5607 window_id: v1,
5608 recipe_display: v2,
5609 }
5610 }
5611 }
5612}
5613
5614#[cfg(feature = "v26_1")]
5615#[derive(Debug, Clone, PartialEq)]
5617pub struct PlayerChat<const V: i32> {
5618 pub global_index: i32,
5620 pub sender_uuid: Uuid,
5622 pub index: i32,
5624 pub signature: Option<Bytes>,
5626 pub plain_message: ByteString,
5628 pub timestamp: i64,
5630 pub salt: i64,
5632 pub previous_messages: Vec<crate::defs::p775::types::PreviousMessages>,
5634 pub unsigned_chat_content: Option<AnonNbt>,
5636 pub filter_type: i32,
5638 pub filter_type_mask: Option<Vec<i64>>,
5640 pub r#type: Holder<crate::defs::p775::play::clientbound::ChatTypes>,
5642 pub network_name: AnonNbt,
5644 pub network_target_name: Option<AnonNbt>,
5646}
5647#[cfg(feature = "v26_1")]
5648impl<const V: i32> Decode for PlayerChat<V> {
5649 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
5650 Ok({
5651 let v1 = r.read_varint()?;
5652 let v2 = r.read_uuid()?;
5653 let v3 = r.read_varint()?;
5654 let v4 = if r.read_bool()? {
5655 Some(r.read_bytes(256)?)
5656 } else {
5657 None
5658 };
5659 let v5 = r.read_string()?;
5660 let v6 = r.read_i64()?;
5661 let v7 = r.read_i64()?;
5662 let v8 = {
5663 let v9 = {
5664 let c = r.read_varint()?;
5665 r.check_count(i64::from(c), 1)?
5666 };
5667 let mut v10 = Vec::with_capacity(v9.min(crate::codec::PREALLOC_LIMIT));
5668 for _ in 0..v9 {
5669 v10.push({
5670 let v11 = r.read_varint()?;
5671 let v12 = if (v11 == 0) {
5672 Some(r.read_bytes(256)?)
5673 } else {
5674 None
5675 };
5676 crate::defs::p775::types::PreviousMessages {
5677 id: v11,
5678 signature: v12,
5679 }
5680 });
5681 }
5682 v10
5683 };
5684 let v13 = if r.read_bool()? {
5685 Some(AnonNbt::read(r)?)
5686 } else {
5687 None
5688 };
5689 let v14 = r.read_varint()?;
5690 let v15 = if (v14 == 2) {
5691 Some({
5692 let v16 = {
5693 let c = r.read_varint()?;
5694 r.check_count(i64::from(c), 8)?
5695 };
5696 let mut v17 = Vec::with_capacity(v16.min(crate::codec::PREALLOC_LIMIT));
5697 for _ in 0..v16 {
5698 v17.push(r.read_i64()?);
5699 }
5700 v17
5701 })
5702 } else {
5703 None
5704 };
5705 let v18 = {
5706 let id = r.read_varint()?;
5707 if id == 0 {
5708 Holder::Inline(
5709 <crate::defs::p775::play::clientbound::ChatTypes as Decode>::decode(r)?,
5710 )
5711 } else {
5712 Holder::Id(id.wrapping_sub(1))
5713 }
5714 };
5715 let v19 = AnonNbt::read(r)?;
5716 let v20 = if r.read_bool()? {
5717 Some(AnonNbt::read(r)?)
5718 } else {
5719 None
5720 };
5721 Self {
5722 global_index: v1,
5723 sender_uuid: v2,
5724 index: v3,
5725 signature: v4,
5726 plain_message: v5,
5727 timestamp: v6,
5728 salt: v7,
5729 previous_messages: v8,
5730 unsigned_chat_content: v13,
5731 filter_type: v14,
5732 filter_type_mask: v15,
5733 r#type: v18,
5734 network_name: v19,
5735 network_target_name: v20,
5736 }
5737 })
5738 }
5739}
5740#[cfg(feature = "v26_1")]
5741impl<const V: i32> Encode for PlayerChat<V> {
5742 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
5743 w.put_varint((*self).global_index);
5744 w.put_uuid(&(*self).sender_uuid);
5745 w.put_varint((*self).index);
5746 match &(*self).signature {
5747 Some(v1) => {
5748 w.put_u8(1);
5749 if (*v1).len() != 256 {
5750 return Err(EncodeError::CountMismatch {
5751 field: "fixed buffer",
5752 expected: 256,
5753 actual: (*v1).len(),
5754 });
5755 }
5756 w.put_slice(&(*v1));
5757 }
5758 None => w.put_u8(0),
5759 }
5760 w.put_string(&(*self).plain_message)?;
5761 w.put_i64((*self).timestamp);
5762 w.put_i64((*self).salt);
5763 w.put_len_varint((*self).previous_messages.len())?;
5764 for v2 in (*self).previous_messages.iter() {
5765 w.put_varint((*v2).id);
5766 match (&(*v2).signature, ((*v2).id == 0)) {
5767 (Some(v3), true) => {
5768 if (*v3).len() != 256 {
5769 return Err(EncodeError::CountMismatch {
5770 field: "fixed buffer",
5771 expected: 256,
5772 actual: (*v3).len(),
5773 });
5774 }
5775 w.put_slice(&(*v3));
5776 }
5777 (None, false) => {}
5778 _ => {
5779 return Err(EncodeError::SwitchMismatch(
5780 "play.clientbound.player_chat.previousMessages.signature",
5781 ));
5782 }
5783 }
5784 }
5785 match &(*self).unsigned_chat_content {
5786 Some(v4) => {
5787 w.put_u8(1);
5788 (*v4).write(w);
5789 }
5790 None => w.put_u8(0),
5791 }
5792 w.put_varint((*self).filter_type);
5793 match (&(*self).filter_type_mask, ((*self).filter_type == 2)) {
5794 (Some(v5), true) => {
5795 w.put_len_varint((*v5).len())?;
5796 for v6 in (*v5).iter() {
5797 w.put_i64((*v6));
5798 }
5799 }
5800 (None, false) => {}
5801 _ => {
5802 return Err(EncodeError::SwitchMismatch(
5803 "play.clientbound.player_chat.filterTypeMask",
5804 ));
5805 }
5806 }
5807 match &(*self).r#type {
5808 Holder::Id(v8) => {
5809 if *v8 == -1 {
5810 return Err(EncodeError::OutOfRange("holder id"));
5811 }
5812 w.put_varint(v8.wrapping_add(1));
5813 }
5814 Holder::Inline(v7) => {
5815 w.put_varint(0);
5816 (*v7).encode(w)?;
5817 }
5818 }
5819 (*self).network_name.write(w);
5820 match &(*self).network_target_name {
5821 Some(v9) => {
5822 w.put_u8(1);
5823 (*v9).write(w);
5824 }
5825 None => w.put_u8(0),
5826 }
5827 Ok(())
5828 }
5829}
5830#[cfg(feature = "v26_1")]
5831#[cfg(feature = "testgen")]
5832impl<const V: i32> Generate for PlayerChat<V> {
5833 fn generate(g: &mut Gen) -> Self {
5834 {
5835 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
5836 let v2 = g.uuid();
5837 let v3 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
5838 let v4 = if g.bool() {
5839 Some(g.fixed_bytes(256))
5840 } else {
5841 None
5842 };
5843 let v5 = g.string();
5844 let v6 = g.i64();
5845 let v7 = g.i64();
5846 let v8 = {
5847 let v9 = g.count();
5848 let mut v10 = Vec::with_capacity(v9.min(crate::codec::PREALLOC_LIMIT));
5849 for _ in 0..v9 {
5850 v10.push({
5851 let v11 = (g.int_in(-2147483648, 2147483647, &[0]) as i32);
5852 let v12 = if (v11 == 0) {
5853 Some(g.fixed_bytes(256))
5854 } else {
5855 None
5856 };
5857 crate::defs::p775::types::PreviousMessages {
5858 id: v11,
5859 signature: v12,
5860 }
5861 });
5862 }
5863 v10
5864 };
5865 let v13 = if g.bool() { Some(g.anon_nbt()) } else { None };
5866 let v14 = (g.int_in(-2147483648, 2147483647, &[2]) as i32);
5867 let v15 = if (v14 == 2) {
5868 Some({
5869 let v16 = g.count();
5870 let mut v17 = Vec::with_capacity(v16.min(crate::codec::PREALLOC_LIMIT));
5871 for _ in 0..v16 {
5872 v17.push(g.i64());
5873 }
5874 v17
5875 })
5876 } else {
5877 None
5878 };
5879 let v18 = if g.bool() {
5880 Holder::Id(match g.int_in(-2147483648, 2147483647, &[0, 1, 2]) as i32 {
5881 -1 => 0,
5882 v => v,
5883 })
5884 } else {
5885 Holder::Inline(
5886 <crate::defs::p775::play::clientbound::ChatTypes as Generate>::generate(g),
5887 )
5888 };
5889 let v19 = g.anon_nbt();
5890 let v20 = if g.bool() { Some(g.anon_nbt()) } else { None };
5891 Self {
5892 global_index: v1,
5893 sender_uuid: v2,
5894 index: v3,
5895 signature: v4,
5896 plain_message: v5,
5897 timestamp: v6,
5898 salt: v7,
5899 previous_messages: v8,
5900 unsigned_chat_content: v13,
5901 filter_type: v14,
5902 filter_type_mask: v15,
5903 r#type: v18,
5904 network_name: v19,
5905 network_target_name: v20,
5906 }
5907 }
5908 }
5909}
5910
5911#[cfg(feature = "v26_1")]
5912#[derive(Debug, Clone, PartialEq)]
5914pub struct EndCombatEvent<const V: i32> {
5915 pub duration: i32,
5917}
5918#[cfg(feature = "v26_1")]
5919impl<const V: i32> Decode for EndCombatEvent<V> {
5920 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
5921 Ok({
5922 let v1 = r.read_varint()?;
5923 Self { duration: v1 }
5924 })
5925 }
5926}
5927#[cfg(feature = "v26_1")]
5928impl<const V: i32> Encode for EndCombatEvent<V> {
5929 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
5930 w.put_varint((*self).duration);
5931 Ok(())
5932 }
5933}
5934#[cfg(feature = "v26_1")]
5935#[cfg(feature = "testgen")]
5936impl<const V: i32> Generate for EndCombatEvent<V> {
5937 fn generate(g: &mut Gen) -> Self {
5938 {
5939 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
5940 Self { duration: v1 }
5941 }
5942 }
5943}
5944
5945#[cfg(feature = "v26_1")]
5946#[derive(Debug, Clone, PartialEq)]
5948pub struct EnterCombatEvent<const V: i32> {}
5949#[cfg(feature = "v26_1")]
5950impl<const V: i32> Decode for EnterCombatEvent<V> {
5951 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
5952 Ok({ Self {} })
5953 }
5954}
5955#[cfg(feature = "v26_1")]
5956impl<const V: i32> Encode for EnterCombatEvent<V> {
5957 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
5958 Ok(())
5959 }
5960}
5961#[cfg(feature = "v26_1")]
5962#[cfg(feature = "testgen")]
5963impl<const V: i32> Generate for EnterCombatEvent<V> {
5964 fn generate(g: &mut Gen) -> Self {
5965 { Self {} }
5966 }
5967}
5968
5969#[cfg(feature = "v26_1")]
5970#[derive(Debug, Clone, PartialEq)]
5972pub struct DeathCombatEvent<const V: i32> {
5973 pub player_id: i32,
5975 pub message: AnonNbt,
5977}
5978#[cfg(feature = "v26_1")]
5979impl<const V: i32> Decode for DeathCombatEvent<V> {
5980 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
5981 Ok({
5982 let v1 = r.read_varint()?;
5983 let v2 = AnonNbt::read(r)?;
5984 Self {
5985 player_id: v1,
5986 message: v2,
5987 }
5988 })
5989 }
5990}
5991#[cfg(feature = "v26_1")]
5992impl<const V: i32> Encode for DeathCombatEvent<V> {
5993 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
5994 w.put_varint((*self).player_id);
5995 (*self).message.write(w);
5996 Ok(())
5997 }
5998}
5999#[cfg(feature = "v26_1")]
6000#[cfg(feature = "testgen")]
6001impl<const V: i32> Generate for DeathCombatEvent<V> {
6002 fn generate(g: &mut Gen) -> Self {
6003 {
6004 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
6005 let v2 = g.anon_nbt();
6006 Self {
6007 player_id: v1,
6008 message: v2,
6009 }
6010 }
6011 }
6012}
6013
6014#[cfg(feature = "v26_1")]
6015#[derive(Debug, Clone, PartialEq)]
6017pub struct PlayerRemove<const V: i32> {
6018 pub players: Vec<Uuid>,
6020}
6021#[cfg(feature = "v26_1")]
6022impl<const V: i32> Decode for PlayerRemove<V> {
6023 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
6024 Ok({
6025 let v1 = {
6026 let v2 = {
6027 let c = r.read_varint()?;
6028 r.check_count(i64::from(c), 16)?
6029 };
6030 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
6031 for _ in 0..v2 {
6032 v3.push(r.read_uuid()?);
6033 }
6034 v3
6035 };
6036 Self { players: v1 }
6037 })
6038 }
6039}
6040#[cfg(feature = "v26_1")]
6041impl<const V: i32> Encode for PlayerRemove<V> {
6042 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
6043 w.put_len_varint((*self).players.len())?;
6044 for v1 in (*self).players.iter() {
6045 w.put_uuid(&(*v1));
6046 }
6047 Ok(())
6048 }
6049}
6050#[cfg(feature = "v26_1")]
6051#[cfg(feature = "testgen")]
6052impl<const V: i32> Generate for PlayerRemove<V> {
6053 fn generate(g: &mut Gen) -> Self {
6054 {
6055 let v1 = {
6056 let v2 = g.count();
6057 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
6058 for _ in 0..v2 {
6059 v3.push(g.uuid());
6060 }
6061 v3
6062 };
6063 Self { players: v1 }
6064 }
6065 }
6066}
6067
6068#[cfg(feature = "v26_1")]
6069#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
6071pub struct PlayerInfoAction(pub u8);
6072#[cfg(feature = "v26_1")]
6073impl PlayerInfoAction {
6074 pub const ADD_PLAYER: Self = Self(1 << 0);
6076 pub const INITIALIZE_CHAT: Self = Self(1 << 1);
6078 pub const UPDATE_GAME_MODE: Self = Self(1 << 2);
6080 pub const UPDATE_LISTED: Self = Self(1 << 3);
6082 pub const UPDATE_LATENCY: Self = Self(1 << 4);
6084 pub const UPDATE_DISPLAY_NAME: Self = Self(1 << 5);
6086 pub const UPDATE_LIST_ORDER: Self = Self(1 << 6);
6088 pub const UPDATE_HAT: Self = Self(1 << 7);
6090 #[inline]
6092 pub const fn contains(self, f: Self) -> bool {
6093 self.0 & f.0 == f.0
6094 }
6095 #[inline]
6097 #[must_use]
6098 pub const fn with(self, f: Self) -> Self {
6099 Self(self.0 | f.0)
6100 }
6101}
6102
6103#[cfg(feature = "v26_1")]
6104#[derive(Debug, Clone, PartialEq)]
6106pub struct PlayerInfoData {
6107 pub uuid: Uuid,
6109 pub player: Option<crate::defs::p775::types::GameProfileNameProp>,
6111 pub chat_session: Option<Option<crate::defs::p775::types::ChatSession>>,
6113 pub gamemode: Option<i32>,
6115 pub listed: Option<bool>,
6117 pub latency: Option<i32>,
6119 pub display_name: Option<Option<AnonNbt>>,
6121 pub list_priority: Option<i32>,
6123 pub show_hat: Option<bool>,
6125}
6126
6127#[cfg(feature = "v26_1")]
6128#[derive(Debug, Clone, PartialEq)]
6130pub struct PlayerInfo<const V: i32> {
6131 pub action: crate::defs::p775::play::clientbound::PlayerInfoAction,
6133 pub data: Vec<crate::defs::p775::play::clientbound::PlayerInfoData>,
6135}
6136#[cfg(feature = "v26_1")]
6137impl<const V: i32> Decode for PlayerInfo<V> {
6138 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
6139 Ok({
6140 let v1 = crate::defs::p775::play::clientbound::PlayerInfoAction(r.read_u8()?);
6141 let v2 = {
6142 let v3 = {
6143 let c = r.read_varint()?;
6144 r.check_count(i64::from(c), 16)?
6145 };
6146 let mut v4 = Vec::with_capacity(v3.min(crate::codec::PREALLOC_LIMIT));
6147 for _ in 0..v3 {
6148 v4.push({
6149 let v5 = r.read_uuid()?;
6150 let v6 = if ((v1.0 >> 0) & 1 != 0) {
6151 Some(
6152 <crate::defs::p775::types::GameProfileNameProp as Decode>::decode(
6153 r,
6154 )?,
6155 )
6156 } else {
6157 None
6158 };
6159 let v7 = if ((v1.0 >> 1) & 1 != 0) {
6160 Some(if r.read_bool()? {
6161 Some({
6162 let v8 = r.read_uuid()?;
6163 let v9 = {
6164 let v10 = r.read_i64()?;
6165 let v11 = r.read_byte_array()?;
6166 let v12 = r.read_byte_array()?;
6167 crate::defs::p775::types::ChatSessionPublicKey {
6168 expire_time: v10,
6169 key_bytes: v11,
6170 key_signature: v12,
6171 }
6172 };
6173 crate::defs::p775::types::ChatSession {
6174 uuid: v8,
6175 public_key: v9,
6176 }
6177 })
6178 } else {
6179 None
6180 })
6181 } else {
6182 None
6183 };
6184 let v13 = if ((v1.0 >> 2) & 1 != 0) {
6185 Some(r.read_varint()?)
6186 } else {
6187 None
6188 };
6189 let v14 = if ((v1.0 >> 3) & 1 != 0) {
6190 Some(r.read_bool()?)
6191 } else {
6192 None
6193 };
6194 let v15 = if ((v1.0 >> 4) & 1 != 0) {
6195 Some(r.read_varint()?)
6196 } else {
6197 None
6198 };
6199 let v16 = if ((v1.0 >> 5) & 1 != 0) {
6200 Some(if r.read_bool()? {
6201 Some(AnonNbt::read(r)?)
6202 } else {
6203 None
6204 })
6205 } else {
6206 None
6207 };
6208 let v17 = if ((v1.0 >> 6) & 1 != 0) {
6209 Some(r.read_varint()?)
6210 } else {
6211 None
6212 };
6213 let v18 = if ((v1.0 >> 7) & 1 != 0) {
6214 Some(r.read_bool()?)
6215 } else {
6216 None
6217 };
6218 crate::defs::p775::play::clientbound::PlayerInfoData {
6219 uuid: v5,
6220 player: v6,
6221 chat_session: v7,
6222 gamemode: v13,
6223 listed: v14,
6224 latency: v15,
6225 display_name: v16,
6226 list_priority: v17,
6227 show_hat: v18,
6228 }
6229 });
6230 }
6231 v4
6232 };
6233 Self {
6234 action: v1,
6235 data: v2,
6236 }
6237 })
6238 }
6239}
6240#[cfg(feature = "v26_1")]
6241impl<const V: i32> Encode for PlayerInfo<V> {
6242 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
6243 w.put_u8((*self).action.0);
6244 w.put_len_varint((*self).data.len())?;
6245 for v1 in (*self).data.iter() {
6246 w.put_uuid(&(*v1).uuid);
6247 match (&(*v1).player, (((*self).action.0 >> 0) & 1 != 0)) {
6248 (Some(v2), true) => {
6249 (*v2).encode(w)?;
6250 }
6251 (None, false) => {}
6252 _ => {
6253 return Err(EncodeError::SwitchMismatch(
6254 "play.clientbound.player_info.data.player",
6255 ));
6256 }
6257 }
6258 match (&(*v1).chat_session, (((*self).action.0 >> 1) & 1 != 0)) {
6259 (Some(v3), true) => match &(*v3) {
6260 Some(v4) => {
6261 w.put_u8(1);
6262 w.put_uuid(&(*v4).uuid);
6263 w.put_i64((*v4).public_key.expire_time);
6264 w.put_byte_array(&(*v4).public_key.key_bytes)?;
6265 w.put_byte_array(&(*v4).public_key.key_signature)?;
6266 }
6267 None => w.put_u8(0),
6268 },
6269 (None, false) => {}
6270 _ => {
6271 return Err(EncodeError::SwitchMismatch(
6272 "play.clientbound.player_info.data.chatSession",
6273 ));
6274 }
6275 }
6276 match (&(*v1).gamemode, (((*self).action.0 >> 2) & 1 != 0)) {
6277 (Some(v5), true) => {
6278 w.put_varint((*v5));
6279 }
6280 (None, false) => {}
6281 _ => {
6282 return Err(EncodeError::SwitchMismatch(
6283 "play.clientbound.player_info.data.gamemode",
6284 ));
6285 }
6286 }
6287 match (&(*v1).listed, (((*self).action.0 >> 3) & 1 != 0)) {
6288 (Some(v6), true) => {
6289 w.put_bool((*v6));
6290 }
6291 (None, false) => {}
6292 _ => {
6293 return Err(EncodeError::SwitchMismatch(
6294 "play.clientbound.player_info.data.listed",
6295 ));
6296 }
6297 }
6298 match (&(*v1).latency, (((*self).action.0 >> 4) & 1 != 0)) {
6299 (Some(v7), true) => {
6300 w.put_varint((*v7));
6301 }
6302 (None, false) => {}
6303 _ => {
6304 return Err(EncodeError::SwitchMismatch(
6305 "play.clientbound.player_info.data.latency",
6306 ));
6307 }
6308 }
6309 match (&(*v1).display_name, (((*self).action.0 >> 5) & 1 != 0)) {
6310 (Some(v8), true) => match &(*v8) {
6311 Some(v9) => {
6312 w.put_u8(1);
6313 (*v9).write(w);
6314 }
6315 None => w.put_u8(0),
6316 },
6317 (None, false) => {}
6318 _ => {
6319 return Err(EncodeError::SwitchMismatch(
6320 "play.clientbound.player_info.data.displayName",
6321 ));
6322 }
6323 }
6324 match (&(*v1).list_priority, (((*self).action.0 >> 6) & 1 != 0)) {
6325 (Some(v10), true) => {
6326 w.put_varint((*v10));
6327 }
6328 (None, false) => {}
6329 _ => {
6330 return Err(EncodeError::SwitchMismatch(
6331 "play.clientbound.player_info.data.listPriority",
6332 ));
6333 }
6334 }
6335 match (&(*v1).show_hat, (((*self).action.0 >> 7) & 1 != 0)) {
6336 (Some(v11), true) => {
6337 w.put_bool((*v11));
6338 }
6339 (None, false) => {}
6340 _ => {
6341 return Err(EncodeError::SwitchMismatch(
6342 "play.clientbound.player_info.data.showHat",
6343 ));
6344 }
6345 }
6346 }
6347 Ok(())
6348 }
6349}
6350#[cfg(feature = "v26_1")]
6351#[cfg(feature = "testgen")]
6352impl<const V: i32> Generate for PlayerInfo<V> {
6353 fn generate(g: &mut Gen) -> Self {
6354 {
6355 let v1 =
6356 crate::defs::p775::play::clientbound::PlayerInfoAction(g.int_in(0, 255, &[]) as u8);
6357 let v2 = {
6358 let v3 = g.count();
6359 let mut v4 = Vec::with_capacity(v3.min(crate::codec::PREALLOC_LIMIT));
6360 for _ in 0..v3 {
6361 v4.push({ let v5 = g.uuid();let v6 = if ((v1.0 >> 0) & 1 != 0) { Some(<crate::defs::p775::types::GameProfileNameProp as Generate>::generate(g)) } else { None };let v7 = if ((v1.0 >> 1) & 1 != 0) { Some(if g.bool() { Some({ let v8 = g.uuid();let v9 = { let v10 = g.i64();let v11 = g.bytes();let v12 = g.bytes(); crate::defs::p775::types::ChatSessionPublicKey { expire_time: v10, key_bytes: v11, key_signature: v12 } }; crate::defs::p775::types::ChatSession { uuid: v8, public_key: v9 } }) } else { None }) } else { None };let v13 = if ((v1.0 >> 2) & 1 != 0) { Some((g.int_in(-2147483648, 2147483647, &[]) as i32)) } else { None };let v14 = if ((v1.0 >> 3) & 1 != 0) { Some(g.bool()) } else { None };let v15 = if ((v1.0 >> 4) & 1 != 0) { Some((g.int_in(-2147483648, 2147483647, &[]) as i32)) } else { None };let v16 = if ((v1.0 >> 5) & 1 != 0) { Some(if g.bool() { Some(g.anon_nbt()) } else { None }) } else { None };let v17 = if ((v1.0 >> 6) & 1 != 0) { Some((g.int_in(-2147483648, 2147483647, &[]) as i32)) } else { None };let v18 = if ((v1.0 >> 7) & 1 != 0) { Some(g.bool()) } else { None }; crate::defs::p775::play::clientbound::PlayerInfoData { uuid: v5, player: v6, chat_session: v7, gamemode: v13, listed: v14, latency: v15, display_name: v16, list_priority: v17, show_hat: v18 } });
6362 }
6363 v4
6364 };
6365 Self {
6366 action: v1,
6367 data: v2,
6368 }
6369 }
6370 }
6371}
6372
6373#[cfg(feature = "v26_1")]
6374#[derive(Debug, Clone, PartialEq)]
6376pub struct FacePlayer<const V: i32> {
6377 pub feet_eyes: i32,
6379 pub x: f64,
6381 pub y: f64,
6383 pub z: f64,
6385 pub is_entity: bool,
6387 pub entity_id: Option<i32>,
6389 pub entity_feet_eyes: Option<i32>,
6391}
6392#[cfg(feature = "v26_1")]
6393impl<const V: i32> Decode for FacePlayer<V> {
6394 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
6395 Ok({
6396 let v1 = r.read_varint()?;
6397 let v2 = r.read_f64()?;
6398 let v3 = r.read_f64()?;
6399 let v4 = r.read_f64()?;
6400 let v5 = r.read_bool()?;
6401 let v6 = if v5 { Some(r.read_varint()?) } else { None };
6402 let v7 = if v5 { Some(r.read_varint()?) } else { None };
6403 Self {
6404 feet_eyes: v1,
6405 x: v2,
6406 y: v3,
6407 z: v4,
6408 is_entity: v5,
6409 entity_id: v6,
6410 entity_feet_eyes: v7,
6411 }
6412 })
6413 }
6414}
6415#[cfg(feature = "v26_1")]
6416impl<const V: i32> Encode for FacePlayer<V> {
6417 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
6418 w.put_varint((*self).feet_eyes);
6419 w.put_f64((*self).x);
6420 w.put_f64((*self).y);
6421 w.put_f64((*self).z);
6422 w.put_bool((*self).is_entity);
6423 match (&(*self).entity_id, (*self).is_entity) {
6424 (Some(v1), true) => {
6425 w.put_varint((*v1));
6426 }
6427 (None, false) => {}
6428 _ => {
6429 return Err(EncodeError::SwitchMismatch(
6430 "play.clientbound.face_player.entityId",
6431 ));
6432 }
6433 }
6434 match (&(*self).entity_feet_eyes, (*self).is_entity) {
6435 (Some(v2), true) => {
6436 w.put_varint((*v2));
6437 }
6438 (None, false) => {}
6439 _ => {
6440 return Err(EncodeError::SwitchMismatch(
6441 "play.clientbound.face_player.entity_feet_eyes",
6442 ));
6443 }
6444 }
6445 Ok(())
6446 }
6447}
6448#[cfg(feature = "v26_1")]
6449#[cfg(feature = "testgen")]
6450impl<const V: i32> Generate for FacePlayer<V> {
6451 fn generate(g: &mut Gen) -> Self {
6452 {
6453 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
6454 let v2 = g.f64();
6455 let v3 = g.f64();
6456 let v4 = g.f64();
6457 let v5 = g.bool();
6458 let v6 = if v5 {
6459 Some((g.int_in(-2147483648, 2147483647, &[]) as i32))
6460 } else {
6461 None
6462 };
6463 let v7 = if v5 {
6464 Some((g.int_in(-2147483648, 2147483647, &[]) as i32))
6465 } else {
6466 None
6467 };
6468 Self {
6469 feet_eyes: v1,
6470 x: v2,
6471 y: v3,
6472 z: v4,
6473 is_entity: v5,
6474 entity_id: v6,
6475 entity_feet_eyes: v7,
6476 }
6477 }
6478 }
6479}
6480
6481#[cfg(feature = "v26_1")]
6482#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
6484pub struct PositionUpdateRelatives(pub u32);
6485#[cfg(feature = "v26_1")]
6486impl PositionUpdateRelatives {
6487 pub const X: Self = Self(1 << 0);
6489 pub const Y: Self = Self(1 << 1);
6491 pub const Z: Self = Self(1 << 2);
6493 pub const YAW: Self = Self(1 << 3);
6495 pub const PITCH: Self = Self(1 << 4);
6497 pub const DX: Self = Self(1 << 5);
6499 pub const DY: Self = Self(1 << 6);
6501 pub const DZ: Self = Self(1 << 7);
6503 pub const YAW_DELTA: Self = Self(1 << 8);
6505 #[inline]
6507 pub const fn contains(self, f: Self) -> bool {
6508 self.0 & f.0 == f.0
6509 }
6510 #[inline]
6512 #[must_use]
6513 pub const fn with(self, f: Self) -> Self {
6514 Self(self.0 | f.0)
6515 }
6516}
6517
6518#[cfg(feature = "v26_1")]
6519#[derive(Debug, Clone, PartialEq)]
6521pub struct Position<const V: i32> {
6522 pub teleport_id: i32,
6524 pub x: f64,
6526 pub y: f64,
6528 pub z: f64,
6530 pub dx: f64,
6532 pub dy: f64,
6534 pub dz: f64,
6536 pub yaw: f32,
6538 pub pitch: f32,
6540 pub flags: crate::defs::p775::play::clientbound::PositionUpdateRelatives,
6542}
6543#[cfg(feature = "v26_1")]
6544impl<const V: i32> Decode for Position<V> {
6545 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
6546 Ok({
6547 let v1 = r.read_varint()?;
6548 let v2 = r.read_f64()?;
6549 let v3 = r.read_f64()?;
6550 let v4 = r.read_f64()?;
6551 let v5 = r.read_f64()?;
6552 let v6 = r.read_f64()?;
6553 let v7 = r.read_f64()?;
6554 let v8 = r.read_f32()?;
6555 let v9 = r.read_f32()?;
6556 let v10 = crate::defs::p775::play::clientbound::PositionUpdateRelatives(r.read_u32()?);
6557 Self {
6558 teleport_id: v1,
6559 x: v2,
6560 y: v3,
6561 z: v4,
6562 dx: v5,
6563 dy: v6,
6564 dz: v7,
6565 yaw: v8,
6566 pitch: v9,
6567 flags: v10,
6568 }
6569 })
6570 }
6571}
6572#[cfg(feature = "v26_1")]
6573impl<const V: i32> Encode for Position<V> {
6574 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
6575 w.put_varint((*self).teleport_id);
6576 w.put_f64((*self).x);
6577 w.put_f64((*self).y);
6578 w.put_f64((*self).z);
6579 w.put_f64((*self).dx);
6580 w.put_f64((*self).dy);
6581 w.put_f64((*self).dz);
6582 w.put_f32((*self).yaw);
6583 w.put_f32((*self).pitch);
6584 w.put_u32((*self).flags.0);
6585 Ok(())
6586 }
6587}
6588#[cfg(feature = "v26_1")]
6589#[cfg(feature = "testgen")]
6590impl<const V: i32> Generate for Position<V> {
6591 fn generate(g: &mut Gen) -> Self {
6592 {
6593 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
6594 let v2 = g.f64();
6595 let v3 = g.f64();
6596 let v4 = g.f64();
6597 let v5 = g.f64();
6598 let v6 = g.f64();
6599 let v7 = g.f64();
6600 let v8 = g.f32();
6601 let v9 = g.f32();
6602 let v10 = crate::defs::p775::play::clientbound::PositionUpdateRelatives(g.int_in(
6603 0,
6604 4294967295,
6605 &[],
6606 )
6607 as u32);
6608 Self {
6609 teleport_id: v1,
6610 x: v2,
6611 y: v3,
6612 z: v4,
6613 dx: v5,
6614 dy: v6,
6615 dz: v7,
6616 yaw: v8,
6617 pitch: v9,
6618 flags: v10,
6619 }
6620 }
6621 }
6622}
6623
6624#[cfg(feature = "v26_1")]
6625#[derive(Debug, Clone, PartialEq)]
6627pub struct PlayerRotation<const V: i32> {
6628 pub yaw: f32,
6630 pub relative_yaw: bool,
6632 pub pitch: f32,
6634 pub relative_pitch: bool,
6636}
6637#[cfg(feature = "v26_1")]
6638impl<const V: i32> Decode for PlayerRotation<V> {
6639 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
6640 Ok({
6641 let v1 = r.read_f32()?;
6642 let v2 = r.read_bool()?;
6643 let v3 = r.read_f32()?;
6644 let v4 = r.read_bool()?;
6645 Self {
6646 yaw: v1,
6647 relative_yaw: v2,
6648 pitch: v3,
6649 relative_pitch: v4,
6650 }
6651 })
6652 }
6653}
6654#[cfg(feature = "v26_1")]
6655impl<const V: i32> Encode for PlayerRotation<V> {
6656 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
6657 w.put_f32((*self).yaw);
6658 w.put_bool((*self).relative_yaw);
6659 w.put_f32((*self).pitch);
6660 w.put_bool((*self).relative_pitch);
6661 Ok(())
6662 }
6663}
6664#[cfg(feature = "v26_1")]
6665#[cfg(feature = "testgen")]
6666impl<const V: i32> Generate for PlayerRotation<V> {
6667 fn generate(g: &mut Gen) -> Self {
6668 {
6669 let v1 = g.f32();
6670 let v2 = g.bool();
6671 let v3 = g.f32();
6672 let v4 = g.bool();
6673 Self {
6674 yaw: v1,
6675 relative_yaw: v2,
6676 pitch: v3,
6677 relative_pitch: v4,
6678 }
6679 }
6680 }
6681}
6682
6683#[cfg(feature = "v26_1")]
6684#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
6686pub struct RecipeBookAddEntriesRecipeCategory(pub i32);
6687#[cfg(feature = "v26_1")]
6688impl RecipeBookAddEntriesRecipeCategory {
6689 pub const CRAFTING_BUILDING_BLOCKS: Self = Self(0);
6691 pub const CRAFTING_REDSTONE: Self = Self(1);
6693 pub const CRAFTING_EQUIPMENT: Self = Self(2);
6695 pub const CRAFTING_MISC: Self = Self(3);
6697 pub const FURNACE_FOOD: Self = Self(4);
6699 pub const FURNACE_BLOCKS: Self = Self(5);
6701 pub const FURNACE_MISC: Self = Self(6);
6703 pub const BLAST_FURNACE_BLOCKS: Self = Self(7);
6705 pub const BLAST_FURNACE_MISC: Self = Self(8);
6707 pub const SMOKER_FOOD: Self = Self(9);
6709 pub const STONECUTTER: Self = Self(10);
6711 pub const SMITHING: Self = Self(11);
6713 pub const CAMPFIRE: Self = Self(12);
6715 pub const fn name(self) -> Option<&'static str> {
6717 match self.0 {
6718 0 => Some("crafting_building_blocks"),
6719 1 => Some("crafting_redstone"),
6720 2 => Some("crafting_equipment"),
6721 3 => Some("crafting_misc"),
6722 4 => Some("furnace_food"),
6723 5 => Some("furnace_blocks"),
6724 6 => Some("furnace_misc"),
6725 7 => Some("blast_furnace_blocks"),
6726 8 => Some("blast_furnace_misc"),
6727 9 => Some("smoker_food"),
6728 10 => Some("stonecutter"),
6729 11 => Some("smithing"),
6730 12 => Some("campfire"),
6731 _ => None,
6732 }
6733 }
6734}
6735#[cfg(feature = "v26_1")]
6736impl std::fmt::Debug for RecipeBookAddEntriesRecipeCategory {
6737 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6738 match self.name() {
6739 Some(n) => write!(f, "RecipeBookAddEntriesRecipeCategory::{n}"),
6740 None => write!(f, "RecipeBookAddEntriesRecipeCategory({})", self.0),
6741 }
6742 }
6743}
6744
6745#[cfg(feature = "v26_1")]
6746#[derive(Debug, Clone, PartialEq)]
6748pub struct RecipeBookAddEntriesRecipe {
6749 pub display_id: i32,
6751 pub display: crate::defs::p775::play::clientbound::RecipeDisplay,
6753 pub group: i32,
6755 pub category: crate::defs::p775::play::clientbound::RecipeBookAddEntriesRecipeCategory,
6757 pub crafting_requirements: Option<Vec<HolderSet>>,
6759}
6760
6761#[cfg(feature = "v26_1")]
6762#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
6764pub struct RecipeBookAddEntriesFlags(pub u8);
6765#[cfg(feature = "v26_1")]
6766impl RecipeBookAddEntriesFlags {
6767 pub const NOTIFICATION: Self = Self(1 << 0);
6769 pub const HIGHLIGHT: Self = Self(1 << 1);
6771 #[inline]
6773 pub const fn contains(self, f: Self) -> bool {
6774 self.0 & f.0 == f.0
6775 }
6776 #[inline]
6778 #[must_use]
6779 pub const fn with(self, f: Self) -> Self {
6780 Self(self.0 | f.0)
6781 }
6782}
6783
6784#[cfg(feature = "v26_1")]
6785#[derive(Debug, Clone, PartialEq)]
6787pub struct RecipeBookAddEntries {
6788 pub recipe: crate::defs::p775::play::clientbound::RecipeBookAddEntriesRecipe,
6790 pub flags: crate::defs::p775::play::clientbound::RecipeBookAddEntriesFlags,
6792}
6793
6794#[cfg(feature = "v26_1")]
6795#[derive(Debug, Clone, PartialEq)]
6797pub struct RecipeBookAdd<const V: i32> {
6798 pub entries: Vec<crate::defs::p775::play::clientbound::RecipeBookAddEntries>,
6800 pub replace: bool,
6802}
6803#[cfg(feature = "v26_1")]
6804impl<const V: i32> Decode for RecipeBookAdd<V> {
6805 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
6806 Ok({
6807 let v1 = {
6808 let v2 = {
6809 let c = r.read_varint()?;
6810 r.check_count(i64::from(c), 6)?
6811 };
6812 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
6813 for _ in 0..v2 {
6814 v3.push({ let v4 = { let v5 = r.read_varint()?;let v6 = <crate::defs::p775::play::clientbound::RecipeDisplay as Decode>::decode(r)?;let v7 = r.read_varint()?;let v8 = crate::defs::p775::play::clientbound::RecipeBookAddEntriesRecipeCategory(r.read_varint()?);let v9 = if r.read_bool()? { Some({ let v10 = { let c = r.read_varint()?; r.check_count(i64::from(c), 1)? }; let mut v11 = Vec::with_capacity(v10.min(crate::codec::PREALLOC_LIMIT)); for _ in 0..v10 { v11.push(<HolderSet as Decode>::decode(r)?); } v11 }) } else { None }; crate::defs::p775::play::clientbound::RecipeBookAddEntriesRecipe { display_id: v5, display: v6, group: v7, category: v8, crafting_requirements: v9 } };let v12 = crate::defs::p775::play::clientbound::RecipeBookAddEntriesFlags(r.read_u8()?); crate::defs::p775::play::clientbound::RecipeBookAddEntries { recipe: v4, flags: v12 } });
6815 }
6816 v3
6817 };
6818 let v13 = r.read_bool()?;
6819 Self {
6820 entries: v1,
6821 replace: v13,
6822 }
6823 })
6824 }
6825}
6826#[cfg(feature = "v26_1")]
6827impl<const V: i32> Encode for RecipeBookAdd<V> {
6828 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
6829 w.put_len_varint((*self).entries.len())?;
6830 for v1 in (*self).entries.iter() {
6831 w.put_varint((*v1).recipe.display_id);
6832 (*v1).recipe.display.encode(w)?;
6833 w.put_varint((*v1).recipe.group);
6834 w.put_varint((*v1).recipe.category.0);
6835 match &(*v1).recipe.crafting_requirements {
6836 Some(v2) => {
6837 w.put_u8(1);
6838 w.put_len_varint((*v2).len())?;
6839 for v3 in (*v2).iter() {
6840 (*v3).encode(w)?;
6841 }
6842 }
6843 None => w.put_u8(0),
6844 }
6845 w.put_u8((*v1).flags.0);
6846 }
6847 w.put_bool((*self).replace);
6848 Ok(())
6849 }
6850}
6851#[cfg(feature = "v26_1")]
6852#[cfg(feature = "testgen")]
6853impl<const V: i32> Generate for RecipeBookAdd<V> {
6854 fn generate(g: &mut Gen) -> Self {
6855 {
6856 let v1 = {
6857 let v2 = g.count();
6858 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
6859 for _ in 0..v2 {
6860 v3.push({ let v4 = { let v5 = (g.int_in(-2147483648, 2147483647, &[]) as i32);let v6 = <crate::defs::p775::play::clientbound::RecipeDisplay as Generate>::generate(g);let v7 = (g.int_in(-2147483648, 2147483647, &[]) as i32);let v8 = crate::defs::p775::play::clientbound::RecipeBookAddEntriesRecipeCategory(g.int_in(-2147483648, 2147483647, &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) as i32);let v9 = if g.bool() { Some({ let v10 = g.count(); let mut v11 = Vec::with_capacity(v10.min(crate::codec::PREALLOC_LIMIT)); for _ in 0..v10 { v11.push(<HolderSet as Generate>::generate(g)); } v11 }) } else { None }; crate::defs::p775::play::clientbound::RecipeBookAddEntriesRecipe { display_id: v5, display: v6, group: v7, category: v8, crafting_requirements: v9 } };let v12 = crate::defs::p775::play::clientbound::RecipeBookAddEntriesFlags(g.int_in(0, 255, &[]) as u8); crate::defs::p775::play::clientbound::RecipeBookAddEntries { recipe: v4, flags: v12 } });
6861 }
6862 v3
6863 };
6864 let v13 = g.bool();
6865 Self {
6866 entries: v1,
6867 replace: v13,
6868 }
6869 }
6870 }
6871}
6872
6873#[cfg(feature = "v26_1")]
6874#[derive(Debug, Clone, PartialEq)]
6876pub struct RecipeBookRemove<const V: i32> {
6877 pub recipe_ids: Vec<i32>,
6879}
6880#[cfg(feature = "v26_1")]
6881impl<const V: i32> Decode for RecipeBookRemove<V> {
6882 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
6883 Ok({
6884 let v1 = {
6885 let v2 = {
6886 let c = r.read_varint()?;
6887 r.check_count(i64::from(c), 1)?
6888 };
6889 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
6890 for _ in 0..v2 {
6891 v3.push(r.read_varint()?);
6892 }
6893 v3
6894 };
6895 Self { recipe_ids: v1 }
6896 })
6897 }
6898}
6899#[cfg(feature = "v26_1")]
6900impl<const V: i32> Encode for RecipeBookRemove<V> {
6901 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
6902 w.put_len_varint((*self).recipe_ids.len())?;
6903 for v1 in (*self).recipe_ids.iter() {
6904 w.put_varint((*v1));
6905 }
6906 Ok(())
6907 }
6908}
6909#[cfg(feature = "v26_1")]
6910#[cfg(feature = "testgen")]
6911impl<const V: i32> Generate for RecipeBookRemove<V> {
6912 fn generate(g: &mut Gen) -> Self {
6913 {
6914 let v1 = {
6915 let v2 = g.count();
6916 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
6917 for _ in 0..v2 {
6918 v3.push((g.int_in(-2147483648, 2147483647, &[]) as i32));
6919 }
6920 v3
6921 };
6922 Self { recipe_ids: v1 }
6923 }
6924 }
6925}
6926
6927#[cfg(feature = "v26_1")]
6928#[derive(Debug, Clone, PartialEq)]
6930pub struct RecipeBookSettings<const V: i32> {
6931 pub crafting: crate::defs::p775::play::clientbound::RecipeBookSetting,
6933 pub furnace: crate::defs::p775::play::clientbound::RecipeBookSetting,
6935 pub blast: crate::defs::p775::play::clientbound::RecipeBookSetting,
6937 pub smoker: crate::defs::p775::play::clientbound::RecipeBookSetting,
6939}
6940#[cfg(feature = "v26_1")]
6941impl<const V: i32> Decode for RecipeBookSettings<V> {
6942 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
6943 Ok({
6944 let v1 =
6945 <crate::defs::p775::play::clientbound::RecipeBookSetting as Decode>::decode(r)?;
6946 let v2 =
6947 <crate::defs::p775::play::clientbound::RecipeBookSetting as Decode>::decode(r)?;
6948 let v3 =
6949 <crate::defs::p775::play::clientbound::RecipeBookSetting as Decode>::decode(r)?;
6950 let v4 =
6951 <crate::defs::p775::play::clientbound::RecipeBookSetting as Decode>::decode(r)?;
6952 Self {
6953 crafting: v1,
6954 furnace: v2,
6955 blast: v3,
6956 smoker: v4,
6957 }
6958 })
6959 }
6960}
6961#[cfg(feature = "v26_1")]
6962impl<const V: i32> Encode for RecipeBookSettings<V> {
6963 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
6964 (*self).crafting.encode(w)?;
6965 (*self).furnace.encode(w)?;
6966 (*self).blast.encode(w)?;
6967 (*self).smoker.encode(w)?;
6968 Ok(())
6969 }
6970}
6971#[cfg(feature = "v26_1")]
6972#[cfg(feature = "testgen")]
6973impl<const V: i32> Generate for RecipeBookSettings<V> {
6974 fn generate(g: &mut Gen) -> Self {
6975 {
6976 let v1 =
6977 <crate::defs::p775::play::clientbound::RecipeBookSetting as Generate>::generate(g);
6978 let v2 =
6979 <crate::defs::p775::play::clientbound::RecipeBookSetting as Generate>::generate(g);
6980 let v3 =
6981 <crate::defs::p775::play::clientbound::RecipeBookSetting as Generate>::generate(g);
6982 let v4 =
6983 <crate::defs::p775::play::clientbound::RecipeBookSetting as Generate>::generate(g);
6984 Self {
6985 crafting: v1,
6986 furnace: v2,
6987 blast: v3,
6988 smoker: v4,
6989 }
6990 }
6991 }
6992}
6993
6994#[cfg(feature = "v26_1")]
6995#[derive(Debug, Clone, PartialEq)]
6997pub struct RemoveEntityEffect<const V: i32> {
6998 pub entity_id: i32,
7000 pub effect_id: i32,
7002}
7003#[cfg(feature = "v26_1")]
7004impl<const V: i32> Decode for RemoveEntityEffect<V> {
7005 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
7006 Ok({
7007 let v1 = r.read_varint()?;
7008 let v2 = r.read_varint()?;
7009 Self {
7010 entity_id: v1,
7011 effect_id: v2,
7012 }
7013 })
7014 }
7015}
7016#[cfg(feature = "v26_1")]
7017impl<const V: i32> Encode for RemoveEntityEffect<V> {
7018 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
7019 w.put_varint((*self).entity_id);
7020 w.put_varint((*self).effect_id);
7021 Ok(())
7022 }
7023}
7024#[cfg(feature = "v26_1")]
7025#[cfg(feature = "testgen")]
7026impl<const V: i32> Generate for RemoveEntityEffect<V> {
7027 fn generate(g: &mut Gen) -> Self {
7028 {
7029 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
7030 let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
7031 Self {
7032 entity_id: v1,
7033 effect_id: v2,
7034 }
7035 }
7036 }
7037}
7038
7039#[cfg(feature = "v26_1")]
7040#[derive(Debug, Clone, PartialEq)]
7042pub struct ResetScore<const V: i32> {
7043 pub entity_name: ByteString,
7045 pub objective_name: Option<ByteString>,
7047}
7048#[cfg(feature = "v26_1")]
7049impl<const V: i32> Decode for ResetScore<V> {
7050 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
7051 Ok({
7052 let v1 = r.read_string()?;
7053 let v2 = if r.read_bool()? {
7054 Some(r.read_string()?)
7055 } else {
7056 None
7057 };
7058 Self {
7059 entity_name: v1,
7060 objective_name: v2,
7061 }
7062 })
7063 }
7064}
7065#[cfg(feature = "v26_1")]
7066impl<const V: i32> Encode for ResetScore<V> {
7067 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
7068 w.put_string(&(*self).entity_name)?;
7069 match &(*self).objective_name {
7070 Some(v1) => {
7071 w.put_u8(1);
7072 w.put_string(&(*v1))?;
7073 }
7074 None => w.put_u8(0),
7075 }
7076 Ok(())
7077 }
7078}
7079#[cfg(feature = "v26_1")]
7080#[cfg(feature = "testgen")]
7081impl<const V: i32> Generate for ResetScore<V> {
7082 fn generate(g: &mut Gen) -> Self {
7083 {
7084 let v1 = g.string();
7085 let v2 = if g.bool() { Some(g.string()) } else { None };
7086 Self {
7087 entity_name: v1,
7088 objective_name: v2,
7089 }
7090 }
7091 }
7092}
7093
7094#[cfg(feature = "v26_1")]
7095#[derive(Debug, Clone, PartialEq)]
7097pub struct RemoveResourcePack<const V: i32> {
7098 pub uuid: Option<Uuid>,
7100}
7101#[cfg(feature = "v26_1")]
7102impl<const V: i32> Decode for RemoveResourcePack<V> {
7103 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
7104 Ok({
7105 let v1 = if r.read_bool()? {
7106 Some(r.read_uuid()?)
7107 } else {
7108 None
7109 };
7110 Self { uuid: v1 }
7111 })
7112 }
7113}
7114#[cfg(feature = "v26_1")]
7115impl<const V: i32> Encode for RemoveResourcePack<V> {
7116 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
7117 match &(*self).uuid {
7118 Some(v1) => {
7119 w.put_u8(1);
7120 w.put_uuid(&(*v1));
7121 }
7122 None => w.put_u8(0),
7123 }
7124 Ok(())
7125 }
7126}
7127#[cfg(feature = "v26_1")]
7128#[cfg(feature = "testgen")]
7129impl<const V: i32> Generate for RemoveResourcePack<V> {
7130 fn generate(g: &mut Gen) -> Self {
7131 {
7132 let v1 = if g.bool() { Some(g.uuid()) } else { None };
7133 Self { uuid: v1 }
7134 }
7135 }
7136}
7137
7138#[cfg(feature = "v26_1")]
7139#[derive(Debug, Clone, PartialEq)]
7141pub struct AddResourcePack<const V: i32> {
7142 pub uuid: Uuid,
7144 pub url: ByteString,
7146 pub hash: ByteString,
7148 pub forced: bool,
7150 pub prompt_message: Option<AnonNbt>,
7152}
7153#[cfg(feature = "v26_1")]
7154impl<const V: i32> Decode for AddResourcePack<V> {
7155 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
7156 Ok({
7157 let v1 = r.read_uuid()?;
7158 let v2 = r.read_string()?;
7159 let v3 = r.read_string()?;
7160 let v4 = r.read_bool()?;
7161 let v5 = if r.read_bool()? {
7162 Some(AnonNbt::read(r)?)
7163 } else {
7164 None
7165 };
7166 Self {
7167 uuid: v1,
7168 url: v2,
7169 hash: v3,
7170 forced: v4,
7171 prompt_message: v5,
7172 }
7173 })
7174 }
7175}
7176#[cfg(feature = "v26_1")]
7177impl<const V: i32> Encode for AddResourcePack<V> {
7178 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
7179 w.put_uuid(&(*self).uuid);
7180 w.put_string(&(*self).url)?;
7181 w.put_string(&(*self).hash)?;
7182 w.put_bool((*self).forced);
7183 match &(*self).prompt_message {
7184 Some(v1) => {
7185 w.put_u8(1);
7186 (*v1).write(w);
7187 }
7188 None => w.put_u8(0),
7189 }
7190 Ok(())
7191 }
7192}
7193#[cfg(feature = "v26_1")]
7194#[cfg(feature = "testgen")]
7195impl<const V: i32> Generate for AddResourcePack<V> {
7196 fn generate(g: &mut Gen) -> Self {
7197 {
7198 let v1 = g.uuid();
7199 let v2 = g.string();
7200 let v3 = g.string();
7201 let v4 = g.bool();
7202 let v5 = if g.bool() { Some(g.anon_nbt()) } else { None };
7203 Self {
7204 uuid: v1,
7205 url: v2,
7206 hash: v3,
7207 forced: v4,
7208 prompt_message: v5,
7209 }
7210 }
7211 }
7212}
7213
7214#[cfg(feature = "v26_1")]
7215#[derive(Debug, Clone, PartialEq)]
7217pub struct Respawn<const V: i32> {
7218 pub world_state: crate::defs::p775::play::clientbound::SpawnInfo,
7220 pub copy_metadata: u8,
7222}
7223#[cfg(feature = "v26_1")]
7224impl<const V: i32> Decode for Respawn<V> {
7225 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
7226 Ok({
7227 let v1 = <crate::defs::p775::play::clientbound::SpawnInfo as Decode>::decode(r)?;
7228 let v2 = r.read_u8()?;
7229 Self {
7230 world_state: v1,
7231 copy_metadata: v2,
7232 }
7233 })
7234 }
7235}
7236#[cfg(feature = "v26_1")]
7237impl<const V: i32> Encode for Respawn<V> {
7238 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
7239 (*self).world_state.encode(w)?;
7240 w.put_u8((*self).copy_metadata);
7241 Ok(())
7242 }
7243}
7244#[cfg(feature = "v26_1")]
7245#[cfg(feature = "testgen")]
7246impl<const V: i32> Generate for Respawn<V> {
7247 fn generate(g: &mut Gen) -> Self {
7248 {
7249 let v1 = <crate::defs::p775::play::clientbound::SpawnInfo as Generate>::generate(g);
7250 let v2 = (g.int_in(0, 255, &[]) as u8);
7251 Self {
7252 world_state: v1,
7253 copy_metadata: v2,
7254 }
7255 }
7256 }
7257}
7258
7259#[cfg(feature = "v26_1")]
7260#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
7262pub struct MultiBlockChangeChunkCoordinates {
7263 pub x: i32,
7265 pub z: i32,
7267 pub y: i32,
7269}
7270
7271#[cfg(feature = "v26_1")]
7272#[derive(Debug, Clone, PartialEq)]
7274pub struct MultiBlockChange<const V: i32> {
7275 pub chunk_coordinates: crate::defs::p775::play::clientbound::MultiBlockChangeChunkCoordinates,
7277 pub records: Vec<i64>,
7279}
7280#[cfg(feature = "v26_1")]
7281impl<const V: i32> Decode for MultiBlockChange<V> {
7282 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
7283 Ok({
7284 let v1 = {
7285 let v2 = r.read_u64()?;
7286 crate::defs::p775::play::clientbound::MultiBlockChangeChunkCoordinates {
7287 x: ((((((v2 >> 42) & 0x3fffff) << 42) as i64) >> 42) as i32),
7288 z: ((((((v2 >> 20) & 0x3fffff) << 42) as i64) >> 42) as i32),
7289 y: ((((((v2 >> 0) & 0xfffff) << 44) as i64) >> 44) as i32),
7290 }
7291 };
7292 let v3 = {
7293 let v4 = {
7294 let c = r.read_varint()?;
7295 r.check_count(i64::from(c), 1)?
7296 };
7297 let mut v5 = Vec::with_capacity(v4.min(crate::codec::PREALLOC_LIMIT));
7298 for _ in 0..v4 {
7299 v5.push(r.read_varlong()?);
7300 }
7301 v5
7302 };
7303 Self {
7304 chunk_coordinates: v1,
7305 records: v3,
7306 }
7307 })
7308 }
7309}
7310#[cfg(feature = "v26_1")]
7311impl<const V: i32> Encode for MultiBlockChange<V> {
7312 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
7313 {
7314 let mut bits: u64 = 0;
7315 {
7316 let x = i128::from((*self).chunk_coordinates.x);
7317 if x < -2097152 || x > 2097151 {
7318 return Err(EncodeError::OutOfRange("x"));
7319 }
7320 bits = (bits << 22) | ((x as u64) & 0x3fffff);
7321 }
7322 {
7323 let x = i128::from((*self).chunk_coordinates.z);
7324 if x < -2097152 || x > 2097151 {
7325 return Err(EncodeError::OutOfRange("z"));
7326 }
7327 bits = (bits << 22) | ((x as u64) & 0x3fffff);
7328 }
7329 {
7330 let x = i128::from((*self).chunk_coordinates.y);
7331 if x < -524288 || x > 524287 {
7332 return Err(EncodeError::OutOfRange("y"));
7333 }
7334 bits = (bits << 20) | ((x as u64) & 0xfffff);
7335 }
7336 w.put_u64(bits);
7337 }
7338 w.put_len_varint((*self).records.len())?;
7339 for v1 in (*self).records.iter() {
7340 w.put_varlong((*v1));
7341 }
7342 Ok(())
7343 }
7344}
7345#[cfg(feature = "v26_1")]
7346#[cfg(feature = "testgen")]
7347impl<const V: i32> Generate for MultiBlockChange<V> {
7348 fn generate(g: &mut Gen) -> Self {
7349 {
7350 let v1 = {
7351 crate::defs::p775::play::clientbound::MultiBlockChangeChunkCoordinates {
7352 x: (g.int_in(-2097152, 2097151, &[]) as i32),
7353 z: (g.int_in(-2097152, 2097151, &[]) as i32),
7354 y: (g.int_in(-524288, 524287, &[]) as i32),
7355 }
7356 };
7357 let v3 = {
7358 let v4 = g.count();
7359 let mut v5 = Vec::with_capacity(v4.min(crate::codec::PREALLOC_LIMIT));
7360 for _ in 0..v4 {
7361 v5.push(g.varlong());
7362 }
7363 v5
7364 };
7365 Self {
7366 chunk_coordinates: v1,
7367 records: v3,
7368 }
7369 }
7370 }
7371}
7372
7373#[cfg(feature = "v26_1")]
7374#[derive(Debug, Clone, PartialEq)]
7376pub struct ServerData<const V: i32> {
7377 pub motd: AnonNbt,
7379 pub icon_bytes: Option<Bytes>,
7381}
7382#[cfg(feature = "v26_1")]
7383impl<const V: i32> Decode for ServerData<V> {
7384 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
7385 Ok({
7386 let v1 = AnonNbt::read(r)?;
7387 let v2 = if r.read_bool()? {
7388 Some(r.read_byte_array()?)
7389 } else {
7390 None
7391 };
7392 Self {
7393 motd: v1,
7394 icon_bytes: v2,
7395 }
7396 })
7397 }
7398}
7399#[cfg(feature = "v26_1")]
7400impl<const V: i32> Encode for ServerData<V> {
7401 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
7402 (*self).motd.write(w);
7403 match &(*self).icon_bytes {
7404 Some(v1) => {
7405 w.put_u8(1);
7406 w.put_byte_array(&(*v1))?;
7407 }
7408 None => w.put_u8(0),
7409 }
7410 Ok(())
7411 }
7412}
7413#[cfg(feature = "v26_1")]
7414#[cfg(feature = "testgen")]
7415impl<const V: i32> Generate for ServerData<V> {
7416 fn generate(g: &mut Gen) -> Self {
7417 {
7418 let v1 = g.anon_nbt();
7419 let v2 = if g.bool() { Some(g.bytes()) } else { None };
7420 Self {
7421 motd: v1,
7422 icon_bytes: v2,
7423 }
7424 }
7425 }
7426}
7427
7428#[cfg(feature = "v26_1")]
7429#[derive(Debug, Clone, PartialEq)]
7431pub struct ActionBar<const V: i32> {
7432 pub text: AnonNbt,
7434}
7435#[cfg(feature = "v26_1")]
7436impl<const V: i32> Decode for ActionBar<V> {
7437 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
7438 Ok({
7439 let v1 = AnonNbt::read(r)?;
7440 Self { text: v1 }
7441 })
7442 }
7443}
7444#[cfg(feature = "v26_1")]
7445impl<const V: i32> Encode for ActionBar<V> {
7446 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
7447 (*self).text.write(w);
7448 Ok(())
7449 }
7450}
7451#[cfg(feature = "v26_1")]
7452#[cfg(feature = "testgen")]
7453impl<const V: i32> Generate for ActionBar<V> {
7454 fn generate(g: &mut Gen) -> Self {
7455 {
7456 let v1 = g.anon_nbt();
7457 Self { text: v1 }
7458 }
7459 }
7460}
7461
7462#[cfg(feature = "v26_1")]
7463#[derive(Debug, Clone, PartialEq)]
7465pub struct WorldBorderCenter<const V: i32> {
7466 pub x: f64,
7468 pub z: f64,
7470}
7471#[cfg(feature = "v26_1")]
7472impl<const V: i32> Decode for WorldBorderCenter<V> {
7473 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
7474 Ok({
7475 let v1 = r.read_f64()?;
7476 let v2 = r.read_f64()?;
7477 Self { x: v1, z: v2 }
7478 })
7479 }
7480}
7481#[cfg(feature = "v26_1")]
7482impl<const V: i32> Encode for WorldBorderCenter<V> {
7483 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
7484 w.put_f64((*self).x);
7485 w.put_f64((*self).z);
7486 Ok(())
7487 }
7488}
7489#[cfg(feature = "v26_1")]
7490#[cfg(feature = "testgen")]
7491impl<const V: i32> Generate for WorldBorderCenter<V> {
7492 fn generate(g: &mut Gen) -> Self {
7493 {
7494 let v1 = g.f64();
7495 let v2 = g.f64();
7496 Self { x: v1, z: v2 }
7497 }
7498 }
7499}
7500
7501#[cfg(feature = "v26_1")]
7502#[derive(Debug, Clone, PartialEq)]
7504pub struct WorldBorderLerpSize<const V: i32> {
7505 pub old_diameter: f64,
7507 pub new_diameter: f64,
7509 pub speed: i64,
7511}
7512#[cfg(feature = "v26_1")]
7513impl<const V: i32> Decode for WorldBorderLerpSize<V> {
7514 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
7515 Ok({
7516 let v1 = r.read_f64()?;
7517 let v2 = r.read_f64()?;
7518 let v3 = r.read_varlong()?;
7519 Self {
7520 old_diameter: v1,
7521 new_diameter: v2,
7522 speed: v3,
7523 }
7524 })
7525 }
7526}
7527#[cfg(feature = "v26_1")]
7528impl<const V: i32> Encode for WorldBorderLerpSize<V> {
7529 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
7530 w.put_f64((*self).old_diameter);
7531 w.put_f64((*self).new_diameter);
7532 w.put_varlong((*self).speed);
7533 Ok(())
7534 }
7535}
7536#[cfg(feature = "v26_1")]
7537#[cfg(feature = "testgen")]
7538impl<const V: i32> Generate for WorldBorderLerpSize<V> {
7539 fn generate(g: &mut Gen) -> Self {
7540 {
7541 let v1 = g.f64();
7542 let v2 = g.f64();
7543 let v3 = g.varlong();
7544 Self {
7545 old_diameter: v1,
7546 new_diameter: v2,
7547 speed: v3,
7548 }
7549 }
7550 }
7551}
7552
7553#[cfg(feature = "v26_1")]
7554#[derive(Debug, Clone, PartialEq)]
7556pub struct WorldBorderSize<const V: i32> {
7557 pub diameter: f64,
7559}
7560#[cfg(feature = "v26_1")]
7561impl<const V: i32> Decode for WorldBorderSize<V> {
7562 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
7563 Ok({
7564 let v1 = r.read_f64()?;
7565 Self { diameter: v1 }
7566 })
7567 }
7568}
7569#[cfg(feature = "v26_1")]
7570impl<const V: i32> Encode for WorldBorderSize<V> {
7571 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
7572 w.put_f64((*self).diameter);
7573 Ok(())
7574 }
7575}
7576#[cfg(feature = "v26_1")]
7577#[cfg(feature = "testgen")]
7578impl<const V: i32> Generate for WorldBorderSize<V> {
7579 fn generate(g: &mut Gen) -> Self {
7580 {
7581 let v1 = g.f64();
7582 Self { diameter: v1 }
7583 }
7584 }
7585}
7586
7587#[cfg(feature = "v26_1")]
7588#[derive(Debug, Clone, PartialEq)]
7590pub struct WorldBorderWarningDelay<const V: i32> {
7591 pub warning_time: i32,
7593}
7594#[cfg(feature = "v26_1")]
7595impl<const V: i32> Decode for WorldBorderWarningDelay<V> {
7596 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
7597 Ok({
7598 let v1 = r.read_varint()?;
7599 Self { warning_time: v1 }
7600 })
7601 }
7602}
7603#[cfg(feature = "v26_1")]
7604impl<const V: i32> Encode for WorldBorderWarningDelay<V> {
7605 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
7606 w.put_varint((*self).warning_time);
7607 Ok(())
7608 }
7609}
7610#[cfg(feature = "v26_1")]
7611#[cfg(feature = "testgen")]
7612impl<const V: i32> Generate for WorldBorderWarningDelay<V> {
7613 fn generate(g: &mut Gen) -> Self {
7614 {
7615 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
7616 Self { warning_time: v1 }
7617 }
7618 }
7619}
7620
7621#[cfg(feature = "v26_1")]
7622#[derive(Debug, Clone, PartialEq)]
7624pub struct WorldBorderWarningReach<const V: i32> {
7625 pub warning_blocks: i32,
7627}
7628#[cfg(feature = "v26_1")]
7629impl<const V: i32> Decode for WorldBorderWarningReach<V> {
7630 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
7631 Ok({
7632 let v1 = r.read_varint()?;
7633 Self { warning_blocks: v1 }
7634 })
7635 }
7636}
7637#[cfg(feature = "v26_1")]
7638impl<const V: i32> Encode for WorldBorderWarningReach<V> {
7639 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
7640 w.put_varint((*self).warning_blocks);
7641 Ok(())
7642 }
7643}
7644#[cfg(feature = "v26_1")]
7645#[cfg(feature = "testgen")]
7646impl<const V: i32> Generate for WorldBorderWarningReach<V> {
7647 fn generate(g: &mut Gen) -> Self {
7648 {
7649 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
7650 Self { warning_blocks: v1 }
7651 }
7652 }
7653}
7654
7655#[cfg(feature = "v26_1")]
7656#[derive(Debug, Clone, PartialEq)]
7658pub struct SetCursorItem<const V: i32> {
7659 pub contents: crate::defs::p775::types::Slot,
7661}
7662#[cfg(feature = "v26_1")]
7663impl<const V: i32> Decode for SetCursorItem<V> {
7664 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
7665 Ok({
7666 let v1 = <crate::defs::p775::types::Slot as Decode>::decode(r)?;
7667 Self { contents: v1 }
7668 })
7669 }
7670}
7671#[cfg(feature = "v26_1")]
7672impl<const V: i32> Encode for SetCursorItem<V> {
7673 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
7674 (*self).contents.encode(w)?;
7675 Ok(())
7676 }
7677}
7678#[cfg(feature = "v26_1")]
7679#[cfg(feature = "testgen")]
7680impl<const V: i32> Generate for SetCursorItem<V> {
7681 fn generate(g: &mut Gen) -> Self {
7682 {
7683 let v1 = <crate::defs::p775::types::Slot as Generate>::generate(g);
7684 Self { contents: v1 }
7685 }
7686 }
7687}
7688
7689#[cfg(feature = "v26_1")]
7690#[derive(Debug, Clone, PartialEq)]
7692pub struct SpawnPosition<const V: i32> {
7693 pub global_pos: crate::defs::p775::types::GlobalPos,
7695 pub yaw: f32,
7697 pub pitch: f32,
7699}
7700#[cfg(feature = "v26_1")]
7701impl<const V: i32> Decode for SpawnPosition<V> {
7702 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
7703 Ok({
7704 let v1 = <crate::defs::p775::types::GlobalPos as Decode>::decode(r)?;
7705 let v2 = r.read_f32()?;
7706 let v3 = r.read_f32()?;
7707 Self {
7708 global_pos: v1,
7709 yaw: v2,
7710 pitch: v3,
7711 }
7712 })
7713 }
7714}
7715#[cfg(feature = "v26_1")]
7716impl<const V: i32> Encode for SpawnPosition<V> {
7717 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
7718 (*self).global_pos.encode(w)?;
7719 w.put_f32((*self).yaw);
7720 w.put_f32((*self).pitch);
7721 Ok(())
7722 }
7723}
7724#[cfg(feature = "v26_1")]
7725#[cfg(feature = "testgen")]
7726impl<const V: i32> Generate for SpawnPosition<V> {
7727 fn generate(g: &mut Gen) -> Self {
7728 {
7729 let v1 = <crate::defs::p775::types::GlobalPos as Generate>::generate(g);
7730 let v2 = g.f32();
7731 let v3 = g.f32();
7732 Self {
7733 global_pos: v1,
7734 yaw: v2,
7735 pitch: v3,
7736 }
7737 }
7738 }
7739}
7740
7741#[cfg(feature = "v26_1")]
7742#[derive(Debug, Clone, PartialEq)]
7744pub struct ScoreboardDisplayObjective<const V: i32> {
7745 pub position: i32,
7747 pub name: ByteString,
7749}
7750#[cfg(feature = "v26_1")]
7751impl<const V: i32> Decode for ScoreboardDisplayObjective<V> {
7752 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
7753 Ok({
7754 let v1 = r.read_varint()?;
7755 let v2 = r.read_string()?;
7756 Self {
7757 position: v1,
7758 name: v2,
7759 }
7760 })
7761 }
7762}
7763#[cfg(feature = "v26_1")]
7764impl<const V: i32> Encode for ScoreboardDisplayObjective<V> {
7765 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
7766 w.put_varint((*self).position);
7767 w.put_string(&(*self).name)?;
7768 Ok(())
7769 }
7770}
7771#[cfg(feature = "v26_1")]
7772#[cfg(feature = "testgen")]
7773impl<const V: i32> Generate for ScoreboardDisplayObjective<V> {
7774 fn generate(g: &mut Gen) -> Self {
7775 {
7776 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
7777 let v2 = g.string();
7778 Self {
7779 position: v1,
7780 name: v2,
7781 }
7782 }
7783 }
7784}
7785
7786#[cfg(feature = "v26_1")]
7787#[derive(Debug, Clone, PartialEq)]
7789pub struct EntityMetadata<const V: i32> {
7790 pub entity_id: i32,
7792 pub metadata: Vec<crate::defs::p775::types::EntityMetadataEntry>,
7794}
7795#[cfg(feature = "v26_1")]
7796impl<const V: i32> Decode for EntityMetadata<V> {
7797 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
7798 Ok({
7799 let v1 = r.read_varint()?;
7800 let v2 = {
7801 let mut v3 = Vec::new();
7802 loop {
7803 if r.peek_u8()? == 255 {
7804 r.skip(1)?;
7805 break;
7806 }
7807 v3.push(<crate::defs::p775::types::EntityMetadataEntry as Decode>::decode(r)?);
7808 }
7809 v3
7810 };
7811 Self {
7812 entity_id: v1,
7813 metadata: v2,
7814 }
7815 })
7816 }
7817}
7818#[cfg(feature = "v26_1")]
7819impl<const V: i32> Encode for EntityMetadata<V> {
7820 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
7821 w.put_varint((*self).entity_id);
7822 for v1 in (*self).metadata.iter() {
7823 let v2 = w.len();
7824 (*v1).encode(w)?;
7825 if w.get(v2) == Some(&255) {
7826 return Err(EncodeError::OutOfRange(
7827 "play.clientbound.entity_metadata.metadata",
7828 ));
7829 }
7830 }
7831 w.put_u8(255);
7832 Ok(())
7833 }
7834}
7835#[cfg(feature = "v26_1")]
7836#[cfg(feature = "testgen")]
7837impl<const V: i32> Generate for EntityMetadata<V> {
7838 fn generate(g: &mut Gen) -> Self {
7839 {
7840 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
7841 let v2 = {
7842 let n = g.count();
7843 let mut v3 = Vec::with_capacity(n);
7844 for _ in 0..n {
7845 v3.push(loop {
7846 let v4 =
7847 <crate::defs::p775::types::EntityMetadataEntry as Generate>::generate(
7848 g,
7849 );
7850 if crate::testgen::first_byte_ok(
7851 |w: &mut BytesMut| -> EncodeResult {
7852 v4.encode(w)?;
7853 Ok(())
7854 },
7855 |b| b != 255,
7856 ) {
7857 break v4;
7858 }
7859 });
7860 }
7861 v3
7862 };
7863 Self {
7864 entity_id: v1,
7865 metadata: v2,
7866 }
7867 }
7868 }
7869}
7870
7871#[cfg(feature = "v26_1")]
7872#[derive(Debug, Clone, PartialEq)]
7874pub struct EntityVelocity<const V: i32> {
7875 pub entity_id: i32,
7877 pub velocity: LpVec3,
7879}
7880#[cfg(feature = "v26_1")]
7881impl<const V: i32> Decode for EntityVelocity<V> {
7882 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
7883 Ok({
7884 let v1 = r.read_varint()?;
7885 let v2 = LpVec3::read(r)?;
7886 Self {
7887 entity_id: v1,
7888 velocity: v2,
7889 }
7890 })
7891 }
7892}
7893#[cfg(feature = "v26_1")]
7894impl<const V: i32> Encode for EntityVelocity<V> {
7895 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
7896 w.put_varint((*self).entity_id);
7897 (*self).velocity.write(w);
7898 Ok(())
7899 }
7900}
7901#[cfg(feature = "v26_1")]
7902#[cfg(feature = "testgen")]
7903impl<const V: i32> Generate for EntityVelocity<V> {
7904 fn generate(g: &mut Gen) -> Self {
7905 {
7906 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
7907 let v2 = <LpVec3 as Generate>::generate(g);
7908 Self {
7909 entity_id: v1,
7910 velocity: v2,
7911 }
7912 }
7913 }
7914}
7915
7916#[cfg(feature = "v26_1")]
7917#[derive(Debug, Clone, PartialEq)]
7919pub struct EntityEquipmentEquipments {
7920 pub slot: i8,
7922 pub item: crate::defs::p775::types::Slot,
7924}
7925
7926#[cfg(feature = "v26_1")]
7927#[derive(Debug, Clone, PartialEq)]
7929pub struct EntityEquipment<const V: i32> {
7930 pub entity_id: i32,
7932 pub equipments: Vec<crate::defs::p775::play::clientbound::EntityEquipmentEquipments>,
7934}
7935#[cfg(feature = "v26_1")]
7936impl<const V: i32> Decode for EntityEquipment<V> {
7937 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
7938 Ok({
7939 let v1 = r.read_varint()?;
7940 let v2 = {
7941 let mut v3 = Vec::new();
7942 loop {
7943 let v4 = r.read_u8()?;
7944 v3.push({
7945 let v5 = ((v4 & 0x7f) as i8);
7946 let v6 = <crate::defs::p775::types::Slot as Decode>::decode(r)?;
7947 crate::defs::p775::play::clientbound::EntityEquipmentEquipments {
7948 slot: v5,
7949 item: v6,
7950 }
7951 });
7952 if v4 & 0x80 == 0 {
7953 break;
7954 }
7955 }
7956 v3
7957 };
7958 Self {
7959 entity_id: v1,
7960 equipments: v2,
7961 }
7962 })
7963 }
7964}
7965#[cfg(feature = "v26_1")]
7966impl<const V: i32> Encode for EntityEquipment<V> {
7967 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
7968 w.put_varint((*self).entity_id);
7969 if (*self).equipments.is_empty() {
7970 return Err(EncodeError::CountMismatch {
7971 field: "play.clientbound.entity_equipment.equipments",
7972 expected: 1,
7973 actual: 0,
7974 });
7975 }
7976 for (v2, v1) in (*self).equipments.iter().enumerate() {
7977 let v3 = w.len();
7978 w.put_i8((*v1).slot);
7979 (*v1).item.encode(w)?;
7980 match w.get_mut(v3) {
7981 Some(b) if *b & 0x80 == 0 => {
7982 if v2 + 1 < (*self).equipments.len() {
7983 *b |= 0x80;
7984 }
7985 }
7986 _ => {
7987 return Err(EncodeError::OutOfRange(
7988 "play.clientbound.entity_equipment.equipments",
7989 ));
7990 }
7991 }
7992 }
7993 Ok(())
7994 }
7995}
7996#[cfg(feature = "v26_1")]
7997#[cfg(feature = "testgen")]
7998impl<const V: i32> Generate for EntityEquipment<V> {
7999 fn generate(g: &mut Gen) -> Self {
8000 {
8001 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
8002 let v2 = {
8003 let n = 1 + g.count();
8004 let mut v3 = Vec::with_capacity(n);
8005 for _ in 0..n {
8006 v3.push(loop {
8007 let v4 = {
8008 let v5 = (g.int_in(-128, 127, &[]) as i8);
8009 let v6 = <crate::defs::p775::types::Slot as Generate>::generate(g);
8010 crate::defs::p775::play::clientbound::EntityEquipmentEquipments {
8011 slot: v5,
8012 item: v6,
8013 }
8014 };
8015 if crate::testgen::first_byte_ok(
8016 |w: &mut BytesMut| -> EncodeResult {
8017 w.put_i8(v4.slot);
8018 v4.item.encode(w)?;
8019 Ok(())
8020 },
8021 |b| b & 0x80 == 0,
8022 ) {
8023 break v4;
8024 }
8025 });
8026 }
8027 v3
8028 };
8029 Self {
8030 entity_id: v1,
8031 equipments: v2,
8032 }
8033 }
8034 }
8035}
8036
8037#[cfg(feature = "v26_1")]
8038#[derive(Debug, Clone, PartialEq)]
8040pub struct HeldItemSlot<const V: i32> {
8041 pub slot: i32,
8043}
8044#[cfg(feature = "v26_1")]
8045impl<const V: i32> Decode for HeldItemSlot<V> {
8046 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
8047 Ok({
8048 let v1 = r.read_varint()?;
8049 Self { slot: v1 }
8050 })
8051 }
8052}
8053#[cfg(feature = "v26_1")]
8054impl<const V: i32> Encode for HeldItemSlot<V> {
8055 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
8056 w.put_varint((*self).slot);
8057 Ok(())
8058 }
8059}
8060#[cfg(feature = "v26_1")]
8061#[cfg(feature = "testgen")]
8062impl<const V: i32> Generate for HeldItemSlot<V> {
8063 fn generate(g: &mut Gen) -> Self {
8064 {
8065 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
8066 Self { slot: v1 }
8067 }
8068 }
8069}
8070
8071#[cfg(feature = "v26_1")]
8072#[derive(Debug, Clone, PartialEq)]
8074pub struct ScoreboardObjective<const V: i32> {
8075 pub name: ByteString,
8077 pub action: i8,
8079 pub display_text: Option<AnonNbt>,
8081 pub r#type: Option<i32>,
8083 pub number_format: Option<Option<i32>>,
8085 pub styling: Option<Option<AnonNbt>>,
8087}
8088#[cfg(feature = "v26_1")]
8089impl<const V: i32> Decode for ScoreboardObjective<V> {
8090 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
8091 Ok({
8092 let v1 = r.read_string()?;
8093 let v2 = r.read_i8()?;
8094 let v3 = if (v2 == 0) || (v2 == 2) {
8095 Some(AnonNbt::read(r)?)
8096 } else {
8097 None
8098 };
8099 let v4 = if (v2 == 0) || (v2 == 2) {
8100 Some(r.read_varint()?)
8101 } else {
8102 None
8103 };
8104 let v5 = if (v2 == 0) || (v2 == 2) {
8105 Some(if r.read_bool()? {
8106 Some(r.read_varint()?)
8107 } else {
8108 None
8109 })
8110 } else {
8111 None
8112 };
8113 let v6 = if (v2 == 0) || (v2 == 2) {
8114 Some(if (v5 == Some(Some(1))) || (v5 == Some(Some(2))) {
8115 Some(AnonNbt::read(r)?)
8116 } else {
8117 None
8118 })
8119 } else {
8120 None
8121 };
8122 Self {
8123 name: v1,
8124 action: v2,
8125 display_text: v3,
8126 r#type: v4,
8127 number_format: v5,
8128 styling: v6,
8129 }
8130 })
8131 }
8132}
8133#[cfg(feature = "v26_1")]
8134impl<const V: i32> Encode for ScoreboardObjective<V> {
8135 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
8136 w.put_string(&(*self).name)?;
8137 w.put_i8((*self).action);
8138 match (
8139 &(*self).display_text,
8140 ((*self).action == 0) || ((*self).action == 2),
8141 ) {
8142 (Some(v1), true) => {
8143 (*v1).write(w);
8144 }
8145 (None, false) => {}
8146 _ => {
8147 return Err(EncodeError::SwitchMismatch(
8148 "play.clientbound.scoreboard_objective.displayText",
8149 ));
8150 }
8151 }
8152 match (
8153 &(*self).r#type,
8154 ((*self).action == 0) || ((*self).action == 2),
8155 ) {
8156 (Some(v2), true) => {
8157 w.put_varint((*v2));
8158 }
8159 (None, false) => {}
8160 _ => {
8161 return Err(EncodeError::SwitchMismatch(
8162 "play.clientbound.scoreboard_objective.type",
8163 ));
8164 }
8165 }
8166 match (
8167 &(*self).number_format,
8168 ((*self).action == 0) || ((*self).action == 2),
8169 ) {
8170 (Some(v3), true) => match &(*v3) {
8171 Some(v4) => {
8172 w.put_u8(1);
8173 w.put_varint((*v4));
8174 }
8175 None => w.put_u8(0),
8176 },
8177 (None, false) => {}
8178 _ => {
8179 return Err(EncodeError::SwitchMismatch(
8180 "play.clientbound.scoreboard_objective.number_format",
8181 ));
8182 }
8183 }
8184 match (
8185 &(*self).styling,
8186 ((*self).action == 0) || ((*self).action == 2),
8187 ) {
8188 (Some(v5), true) => {
8189 match (
8190 &(*v5),
8191 ((*self).number_format == Some(Some(1)))
8192 || ((*self).number_format == Some(Some(2))),
8193 ) {
8194 (Some(v6), true) => {
8195 (*v6).write(w);
8196 }
8197 (None, false) => {}
8198 _ => {
8199 return Err(EncodeError::SwitchMismatch(
8200 "play.clientbound.scoreboard_objective.styling",
8201 ));
8202 }
8203 }
8204 }
8205 (None, false) => {}
8206 _ => {
8207 return Err(EncodeError::SwitchMismatch(
8208 "play.clientbound.scoreboard_objective.styling",
8209 ));
8210 }
8211 }
8212 Ok(())
8213 }
8214}
8215#[cfg(feature = "v26_1")]
8216#[cfg(feature = "testgen")]
8217impl<const V: i32> Generate for ScoreboardObjective<V> {
8218 fn generate(g: &mut Gen) -> Self {
8219 {
8220 let v1 = g.string();
8221 let v2 = (g.int_in(-128, 127, &[0, 2, 0, 2, 0, 2, 0, 2]) as i8);
8222 let v3 = if (v2 == 0) || (v2 == 2) {
8223 Some(g.anon_nbt())
8224 } else {
8225 None
8226 };
8227 let v4 = if (v2 == 0) || (v2 == 2) {
8228 Some((g.int_in(-2147483648, 2147483647, &[]) as i32))
8229 } else {
8230 None
8231 };
8232 let v5 = if (v2 == 0) || (v2 == 2) {
8233 Some(if g.bool() {
8234 Some((g.int_in(-2147483648, 2147483647, &[]) as i32))
8235 } else {
8236 None
8237 })
8238 } else {
8239 None
8240 };
8241 let v6 = if (v2 == 0) || (v2 == 2) {
8242 Some(if (v5 == Some(Some(1))) || (v5 == Some(Some(2))) {
8243 Some(g.anon_nbt())
8244 } else {
8245 None
8246 })
8247 } else {
8248 None
8249 };
8250 Self {
8251 name: v1,
8252 action: v2,
8253 display_text: v3,
8254 r#type: v4,
8255 number_format: v5,
8256 styling: v6,
8257 }
8258 }
8259 }
8260}
8261
8262#[cfg(feature = "v26_1")]
8263#[derive(Debug, Clone, PartialEq)]
8265pub struct SetPlayerInventory<const V: i32> {
8266 pub slot_id: i32,
8268 pub contents: crate::defs::p775::types::Slot,
8270}
8271#[cfg(feature = "v26_1")]
8272impl<const V: i32> Decode for SetPlayerInventory<V> {
8273 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
8274 Ok({
8275 let v1 = r.read_varint()?;
8276 let v2 = <crate::defs::p775::types::Slot as Decode>::decode(r)?;
8277 Self {
8278 slot_id: v1,
8279 contents: v2,
8280 }
8281 })
8282 }
8283}
8284#[cfg(feature = "v26_1")]
8285impl<const V: i32> Encode for SetPlayerInventory<V> {
8286 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
8287 w.put_varint((*self).slot_id);
8288 (*self).contents.encode(w)?;
8289 Ok(())
8290 }
8291}
8292#[cfg(feature = "v26_1")]
8293#[cfg(feature = "testgen")]
8294impl<const V: i32> Generate for SetPlayerInventory<V> {
8295 fn generate(g: &mut Gen) -> Self {
8296 {
8297 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
8298 let v2 = <crate::defs::p775::types::Slot as Generate>::generate(g);
8299 Self {
8300 slot_id: v1,
8301 contents: v2,
8302 }
8303 }
8304 }
8305}
8306
8307#[cfg(feature = "v26_1")]
8308#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
8310pub struct TeamsMode(pub i8);
8311#[cfg(feature = "v26_1")]
8312impl TeamsMode {
8313 pub const ADD: Self = Self(0);
8315 pub const REMOVE: Self = Self(1);
8317 pub const CHANGE: Self = Self(2);
8319 pub const JOIN: Self = Self(3);
8321 pub const LEAVE: Self = Self(4);
8323 pub const fn name(self) -> Option<&'static str> {
8325 match self.0 {
8326 0 => Some("add"),
8327 1 => Some("remove"),
8328 2 => Some("change"),
8329 3 => Some("join"),
8330 4 => Some("leave"),
8331 _ => None,
8332 }
8333 }
8334}
8335#[cfg(feature = "v26_1")]
8336impl std::fmt::Debug for TeamsMode {
8337 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8338 match self.name() {
8339 Some(n) => write!(f, "TeamsMode::{n}"),
8340 None => write!(f, "TeamsMode({})", self.0),
8341 }
8342 }
8343}
8344
8345#[cfg(feature = "v26_1")]
8346#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
8348pub struct TeamsBodyAddFlags(pub u8);
8349#[cfg(feature = "v26_1")]
8350impl TeamsBodyAddFlags {
8351 pub const FRIENDLY_FIRE: Self = Self(1 << 0);
8353 pub const SEE_FRIENDLY_INVISIBLE: Self = Self(1 << 1);
8355 #[inline]
8357 pub const fn contains(self, f: Self) -> bool {
8358 self.0 & f.0 == f.0
8359 }
8360 #[inline]
8362 #[must_use]
8363 pub const fn with(self, f: Self) -> Self {
8364 Self(self.0 | f.0)
8365 }
8366}
8367
8368#[cfg(feature = "v26_1")]
8369#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
8371pub struct TeamsBodyAddNameTagVisibility(pub i32);
8372#[cfg(feature = "v26_1")]
8373impl TeamsBodyAddNameTagVisibility {
8374 pub const ALWAYS: Self = Self(0);
8376 pub const NEVER: Self = Self(1);
8378 pub const HIDE_FOR_OTHER_TEAMS: Self = Self(2);
8380 pub const HIDE_FOR_OWN_TEAM: Self = Self(3);
8382 pub const fn name(self) -> Option<&'static str> {
8384 match self.0 {
8385 0 => Some("always"),
8386 1 => Some("never"),
8387 2 => Some("hide_for_other_teams"),
8388 3 => Some("hide_for_own_team"),
8389 _ => None,
8390 }
8391 }
8392}
8393#[cfg(feature = "v26_1")]
8394impl std::fmt::Debug for TeamsBodyAddNameTagVisibility {
8395 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8396 match self.name() {
8397 Some(n) => write!(f, "TeamsBodyAddNameTagVisibility::{n}"),
8398 None => write!(f, "TeamsBodyAddNameTagVisibility({})", self.0),
8399 }
8400 }
8401}
8402
8403#[cfg(feature = "v26_1")]
8404#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
8406pub struct TeamsBodyAddCollisionRule(pub i32);
8407#[cfg(feature = "v26_1")]
8408impl TeamsBodyAddCollisionRule {
8409 pub const ALWAYS: Self = Self(0);
8411 pub const NEVER: Self = Self(1);
8413 pub const PUSH_OTHER_TEAMS: Self = Self(2);
8415 pub const PUSH_OWN_TEAM: Self = Self(3);
8417 pub const fn name(self) -> Option<&'static str> {
8419 match self.0 {
8420 0 => Some("always"),
8421 1 => Some("never"),
8422 2 => Some("push_other_teams"),
8423 3 => Some("push_own_team"),
8424 _ => None,
8425 }
8426 }
8427}
8428#[cfg(feature = "v26_1")]
8429impl std::fmt::Debug for TeamsBodyAddCollisionRule {
8430 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8431 match self.name() {
8432 Some(n) => write!(f, "TeamsBodyAddCollisionRule::{n}"),
8433 None => write!(f, "TeamsBodyAddCollisionRule({})", self.0),
8434 }
8435 }
8436}
8437
8438#[cfg(feature = "v26_1")]
8439#[derive(Debug, Clone, PartialEq)]
8441pub struct TeamsBodyAdd {
8442 pub name: AnonNbt,
8444 pub flags: crate::defs::p775::play::clientbound::TeamsBodyAddFlags,
8446 pub name_tag_visibility: crate::defs::p775::play::clientbound::TeamsBodyAddNameTagVisibility,
8448 pub collision_rule: crate::defs::p775::play::clientbound::TeamsBodyAddCollisionRule,
8450 pub formatting: i32,
8452 pub prefix: AnonNbt,
8454 pub suffix: AnonNbt,
8456}
8457
8458#[cfg(feature = "v26_1")]
8459#[derive(Debug, Clone, PartialEq)]
8461pub struct Teams<const V: i32> {
8462 pub team: ByteString,
8464 pub mode: crate::defs::p775::play::clientbound::TeamsMode,
8466 pub body: Option<crate::defs::p775::play::clientbound::TeamsBodyAdd>,
8468 pub players: Option<Vec<ByteString>>,
8470}
8471#[cfg(feature = "v26_1")]
8472impl<const V: i32> Decode for Teams<V> {
8473 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
8474 Ok({
8475 let v1 = r.read_string()?;
8476 let v2 = crate::defs::p775::play::clientbound::TeamsMode(r.read_i8()?);
8477 let v3 = if (v2.0 == 0) || (v2.0 == 2) {
8478 Some({
8479 let v4 = AnonNbt::read(r)?;
8480 let v5 = crate::defs::p775::play::clientbound::TeamsBodyAddFlags(r.read_u8()?);
8481 let v6 = crate::defs::p775::play::clientbound::TeamsBodyAddNameTagVisibility(
8482 r.read_varint()?,
8483 );
8484 let v7 = crate::defs::p775::play::clientbound::TeamsBodyAddCollisionRule(
8485 r.read_varint()?,
8486 );
8487 let v8 = r.read_varint()?;
8488 let v9 = AnonNbt::read(r)?;
8489 let v10 = AnonNbt::read(r)?;
8490 crate::defs::p775::play::clientbound::TeamsBodyAdd {
8491 name: v4,
8492 flags: v5,
8493 name_tag_visibility: v6,
8494 collision_rule: v7,
8495 formatting: v8,
8496 prefix: v9,
8497 suffix: v10,
8498 }
8499 })
8500 } else {
8501 None
8502 };
8503 let v11 = if (v2.0 == 0) || (v2.0 == 3) || (v2.0 == 4) {
8504 Some({
8505 let v12 = {
8506 let c = r.read_varint()?;
8507 r.check_count(i64::from(c), 1)?
8508 };
8509 let mut v13 = Vec::with_capacity(v12.min(crate::codec::PREALLOC_LIMIT));
8510 for _ in 0..v12 {
8511 v13.push(r.read_string()?);
8512 }
8513 v13
8514 })
8515 } else {
8516 None
8517 };
8518 Self {
8519 team: v1,
8520 mode: v2,
8521 body: v3,
8522 players: v11,
8523 }
8524 })
8525 }
8526}
8527#[cfg(feature = "v26_1")]
8528impl<const V: i32> Encode for Teams<V> {
8529 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
8530 w.put_string(&(*self).team)?;
8531 w.put_i8((*self).mode.0);
8532 match (
8533 &(*self).body,
8534 ((*self).mode.0 == 0) || ((*self).mode.0 == 2),
8535 ) {
8536 (Some(v1), true) => {
8537 (*v1).name.write(w);
8538 w.put_u8((*v1).flags.0);
8539 w.put_varint((*v1).name_tag_visibility.0);
8540 w.put_varint((*v1).collision_rule.0);
8541 w.put_varint((*v1).formatting);
8542 (*v1).prefix.write(w);
8543 (*v1).suffix.write(w);
8544 }
8545 (None, false) => {}
8546 _ => return Err(EncodeError::SwitchMismatch("play.clientbound.teams.body")),
8547 }
8548 match (
8549 &(*self).players,
8550 ((*self).mode.0 == 0) || ((*self).mode.0 == 3) || ((*self).mode.0 == 4),
8551 ) {
8552 (Some(v2), true) => {
8553 w.put_len_varint((*v2).len())?;
8554 for v3 in (*v2).iter() {
8555 w.put_string(&(*v3))?;
8556 }
8557 }
8558 (None, false) => {}
8559 _ => {
8560 return Err(EncodeError::SwitchMismatch(
8561 "play.clientbound.teams.players",
8562 ));
8563 }
8564 }
8565 Ok(())
8566 }
8567}
8568#[cfg(feature = "v26_1")]
8569#[cfg(feature = "testgen")]
8570impl<const V: i32> Generate for Teams<V> {
8571 fn generate(g: &mut Gen) -> Self {
8572 {
8573 let v1 = g.string();
8574 let v2 = crate::defs::p775::play::clientbound::TeamsMode(g.int_in(
8575 -128,
8576 127,
8577 &[0, 1, 2, 3, 4],
8578 ) as i8);
8579 let v3 = if (v2.0 == 0) || (v2.0 == 2) {
8580 Some({
8581 let v4 = g.anon_nbt();
8582 let v5 = crate::defs::p775::play::clientbound::TeamsBodyAddFlags(g.int_in(
8583 0,
8584 255,
8585 &[],
8586 )
8587 as u8);
8588 let v6 = crate::defs::p775::play::clientbound::TeamsBodyAddNameTagVisibility(
8589 g.int_in(-2147483648, 2147483647, &[0, 1, 2, 3]) as i32,
8590 );
8591 let v7 = crate::defs::p775::play::clientbound::TeamsBodyAddCollisionRule(
8592 g.int_in(-2147483648, 2147483647, &[0, 1, 2, 3]) as i32,
8593 );
8594 let v8 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
8595 let v9 = g.anon_nbt();
8596 let v10 = g.anon_nbt();
8597 crate::defs::p775::play::clientbound::TeamsBodyAdd {
8598 name: v4,
8599 flags: v5,
8600 name_tag_visibility: v6,
8601 collision_rule: v7,
8602 formatting: v8,
8603 prefix: v9,
8604 suffix: v10,
8605 }
8606 })
8607 } else {
8608 None
8609 };
8610 let v11 = if (v2.0 == 0) || (v2.0 == 3) || (v2.0 == 4) {
8611 Some({
8612 let v12 = g.count();
8613 let mut v13 = Vec::with_capacity(v12.min(crate::codec::PREALLOC_LIMIT));
8614 for _ in 0..v12 {
8615 v13.push(g.string());
8616 }
8617 v13
8618 })
8619 } else {
8620 None
8621 };
8622 Self {
8623 team: v1,
8624 mode: v2,
8625 body: v3,
8626 players: v11,
8627 }
8628 }
8629 }
8630}
8631
8632#[cfg(feature = "v26_1")]
8633#[derive(Debug, Clone, PartialEq)]
8635pub struct ScoreboardScore<const V: i32> {
8636 pub item_name: ByteString,
8638 pub score_name: ByteString,
8640 pub value: i32,
8642 pub display_name: Option<AnonNbt>,
8644 pub number_format: Option<i32>,
8646 pub styling: Option<AnonNbt>,
8648}
8649#[cfg(feature = "v26_1")]
8650impl<const V: i32> Decode for ScoreboardScore<V> {
8651 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
8652 Ok({
8653 let v1 = r.read_string()?;
8654 let v2 = r.read_string()?;
8655 let v3 = r.read_varint()?;
8656 let v4 = if r.read_bool()? {
8657 Some(AnonNbt::read(r)?)
8658 } else {
8659 None
8660 };
8661 let v5 = if r.read_bool()? {
8662 Some(r.read_varint()?)
8663 } else {
8664 None
8665 };
8666 let v6 = if (v5 == Some(1)) || (v5 == Some(2)) {
8667 Some(AnonNbt::read(r)?)
8668 } else {
8669 None
8670 };
8671 Self {
8672 item_name: v1,
8673 score_name: v2,
8674 value: v3,
8675 display_name: v4,
8676 number_format: v5,
8677 styling: v6,
8678 }
8679 })
8680 }
8681}
8682#[cfg(feature = "v26_1")]
8683impl<const V: i32> Encode for ScoreboardScore<V> {
8684 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
8685 w.put_string(&(*self).item_name)?;
8686 w.put_string(&(*self).score_name)?;
8687 w.put_varint((*self).value);
8688 match &(*self).display_name {
8689 Some(v1) => {
8690 w.put_u8(1);
8691 (*v1).write(w);
8692 }
8693 None => w.put_u8(0),
8694 }
8695 match &(*self).number_format {
8696 Some(v2) => {
8697 w.put_u8(1);
8698 w.put_varint((*v2));
8699 }
8700 None => w.put_u8(0),
8701 }
8702 match (
8703 &(*self).styling,
8704 ((*self).number_format == Some(1)) || ((*self).number_format == Some(2)),
8705 ) {
8706 (Some(v3), true) => {
8707 (*v3).write(w);
8708 }
8709 (None, false) => {}
8710 _ => {
8711 return Err(EncodeError::SwitchMismatch(
8712 "play.clientbound.scoreboard_score.styling",
8713 ));
8714 }
8715 }
8716 Ok(())
8717 }
8718}
8719#[cfg(feature = "v26_1")]
8720#[cfg(feature = "testgen")]
8721impl<const V: i32> Generate for ScoreboardScore<V> {
8722 fn generate(g: &mut Gen) -> Self {
8723 {
8724 let v1 = g.string();
8725 let v2 = g.string();
8726 let v3 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
8727 let v4 = if g.bool() { Some(g.anon_nbt()) } else { None };
8728 let v5 = if g.bool() {
8729 Some((g.int_in(-2147483648, 2147483647, &[]) as i32))
8730 } else {
8731 None
8732 };
8733 let v6 = if (v5 == Some(1)) || (v5 == Some(2)) {
8734 Some(g.anon_nbt())
8735 } else {
8736 None
8737 };
8738 Self {
8739 item_name: v1,
8740 score_name: v2,
8741 value: v3,
8742 display_name: v4,
8743 number_format: v5,
8744 styling: v6,
8745 }
8746 }
8747 }
8748}
8749
8750#[cfg(feature = "v26_1")]
8751#[derive(Debug, Clone, PartialEq)]
8753pub struct SimulationDistance<const V: i32> {
8754 pub distance: i32,
8756}
8757#[cfg(feature = "v26_1")]
8758impl<const V: i32> Decode for SimulationDistance<V> {
8759 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
8760 Ok({
8761 let v1 = r.read_varint()?;
8762 Self { distance: v1 }
8763 })
8764 }
8765}
8766#[cfg(feature = "v26_1")]
8767impl<const V: i32> Encode for SimulationDistance<V> {
8768 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
8769 w.put_varint((*self).distance);
8770 Ok(())
8771 }
8772}
8773#[cfg(feature = "v26_1")]
8774#[cfg(feature = "testgen")]
8775impl<const V: i32> Generate for SimulationDistance<V> {
8776 fn generate(g: &mut Gen) -> Self {
8777 {
8778 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
8779 Self { distance: v1 }
8780 }
8781 }
8782}
8783
8784#[cfg(feature = "v26_1")]
8785#[derive(Debug, Clone, PartialEq)]
8787pub struct SetTitleSubtitle<const V: i32> {
8788 pub text: AnonNbt,
8790}
8791#[cfg(feature = "v26_1")]
8792impl<const V: i32> Decode for SetTitleSubtitle<V> {
8793 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
8794 Ok({
8795 let v1 = AnonNbt::read(r)?;
8796 Self { text: v1 }
8797 })
8798 }
8799}
8800#[cfg(feature = "v26_1")]
8801impl<const V: i32> Encode for SetTitleSubtitle<V> {
8802 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
8803 (*self).text.write(w);
8804 Ok(())
8805 }
8806}
8807#[cfg(feature = "v26_1")]
8808#[cfg(feature = "testgen")]
8809impl<const V: i32> Generate for SetTitleSubtitle<V> {
8810 fn generate(g: &mut Gen) -> Self {
8811 {
8812 let v1 = g.anon_nbt();
8813 Self { text: v1 }
8814 }
8815 }
8816}
8817
8818#[cfg(feature = "v26_1")]
8819#[derive(Debug, Clone, PartialEq)]
8821pub struct UpdateTimeClockUpdates {
8822 pub id: i32,
8824 pub total_ticks: i64,
8826 pub partial_tick: f32,
8828 pub rate: f32,
8830}
8831
8832#[cfg(feature = "v26_1")]
8833#[derive(Debug, Clone, PartialEq)]
8835pub struct UpdateTime<const V: i32> {
8836 pub age: i64,
8838 pub clock_updates: Vec<crate::defs::p775::play::clientbound::UpdateTimeClockUpdates>,
8840}
8841#[cfg(feature = "v26_1")]
8842impl<const V: i32> Decode for UpdateTime<V> {
8843 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
8844 Ok({
8845 let v1 = r.read_i64()?;
8846 let v2 = {
8847 let v3 = {
8848 let c = r.read_varint()?;
8849 r.check_count(i64::from(c), 10)?
8850 };
8851 let mut v4 = Vec::with_capacity(v3.min(crate::codec::PREALLOC_LIMIT));
8852 for _ in 0..v3 {
8853 v4.push({
8854 let v5 = r.read_varint()?;
8855 let v6 = r.read_varlong()?;
8856 let v7 = r.read_f32()?;
8857 let v8 = r.read_f32()?;
8858 crate::defs::p775::play::clientbound::UpdateTimeClockUpdates {
8859 id: v5,
8860 total_ticks: v6,
8861 partial_tick: v7,
8862 rate: v8,
8863 }
8864 });
8865 }
8866 v4
8867 };
8868 Self {
8869 age: v1,
8870 clock_updates: v2,
8871 }
8872 })
8873 }
8874}
8875#[cfg(feature = "v26_1")]
8876impl<const V: i32> Encode for UpdateTime<V> {
8877 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
8878 w.put_i64((*self).age);
8879 w.put_len_varint((*self).clock_updates.len())?;
8880 for v1 in (*self).clock_updates.iter() {
8881 w.put_varint((*v1).id);
8882 w.put_varlong((*v1).total_ticks);
8883 w.put_f32((*v1).partial_tick);
8884 w.put_f32((*v1).rate);
8885 }
8886 Ok(())
8887 }
8888}
8889#[cfg(feature = "v26_1")]
8890#[cfg(feature = "testgen")]
8891impl<const V: i32> Generate for UpdateTime<V> {
8892 fn generate(g: &mut Gen) -> Self {
8893 {
8894 let v1 = g.i64();
8895 let v2 = {
8896 let v3 = g.count();
8897 let mut v4 = Vec::with_capacity(v3.min(crate::codec::PREALLOC_LIMIT));
8898 for _ in 0..v3 {
8899 v4.push({
8900 let v5 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
8901 let v6 = g.varlong();
8902 let v7 = g.f32();
8903 let v8 = g.f32();
8904 crate::defs::p775::play::clientbound::UpdateTimeClockUpdates {
8905 id: v5,
8906 total_ticks: v6,
8907 partial_tick: v7,
8908 rate: v8,
8909 }
8910 });
8911 }
8912 v4
8913 };
8914 Self {
8915 age: v1,
8916 clock_updates: v2,
8917 }
8918 }
8919 }
8920}
8921
8922#[cfg(feature = "v26_1")]
8923#[derive(Debug, Clone, PartialEq)]
8925pub struct SetTitleText<const V: i32> {
8926 pub text: AnonNbt,
8928}
8929#[cfg(feature = "v26_1")]
8930impl<const V: i32> Decode for SetTitleText<V> {
8931 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
8932 Ok({
8933 let v1 = AnonNbt::read(r)?;
8934 Self { text: v1 }
8935 })
8936 }
8937}
8938#[cfg(feature = "v26_1")]
8939impl<const V: i32> Encode for SetTitleText<V> {
8940 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
8941 (*self).text.write(w);
8942 Ok(())
8943 }
8944}
8945#[cfg(feature = "v26_1")]
8946#[cfg(feature = "testgen")]
8947impl<const V: i32> Generate for SetTitleText<V> {
8948 fn generate(g: &mut Gen) -> Self {
8949 {
8950 let v1 = g.anon_nbt();
8951 Self { text: v1 }
8952 }
8953 }
8954}
8955
8956#[cfg(feature = "v26_1")]
8957#[derive(Debug, Clone, PartialEq)]
8959pub struct SetTitleTime<const V: i32> {
8960 pub fade_in: i32,
8962 pub stay: i32,
8964 pub fade_out: i32,
8966}
8967#[cfg(feature = "v26_1")]
8968impl<const V: i32> Decode for SetTitleTime<V> {
8969 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
8970 Ok({
8971 let v1 = r.read_i32()?;
8972 let v2 = r.read_i32()?;
8973 let v3 = r.read_i32()?;
8974 Self {
8975 fade_in: v1,
8976 stay: v2,
8977 fade_out: v3,
8978 }
8979 })
8980 }
8981}
8982#[cfg(feature = "v26_1")]
8983impl<const V: i32> Encode for SetTitleTime<V> {
8984 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
8985 w.put_i32((*self).fade_in);
8986 w.put_i32((*self).stay);
8987 w.put_i32((*self).fade_out);
8988 Ok(())
8989 }
8990}
8991#[cfg(feature = "v26_1")]
8992#[cfg(feature = "testgen")]
8993impl<const V: i32> Generate for SetTitleTime<V> {
8994 fn generate(g: &mut Gen) -> Self {
8995 {
8996 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
8997 let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
8998 let v3 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
8999 Self {
9000 fade_in: v1,
9001 stay: v2,
9002 fade_out: v3,
9003 }
9004 }
9005 }
9006}
9007
9008#[cfg(feature = "v26_1")]
9009#[derive(Debug, Clone, PartialEq)]
9011pub struct EntitySoundEffect<const V: i32> {
9012 pub sound: Holder<crate::defs::p775::types::ItemSoundEvent>,
9014 pub sound_category: crate::defs::p775::types::SoundSource,
9016 pub entity_id: i32,
9018 pub volume: f32,
9020 pub pitch: f32,
9022 pub seed: i64,
9024}
9025#[cfg(feature = "v26_1")]
9026impl<const V: i32> Decode for EntitySoundEffect<V> {
9027 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
9028 Ok({
9029 let v1 = {
9030 let id = r.read_varint()?;
9031 if id == 0 {
9032 Holder::Inline(<crate::defs::p775::types::ItemSoundEvent as Decode>::decode(r)?)
9033 } else {
9034 Holder::Id(id.wrapping_sub(1))
9035 }
9036 };
9037 let v2 = crate::defs::p775::types::SoundSource(r.read_varint()?);
9038 let v3 = r.read_varint()?;
9039 let v4 = r.read_f32()?;
9040 let v5 = r.read_f32()?;
9041 let v6 = r.read_i64()?;
9042 Self {
9043 sound: v1,
9044 sound_category: v2,
9045 entity_id: v3,
9046 volume: v4,
9047 pitch: v5,
9048 seed: v6,
9049 }
9050 })
9051 }
9052}
9053#[cfg(feature = "v26_1")]
9054impl<const V: i32> Encode for EntitySoundEffect<V> {
9055 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
9056 match &(*self).sound {
9057 Holder::Id(v2) => {
9058 if *v2 == -1 {
9059 return Err(EncodeError::OutOfRange("holder id"));
9060 }
9061 w.put_varint(v2.wrapping_add(1));
9062 }
9063 Holder::Inline(v1) => {
9064 w.put_varint(0);
9065 (*v1).encode(w)?;
9066 }
9067 }
9068 w.put_varint((*self).sound_category.0);
9069 w.put_varint((*self).entity_id);
9070 w.put_f32((*self).volume);
9071 w.put_f32((*self).pitch);
9072 w.put_i64((*self).seed);
9073 Ok(())
9074 }
9075}
9076#[cfg(feature = "v26_1")]
9077#[cfg(feature = "testgen")]
9078impl<const V: i32> Generate for EntitySoundEffect<V> {
9079 fn generate(g: &mut Gen) -> Self {
9080 {
9081 let v1 = if g.bool() {
9082 Holder::Id(match g.int_in(-2147483648, 2147483647, &[0, 1, 2]) as i32 {
9083 -1 => 0,
9084 v => v,
9085 })
9086 } else {
9087 Holder::Inline(<crate::defs::p775::types::ItemSoundEvent as Generate>::generate(g))
9088 };
9089 let v2 = crate::defs::p775::types::SoundSource(g.int_in(
9090 -2147483648,
9091 2147483647,
9092 &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
9093 ) as i32);
9094 let v3 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
9095 let v4 = g.f32();
9096 let v5 = g.f32();
9097 let v6 = g.i64();
9098 Self {
9099 sound: v1,
9100 sound_category: v2,
9101 entity_id: v3,
9102 volume: v4,
9103 pitch: v5,
9104 seed: v6,
9105 }
9106 }
9107 }
9108}
9109
9110#[cfg(feature = "v26_1")]
9111#[derive(Debug, Clone, PartialEq)]
9113pub struct SoundEffect<const V: i32> {
9114 pub sound: Holder<crate::defs::p775::types::ItemSoundEvent>,
9116 pub sound_category: crate::defs::p775::types::SoundSource,
9118 pub x: i32,
9120 pub y: i32,
9122 pub z: i32,
9124 pub volume: f32,
9126 pub pitch: f32,
9128 pub seed: i64,
9130}
9131#[cfg(feature = "v26_1")]
9132impl<const V: i32> Decode for SoundEffect<V> {
9133 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
9134 Ok({
9135 let v1 = {
9136 let id = r.read_varint()?;
9137 if id == 0 {
9138 Holder::Inline(<crate::defs::p775::types::ItemSoundEvent as Decode>::decode(r)?)
9139 } else {
9140 Holder::Id(id.wrapping_sub(1))
9141 }
9142 };
9143 let v2 = crate::defs::p775::types::SoundSource(r.read_varint()?);
9144 let v3 = r.read_i32()?;
9145 let v4 = r.read_i32()?;
9146 let v5 = r.read_i32()?;
9147 let v6 = r.read_f32()?;
9148 let v7 = r.read_f32()?;
9149 let v8 = r.read_i64()?;
9150 Self {
9151 sound: v1,
9152 sound_category: v2,
9153 x: v3,
9154 y: v4,
9155 z: v5,
9156 volume: v6,
9157 pitch: v7,
9158 seed: v8,
9159 }
9160 })
9161 }
9162}
9163#[cfg(feature = "v26_1")]
9164impl<const V: i32> Encode for SoundEffect<V> {
9165 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
9166 match &(*self).sound {
9167 Holder::Id(v2) => {
9168 if *v2 == -1 {
9169 return Err(EncodeError::OutOfRange("holder id"));
9170 }
9171 w.put_varint(v2.wrapping_add(1));
9172 }
9173 Holder::Inline(v1) => {
9174 w.put_varint(0);
9175 (*v1).encode(w)?;
9176 }
9177 }
9178 w.put_varint((*self).sound_category.0);
9179 w.put_i32((*self).x);
9180 w.put_i32((*self).y);
9181 w.put_i32((*self).z);
9182 w.put_f32((*self).volume);
9183 w.put_f32((*self).pitch);
9184 w.put_i64((*self).seed);
9185 Ok(())
9186 }
9187}
9188#[cfg(feature = "v26_1")]
9189#[cfg(feature = "testgen")]
9190impl<const V: i32> Generate for SoundEffect<V> {
9191 fn generate(g: &mut Gen) -> Self {
9192 {
9193 let v1 = if g.bool() {
9194 Holder::Id(match g.int_in(-2147483648, 2147483647, &[0, 1, 2]) as i32 {
9195 -1 => 0,
9196 v => v,
9197 })
9198 } else {
9199 Holder::Inline(<crate::defs::p775::types::ItemSoundEvent as Generate>::generate(g))
9200 };
9201 let v2 = crate::defs::p775::types::SoundSource(g.int_in(
9202 -2147483648,
9203 2147483647,
9204 &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
9205 ) as i32);
9206 let v3 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
9207 let v4 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
9208 let v5 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
9209 let v6 = g.f32();
9210 let v7 = g.f32();
9211 let v8 = g.i64();
9212 Self {
9213 sound: v1,
9214 sound_category: v2,
9215 x: v3,
9216 y: v4,
9217 z: v5,
9218 volume: v6,
9219 pitch: v7,
9220 seed: v8,
9221 }
9222 }
9223 }
9224}
9225
9226#[cfg(feature = "v26_1")]
9227#[derive(Debug, Clone, PartialEq)]
9229pub struct StartConfiguration<const V: i32> {}
9230#[cfg(feature = "v26_1")]
9231impl<const V: i32> Decode for StartConfiguration<V> {
9232 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
9233 Ok({ Self {} })
9234 }
9235}
9236#[cfg(feature = "v26_1")]
9237impl<const V: i32> Encode for StartConfiguration<V> {
9238 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
9239 Ok(())
9240 }
9241}
9242#[cfg(feature = "v26_1")]
9243#[cfg(feature = "testgen")]
9244impl<const V: i32> Generate for StartConfiguration<V> {
9245 fn generate(g: &mut Gen) -> Self {
9246 { Self {} }
9247 }
9248}
9249
9250#[cfg(feature = "v26_1")]
9251#[derive(Debug, Clone, PartialEq)]
9253pub struct StoreCookie<const V: i32> {
9254 pub key: ByteString,
9256 pub value: Bytes,
9258}
9259#[cfg(feature = "v26_1")]
9260impl<const V: i32> Decode for StoreCookie<V> {
9261 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
9262 Ok({
9263 let v1 = r.read_string()?;
9264 let v2 = r.read_byte_array()?;
9265 Self { key: v1, value: v2 }
9266 })
9267 }
9268}
9269#[cfg(feature = "v26_1")]
9270impl<const V: i32> Encode for StoreCookie<V> {
9271 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
9272 w.put_string(&(*self).key)?;
9273 w.put_byte_array(&(*self).value)?;
9274 Ok(())
9275 }
9276}
9277#[cfg(feature = "v26_1")]
9278#[cfg(feature = "testgen")]
9279impl<const V: i32> Generate for StoreCookie<V> {
9280 fn generate(g: &mut Gen) -> Self {
9281 {
9282 let v1 = g.string();
9283 let v2 = g.bytes();
9284 Self { key: v1, value: v2 }
9285 }
9286 }
9287}
9288
9289#[cfg(feature = "v26_1")]
9290#[derive(Debug, Clone, PartialEq)]
9292pub struct SystemChat<const V: i32> {
9293 pub content: AnonNbt,
9295 pub is_action_bar: bool,
9297}
9298#[cfg(feature = "v26_1")]
9299impl<const V: i32> Decode for SystemChat<V> {
9300 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
9301 Ok({
9302 let v1 = AnonNbt::read(r)?;
9303 let v2 = r.read_bool()?;
9304 Self {
9305 content: v1,
9306 is_action_bar: v2,
9307 }
9308 })
9309 }
9310}
9311#[cfg(feature = "v26_1")]
9312impl<const V: i32> Encode for SystemChat<V> {
9313 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
9314 (*self).content.write(w);
9315 w.put_bool((*self).is_action_bar);
9316 Ok(())
9317 }
9318}
9319#[cfg(feature = "v26_1")]
9320#[cfg(feature = "testgen")]
9321impl<const V: i32> Generate for SystemChat<V> {
9322 fn generate(g: &mut Gen) -> Self {
9323 {
9324 let v1 = g.anon_nbt();
9325 let v2 = g.bool();
9326 Self {
9327 content: v1,
9328 is_action_bar: v2,
9329 }
9330 }
9331 }
9332}
9333
9334#[cfg(feature = "v26_1")]
9335#[derive(Debug, Clone, PartialEq)]
9337pub struct PlayerlistHeader<const V: i32> {
9338 pub header: AnonNbt,
9340 pub footer: AnonNbt,
9342}
9343#[cfg(feature = "v26_1")]
9344impl<const V: i32> Decode for PlayerlistHeader<V> {
9345 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
9346 Ok({
9347 let v1 = AnonNbt::read(r)?;
9348 let v2 = AnonNbt::read(r)?;
9349 Self {
9350 header: v1,
9351 footer: v2,
9352 }
9353 })
9354 }
9355}
9356#[cfg(feature = "v26_1")]
9357impl<const V: i32> Encode for PlayerlistHeader<V> {
9358 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
9359 (*self).header.write(w);
9360 (*self).footer.write(w);
9361 Ok(())
9362 }
9363}
9364#[cfg(feature = "v26_1")]
9365#[cfg(feature = "testgen")]
9366impl<const V: i32> Generate for PlayerlistHeader<V> {
9367 fn generate(g: &mut Gen) -> Self {
9368 {
9369 let v1 = g.anon_nbt();
9370 let v2 = g.anon_nbt();
9371 Self {
9372 header: v1,
9373 footer: v2,
9374 }
9375 }
9376 }
9377}
9378
9379#[cfg(feature = "v26_1")]
9380#[derive(Debug, Clone, PartialEq)]
9382pub struct NbtQueryResponse<const V: i32> {
9383 pub transaction_id: i32,
9385 pub nbt: Option<AnonNbt>,
9387}
9388#[cfg(feature = "v26_1")]
9389impl<const V: i32> Decode for NbtQueryResponse<V> {
9390 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
9391 Ok({
9392 let v1 = r.read_varint()?;
9393 let v2 = AnonNbt::read_optional(r)?;
9394 Self {
9395 transaction_id: v1,
9396 nbt: v2,
9397 }
9398 })
9399 }
9400}
9401#[cfg(feature = "v26_1")]
9402impl<const V: i32> Encode for NbtQueryResponse<V> {
9403 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
9404 w.put_varint((*self).transaction_id);
9405 AnonNbt::write_optional(&(*self).nbt, w);
9406 Ok(())
9407 }
9408}
9409#[cfg(feature = "v26_1")]
9410#[cfg(feature = "testgen")]
9411impl<const V: i32> Generate for NbtQueryResponse<V> {
9412 fn generate(g: &mut Gen) -> Self {
9413 {
9414 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
9415 let v2 = g.anon_opt_nbt();
9416 Self {
9417 transaction_id: v1,
9418 nbt: v2,
9419 }
9420 }
9421 }
9422}
9423
9424#[cfg(feature = "v26_1")]
9425#[derive(Debug, Clone, PartialEq)]
9427pub struct EntityTeleport<const V: i32> {
9428 pub entity_id: i32,
9430 pub x: f64,
9432 pub y: f64,
9434 pub z: f64,
9436 pub dx: f64,
9438 pub dy: f64,
9440 pub dz: f64,
9442 pub yaw: f32,
9444 pub pitch: f32,
9446 pub flags: crate::defs::p775::play::clientbound::PositionUpdateRelatives,
9448 pub on_ground: bool,
9450}
9451#[cfg(feature = "v26_1")]
9452impl<const V: i32> Decode for EntityTeleport<V> {
9453 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
9454 Ok({
9455 let v1 = r.read_varint()?;
9456 let v2 = r.read_f64()?;
9457 let v3 = r.read_f64()?;
9458 let v4 = r.read_f64()?;
9459 let v5 = r.read_f64()?;
9460 let v6 = r.read_f64()?;
9461 let v7 = r.read_f64()?;
9462 let v8 = r.read_f32()?;
9463 let v9 = r.read_f32()?;
9464 let v10 = crate::defs::p775::play::clientbound::PositionUpdateRelatives(r.read_u32()?);
9465 let v11 = r.read_bool()?;
9466 Self {
9467 entity_id: v1,
9468 x: v2,
9469 y: v3,
9470 z: v4,
9471 dx: v5,
9472 dy: v6,
9473 dz: v7,
9474 yaw: v8,
9475 pitch: v9,
9476 flags: v10,
9477 on_ground: v11,
9478 }
9479 })
9480 }
9481}
9482#[cfg(feature = "v26_1")]
9483impl<const V: i32> Encode for EntityTeleport<V> {
9484 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
9485 w.put_varint((*self).entity_id);
9486 w.put_f64((*self).x);
9487 w.put_f64((*self).y);
9488 w.put_f64((*self).z);
9489 w.put_f64((*self).dx);
9490 w.put_f64((*self).dy);
9491 w.put_f64((*self).dz);
9492 w.put_f32((*self).yaw);
9493 w.put_f32((*self).pitch);
9494 w.put_u32((*self).flags.0);
9495 w.put_bool((*self).on_ground);
9496 Ok(())
9497 }
9498}
9499#[cfg(feature = "v26_1")]
9500#[cfg(feature = "testgen")]
9501impl<const V: i32> Generate for EntityTeleport<V> {
9502 fn generate(g: &mut Gen) -> Self {
9503 {
9504 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
9505 let v2 = g.f64();
9506 let v3 = g.f64();
9507 let v4 = g.f64();
9508 let v5 = g.f64();
9509 let v6 = g.f64();
9510 let v7 = g.f64();
9511 let v8 = g.f32();
9512 let v9 = g.f32();
9513 let v10 = crate::defs::p775::play::clientbound::PositionUpdateRelatives(g.int_in(
9514 0,
9515 4294967295,
9516 &[],
9517 )
9518 as u32);
9519 let v11 = g.bool();
9520 Self {
9521 entity_id: v1,
9522 x: v2,
9523 y: v3,
9524 z: v4,
9525 dx: v5,
9526 dy: v6,
9527 dz: v7,
9528 yaw: v8,
9529 pitch: v9,
9530 flags: v10,
9531 on_ground: v11,
9532 }
9533 }
9534 }
9535}
9536
9537#[cfg(feature = "v26_1")]
9538#[derive(Debug, Clone, PartialEq)]
9540pub struct TestInstanceBlockStatus<const V: i32> {
9541 pub status: AnonNbt,
9543 pub size: Option<crate::defs::p775::types::Vec3i>,
9545}
9546#[cfg(feature = "v26_1")]
9547impl<const V: i32> Decode for TestInstanceBlockStatus<V> {
9548 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
9549 Ok({
9550 let v1 = AnonNbt::read(r)?;
9551 let v2 = if r.read_bool()? {
9552 Some(<crate::defs::p775::types::Vec3i as Decode>::decode(r)?)
9553 } else {
9554 None
9555 };
9556 Self {
9557 status: v1,
9558 size: v2,
9559 }
9560 })
9561 }
9562}
9563#[cfg(feature = "v26_1")]
9564impl<const V: i32> Encode for TestInstanceBlockStatus<V> {
9565 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
9566 (*self).status.write(w);
9567 match &(*self).size {
9568 Some(v1) => {
9569 w.put_u8(1);
9570 (*v1).encode(w)?;
9571 }
9572 None => w.put_u8(0),
9573 }
9574 Ok(())
9575 }
9576}
9577#[cfg(feature = "v26_1")]
9578#[cfg(feature = "testgen")]
9579impl<const V: i32> Generate for TestInstanceBlockStatus<V> {
9580 fn generate(g: &mut Gen) -> Self {
9581 {
9582 let v1 = g.anon_nbt();
9583 let v2 = if g.bool() {
9584 Some(<crate::defs::p775::types::Vec3i as Generate>::generate(g))
9585 } else {
9586 None
9587 };
9588 Self {
9589 status: v1,
9590 size: v2,
9591 }
9592 }
9593 }
9594}
9595
9596#[cfg(feature = "v26_1")]
9597#[derive(Debug, Clone, PartialEq)]
9599pub struct SetTickingState<const V: i32> {
9600 pub tick_rate: f32,
9602 pub is_frozen: bool,
9604}
9605#[cfg(feature = "v26_1")]
9606impl<const V: i32> Decode for SetTickingState<V> {
9607 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
9608 Ok({
9609 let v1 = r.read_f32()?;
9610 let v2 = r.read_bool()?;
9611 Self {
9612 tick_rate: v1,
9613 is_frozen: v2,
9614 }
9615 })
9616 }
9617}
9618#[cfg(feature = "v26_1")]
9619impl<const V: i32> Encode for SetTickingState<V> {
9620 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
9621 w.put_f32((*self).tick_rate);
9622 w.put_bool((*self).is_frozen);
9623 Ok(())
9624 }
9625}
9626#[cfg(feature = "v26_1")]
9627#[cfg(feature = "testgen")]
9628impl<const V: i32> Generate for SetTickingState<V> {
9629 fn generate(g: &mut Gen) -> Self {
9630 {
9631 let v1 = g.f32();
9632 let v2 = g.bool();
9633 Self {
9634 tick_rate: v1,
9635 is_frozen: v2,
9636 }
9637 }
9638 }
9639}
9640
9641#[cfg(feature = "v26_1")]
9642#[derive(Debug, Clone, PartialEq)]
9644pub struct StepTick<const V: i32> {
9645 pub tick_steps: i32,
9647}
9648#[cfg(feature = "v26_1")]
9649impl<const V: i32> Decode for StepTick<V> {
9650 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
9651 Ok({
9652 let v1 = r.read_varint()?;
9653 Self { tick_steps: v1 }
9654 })
9655 }
9656}
9657#[cfg(feature = "v26_1")]
9658impl<const V: i32> Encode for StepTick<V> {
9659 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
9660 w.put_varint((*self).tick_steps);
9661 Ok(())
9662 }
9663}
9664#[cfg(feature = "v26_1")]
9665#[cfg(feature = "testgen")]
9666impl<const V: i32> Generate for StepTick<V> {
9667 fn generate(g: &mut Gen) -> Self {
9668 {
9669 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
9670 Self { tick_steps: v1 }
9671 }
9672 }
9673}
9674
9675#[cfg(feature = "v26_1")]
9676#[derive(Debug, Clone, PartialEq)]
9678pub struct Transfer<const V: i32> {
9679 pub host: ByteString,
9681 pub port: i32,
9683}
9684#[cfg(feature = "v26_1")]
9685impl<const V: i32> Decode for Transfer<V> {
9686 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
9687 Ok({
9688 let v1 = r.read_string()?;
9689 let v2 = r.read_varint()?;
9690 Self { host: v1, port: v2 }
9691 })
9692 }
9693}
9694#[cfg(feature = "v26_1")]
9695impl<const V: i32> Encode for Transfer<V> {
9696 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
9697 w.put_string(&(*self).host)?;
9698 w.put_varint((*self).port);
9699 Ok(())
9700 }
9701}
9702#[cfg(feature = "v26_1")]
9703#[cfg(feature = "testgen")]
9704impl<const V: i32> Generate for Transfer<V> {
9705 fn generate(g: &mut Gen) -> Self {
9706 {
9707 let v1 = g.string();
9708 let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
9709 Self { host: v1, port: v2 }
9710 }
9711 }
9712}
9713
9714#[cfg(feature = "v26_1")]
9715#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
9717pub struct AdvancementsAdvancementMappingValueDisplayDataFlags {
9718 pub unused: u32,
9720 pub hidden: u8,
9722 pub show_toast: u8,
9724 pub has_background_texture: u8,
9726}
9727
9728#[cfg(feature = "v26_1")]
9729#[derive(Debug, Clone, PartialEq)]
9731pub struct AdvancementsAdvancementMappingValueDisplayData {
9732 pub title: AnonNbt,
9734 pub description: AnonNbt,
9736 pub icon: crate::defs::p775::types::ItemStackTemplate,
9738 pub frame_type: i32,
9740 pub flags:
9742 crate::defs::p775::play::clientbound::AdvancementsAdvancementMappingValueDisplayDataFlags,
9743 pub background_texture: Option<ByteString>,
9745 pub x_cord: f32,
9747 pub y_cord: f32,
9749}
9750
9751#[cfg(feature = "v26_1")]
9752#[derive(Debug, Clone, PartialEq)]
9754pub struct AdvancementsAdvancementMappingValue {
9755 pub parent_id: Option<ByteString>,
9757 pub display_data: Option<
9759 crate::defs::p775::play::clientbound::AdvancementsAdvancementMappingValueDisplayData,
9760 >,
9761 pub requirements: Vec<Vec<ByteString>>,
9763 pub sends_telemtry_data: bool,
9765}
9766
9767#[cfg(feature = "v26_1")]
9768#[derive(Debug, Clone, PartialEq)]
9770pub struct AdvancementsAdvancementMapping {
9771 pub key: ByteString,
9773 pub value: crate::defs::p775::play::clientbound::AdvancementsAdvancementMappingValue,
9775}
9776
9777#[cfg(feature = "v26_1")]
9778#[derive(Debug, Clone, PartialEq)]
9780pub struct Advancements<const V: i32> {
9781 pub reset: bool,
9783 pub advancement_mapping:
9785 Vec<crate::defs::p775::play::clientbound::AdvancementsAdvancementMapping>,
9786 pub identifiers: Vec<ByteString>,
9788 pub progress_mapping: Vec<crate::defs::p340::play::clientbound::AdvancementsProgressMapping>,
9790 pub show_advancements: bool,
9792}
9793#[cfg(feature = "v26_1")]
9794impl<const V: i32> Decode for Advancements<V> {
9795 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
9796 Ok({
9797 let v1 = r.read_bool()?;
9798 let v2 = {
9799 let v3 = {
9800 let c = r.read_varint()?;
9801 r.check_count(i64::from(c), 5)?
9802 };
9803 let mut v4 = Vec::with_capacity(v3.min(crate::codec::PREALLOC_LIMIT));
9804 for _ in 0..v3 {
9805 v4.push({ let v5 = r.read_string()?;let v6 = { let v7 = if r.read_bool()? { Some(r.read_string()?) } else { None };let v8 = if r.read_bool()? { Some({ let v9 = AnonNbt::read(r)?;let v10 = AnonNbt::read(r)?;let v11 = <crate::defs::p775::types::ItemStackTemplate as Decode>::decode(r)?;let v12 = r.read_varint()?;let v13 = { let v14 = u64::from(r.read_i32()? as u32); crate::defs::p775::play::clientbound::AdvancementsAdvancementMappingValueDisplayDataFlags { unused: (((v14 >> 3) & 0x1fffffff) as u32), hidden: (((v14 >> 2) & 0x1) as u8), show_toast: (((v14 >> 1) & 0x1) as u8), has_background_texture: (((v14 >> 0) & 0x1) as u8) } };let v15 = if (v13.has_background_texture == 1) { Some(r.read_string()?) } else { None };let v16 = r.read_f32()?;let v17 = r.read_f32()?; crate::defs::p775::play::clientbound::AdvancementsAdvancementMappingValueDisplayData { title: v9, description: v10, icon: v11, frame_type: v12, flags: v13, background_texture: v15, x_cord: v16, y_cord: v17 } }) } else { None };let v18 = { let v19 = { let c = r.read_varint()?; r.check_count(i64::from(c), 1)? }; let mut v20 = Vec::with_capacity(v19.min(crate::codec::PREALLOC_LIMIT)); for _ in 0..v19 { v20.push({ let v21 = { let c = r.read_varint()?; r.check_count(i64::from(c), 1)? }; let mut v22 = Vec::with_capacity(v21.min(crate::codec::PREALLOC_LIMIT)); for _ in 0..v21 { v22.push(r.read_string()?); } v22 }); } v20 };let v23 = r.read_bool()?; crate::defs::p775::play::clientbound::AdvancementsAdvancementMappingValue { parent_id: v7, display_data: v8, requirements: v18, sends_telemtry_data: v23 } }; crate::defs::p775::play::clientbound::AdvancementsAdvancementMapping { key: v5, value: v6 } });
9806 }
9807 v4
9808 };
9809 let v24 = {
9810 let v25 = {
9811 let c = r.read_varint()?;
9812 r.check_count(i64::from(c), 1)?
9813 };
9814 let mut v26 = Vec::with_capacity(v25.min(crate::codec::PREALLOC_LIMIT));
9815 for _ in 0..v25 {
9816 v26.push(r.read_string()?);
9817 }
9818 v26
9819 };
9820 let v27 = {
9821 let v28 = {
9822 let c = r.read_varint()?;
9823 r.check_count(i64::from(c), 2)?
9824 };
9825 let mut v29 = Vec::with_capacity(v28.min(crate::codec::PREALLOC_LIMIT));
9826 for _ in 0..v28 {
9827 v29.push({ let v30 = r.read_string()?;let v31 = { let v32 = { let c = r.read_varint()?; r.check_count(i64::from(c), 2)? }; let mut v33 = Vec::with_capacity(v32.min(crate::codec::PREALLOC_LIMIT)); for _ in 0..v32 { v33.push({ let v34 = r.read_string()?;let v35 = if r.read_bool()? { Some(r.read_i64()?) } else { None }; crate::defs::p340::play::clientbound::AdvancementsProgressMappingValue { criterion_identifier: v34, criterion_progress: v35 } }); } v33 }; crate::defs::p340::play::clientbound::AdvancementsProgressMapping { key: v30, value: v31 } });
9828 }
9829 v29
9830 };
9831 let v36 = r.read_bool()?;
9832 Self {
9833 reset: v1,
9834 advancement_mapping: v2,
9835 identifiers: v24,
9836 progress_mapping: v27,
9837 show_advancements: v36,
9838 }
9839 })
9840 }
9841}
9842#[cfg(feature = "v26_1")]
9843impl<const V: i32> Encode for Advancements<V> {
9844 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
9845 w.put_bool((*self).reset);
9846 w.put_len_varint((*self).advancement_mapping.len())?;
9847 for v1 in (*self).advancement_mapping.iter() {
9848 w.put_string(&(*v1).key)?;
9849 match &(*v1).value.parent_id {
9850 Some(v2) => {
9851 w.put_u8(1);
9852 w.put_string(&(*v2))?;
9853 }
9854 None => w.put_u8(0),
9855 }
9856 match &(*v1).value.display_data {
9857 Some(v3) => {
9858 w.put_u8(1);
9859 (*v3).title.write(w);
9860 (*v3).description.write(w);
9861 (*v3).icon.encode(w)?;
9862 w.put_varint((*v3).frame_type);
9863 {
9864 let mut bits: u64 = 0;
9865 {
9866 let x = i128::from((*v3).flags.unused);
9867 if x < 0 || x > 536870911 {
9868 return Err(EncodeError::OutOfRange("unused"));
9869 }
9870 bits = (bits << 29) | ((x as u64) & 0x1fffffff);
9871 }
9872 {
9873 let x = i128::from((*v3).flags.hidden);
9874 if x < 0 || x > 1 {
9875 return Err(EncodeError::OutOfRange("hidden"));
9876 }
9877 bits = (bits << 1) | ((x as u64) & 0x1);
9878 }
9879 {
9880 let x = i128::from((*v3).flags.show_toast);
9881 if x < 0 || x > 1 {
9882 return Err(EncodeError::OutOfRange("show_toast"));
9883 }
9884 bits = (bits << 1) | ((x as u64) & 0x1);
9885 }
9886 {
9887 let x = i128::from((*v3).flags.has_background_texture);
9888 if x < 0 || x > 1 {
9889 return Err(EncodeError::OutOfRange("has_background_texture"));
9890 }
9891 bits = (bits << 1) | ((x as u64) & 0x1);
9892 }
9893 w.put_u32(bits as u32);
9894 }
9895 match (
9896 &(*v3).background_texture,
9897 ((*v3).flags.has_background_texture == 1),
9898 ) {
9899 (Some(v4), true) => {
9900 w.put_string(&(*v4))?;
9901 }
9902 (None, false) => {}
9903 _ => {
9904 return Err(EncodeError::SwitchMismatch(
9905 "play.clientbound.advancements.advancementMapping.value.displayData.backgroundTexture",
9906 ));
9907 }
9908 }
9909 w.put_f32((*v3).x_cord);
9910 w.put_f32((*v3).y_cord);
9911 }
9912 None => w.put_u8(0),
9913 }
9914 w.put_len_varint((*v1).value.requirements.len())?;
9915 for v5 in (*v1).value.requirements.iter() {
9916 w.put_len_varint((*v5).len())?;
9917 for v6 in (*v5).iter() {
9918 w.put_string(&(*v6))?;
9919 }
9920 }
9921 w.put_bool((*v1).value.sends_telemtry_data);
9922 }
9923 w.put_len_varint((*self).identifiers.len())?;
9924 for v7 in (*self).identifiers.iter() {
9925 w.put_string(&(*v7))?;
9926 }
9927 w.put_len_varint((*self).progress_mapping.len())?;
9928 for v8 in (*self).progress_mapping.iter() {
9929 w.put_string(&(*v8).key)?;
9930 w.put_len_varint((*v8).value.len())?;
9931 for v9 in (*v8).value.iter() {
9932 w.put_string(&(*v9).criterion_identifier)?;
9933 match &(*v9).criterion_progress {
9934 Some(v10) => {
9935 w.put_u8(1);
9936 w.put_i64((*v10));
9937 }
9938 None => w.put_u8(0),
9939 }
9940 }
9941 }
9942 w.put_bool((*self).show_advancements);
9943 Ok(())
9944 }
9945}
9946#[cfg(feature = "v26_1")]
9947#[cfg(feature = "testgen")]
9948impl<const V: i32> Generate for Advancements<V> {
9949 fn generate(g: &mut Gen) -> Self {
9950 {
9951 let v1 = g.bool();
9952 let v2 = {
9953 let v3 = g.count();
9954 let mut v4 = Vec::with_capacity(v3.min(crate::codec::PREALLOC_LIMIT));
9955 for _ in 0..v3 {
9956 v4.push({ let v5 = g.string();let v6 = { let v7 = if g.bool() { Some(g.string()) } else { None };let v8 = if g.bool() { Some({ let v9 = g.anon_nbt();let v10 = g.anon_nbt();let v11 = <crate::defs::p775::types::ItemStackTemplate as Generate>::generate(g);let v12 = (g.int_in(-2147483648, 2147483647, &[]) as i32);let v13 = { crate::defs::p775::play::clientbound::AdvancementsAdvancementMappingValueDisplayDataFlags { unused: (g.int_in(0, 536870911, &[]) as u32), hidden: (g.int_in(0, 1, &[]) as u8), show_toast: (g.int_in(0, 1, &[]) as u8), has_background_texture: (g.int_in(0, 1, &[1]) as u8) } };let v15 = if (v13.has_background_texture == 1) { Some(g.string()) } else { None };let v16 = g.f32();let v17 = g.f32(); crate::defs::p775::play::clientbound::AdvancementsAdvancementMappingValueDisplayData { title: v9, description: v10, icon: v11, frame_type: v12, flags: v13, background_texture: v15, x_cord: v16, y_cord: v17 } }) } else { None };let v18 = { let v19 = g.count(); let mut v20 = Vec::with_capacity(v19.min(crate::codec::PREALLOC_LIMIT)); for _ in 0..v19 { v20.push({ let v21 = g.count(); let mut v22 = Vec::with_capacity(v21.min(crate::codec::PREALLOC_LIMIT)); for _ in 0..v21 { v22.push(g.string()); } v22 }); } v20 };let v23 = g.bool(); crate::defs::p775::play::clientbound::AdvancementsAdvancementMappingValue { parent_id: v7, display_data: v8, requirements: v18, sends_telemtry_data: v23 } }; crate::defs::p775::play::clientbound::AdvancementsAdvancementMapping { key: v5, value: v6 } });
9957 }
9958 v4
9959 };
9960 let v24 = {
9961 let v25 = g.count();
9962 let mut v26 = Vec::with_capacity(v25.min(crate::codec::PREALLOC_LIMIT));
9963 for _ in 0..v25 {
9964 v26.push(g.string());
9965 }
9966 v26
9967 };
9968 let v27 = {
9969 let v28 = g.count();
9970 let mut v29 = Vec::with_capacity(v28.min(crate::codec::PREALLOC_LIMIT));
9971 for _ in 0..v28 {
9972 v29.push({ let v30 = g.string();let v31 = { let v32 = g.count(); let mut v33 = Vec::with_capacity(v32.min(crate::codec::PREALLOC_LIMIT)); for _ in 0..v32 { v33.push({ let v34 = g.string();let v35 = if g.bool() { Some(g.i64()) } else { None }; crate::defs::p340::play::clientbound::AdvancementsProgressMappingValue { criterion_identifier: v34, criterion_progress: v35 } }); } v33 }; crate::defs::p340::play::clientbound::AdvancementsProgressMapping { key: v30, value: v31 } });
9973 }
9974 v29
9975 };
9976 let v36 = g.bool();
9977 Self {
9978 reset: v1,
9979 advancement_mapping: v2,
9980 identifiers: v24,
9981 progress_mapping: v27,
9982 show_advancements: v36,
9983 }
9984 }
9985 }
9986}
9987
9988#[cfg(feature = "v26_1")]
9989#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
9991pub struct EntityUpdateAttributesPropertiesKey(pub i32);
9992#[cfg(feature = "v26_1")]
9993impl EntityUpdateAttributesPropertiesKey {
9994 pub const GENERIC_ARMOR: Self = Self(0);
9996 pub const GENERIC_ARMOR_TOUGHNESS: Self = Self(1);
9998 pub const GENERIC_ATTACK_DAMAGE: Self = Self(2);
10000 pub const GENERIC_ATTACK_KNOCKBACK: Self = Self(3);
10002 pub const GENERIC_ATTACK_SPEED: Self = Self(4);
10004 pub const PLAYER_BLOCK_BREAK_SPEED: Self = Self(5);
10006 pub const PLAYER_BLOCK_INTERACTION_RANGE: Self = Self(6);
10008 pub const BURNING_TIME: Self = Self(7);
10010 pub const CAMERA_DISTANCE: Self = Self(8);
10012 pub const EXPLOSION_KNOCKBACK_RESISTANCE: Self = Self(9);
10014 pub const PLAYER_ENTITY_INTERACTION_RANGE: Self = Self(10);
10016 pub const GENERIC_FALL_DAMAGE_MULTIPLIER: Self = Self(11);
10018 pub const GENERIC_FLYING_SPEED: Self = Self(12);
10020 pub const GENERIC_FOLLOW_RANGE: Self = Self(13);
10022 pub const GENERIC_GRAVITY: Self = Self(14);
10024 pub const GENERIC_JUMP_STRENGTH: Self = Self(15);
10026 pub const GENERIC_KNOCKBACK_RESISTANCE: Self = Self(16);
10028 pub const GENERIC_LUCK: Self = Self(17);
10030 pub const GENERIC_MAX_ABSORPTION: Self = Self(18);
10032 pub const GENERIC_MAX_HEALTH: Self = Self(19);
10034 pub const MINING_EFFICIENCY: Self = Self(20);
10036 pub const MOVEMENT_EFFICIENCY: Self = Self(21);
10038 pub const GENERIC_MOVEMENT_SPEED: Self = Self(22);
10040 pub const OXYGEN_BONUS: Self = Self(23);
10042 pub const GENERIC_SAFE_FALL_DISTANCE: Self = Self(24);
10044 pub const GENERIC_SCALE: Self = Self(25);
10046 pub const SNEAKING_SPEED: Self = Self(26);
10048 pub const ZOMBIE_SPAWN_REINFORCEMENTS: Self = Self(27);
10050 pub const GENERIC_STEP_HEIGHT: Self = Self(28);
10052 pub const SUBMERGED_MINING_SPEED: Self = Self(29);
10054 pub const SWEEPING_DAMAGE_RATIO: Self = Self(30);
10056 pub const TEMPT_RANGE: Self = Self(31);
10058 pub const WATER_MOVEMENT_EFFICIENCY: Self = Self(32);
10060 pub const WAYPOINT_TRANSMIT_RANGE: Self = Self(33);
10062 pub const WAYPOINT_RECEIVE_RANGE: Self = Self(34);
10064 pub const fn name(self) -> Option<&'static str> {
10066 match self.0 {
10067 0 => Some("generic.armor"),
10068 1 => Some("generic.armor_toughness"),
10069 2 => Some("generic.attack_damage"),
10070 3 => Some("generic.attack_knockback"),
10071 4 => Some("generic.attack_speed"),
10072 5 => Some("player.block_break_speed"),
10073 6 => Some("player.block_interaction_range"),
10074 7 => Some("burning_time"),
10075 8 => Some("camera_distance"),
10076 9 => Some("explosion_knockback_resistance"),
10077 10 => Some("player.entity_interaction_range"),
10078 11 => Some("generic.fall_damage_multiplier"),
10079 12 => Some("generic.flying_speed"),
10080 13 => Some("generic.follow_range"),
10081 14 => Some("generic.gravity"),
10082 15 => Some("generic.jump_strength"),
10083 16 => Some("generic.knockback_resistance"),
10084 17 => Some("generic.luck"),
10085 18 => Some("generic.max_absorption"),
10086 19 => Some("generic.max_health"),
10087 20 => Some("mining_efficiency"),
10088 21 => Some("movement_efficiency"),
10089 22 => Some("generic.movement_speed"),
10090 23 => Some("oxygen_bonus"),
10091 24 => Some("generic.safe_fall_distance"),
10092 25 => Some("generic.scale"),
10093 26 => Some("sneaking_speed"),
10094 27 => Some("zombie.spawn_reinforcements"),
10095 28 => Some("generic.step_height"),
10096 29 => Some("submerged_mining_speed"),
10097 30 => Some("sweeping_damage_ratio"),
10098 31 => Some("tempt_range"),
10099 32 => Some("water_movement_efficiency"),
10100 33 => Some("waypoint_transmit_range"),
10101 34 => Some("waypoint_receive_range"),
10102 _ => None,
10103 }
10104 }
10105}
10106#[cfg(feature = "v26_1")]
10107impl std::fmt::Debug for EntityUpdateAttributesPropertiesKey {
10108 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10109 match self.name() {
10110 Some(n) => write!(f, "EntityUpdateAttributesPropertiesKey::{n}"),
10111 None => write!(f, "EntityUpdateAttributesPropertiesKey({})", self.0),
10112 }
10113 }
10114}
10115
10116#[cfg(feature = "v26_1")]
10117#[derive(Debug, Clone, PartialEq)]
10119pub struct EntityUpdateAttributesPropertiesModifiers {
10120 pub uuid: ByteString,
10122 pub amount: f64,
10124 pub operation: i8,
10126}
10127
10128#[cfg(feature = "v26_1")]
10129#[derive(Debug, Clone, PartialEq)]
10131pub struct EntityUpdateAttributesProperties {
10132 pub key: crate::defs::p775::play::clientbound::EntityUpdateAttributesPropertiesKey,
10134 pub value: f64,
10136 pub modifiers:
10138 Vec<crate::defs::p775::play::clientbound::EntityUpdateAttributesPropertiesModifiers>,
10139}
10140
10141#[cfg(feature = "v26_1")]
10142#[derive(Debug, Clone, PartialEq)]
10144pub struct EntityUpdateAttributes<const V: i32> {
10145 pub entity_id: i32,
10147 pub properties: Vec<crate::defs::p775::play::clientbound::EntityUpdateAttributesProperties>,
10149}
10150#[cfg(feature = "v26_1")]
10151impl<const V: i32> Decode for EntityUpdateAttributes<V> {
10152 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
10153 Ok({
10154 let v1 = r.read_varint()?;
10155 let v2 = {
10156 let v3 = {
10157 let c = r.read_varint()?;
10158 r.check_count(i64::from(c), 10)?
10159 };
10160 let mut v4 = Vec::with_capacity(v3.min(crate::codec::PREALLOC_LIMIT));
10161 for _ in 0..v3 {
10162 v4.push({ let v5 = crate::defs::p775::play::clientbound::EntityUpdateAttributesPropertiesKey(r.read_varint()?);let v6 = r.read_f64()?;let v7 = { let v8 = { let c = r.read_varint()?; r.check_count(i64::from(c), 10)? }; let mut v9 = Vec::with_capacity(v8.min(crate::codec::PREALLOC_LIMIT)); for _ in 0..v8 { v9.push({ let v10 = r.read_string()?;let v11 = r.read_f64()?;let v12 = r.read_i8()?; crate::defs::p775::play::clientbound::EntityUpdateAttributesPropertiesModifiers { uuid: v10, amount: v11, operation: v12 } }); } v9 }; crate::defs::p775::play::clientbound::EntityUpdateAttributesProperties { key: v5, value: v6, modifiers: v7 } });
10163 }
10164 v4
10165 };
10166 Self {
10167 entity_id: v1,
10168 properties: v2,
10169 }
10170 })
10171 }
10172}
10173#[cfg(feature = "v26_1")]
10174impl<const V: i32> Encode for EntityUpdateAttributes<V> {
10175 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
10176 w.put_varint((*self).entity_id);
10177 w.put_len_varint((*self).properties.len())?;
10178 for v1 in (*self).properties.iter() {
10179 w.put_varint((*v1).key.0);
10180 w.put_f64((*v1).value);
10181 w.put_len_varint((*v1).modifiers.len())?;
10182 for v2 in (*v1).modifiers.iter() {
10183 w.put_string(&(*v2).uuid)?;
10184 w.put_f64((*v2).amount);
10185 w.put_i8((*v2).operation);
10186 }
10187 }
10188 Ok(())
10189 }
10190}
10191#[cfg(feature = "v26_1")]
10192#[cfg(feature = "testgen")]
10193impl<const V: i32> Generate for EntityUpdateAttributes<V> {
10194 fn generate(g: &mut Gen) -> Self {
10195 {
10196 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
10197 let v2 = {
10198 let v3 = g.count();
10199 let mut v4 = Vec::with_capacity(v3.min(crate::codec::PREALLOC_LIMIT));
10200 for _ in 0..v3 {
10201 v4.push({ let v5 = crate::defs::p775::play::clientbound::EntityUpdateAttributesPropertiesKey(g.int_in(-2147483648, 2147483647, &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34]) as i32);let v6 = g.f64();let v7 = { let v8 = g.count(); let mut v9 = Vec::with_capacity(v8.min(crate::codec::PREALLOC_LIMIT)); for _ in 0..v8 { v9.push({ let v10 = g.string();let v11 = g.f64();let v12 = (g.int_in(-128, 127, &[]) as i8); crate::defs::p775::play::clientbound::EntityUpdateAttributesPropertiesModifiers { uuid: v10, amount: v11, operation: v12 } }); } v9 }; crate::defs::p775::play::clientbound::EntityUpdateAttributesProperties { key: v5, value: v6, modifiers: v7 } });
10202 }
10203 v4
10204 };
10205 Self {
10206 entity_id: v1,
10207 properties: v2,
10208 }
10209 }
10210 }
10211}
10212
10213#[cfg(feature = "v26_1")]
10214#[derive(Debug, Clone, PartialEq)]
10216pub struct EntityEffect<const V: i32> {
10217 pub entity_id: i32,
10219 pub effect_id: i32,
10221 pub amplifier: i32,
10223 pub duration: i32,
10225 pub flags: u8,
10227}
10228#[cfg(feature = "v26_1")]
10229impl<const V: i32> Decode for EntityEffect<V> {
10230 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
10231 Ok({
10232 let v1 = r.read_varint()?;
10233 let v2 = r.read_varint()?;
10234 let v3 = r.read_varint()?;
10235 let v4 = r.read_varint()?;
10236 let v5 = r.read_u8()?;
10237 Self {
10238 entity_id: v1,
10239 effect_id: v2,
10240 amplifier: v3,
10241 duration: v4,
10242 flags: v5,
10243 }
10244 })
10245 }
10246}
10247#[cfg(feature = "v26_1")]
10248impl<const V: i32> Encode for EntityEffect<V> {
10249 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
10250 w.put_varint((*self).entity_id);
10251 w.put_varint((*self).effect_id);
10252 w.put_varint((*self).amplifier);
10253 w.put_varint((*self).duration);
10254 w.put_u8((*self).flags);
10255 Ok(())
10256 }
10257}
10258#[cfg(feature = "v26_1")]
10259#[cfg(feature = "testgen")]
10260impl<const V: i32> Generate for EntityEffect<V> {
10261 fn generate(g: &mut Gen) -> Self {
10262 {
10263 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
10264 let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
10265 let v3 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
10266 let v4 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
10267 let v5 = (g.int_in(0, 255, &[]) as u8);
10268 Self {
10269 entity_id: v1,
10270 effect_id: v2,
10271 amplifier: v3,
10272 duration: v4,
10273 flags: v5,
10274 }
10275 }
10276 }
10277}
10278
10279#[cfg(feature = "v26_1")]
10280#[derive(Debug, Clone, PartialEq)]
10282pub struct DeclareRecipesRecipes {
10283 pub name: ByteString,
10285 pub items: Vec<i32>,
10287}
10288
10289#[cfg(feature = "v26_1")]
10290#[derive(Debug, Clone, PartialEq)]
10292pub struct DeclareRecipesStoneCutterRecipes {
10293 pub input: HolderSet,
10295 pub slot_display: crate::defs::p775::play::clientbound::SlotDisplay,
10297}
10298
10299#[cfg(feature = "v26_1")]
10300#[derive(Debug, Clone, PartialEq)]
10302pub struct DeclareRecipes<const V: i32> {
10303 pub recipes: Vec<crate::defs::p775::play::clientbound::DeclareRecipesRecipes>,
10305 pub stone_cutter_recipes:
10307 Vec<crate::defs::p775::play::clientbound::DeclareRecipesStoneCutterRecipes>,
10308}
10309#[cfg(feature = "v26_1")]
10310impl<const V: i32> Decode for DeclareRecipes<V> {
10311 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
10312 Ok({
10313 let v1 = {
10314 let v2 = {
10315 let c = r.read_varint()?;
10316 r.check_count(i64::from(c), 2)?
10317 };
10318 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
10319 for _ in 0..v2 {
10320 v3.push({
10321 let v4 = r.read_string()?;
10322 let v5 = {
10323 let v6 = {
10324 let c = r.read_varint()?;
10325 r.check_count(i64::from(c), 1)?
10326 };
10327 let mut v7 = Vec::with_capacity(v6.min(crate::codec::PREALLOC_LIMIT));
10328 for _ in 0..v6 {
10329 v7.push(r.read_varint()?);
10330 }
10331 v7
10332 };
10333 crate::defs::p775::play::clientbound::DeclareRecipesRecipes {
10334 name: v4,
10335 items: v5,
10336 }
10337 });
10338 }
10339 v3
10340 };
10341 let v8 = {
10342 let v9 = {
10343 let c = r.read_varint()?;
10344 r.check_count(i64::from(c), 2)?
10345 };
10346 let mut v10 = Vec::with_capacity(v9.min(crate::codec::PREALLOC_LIMIT));
10347 for _ in 0..v9 {
10348 v10.push({
10349 let v11 = <HolderSet as Decode>::decode(r)?;
10350 let v12 =
10351 <crate::defs::p775::play::clientbound::SlotDisplay as Decode>::decode(
10352 r,
10353 )?;
10354 crate::defs::p775::play::clientbound::DeclareRecipesStoneCutterRecipes {
10355 input: v11,
10356 slot_display: v12,
10357 }
10358 });
10359 }
10360 v10
10361 };
10362 Self {
10363 recipes: v1,
10364 stone_cutter_recipes: v8,
10365 }
10366 })
10367 }
10368}
10369#[cfg(feature = "v26_1")]
10370impl<const V: i32> Encode for DeclareRecipes<V> {
10371 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
10372 w.put_len_varint((*self).recipes.len())?;
10373 for v1 in (*self).recipes.iter() {
10374 w.put_string(&(*v1).name)?;
10375 w.put_len_varint((*v1).items.len())?;
10376 for v2 in (*v1).items.iter() {
10377 w.put_varint((*v2));
10378 }
10379 }
10380 w.put_len_varint((*self).stone_cutter_recipes.len())?;
10381 for v3 in (*self).stone_cutter_recipes.iter() {
10382 (*v3).input.encode(w)?;
10383 (*v3).slot_display.encode(w)?;
10384 }
10385 Ok(())
10386 }
10387}
10388#[cfg(feature = "v26_1")]
10389#[cfg(feature = "testgen")]
10390impl<const V: i32> Generate for DeclareRecipes<V> {
10391 fn generate(g: &mut Gen) -> Self {
10392 {
10393 let v1 = {
10394 let v2 = g.count();
10395 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
10396 for _ in 0..v2 {
10397 v3.push({
10398 let v4 = g.string();
10399 let v5 = {
10400 let v6 = g.count();
10401 let mut v7 = Vec::with_capacity(v6.min(crate::codec::PREALLOC_LIMIT));
10402 for _ in 0..v6 {
10403 v7.push((g.int_in(-2147483648, 2147483647, &[]) as i32));
10404 }
10405 v7
10406 };
10407 crate::defs::p775::play::clientbound::DeclareRecipesRecipes {
10408 name: v4,
10409 items: v5,
10410 }
10411 });
10412 }
10413 v3
10414 };
10415 let v8 = {
10416 let v9 = g.count();
10417 let mut v10 = Vec::with_capacity(v9.min(crate::codec::PREALLOC_LIMIT));
10418 for _ in 0..v9 {
10419 v10.push({ let v11 = <HolderSet as Generate>::generate(g);let v12 = <crate::defs::p775::play::clientbound::SlotDisplay as Generate>::generate(g); crate::defs::p775::play::clientbound::DeclareRecipesStoneCutterRecipes { input: v11, slot_display: v12 } });
10420 }
10421 v10
10422 };
10423 Self {
10424 recipes: v1,
10425 stone_cutter_recipes: v8,
10426 }
10427 }
10428 }
10429}
10430
10431#[cfg(feature = "v26_1")]
10432#[derive(Debug, Clone, PartialEq)]
10434pub struct TagsTags {
10435 pub tag_type: ByteString,
10437 pub tags: Vec<crate::defs::p754::types::Tags>,
10439}
10440
10441#[cfg(feature = "v26_1")]
10442#[derive(Debug, Clone, PartialEq)]
10444pub struct Tags<const V: i32> {
10445 pub tags: Vec<crate::defs::p775::play::clientbound::TagsTags>,
10447}
10448#[cfg(feature = "v26_1")]
10449impl<const V: i32> Decode for Tags<V> {
10450 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
10451 Ok({
10452 let v1 = {
10453 let v2 = {
10454 let c = r.read_varint()?;
10455 r.check_count(i64::from(c), 2)?
10456 };
10457 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
10458 for _ in 0..v2 {
10459 v3.push({
10460 let v4 = r.read_string()?;
10461 let v5 = {
10462 let v6 = {
10463 let c = r.read_varint()?;
10464 r.check_count(i64::from(c), 2)?
10465 };
10466 let mut v7 = Vec::with_capacity(v6.min(crate::codec::PREALLOC_LIMIT));
10467 for _ in 0..v6 {
10468 v7.push({
10469 let v8 = r.read_string()?;
10470 let v9 = {
10471 let v10 = {
10472 let c = r.read_varint()?;
10473 r.check_count(i64::from(c), 1)?
10474 };
10475 let mut v11 = Vec::with_capacity(
10476 v10.min(crate::codec::PREALLOC_LIMIT),
10477 );
10478 for _ in 0..v10 {
10479 v11.push(r.read_varint()?);
10480 }
10481 v11
10482 };
10483 crate::defs::p754::types::Tags {
10484 tag_name: v8,
10485 entries: v9,
10486 }
10487 });
10488 }
10489 v7
10490 };
10491 crate::defs::p775::play::clientbound::TagsTags {
10492 tag_type: v4,
10493 tags: v5,
10494 }
10495 });
10496 }
10497 v3
10498 };
10499 Self { tags: v1 }
10500 })
10501 }
10502}
10503#[cfg(feature = "v26_1")]
10504impl<const V: i32> Encode for Tags<V> {
10505 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
10506 w.put_len_varint((*self).tags.len())?;
10507 for v1 in (*self).tags.iter() {
10508 w.put_string(&(*v1).tag_type)?;
10509 w.put_len_varint((*v1).tags.len())?;
10510 for v2 in (*v1).tags.iter() {
10511 w.put_string(&(*v2).tag_name)?;
10512 w.put_len_varint((*v2).entries.len())?;
10513 for v3 in (*v2).entries.iter() {
10514 w.put_varint((*v3));
10515 }
10516 }
10517 }
10518 Ok(())
10519 }
10520}
10521#[cfg(feature = "v26_1")]
10522#[cfg(feature = "testgen")]
10523impl<const V: i32> Generate for Tags<V> {
10524 fn generate(g: &mut Gen) -> Self {
10525 {
10526 let v1 = {
10527 let v2 = g.count();
10528 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
10529 for _ in 0..v2 {
10530 v3.push({
10531 let v4 = g.string();
10532 let v5 = {
10533 let v6 = g.count();
10534 let mut v7 = Vec::with_capacity(v6.min(crate::codec::PREALLOC_LIMIT));
10535 for _ in 0..v6 {
10536 v7.push({
10537 let v8 = g.string();
10538 let v9 = {
10539 let v10 = g.count();
10540 let mut v11 = Vec::with_capacity(
10541 v10.min(crate::codec::PREALLOC_LIMIT),
10542 );
10543 for _ in 0..v10 {
10544 v11.push(
10545 (g.int_in(-2147483648, 2147483647, &[]) as i32),
10546 );
10547 }
10548 v11
10549 };
10550 crate::defs::p754::types::Tags {
10551 tag_name: v8,
10552 entries: v9,
10553 }
10554 });
10555 }
10556 v7
10557 };
10558 crate::defs::p775::play::clientbound::TagsTags {
10559 tag_type: v4,
10560 tags: v5,
10561 }
10562 });
10563 }
10564 v3
10565 };
10566 Self { tags: v1 }
10567 }
10568 }
10569}
10570
10571#[cfg(feature = "v26_1")]
10572#[derive(Debug, Clone, PartialEq)]
10574pub struct SetProjectilePower<const V: i32> {
10575 pub id: i32,
10577 pub acceleration_power: f64,
10579}
10580#[cfg(feature = "v26_1")]
10581impl<const V: i32> Decode for SetProjectilePower<V> {
10582 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
10583 Ok({
10584 let v1 = r.read_varint()?;
10585 let v2 = r.read_f64()?;
10586 Self {
10587 id: v1,
10588 acceleration_power: v2,
10589 }
10590 })
10591 }
10592}
10593#[cfg(feature = "v26_1")]
10594impl<const V: i32> Encode for SetProjectilePower<V> {
10595 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
10596 w.put_varint((*self).id);
10597 w.put_f64((*self).acceleration_power);
10598 Ok(())
10599 }
10600}
10601#[cfg(feature = "v26_1")]
10602#[cfg(feature = "testgen")]
10603impl<const V: i32> Generate for SetProjectilePower<V> {
10604 fn generate(g: &mut Gen) -> Self {
10605 {
10606 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
10607 let v2 = g.f64();
10608 Self {
10609 id: v1,
10610 acceleration_power: v2,
10611 }
10612 }
10613 }
10614}
10615
10616#[cfg(feature = "v26_1")]
10617#[derive(Debug, Clone, PartialEq)]
10619pub struct CustomReportDetailsDetails {
10620 pub key: ByteString,
10622 pub value: ByteString,
10624}
10625
10626#[cfg(feature = "v26_1")]
10627#[derive(Debug, Clone, PartialEq)]
10629pub struct CustomReportDetails<const V: i32> {
10630 pub details: Vec<crate::defs::p775::play::clientbound::CustomReportDetailsDetails>,
10632}
10633#[cfg(feature = "v26_1")]
10634impl<const V: i32> Decode for CustomReportDetails<V> {
10635 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
10636 Ok({
10637 let v1 = {
10638 let v2 = {
10639 let c = r.read_varint()?;
10640 r.check_count(i64::from(c), 2)?
10641 };
10642 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
10643 for _ in 0..v2 {
10644 v3.push({
10645 let v4 = r.read_string()?;
10646 let v5 = r.read_string()?;
10647 crate::defs::p775::play::clientbound::CustomReportDetailsDetails {
10648 key: v4,
10649 value: v5,
10650 }
10651 });
10652 }
10653 v3
10654 };
10655 Self { details: v1 }
10656 })
10657 }
10658}
10659#[cfg(feature = "v26_1")]
10660impl<const V: i32> Encode for CustomReportDetails<V> {
10661 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
10662 w.put_len_varint((*self).details.len())?;
10663 for v1 in (*self).details.iter() {
10664 w.put_string(&(*v1).key)?;
10665 w.put_string(&(*v1).value)?;
10666 }
10667 Ok(())
10668 }
10669}
10670#[cfg(feature = "v26_1")]
10671#[cfg(feature = "testgen")]
10672impl<const V: i32> Generate for CustomReportDetails<V> {
10673 fn generate(g: &mut Gen) -> Self {
10674 {
10675 let v1 = {
10676 let v2 = g.count();
10677 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
10678 for _ in 0..v2 {
10679 v3.push({
10680 let v4 = g.string();
10681 let v5 = g.string();
10682 crate::defs::p775::play::clientbound::CustomReportDetailsDetails {
10683 key: v4,
10684 value: v5,
10685 }
10686 });
10687 }
10688 v3
10689 };
10690 Self { details: v1 }
10691 }
10692 }
10693}
10694
10695#[cfg(feature = "v26_1")]
10696#[derive(Debug, Clone, PartialEq)]
10698pub struct ServerLinksLinks {
10699 pub has_known_type: bool,
10701 pub known_type: Option<crate::defs::p775::types::ServerLinkType>,
10703 pub unknown_type: Option<AnonNbt>,
10705 pub link: ByteString,
10707}
10708
10709#[cfg(feature = "v26_1")]
10710#[derive(Debug, Clone, PartialEq)]
10712pub struct ServerLinks<const V: i32> {
10713 pub links: Vec<crate::defs::p775::play::clientbound::ServerLinksLinks>,
10715}
10716#[cfg(feature = "v26_1")]
10717impl<const V: i32> Decode for ServerLinks<V> {
10718 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
10719 Ok({
10720 let v1 = {
10721 let v2 = {
10722 let c = r.read_varint()?;
10723 r.check_count(i64::from(c), 2)?
10724 };
10725 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
10726 for _ in 0..v2 {
10727 v3.push({
10728 let v4 = r.read_bool()?;
10729 let v5 = if v4 {
10730 Some(crate::defs::p775::types::ServerLinkType(r.read_varint()?))
10731 } else {
10732 None
10733 };
10734 let v6 = if (!v4) { Some(AnonNbt::read(r)?) } else { None };
10735 let v7 = r.read_string()?;
10736 crate::defs::p775::play::clientbound::ServerLinksLinks {
10737 has_known_type: v4,
10738 known_type: v5,
10739 unknown_type: v6,
10740 link: v7,
10741 }
10742 });
10743 }
10744 v3
10745 };
10746 Self { links: v1 }
10747 })
10748 }
10749}
10750#[cfg(feature = "v26_1")]
10751impl<const V: i32> Encode for ServerLinks<V> {
10752 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
10753 w.put_len_varint((*self).links.len())?;
10754 for v1 in (*self).links.iter() {
10755 w.put_bool((*v1).has_known_type);
10756 match (&(*v1).known_type, (*v1).has_known_type) {
10757 (Some(v2), true) => {
10758 w.put_varint((*v2).0);
10759 }
10760 (None, false) => {}
10761 _ => {
10762 return Err(EncodeError::SwitchMismatch(
10763 "play.clientbound.server_links.links.knownType",
10764 ));
10765 }
10766 }
10767 match (&(*v1).unknown_type, (!(*v1).has_known_type)) {
10768 (Some(v3), true) => {
10769 (*v3).write(w);
10770 }
10771 (None, false) => {}
10772 _ => {
10773 return Err(EncodeError::SwitchMismatch(
10774 "play.clientbound.server_links.links.unknownType",
10775 ));
10776 }
10777 }
10778 w.put_string(&(*v1).link)?;
10779 }
10780 Ok(())
10781 }
10782}
10783#[cfg(feature = "v26_1")]
10784#[cfg(feature = "testgen")]
10785impl<const V: i32> Generate for ServerLinks<V> {
10786 fn generate(g: &mut Gen) -> Self {
10787 {
10788 let v1 = {
10789 let v2 = g.count();
10790 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
10791 for _ in 0..v2 {
10792 v3.push({
10793 let v4 = g.bool();
10794 let v5 = if v4 {
10795 Some(crate::defs::p775::types::ServerLinkType(g.int_in(
10796 -2147483648,
10797 2147483647,
10798 &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
10799 )
10800 as i32))
10801 } else {
10802 None
10803 };
10804 let v6 = if (!v4) { Some(g.anon_nbt()) } else { None };
10805 let v7 = g.string();
10806 crate::defs::p775::play::clientbound::ServerLinksLinks {
10807 has_known_type: v4,
10808 known_type: v5,
10809 unknown_type: v6,
10810 link: v7,
10811 }
10812 });
10813 }
10814 v3
10815 };
10816 Self { links: v1 }
10817 }
10818 }
10819}
10820
10821#[cfg(feature = "v26_1")]
10822#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
10824pub struct TrackedWaypointOperation(pub i32);
10825#[cfg(feature = "v26_1")]
10826impl TrackedWaypointOperation {
10827 pub const TRACK: Self = Self(0);
10829 pub const UNTRACK: Self = Self(1);
10831 pub const UPDATE: Self = Self(2);
10833 pub const fn name(self) -> Option<&'static str> {
10835 match self.0 {
10836 0 => Some("track"),
10837 1 => Some("untrack"),
10838 2 => Some("update"),
10839 _ => None,
10840 }
10841 }
10842}
10843#[cfg(feature = "v26_1")]
10844impl std::fmt::Debug for TrackedWaypointOperation {
10845 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10846 match self.name() {
10847 Some(n) => write!(f, "TrackedWaypointOperation::{n}"),
10848 None => write!(f, "TrackedWaypointOperation({})", self.0),
10849 }
10850 }
10851}
10852
10853#[cfg(feature = "v26_1")]
10854#[derive(Debug, Clone, PartialEq)]
10856pub struct TrackedWaypointWaypointBodyTrue {
10857 pub uuid: Uuid,
10859}
10860
10861#[cfg(feature = "v26_1")]
10862#[derive(Debug, Clone, PartialEq)]
10864pub struct TrackedWaypointWaypointBodyFalse {
10865 pub id: ByteString,
10867}
10868
10869#[cfg(feature = "v26_1")]
10870#[derive(Debug, Clone, PartialEq)]
10872pub enum TrackedWaypointWaypointBody {
10873 True(crate::defs::p775::play::clientbound::TrackedWaypointWaypointBodyTrue),
10875 False(crate::defs::p775::play::clientbound::TrackedWaypointWaypointBodyFalse),
10877 Other,
10879}
10880
10881#[cfg(feature = "v26_1")]
10882#[derive(Debug, Clone, PartialEq)]
10884pub struct TrackedWaypointWaypointIconColor {
10885 pub red: u8,
10887 pub green: u8,
10889 pub blue: u8,
10891}
10892
10893#[cfg(feature = "v26_1")]
10894#[derive(Debug, Clone, PartialEq)]
10896pub struct TrackedWaypointWaypointIcon {
10897 pub style: ByteString,
10899 pub color: Option<crate::defs::p775::play::clientbound::TrackedWaypointWaypointIconColor>,
10901}
10902
10903#[cfg(feature = "v26_1")]
10904#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
10906pub struct TrackedWaypointWaypointType(pub i32);
10907#[cfg(feature = "v26_1")]
10908impl TrackedWaypointWaypointType {
10909 pub const EMPTY: Self = Self(0);
10911 pub const VEC3I: Self = Self(1);
10913 pub const CHUNK: Self = Self(2);
10915 pub const AZIMUTH: Self = Self(3);
10917 pub const fn name(self) -> Option<&'static str> {
10919 match self.0 {
10920 0 => Some("empty"),
10921 1 => Some("vec3i"),
10922 2 => Some("chunk"),
10923 3 => Some("azimuth"),
10924 _ => None,
10925 }
10926 }
10927}
10928#[cfg(feature = "v26_1")]
10929impl std::fmt::Debug for TrackedWaypointWaypointType {
10930 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10931 match self.name() {
10932 Some(n) => write!(f, "TrackedWaypointWaypointType::{n}"),
10933 None => write!(f, "TrackedWaypointWaypointType({})", self.0),
10934 }
10935 }
10936}
10937
10938#[cfg(feature = "v26_1")]
10939#[derive(Debug, Clone, PartialEq)]
10941pub struct TrackedWaypointWaypointDataChunk {
10942 pub chunk_x: i32,
10944 pub chunk_z: i32,
10946}
10947
10948#[cfg(feature = "v26_1")]
10949#[derive(Debug, Clone, PartialEq)]
10951pub enum TrackedWaypointWaypointData {
10952 Vec3i(crate::defs::p775::types::Vec3i),
10954 Chunk(crate::defs::p775::play::clientbound::TrackedWaypointWaypointDataChunk),
10956 Azimuth(f32),
10958 Other,
10960}
10961
10962#[cfg(feature = "v26_1")]
10963#[derive(Debug, Clone, PartialEq)]
10965pub struct TrackedWaypointWaypoint {
10966 pub has_uuid: bool,
10968 pub body: crate::defs::p775::play::clientbound::TrackedWaypointWaypointBody,
10970 pub icon: crate::defs::p775::play::clientbound::TrackedWaypointWaypointIcon,
10972 pub r#type: crate::defs::p775::play::clientbound::TrackedWaypointWaypointType,
10974 pub data: crate::defs::p775::play::clientbound::TrackedWaypointWaypointData,
10976}
10977
10978#[cfg(feature = "v26_1")]
10979#[derive(Debug, Clone, PartialEq)]
10981pub struct TrackedWaypoint<const V: i32> {
10982 pub operation: crate::defs::p775::play::clientbound::TrackedWaypointOperation,
10984 pub waypoint: crate::defs::p775::play::clientbound::TrackedWaypointWaypoint,
10986}
10987#[cfg(feature = "v26_1")]
10988impl<const V: i32> Decode for TrackedWaypoint<V> {
10989 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
10990 Ok({
10991 let v1 =
10992 crate::defs::p775::play::clientbound::TrackedWaypointOperation(r.read_varint()?);
10993 let v2 = {
10994 let v3 = r.read_bool()?;
10995 let v4 = (if v3 {
10996 crate::defs::p775::play::clientbound::TrackedWaypointWaypointBody::True({
10997 let v5 = r.read_uuid()?;
10998 crate::defs::p775::play::clientbound::TrackedWaypointWaypointBodyTrue {
10999 uuid: v5,
11000 }
11001 })
11002 } else if (!v3) {
11003 crate::defs::p775::play::clientbound::TrackedWaypointWaypointBody::False({
11004 let v6 = r.read_string()?;
11005 crate::defs::p775::play::clientbound::TrackedWaypointWaypointBodyFalse {
11006 id: v6,
11007 }
11008 })
11009 } else {
11010 crate::defs::p775::play::clientbound::TrackedWaypointWaypointBody::Other
11011 });
11012 let v7 = {
11013 let v8 = r.read_string()?;
11014 let v9 = if r.read_bool()? {
11015 Some({
11016 let v10 = r.read_u8()?;
11017 let v11 = r.read_u8()?;
11018 let v12 = r.read_u8()?;
11019 crate::defs::p775::play::clientbound::TrackedWaypointWaypointIconColor {
11020 red: v10,
11021 green: v11,
11022 blue: v12,
11023 }
11024 })
11025 } else {
11026 None
11027 };
11028 crate::defs::p775::play::clientbound::TrackedWaypointWaypointIcon {
11029 style: v8,
11030 color: v9,
11031 }
11032 };
11033 let v13 = crate::defs::p775::play::clientbound::TrackedWaypointWaypointType(
11034 r.read_varint()?,
11035 );
11036 let v14 = (if (v13.0 == 1) {
11037 crate::defs::p775::play::clientbound::TrackedWaypointWaypointData::Vec3i(
11038 <crate::defs::p775::types::Vec3i as Decode>::decode(r)?,
11039 )
11040 } else if (v13.0 == 2) {
11041 crate::defs::p775::play::clientbound::TrackedWaypointWaypointData::Chunk({
11042 let v15 = r.read_varint()?;
11043 let v16 = r.read_varint()?;
11044 crate::defs::p775::play::clientbound::TrackedWaypointWaypointDataChunk {
11045 chunk_x: v15,
11046 chunk_z: v16,
11047 }
11048 })
11049 } else if (v13.0 == 3) {
11050 crate::defs::p775::play::clientbound::TrackedWaypointWaypointData::Azimuth(
11051 r.read_f32()?,
11052 )
11053 } else {
11054 crate::defs::p775::play::clientbound::TrackedWaypointWaypointData::Other
11055 });
11056 crate::defs::p775::play::clientbound::TrackedWaypointWaypoint {
11057 has_uuid: v3,
11058 body: v4,
11059 icon: v7,
11060 r#type: v13,
11061 data: v14,
11062 }
11063 };
11064 Self {
11065 operation: v1,
11066 waypoint: v2,
11067 }
11068 })
11069 }
11070}
11071#[cfg(feature = "v26_1")]
11072impl<const V: i32> Encode for TrackedWaypoint<V> {
11073 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
11074 w.put_varint((*self).operation.0);
11075 w.put_bool((*self).waypoint.has_uuid);
11076 match &(*self).waypoint.body {
11077 crate::defs::p775::play::clientbound::TrackedWaypointWaypointBody::True(v1) => {
11078 if !((*self).waypoint.has_uuid) {
11079 return Err(EncodeError::SwitchMismatch(
11080 "play.clientbound.tracked_waypoint.waypoint.body",
11081 ));
11082 }
11083 w.put_uuid(&(*v1).uuid);
11084 }
11085 crate::defs::p775::play::clientbound::TrackedWaypointWaypointBody::False(v2) => {
11086 if !(!(*self).waypoint.has_uuid) {
11087 return Err(EncodeError::SwitchMismatch(
11088 "play.clientbound.tracked_waypoint.waypoint.body",
11089 ));
11090 }
11091 w.put_string(&(*v2).id)?;
11092 }
11093 crate::defs::p775::play::clientbound::TrackedWaypointWaypointBody::Other => {
11094 if !(!((*self).waypoint.has_uuid || (!(*self).waypoint.has_uuid))) {
11095 return Err(EncodeError::SwitchMismatch(
11096 "play.clientbound.tracked_waypoint.waypoint.body",
11097 ));
11098 }
11099 }
11100 }
11101 w.put_string(&(*self).waypoint.icon.style)?;
11102 match &(*self).waypoint.icon.color {
11103 Some(v3) => {
11104 w.put_u8(1);
11105 w.put_u8((*v3).red);
11106 w.put_u8((*v3).green);
11107 w.put_u8((*v3).blue);
11108 }
11109 None => w.put_u8(0),
11110 }
11111 w.put_varint((*self).waypoint.r#type.0);
11112 match &(*self).waypoint.data {
11113 crate::defs::p775::play::clientbound::TrackedWaypointWaypointData::Vec3i(v4) => {
11114 if !((*self).waypoint.r#type.0 == 1) {
11115 return Err(EncodeError::SwitchMismatch(
11116 "play.clientbound.tracked_waypoint.waypoint.data",
11117 ));
11118 }
11119 (*v4).encode(w)?;
11120 }
11121 crate::defs::p775::play::clientbound::TrackedWaypointWaypointData::Chunk(v5) => {
11122 if !((*self).waypoint.r#type.0 == 2) {
11123 return Err(EncodeError::SwitchMismatch(
11124 "play.clientbound.tracked_waypoint.waypoint.data",
11125 ));
11126 }
11127 w.put_varint((*v5).chunk_x);
11128 w.put_varint((*v5).chunk_z);
11129 }
11130 crate::defs::p775::play::clientbound::TrackedWaypointWaypointData::Azimuth(v6) => {
11131 if !((*self).waypoint.r#type.0 == 3) {
11132 return Err(EncodeError::SwitchMismatch(
11133 "play.clientbound.tracked_waypoint.waypoint.data",
11134 ));
11135 }
11136 w.put_f32((*v6));
11137 }
11138 crate::defs::p775::play::clientbound::TrackedWaypointWaypointData::Other => {
11139 if !(!(((*self).waypoint.r#type.0 == 1)
11140 || ((*self).waypoint.r#type.0 == 2)
11141 || ((*self).waypoint.r#type.0 == 3)))
11142 {
11143 return Err(EncodeError::SwitchMismatch(
11144 "play.clientbound.tracked_waypoint.waypoint.data",
11145 ));
11146 }
11147 }
11148 }
11149 Ok(())
11150 }
11151}
11152#[cfg(feature = "v26_1")]
11153#[cfg(feature = "testgen")]
11154impl<const V: i32> Generate for TrackedWaypoint<V> {
11155 fn generate(g: &mut Gen) -> Self {
11156 {
11157 let v1 = crate::defs::p775::play::clientbound::TrackedWaypointOperation(g.int_in(
11158 -2147483648,
11159 2147483647,
11160 &[0, 1, 2],
11161 )
11162 as i32);
11163 let v2 = {
11164 let v3 = g.bool();
11165 let v4 = (if v3 {
11166 crate::defs::p775::play::clientbound::TrackedWaypointWaypointBody::True({
11167 let v5 = g.uuid();
11168 crate::defs::p775::play::clientbound::TrackedWaypointWaypointBodyTrue {
11169 uuid: v5,
11170 }
11171 })
11172 } else if (!v3) {
11173 crate::defs::p775::play::clientbound::TrackedWaypointWaypointBody::False({
11174 let v6 = g.string();
11175 crate::defs::p775::play::clientbound::TrackedWaypointWaypointBodyFalse {
11176 id: v6,
11177 }
11178 })
11179 } else {
11180 crate::defs::p775::play::clientbound::TrackedWaypointWaypointBody::Other
11181 });
11182 let v7 = {
11183 let v8 = g.string();
11184 let v9 = if g.bool() {
11185 Some({
11186 let v10 = (g.int_in(0, 255, &[]) as u8);
11187 let v11 = (g.int_in(0, 255, &[]) as u8);
11188 let v12 = (g.int_in(0, 255, &[]) as u8);
11189 crate::defs::p775::play::clientbound::TrackedWaypointWaypointIconColor {
11190 red: v10,
11191 green: v11,
11192 blue: v12,
11193 }
11194 })
11195 } else {
11196 None
11197 };
11198 crate::defs::p775::play::clientbound::TrackedWaypointWaypointIcon {
11199 style: v8,
11200 color: v9,
11201 }
11202 };
11203 let v13 = crate::defs::p775::play::clientbound::TrackedWaypointWaypointType(
11204 g.int_in(-2147483648, 2147483647, &[0, 1, 2, 3]) as i32,
11205 );
11206 let v14 = (if (v13.0 == 1) {
11207 crate::defs::p775::play::clientbound::TrackedWaypointWaypointData::Vec3i(
11208 <crate::defs::p775::types::Vec3i as Generate>::generate(g),
11209 )
11210 } else if (v13.0 == 2) {
11211 crate::defs::p775::play::clientbound::TrackedWaypointWaypointData::Chunk({
11212 let v15 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
11213 let v16 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
11214 crate::defs::p775::play::clientbound::TrackedWaypointWaypointDataChunk {
11215 chunk_x: v15,
11216 chunk_z: v16,
11217 }
11218 })
11219 } else if (v13.0 == 3) {
11220 crate::defs::p775::play::clientbound::TrackedWaypointWaypointData::Azimuth(
11221 g.f32(),
11222 )
11223 } else {
11224 crate::defs::p775::play::clientbound::TrackedWaypointWaypointData::Other
11225 });
11226 crate::defs::p775::play::clientbound::TrackedWaypointWaypoint {
11227 has_uuid: v3,
11228 body: v4,
11229 icon: v7,
11230 r#type: v13,
11231 data: v14,
11232 }
11233 };
11234 Self {
11235 operation: v1,
11236 waypoint: v2,
11237 }
11238 }
11239 }
11240}
11241
11242#[cfg(feature = "v26_1")]
11243#[derive(Debug, Clone, PartialEq)]
11245pub struct ClearDialog<const V: i32> {}
11246#[cfg(feature = "v26_1")]
11247impl<const V: i32> Decode for ClearDialog<V> {
11248 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
11249 Ok({ Self {} })
11250 }
11251}
11252#[cfg(feature = "v26_1")]
11253impl<const V: i32> Encode for ClearDialog<V> {
11254 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
11255 Ok(())
11256 }
11257}
11258#[cfg(feature = "v26_1")]
11259#[cfg(feature = "testgen")]
11260impl<const V: i32> Generate for ClearDialog<V> {
11261 fn generate(g: &mut Gen) -> Self {
11262 { Self {} }
11263 }
11264}
11265
11266#[cfg(feature = "v26_1")]
11267#[derive(Debug, Clone, PartialEq)]
11269pub struct ShowDialog<const V: i32> {
11270 pub dialog: Holder<AnonNbt>,
11272}
11273#[cfg(feature = "v26_1")]
11274impl<const V: i32> Decode for ShowDialog<V> {
11275 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
11276 Ok({
11277 let v1 = {
11278 let id = r.read_varint()?;
11279 if id == 0 {
11280 Holder::Inline(AnonNbt::read(r)?)
11281 } else {
11282 Holder::Id(id.wrapping_sub(1))
11283 }
11284 };
11285 Self { dialog: v1 }
11286 })
11287 }
11288}
11289#[cfg(feature = "v26_1")]
11290impl<const V: i32> Encode for ShowDialog<V> {
11291 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
11292 match &(*self).dialog {
11293 Holder::Id(v2) => {
11294 if *v2 == -1 {
11295 return Err(EncodeError::OutOfRange("holder id"));
11296 }
11297 w.put_varint(v2.wrapping_add(1));
11298 }
11299 Holder::Inline(v1) => {
11300 w.put_varint(0);
11301 (*v1).write(w);
11302 }
11303 }
11304 Ok(())
11305 }
11306}
11307#[cfg(feature = "v26_1")]
11308#[cfg(feature = "testgen")]
11309impl<const V: i32> Generate for ShowDialog<V> {
11310 fn generate(g: &mut Gen) -> Self {
11311 {
11312 let v1 = if g.bool() {
11313 Holder::Id(match g.int_in(-2147483648, 2147483647, &[0, 1, 2]) as i32 {
11314 -1 => 0,
11315 v => v,
11316 })
11317 } else {
11318 Holder::Inline(g.anon_nbt())
11319 };
11320 Self { dialog: v1 }
11321 }
11322 }
11323}