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_3")]
29#[derive(Debug, Clone, PartialEq)]
31pub struct ExplosionParticleEntry {
32 pub data: crate::defs::p777::play::clientbound::ExplosionParticleInfo,
34 pub weight: i32,
36}
37#[cfg(feature = "v26_3")]
38impl Decode for ExplosionParticleEntry {
39 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
40 Ok({
41 let v1 =
42 <crate::defs::p777::play::clientbound::ExplosionParticleInfo as Decode>::decode(r)?;
43 let v2 = r.read_varint()?;
44 Self {
45 data: v1,
46 weight: v2,
47 }
48 })
49 }
50}
51#[cfg(feature = "v26_3")]
52impl Encode for ExplosionParticleEntry {
53 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
54 (*self).data.encode(w)?;
55 w.put_varint((*self).weight);
56 Ok(())
57 }
58}
59#[cfg(feature = "v26_3")]
60#[cfg(feature = "testgen")]
61impl Generate for ExplosionParticleEntry {
62 fn generate(g: &mut Gen) -> Self {
63 {
64 let v1 =
65 <crate::defs::p777::play::clientbound::ExplosionParticleInfo as Generate>::generate(
66 g,
67 );
68 let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
69 Self {
70 data: v1,
71 weight: v2,
72 }
73 }
74 }
75}
76
77#[cfg(feature = "v26_3")]
78#[derive(Debug, Clone, PartialEq)]
80pub struct ExplosionParticleInfo {
81 pub particle: crate::defs::p777::types::Particle,
83 pub scaling: f32,
85 pub speed: f32,
87}
88#[cfg(feature = "v26_3")]
89impl Decode for ExplosionParticleInfo {
90 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
91 Ok({
92 let v1 = <crate::defs::p777::types::Particle as Decode>::decode(r)?;
93 let v2 = r.read_f32()?;
94 let v3 = r.read_f32()?;
95 Self {
96 particle: v1,
97 scaling: v2,
98 speed: v3,
99 }
100 })
101 }
102}
103#[cfg(feature = "v26_3")]
104impl Encode for ExplosionParticleInfo {
105 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
106 (*self).particle.encode(w)?;
107 w.put_f32((*self).scaling);
108 w.put_f32((*self).speed);
109 Ok(())
110 }
111}
112#[cfg(feature = "v26_3")]
113#[cfg(feature = "testgen")]
114impl Generate for ExplosionParticleInfo {
115 fn generate(g: &mut Gen) -> Self {
116 {
117 let v1 = <crate::defs::p777::types::Particle as Generate>::generate(g);
118 let v2 = g.f32();
119 let v3 = g.f32();
120 Self {
121 particle: v1,
122 scaling: v2,
123 speed: v3,
124 }
125 }
126 }
127}
128
129#[cfg(feature = "v26_3")]
130#[derive(Debug, Clone, PartialEq)]
132pub struct RecipeDisplayDataCraftingShapeless {
133 pub ingredients: Vec<crate::defs::p777::play::clientbound::SlotDisplay>,
135 pub result: crate::defs::p777::play::clientbound::SlotDisplay,
137 pub crafting_station: crate::defs::p777::play::clientbound::SlotDisplay,
139}
140
141#[cfg(feature = "v26_3")]
142#[derive(Debug, Clone, PartialEq)]
144pub struct RecipeDisplayDataCraftingShaped {
145 pub width: i32,
147 pub height: i32,
149 pub ingredients: Vec<crate::defs::p777::play::clientbound::SlotDisplay>,
151 pub result: crate::defs::p777::play::clientbound::SlotDisplay,
153 pub crafting_station: crate::defs::p777::play::clientbound::SlotDisplay,
155}
156
157#[cfg(feature = "v26_3")]
158#[derive(Debug, Clone, PartialEq)]
160pub struct RecipeDisplayDataFurnace {
161 pub ingredient: crate::defs::p777::play::clientbound::SlotDisplay,
163 pub fuel: crate::defs::p777::play::clientbound::SlotDisplay,
165 pub result: crate::defs::p777::play::clientbound::SlotDisplay,
167 pub crafting_station: crate::defs::p777::play::clientbound::SlotDisplay,
169 pub duration: i32,
171 pub experience: f32,
173}
174
175#[cfg(feature = "v26_3")]
176#[derive(Debug, Clone, PartialEq)]
178pub struct RecipeDisplayDataStonecutter {
179 pub ingredient: crate::defs::p777::play::clientbound::SlotDisplay,
181 pub result: crate::defs::p777::play::clientbound::SlotDisplay,
183 pub crafting_station: crate::defs::p777::play::clientbound::SlotDisplay,
185}
186
187#[cfg(feature = "v26_3")]
188#[derive(Debug, Clone, PartialEq)]
190pub struct RecipeDisplayDataSmithing {
191 pub template: crate::defs::p777::play::clientbound::SlotDisplay,
193 pub base: crate::defs::p777::play::clientbound::SlotDisplay,
195 pub addition: crate::defs::p777::play::clientbound::SlotDisplay,
197 pub result: crate::defs::p777::play::clientbound::SlotDisplay,
199 pub crafting_station: crate::defs::p777::play::clientbound::SlotDisplay,
201}
202
203#[cfg(feature = "v26_3")]
204#[derive(Debug, Clone, PartialEq)]
206#[non_exhaustive]
207pub enum RecipeDisplayData {
208 CraftingShapeless(crate::defs::p777::play::clientbound::RecipeDisplayDataCraftingShapeless),
210 CraftingShaped(crate::defs::p777::play::clientbound::RecipeDisplayDataCraftingShaped),
212 Furnace(crate::defs::p777::play::clientbound::RecipeDisplayDataFurnace),
214 Stonecutter(crate::defs::p777::play::clientbound::RecipeDisplayDataStonecutter),
216 Smithing(crate::defs::p777::play::clientbound::RecipeDisplayDataSmithing),
218 Other,
220}
221
222#[cfg(feature = "v26_3")]
223#[derive(Debug, Clone, PartialEq)]
225pub struct RecipeDisplay {
226 pub r#type: crate::defs::p775::play::clientbound::RecipeDisplayType,
228 pub data: crate::defs::p777::play::clientbound::RecipeDisplayData,
230}
231#[cfg(feature = "v26_3")]
232impl Decode for RecipeDisplay {
233 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
234 Ok({
235 let v1 = crate::defs::p775::play::clientbound::RecipeDisplayType(r.read_varint()?);
236 let v2 = (if (v1.0 == 0) {
237 crate::defs::p777::play::clientbound::RecipeDisplayData::CraftingShapeless({
238 let v3 = {
239 let v4 = {
240 let c = r.read_varint()?;
241 r.check_count(i64::from(c), 1)?
242 };
243 let mut v5 = Vec::with_capacity(v4.min(crate::codec::PREALLOC_LIMIT));
244 for _ in 0..v4 {
245 v5.push(<crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?);
246 }
247 v5
248 };
249 let v6 =
250 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?;
251 let v7 =
252 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?;
253 crate::defs::p777::play::clientbound::RecipeDisplayDataCraftingShapeless {
254 ingredients: v3,
255 result: v6,
256 crafting_station: v7,
257 }
258 })
259 } else if (v1.0 == 1) {
260 crate::defs::p777::play::clientbound::RecipeDisplayData::CraftingShaped({
261 let v8 = r.read_varint()?;
262 let v9 = r.read_varint()?;
263 let v10 = {
264 let v11 = {
265 let c = r.read_varint()?;
266 r.check_count(i64::from(c), 1)?
267 };
268 let mut v12 = Vec::with_capacity(v11.min(crate::codec::PREALLOC_LIMIT));
269 for _ in 0..v11 {
270 v12.push(<crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?);
271 }
272 v12
273 };
274 let v13 =
275 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?;
276 let v14 =
277 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?;
278 crate::defs::p777::play::clientbound::RecipeDisplayDataCraftingShaped {
279 width: v8,
280 height: v9,
281 ingredients: v10,
282 result: v13,
283 crafting_station: v14,
284 }
285 })
286 } else if (v1.0 == 2) {
287 crate::defs::p777::play::clientbound::RecipeDisplayData::Furnace({
288 let v15 =
289 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?;
290 let v16 =
291 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?;
292 let v17 =
293 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?;
294 let v18 =
295 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?;
296 let v19 = r.read_varint()?;
297 let v20 = r.read_f32()?;
298 crate::defs::p777::play::clientbound::RecipeDisplayDataFurnace {
299 ingredient: v15,
300 fuel: v16,
301 result: v17,
302 crafting_station: v18,
303 duration: v19,
304 experience: v20,
305 }
306 })
307 } else if (v1.0 == 3) {
308 crate::defs::p777::play::clientbound::RecipeDisplayData::Stonecutter({
309 let v21 =
310 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?;
311 let v22 =
312 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?;
313 let v23 =
314 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?;
315 crate::defs::p777::play::clientbound::RecipeDisplayDataStonecutter {
316 ingredient: v21,
317 result: v22,
318 crafting_station: v23,
319 }
320 })
321 } else if (v1.0 == 4) {
322 crate::defs::p777::play::clientbound::RecipeDisplayData::Smithing({
323 let v24 =
324 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?;
325 let v25 =
326 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?;
327 let v26 =
328 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?;
329 let v27 =
330 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?;
331 let v28 =
332 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?;
333 crate::defs::p777::play::clientbound::RecipeDisplayDataSmithing {
334 template: v24,
335 base: v25,
336 addition: v26,
337 result: v27,
338 crafting_station: v28,
339 }
340 })
341 } else {
342 crate::defs::p777::play::clientbound::RecipeDisplayData::Other
343 });
344 Self {
345 r#type: v1,
346 data: v2,
347 }
348 })
349 }
350}
351#[cfg(feature = "v26_3")]
352impl Encode for RecipeDisplay {
353 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
354 w.put_varint((*self).r#type.0);
355 match &(*self).data {
356 crate::defs::p777::play::clientbound::RecipeDisplayData::CraftingShapeless(v1) => {
357 if !((*self).r#type.0 == 0) {
358 return Err(EncodeError::SwitchMismatch(
359 "play.clientbound.RecipeDisplay.data",
360 ));
361 }
362 w.put_len_varint((*v1).ingredients.len())?;
363 for v2 in (*v1).ingredients.iter() {
364 (*v2).encode(w)?;
365 }
366 (*v1).result.encode(w)?;
367 (*v1).crafting_station.encode(w)?;
368 }
369 crate::defs::p777::play::clientbound::RecipeDisplayData::CraftingShaped(v3) => {
370 if !((*self).r#type.0 == 1) {
371 return Err(EncodeError::SwitchMismatch(
372 "play.clientbound.RecipeDisplay.data",
373 ));
374 }
375 w.put_varint((*v3).width);
376 w.put_varint((*v3).height);
377 w.put_len_varint((*v3).ingredients.len())?;
378 for v4 in (*v3).ingredients.iter() {
379 (*v4).encode(w)?;
380 }
381 (*v3).result.encode(w)?;
382 (*v3).crafting_station.encode(w)?;
383 }
384 crate::defs::p777::play::clientbound::RecipeDisplayData::Furnace(v5) => {
385 if !((*self).r#type.0 == 2) {
386 return Err(EncodeError::SwitchMismatch(
387 "play.clientbound.RecipeDisplay.data",
388 ));
389 }
390 (*v5).ingredient.encode(w)?;
391 (*v5).fuel.encode(w)?;
392 (*v5).result.encode(w)?;
393 (*v5).crafting_station.encode(w)?;
394 w.put_varint((*v5).duration);
395 w.put_f32((*v5).experience);
396 }
397 crate::defs::p777::play::clientbound::RecipeDisplayData::Stonecutter(v6) => {
398 if !((*self).r#type.0 == 3) {
399 return Err(EncodeError::SwitchMismatch(
400 "play.clientbound.RecipeDisplay.data",
401 ));
402 }
403 (*v6).ingredient.encode(w)?;
404 (*v6).result.encode(w)?;
405 (*v6).crafting_station.encode(w)?;
406 }
407 crate::defs::p777::play::clientbound::RecipeDisplayData::Smithing(v7) => {
408 if !((*self).r#type.0 == 4) {
409 return Err(EncodeError::SwitchMismatch(
410 "play.clientbound.RecipeDisplay.data",
411 ));
412 }
413 (*v7).template.encode(w)?;
414 (*v7).base.encode(w)?;
415 (*v7).addition.encode(w)?;
416 (*v7).result.encode(w)?;
417 (*v7).crafting_station.encode(w)?;
418 }
419 crate::defs::p777::play::clientbound::RecipeDisplayData::Other => {
420 if !(!(((*self).r#type.0 == 0)
421 || ((*self).r#type.0 == 1)
422 || ((*self).r#type.0 == 2)
423 || ((*self).r#type.0 == 3)
424 || ((*self).r#type.0 == 4)))
425 {
426 return Err(EncodeError::SwitchMismatch(
427 "play.clientbound.RecipeDisplay.data",
428 ));
429 }
430 }
431 }
432 Ok(())
433 }
434}
435#[cfg(feature = "v26_3")]
436#[cfg(feature = "testgen")]
437impl Generate for RecipeDisplay {
438 fn generate(g: &mut Gen) -> Self {
439 {
440 let v1 = crate::defs::p775::play::clientbound::RecipeDisplayType(g.int_in(
441 -2147483648,
442 2147483647,
443 &[0, 1, 2, 3, 4],
444 ) as i32);
445 let v2 = (if (v1.0 == 0) {
446 crate::defs::p777::play::clientbound::RecipeDisplayData::CraftingShapeless({
447 let v3 = {
448 let v4 = g.count();
449 let mut v5 = Vec::with_capacity(v4.min(crate::codec::PREALLOC_LIMIT));
450 for _ in 0..v4 {
451 v5.push(<crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(g));
452 }
453 v5
454 };
455 let v6 =
456 <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(
457 g,
458 );
459 let v7 =
460 <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(
461 g,
462 );
463 crate::defs::p777::play::clientbound::RecipeDisplayDataCraftingShapeless {
464 ingredients: v3,
465 result: v6,
466 crafting_station: v7,
467 }
468 })
469 } else if (v1.0 == 1) {
470 crate::defs::p777::play::clientbound::RecipeDisplayData::CraftingShaped({
471 let v8 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
472 let v9 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
473 let v10 = {
474 let v11 = g.count();
475 let mut v12 = Vec::with_capacity(v11.min(crate::codec::PREALLOC_LIMIT));
476 for _ in 0..v11 {
477 v12.push(<crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(g));
478 }
479 v12
480 };
481 let v13 =
482 <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(
483 g,
484 );
485 let v14 =
486 <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(
487 g,
488 );
489 crate::defs::p777::play::clientbound::RecipeDisplayDataCraftingShaped {
490 width: v8,
491 height: v9,
492 ingredients: v10,
493 result: v13,
494 crafting_station: v14,
495 }
496 })
497 } else if (v1.0 == 2) {
498 crate::defs::p777::play::clientbound::RecipeDisplayData::Furnace({
499 let v15 =
500 <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(
501 g,
502 );
503 let v16 =
504 <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(
505 g,
506 );
507 let v17 =
508 <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(
509 g,
510 );
511 let v18 =
512 <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(
513 g,
514 );
515 let v19 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
516 let v20 = g.f32();
517 crate::defs::p777::play::clientbound::RecipeDisplayDataFurnace {
518 ingredient: v15,
519 fuel: v16,
520 result: v17,
521 crafting_station: v18,
522 duration: v19,
523 experience: v20,
524 }
525 })
526 } else if (v1.0 == 3) {
527 crate::defs::p777::play::clientbound::RecipeDisplayData::Stonecutter({
528 let v21 =
529 <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(
530 g,
531 );
532 let v22 =
533 <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(
534 g,
535 );
536 let v23 =
537 <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(
538 g,
539 );
540 crate::defs::p777::play::clientbound::RecipeDisplayDataStonecutter {
541 ingredient: v21,
542 result: v22,
543 crafting_station: v23,
544 }
545 })
546 } else if (v1.0 == 4) {
547 crate::defs::p777::play::clientbound::RecipeDisplayData::Smithing({
548 let v24 =
549 <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(
550 g,
551 );
552 let v25 =
553 <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(
554 g,
555 );
556 let v26 =
557 <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(
558 g,
559 );
560 let v27 =
561 <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(
562 g,
563 );
564 let v28 =
565 <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(
566 g,
567 );
568 crate::defs::p777::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::p777::play::clientbound::RecipeDisplayData::Other
578 });
579 Self {
580 r#type: v1,
581 data: v2,
582 }
583 }
584 }
585}
586
587#[cfg(feature = "v26_3")]
588#[derive(Debug, Clone, PartialEq)]
590pub struct SlotDisplayDataWithAnyPotion {
591 pub base: Box<crate::defs::p777::play::clientbound::SlotDisplay>,
593}
594
595#[cfg(feature = "v26_3")]
596#[derive(Debug, Clone, PartialEq)]
598pub struct SlotDisplayDataOnlyWithComponent {
599 pub source: Box<crate::defs::p777::play::clientbound::SlotDisplay>,
601 pub component: crate::defs::p777::types::SlotComponentType,
603}
604
605#[cfg(feature = "v26_3")]
606#[derive(Debug, Clone, PartialEq)]
608pub struct SlotDisplayDataDyedSlotDemo {
609 pub dye: Box<crate::defs::p777::play::clientbound::SlotDisplay>,
611 pub target: Box<crate::defs::p777::play::clientbound::SlotDisplay>,
613}
614
615#[cfg(feature = "v26_3")]
616#[derive(Debug, Clone, PartialEq)]
618pub struct SlotDisplayDataSmithingTrim {
619 pub base: Box<crate::defs::p777::play::clientbound::SlotDisplay>,
621 pub material: Box<crate::defs::p777::play::clientbound::SlotDisplay>,
623 pub pattern: Holder<crate::defs::p775::types::ArmorTrimPattern>,
625}
626
627#[cfg(feature = "v26_3")]
628#[derive(Debug, Clone, PartialEq)]
630pub struct SlotDisplayDataWithRemainder {
631 pub input: Box<crate::defs::p777::play::clientbound::SlotDisplay>,
633 pub remainder: Box<crate::defs::p777::play::clientbound::SlotDisplay>,
635}
636
637#[cfg(feature = "v26_3")]
638#[derive(Debug, Clone, PartialEq)]
640#[non_exhaustive]
641pub enum SlotDisplayData {
642 Empty,
644 AnyFuel,
646 WithAnyPotion(crate::defs::p777::play::clientbound::SlotDisplayDataWithAnyPotion),
648 OnlyWithComponent(crate::defs::p777::play::clientbound::SlotDisplayDataOnlyWithComponent),
650 Item(i32),
652 ItemStack(crate::defs::p777::types::ItemStackTemplate),
654 Tag(HolderSet),
656 DyedSlotDemo(crate::defs::p777::play::clientbound::SlotDisplayDataDyedSlotDemo),
658 SmithingTrim(crate::defs::p777::play::clientbound::SlotDisplayDataSmithingTrim),
660 WithRemainder(crate::defs::p777::play::clientbound::SlotDisplayDataWithRemainder),
662 Composite(Vec<crate::defs::p777::play::clientbound::SlotDisplay>),
664 Other,
666}
667
668#[cfg(feature = "v26_3")]
669#[derive(Debug, Clone, PartialEq)]
671pub struct SlotDisplay {
672 pub r#type: crate::defs::p775::play::clientbound::SlotDisplayType,
674 pub data: crate::defs::p777::play::clientbound::SlotDisplayData,
676}
677#[cfg(feature = "v26_3")]
678impl Decode for SlotDisplay {
679 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
680 Ok({
681 let v1 = crate::defs::p775::play::clientbound::SlotDisplayType(r.read_varint()?);
682 let v2 = (if (v1.0 == 0) {
683 crate::defs::p777::play::clientbound::SlotDisplayData::Empty
684 } else if (v1.0 == 1) {
685 crate::defs::p777::play::clientbound::SlotDisplayData::AnyFuel
686 } else if (v1.0 == 2) {
687 crate::defs::p777::play::clientbound::SlotDisplayData::WithAnyPotion({
688 let v3 = Box::new(
689 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?,
690 );
691 crate::defs::p777::play::clientbound::SlotDisplayDataWithAnyPotion { base: v3 }
692 })
693 } else if (v1.0 == 3) {
694 crate::defs::p777::play::clientbound::SlotDisplayData::OnlyWithComponent({
695 let v4 = Box::new(
696 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?,
697 );
698 let v5 = crate::defs::p777::types::SlotComponentType(r.read_varint()?);
699 crate::defs::p777::play::clientbound::SlotDisplayDataOnlyWithComponent {
700 source: v4,
701 component: v5,
702 }
703 })
704 } else if (v1.0 == 4) {
705 crate::defs::p777::play::clientbound::SlotDisplayData::Item(r.read_varint()?)
706 } else if (v1.0 == 5) {
707 crate::defs::p777::play::clientbound::SlotDisplayData::ItemStack(
708 <crate::defs::p777::types::ItemStackTemplate as Decode>::decode(r)?,
709 )
710 } else if (v1.0 == 6) {
711 crate::defs::p777::play::clientbound::SlotDisplayData::Tag(
712 <HolderSet as Decode>::decode(r)?,
713 )
714 } else if (v1.0 == 7) {
715 crate::defs::p777::play::clientbound::SlotDisplayData::DyedSlotDemo({
716 let v6 = Box::new(
717 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?,
718 );
719 let v7 = Box::new(
720 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?,
721 );
722 crate::defs::p777::play::clientbound::SlotDisplayDataDyedSlotDemo {
723 dye: v6,
724 target: v7,
725 }
726 })
727 } else if (v1.0 == 8) {
728 crate::defs::p777::play::clientbound::SlotDisplayData::SmithingTrim({
729 let v8 = Box::new(
730 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?,
731 );
732 let v9 = Box::new(
733 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?,
734 );
735 let v10 = {
736 let id = r.read_varint()?;
737 if id == 0 {
738 Holder::Inline(
739 <crate::defs::p775::types::ArmorTrimPattern as Decode>::decode(r)?,
740 )
741 } else {
742 Holder::Id(id.wrapping_sub(1))
743 }
744 };
745 crate::defs::p777::play::clientbound::SlotDisplayDataSmithingTrim {
746 base: v8,
747 material: v9,
748 pattern: v10,
749 }
750 })
751 } else if (v1.0 == 9) {
752 crate::defs::p777::play::clientbound::SlotDisplayData::WithRemainder({
753 let v11 = Box::new(
754 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?,
755 );
756 let v12 = Box::new(
757 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(r)?,
758 );
759 crate::defs::p777::play::clientbound::SlotDisplayDataWithRemainder {
760 input: v11,
761 remainder: v12,
762 }
763 })
764 } else if (v1.0 == 10) {
765 crate::defs::p777::play::clientbound::SlotDisplayData::Composite({
766 let v13 = {
767 let c = r.read_varint()?;
768 r.check_count(i64::from(c), 1)?
769 };
770 let mut v14 = Vec::with_capacity(v13.min(crate::codec::PREALLOC_LIMIT));
771 for _ in 0..v13 {
772 v14.push(
773 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(
774 r,
775 )?,
776 );
777 }
778 v14
779 })
780 } else {
781 crate::defs::p777::play::clientbound::SlotDisplayData::Other
782 });
783 Self {
784 r#type: v1,
785 data: v2,
786 }
787 })
788 }
789}
790#[cfg(feature = "v26_3")]
791impl Encode for SlotDisplay {
792 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
793 w.put_varint((*self).r#type.0);
794 match &(*self).data {
795 crate::defs::p777::play::clientbound::SlotDisplayData::Empty => {
796 if !((*self).r#type.0 == 0) {
797 return Err(EncodeError::SwitchMismatch(
798 "play.clientbound.SlotDisplay.data",
799 ));
800 }
801 }
802 crate::defs::p777::play::clientbound::SlotDisplayData::AnyFuel => {
803 if !((*self).r#type.0 == 1) {
804 return Err(EncodeError::SwitchMismatch(
805 "play.clientbound.SlotDisplay.data",
806 ));
807 }
808 }
809 crate::defs::p777::play::clientbound::SlotDisplayData::WithAnyPotion(v1) => {
810 if !((*self).r#type.0 == 2) {
811 return Err(EncodeError::SwitchMismatch(
812 "play.clientbound.SlotDisplay.data",
813 ));
814 }
815 (*(*v1).base).encode(w)?;
816 }
817 crate::defs::p777::play::clientbound::SlotDisplayData::OnlyWithComponent(v2) => {
818 if !((*self).r#type.0 == 3) {
819 return Err(EncodeError::SwitchMismatch(
820 "play.clientbound.SlotDisplay.data",
821 ));
822 }
823 (*(*v2).source).encode(w)?;
824 w.put_varint((*v2).component.0);
825 }
826 crate::defs::p777::play::clientbound::SlotDisplayData::Item(v3) => {
827 if !((*self).r#type.0 == 4) {
828 return Err(EncodeError::SwitchMismatch(
829 "play.clientbound.SlotDisplay.data",
830 ));
831 }
832 w.put_varint((*v3));
833 }
834 crate::defs::p777::play::clientbound::SlotDisplayData::ItemStack(v4) => {
835 if !((*self).r#type.0 == 5) {
836 return Err(EncodeError::SwitchMismatch(
837 "play.clientbound.SlotDisplay.data",
838 ));
839 }
840 (*v4).encode(w)?;
841 }
842 crate::defs::p777::play::clientbound::SlotDisplayData::Tag(v5) => {
843 if !((*self).r#type.0 == 6) {
844 return Err(EncodeError::SwitchMismatch(
845 "play.clientbound.SlotDisplay.data",
846 ));
847 }
848 (*v5).encode(w)?;
849 }
850 crate::defs::p777::play::clientbound::SlotDisplayData::DyedSlotDemo(v6) => {
851 if !((*self).r#type.0 == 7) {
852 return Err(EncodeError::SwitchMismatch(
853 "play.clientbound.SlotDisplay.data",
854 ));
855 }
856 (*(*v6).dye).encode(w)?;
857 (*(*v6).target).encode(w)?;
858 }
859 crate::defs::p777::play::clientbound::SlotDisplayData::SmithingTrim(v7) => {
860 if !((*self).r#type.0 == 8) {
861 return Err(EncodeError::SwitchMismatch(
862 "play.clientbound.SlotDisplay.data",
863 ));
864 }
865 (*(*v7).base).encode(w)?;
866 (*(*v7).material).encode(w)?;
867 match &(*v7).pattern {
868 Holder::Id(v9) => {
869 if *v9 == -1 {
870 return Err(EncodeError::OutOfRange("holder id"));
871 }
872 w.put_varint(v9.wrapping_add(1));
873 }
874 Holder::Inline(v8) => {
875 w.put_varint(0);
876 (*v8).encode(w)?;
877 }
878 }
879 }
880 crate::defs::p777::play::clientbound::SlotDisplayData::WithRemainder(v10) => {
881 if !((*self).r#type.0 == 9) {
882 return Err(EncodeError::SwitchMismatch(
883 "play.clientbound.SlotDisplay.data",
884 ));
885 }
886 (*(*v10).input).encode(w)?;
887 (*(*v10).remainder).encode(w)?;
888 }
889 crate::defs::p777::play::clientbound::SlotDisplayData::Composite(v11) => {
890 if !((*self).r#type.0 == 10) {
891 return Err(EncodeError::SwitchMismatch(
892 "play.clientbound.SlotDisplay.data",
893 ));
894 }
895 w.put_len_varint((*v11).len())?;
896 for v12 in (*v11).iter() {
897 (*v12).encode(w)?;
898 }
899 }
900 crate::defs::p777::play::clientbound::SlotDisplayData::Other => {
901 if !(!(((*self).r#type.0 == 0)
902 || ((*self).r#type.0 == 1)
903 || ((*self).r#type.0 == 2)
904 || ((*self).r#type.0 == 3)
905 || ((*self).r#type.0 == 4)
906 || ((*self).r#type.0 == 5)
907 || ((*self).r#type.0 == 6)
908 || ((*self).r#type.0 == 7)
909 || ((*self).r#type.0 == 8)
910 || ((*self).r#type.0 == 9)
911 || ((*self).r#type.0 == 10)))
912 {
913 return Err(EncodeError::SwitchMismatch(
914 "play.clientbound.SlotDisplay.data",
915 ));
916 }
917 }
918 }
919 Ok(())
920 }
921}
922#[cfg(feature = "v26_3")]
923#[cfg(feature = "testgen")]
924impl Generate for SlotDisplay {
925 fn generate(g: &mut Gen) -> Self {
926 {
927 let v1 = crate::defs::p775::play::clientbound::SlotDisplayType(g.int_in(
928 -2147483648,
929 2147483647,
930 &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
931 ) as i32);
932 let v2 = (if (v1.0 == 0) {
933 crate::defs::p777::play::clientbound::SlotDisplayData::Empty
934 } else if (v1.0 == 1) {
935 crate::defs::p777::play::clientbound::SlotDisplayData::AnyFuel
936 } else if (v1.0 == 2) {
937 crate::defs::p777::play::clientbound::SlotDisplayData::WithAnyPotion({
938 let v3 = Box::new(
939 <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(
940 g,
941 ),
942 );
943 crate::defs::p777::play::clientbound::SlotDisplayDataWithAnyPotion { base: v3 }
944 })
945 } else if (v1.0 == 3) {
946 crate::defs::p777::play::clientbound::SlotDisplayData::OnlyWithComponent({
947 let v4 = Box::new(
948 <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(
949 g,
950 ),
951 );
952 let v5 = crate::defs::p777::types::SlotComponentType(g.int_in(
953 -2147483648,
954 2147483647,
955 &[
956 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
957 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
958 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
959 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
960 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
961 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
962 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
963 ],
964 )
965 as i32);
966 crate::defs::p777::play::clientbound::SlotDisplayDataOnlyWithComponent {
967 source: v4,
968 component: v5,
969 }
970 })
971 } else if (v1.0 == 4) {
972 crate::defs::p777::play::clientbound::SlotDisplayData::Item(
973 (g.int_in(-2147483648, 2147483647, &[]) as i32),
974 )
975 } else if (v1.0 == 5) {
976 crate::defs::p777::play::clientbound::SlotDisplayData::ItemStack(
977 <crate::defs::p777::types::ItemStackTemplate as Generate>::generate(g),
978 )
979 } else if (v1.0 == 6) {
980 crate::defs::p777::play::clientbound::SlotDisplayData::Tag(
981 <HolderSet as Generate>::generate(g),
982 )
983 } else if (v1.0 == 7) {
984 crate::defs::p777::play::clientbound::SlotDisplayData::DyedSlotDemo({
985 let v6 = Box::new(
986 <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(
987 g,
988 ),
989 );
990 let v7 = Box::new(
991 <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(
992 g,
993 ),
994 );
995 crate::defs::p777::play::clientbound::SlotDisplayDataDyedSlotDemo {
996 dye: v6,
997 target: v7,
998 }
999 })
1000 } else if (v1.0 == 8) {
1001 crate::defs::p777::play::clientbound::SlotDisplayData::SmithingTrim({
1002 let v8 = Box::new(
1003 <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(
1004 g,
1005 ),
1006 );
1007 let v9 = Box::new(
1008 <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(
1009 g,
1010 ),
1011 );
1012 let v10 = if g.bool() {
1013 Holder::Id(match g.int_in(-2147483648, 2147483647, &[0, 1, 2]) as i32 {
1014 -1 => 0,
1015 v => v,
1016 })
1017 } else {
1018 Holder::Inline(
1019 <crate::defs::p775::types::ArmorTrimPattern as Generate>::generate(g),
1020 )
1021 };
1022 crate::defs::p777::play::clientbound::SlotDisplayDataSmithingTrim {
1023 base: v8,
1024 material: v9,
1025 pattern: v10,
1026 }
1027 })
1028 } else if (v1.0 == 9) {
1029 crate::defs::p777::play::clientbound::SlotDisplayData::WithRemainder({
1030 let v11 = Box::new(
1031 <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(
1032 g,
1033 ),
1034 );
1035 let v12 = Box::new(
1036 <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(
1037 g,
1038 ),
1039 );
1040 crate::defs::p777::play::clientbound::SlotDisplayDataWithRemainder {
1041 input: v11,
1042 remainder: v12,
1043 }
1044 })
1045 } else if (v1.0 == 10) {
1046 crate::defs::p777::play::clientbound::SlotDisplayData::Composite({
1047 let v13 = g.count();
1048 let mut v14 = Vec::with_capacity(v13.min(crate::codec::PREALLOC_LIMIT));
1049 for _ in 0..v13 {
1050 v14.push(<crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(g));
1051 }
1052 v14
1053 })
1054 } else {
1055 crate::defs::p777::play::clientbound::SlotDisplayData::Other
1056 });
1057 Self {
1058 r#type: v1,
1059 data: v2,
1060 }
1061 }
1062 }
1063}
1064
1065#[cfg(feature = "v26_3")]
1066#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
1068#[non_exhaustive]
1069pub struct SpawnInfoGamemode(pub i32);
1070#[cfg(feature = "v26_3")]
1071impl SpawnInfoGamemode {
1072 pub const fn new(v: i32) -> Self {
1074 Self(v)
1075 }
1076 pub const SURVIVAL: Self = Self(0);
1078 pub const CREATIVE: Self = Self(1);
1080 pub const ADVENTURE: Self = Self(2);
1082 pub const SPECTATOR: Self = Self(3);
1084 pub const fn name(self) -> Option<&'static str> {
1086 match self.0 {
1087 0 => Some("survival"),
1088 1 => Some("creative"),
1089 2 => Some("adventure"),
1090 3 => Some("spectator"),
1091 _ => None,
1092 }
1093 }
1094}
1095#[cfg(feature = "v26_3")]
1096impl std::fmt::Debug for SpawnInfoGamemode {
1097 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1098 match self.name() {
1099 Some(n) => write!(f, "SpawnInfoGamemode::{n}"),
1100 None => write!(f, "SpawnInfoGamemode({})", self.0),
1101 }
1102 }
1103}
1104
1105#[cfg(feature = "v26_3")]
1106#[derive(Debug, Clone, PartialEq)]
1108pub struct SpawnInfo {
1109 pub dimension: i32,
1111 pub name: ByteString,
1113 pub hashed_seed: i64,
1115 pub gamemode: crate::defs::p777::play::clientbound::SpawnInfoGamemode,
1117 pub previous_gamemode: i32,
1119 pub is_debug: bool,
1121 pub is_flat: bool,
1123 pub death: Option<crate::defs::p775::types::GlobalPos>,
1125 pub portal_cooldown: i32,
1127 pub sea_level: i32,
1129}
1130#[cfg(feature = "v26_3")]
1131impl Decode for SpawnInfo {
1132 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1133 Ok({
1134 let v1 = r.read_varint()?;
1135 let v2 = r.read_string()?;
1136 let v3 = r.read_i64()?;
1137 let v4 = crate::defs::p777::play::clientbound::SpawnInfoGamemode(r.read_varint()?);
1138 let v5 = r.read_varint()?;
1139 let v6 = r.read_bool()?;
1140 let v7 = r.read_bool()?;
1141 let v8 = if r.read_bool()? {
1142 Some(<crate::defs::p775::types::GlobalPos as Decode>::decode(r)?)
1143 } else {
1144 None
1145 };
1146 let v9 = r.read_varint()?;
1147 let v10 = r.read_varint()?;
1148 Self {
1149 dimension: v1,
1150 name: v2,
1151 hashed_seed: v3,
1152 gamemode: v4,
1153 previous_gamemode: v5,
1154 is_debug: v6,
1155 is_flat: v7,
1156 death: v8,
1157 portal_cooldown: v9,
1158 sea_level: v10,
1159 }
1160 })
1161 }
1162}
1163#[cfg(feature = "v26_3")]
1164impl Encode for SpawnInfo {
1165 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1166 w.put_varint((*self).dimension);
1167 w.put_string(&(*self).name)?;
1168 w.put_i64((*self).hashed_seed);
1169 w.put_varint((*self).gamemode.0);
1170 w.put_varint((*self).previous_gamemode);
1171 w.put_bool((*self).is_debug);
1172 w.put_bool((*self).is_flat);
1173 match &(*self).death {
1174 Some(v1) => {
1175 w.put_u8(1);
1176 (*v1).encode(w)?;
1177 }
1178 None => w.put_u8(0),
1179 }
1180 w.put_varint((*self).portal_cooldown);
1181 w.put_varint((*self).sea_level);
1182 Ok(())
1183 }
1184}
1185#[cfg(feature = "v26_3")]
1186#[cfg(feature = "testgen")]
1187impl Generate for SpawnInfo {
1188 fn generate(g: &mut Gen) -> Self {
1189 {
1190 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1191 let v2 = g.string();
1192 let v3 = g.i64();
1193 let v4 = crate::defs::p777::play::clientbound::SpawnInfoGamemode(g.int_in(
1194 -2147483648,
1195 2147483647,
1196 &[0, 1, 2, 3],
1197 ) as i32);
1198 let v5 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1199 let v6 = g.bool();
1200 let v7 = g.bool();
1201 let v8 = if g.bool() {
1202 Some(<crate::defs::p775::types::GlobalPos as Generate>::generate(
1203 g,
1204 ))
1205 } else {
1206 None
1207 };
1208 let v9 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1209 let v10 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1210 Self {
1211 dimension: v1,
1212 name: v2,
1213 hashed_seed: v3,
1214 gamemode: v4,
1215 previous_gamemode: v5,
1216 is_debug: v6,
1217 is_flat: v7,
1218 death: v8,
1219 portal_cooldown: v9,
1220 sea_level: v10,
1221 }
1222 }
1223 }
1224}
1225
1226#[cfg(feature = "v26_3")]
1227#[derive(Debug, Clone, PartialEq)]
1229pub struct DeclareCommands<const V: i32> {
1230 pub nodes: Vec<crate::defs::p777::types::CommandNode>,
1232 pub root_index: i32,
1234}
1235#[cfg(feature = "v26_3")]
1236impl<const V: i32> Decode for DeclareCommands<V> {
1237 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1238 Ok({
1239 let v1 = {
1240 let v2 = {
1241 let c = r.read_varint()?;
1242 r.check_count(i64::from(c), 2)?
1243 };
1244 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
1245 for _ in 0..v2 {
1246 v3.push(<crate::defs::p777::types::CommandNode as Decode>::decode(
1247 r,
1248 )?);
1249 }
1250 v3
1251 };
1252 let v4 = r.read_varint()?;
1253 Self {
1254 nodes: v1,
1255 root_index: v4,
1256 }
1257 })
1258 }
1259}
1260#[cfg(feature = "v26_3")]
1261impl<const V: i32> Encode for DeclareCommands<V> {
1262 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1263 w.put_len_varint((*self).nodes.len())?;
1264 for v1 in (*self).nodes.iter() {
1265 (*v1).encode(w)?;
1266 }
1267 w.put_varint((*self).root_index);
1268 Ok(())
1269 }
1270}
1271#[cfg(feature = "v26_3")]
1272#[cfg(feature = "testgen")]
1273impl<const V: i32> Generate for DeclareCommands<V> {
1274 fn generate(g: &mut Gen) -> Self {
1275 {
1276 let v1 = {
1277 let v2 = g.count();
1278 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
1279 for _ in 0..v2 {
1280 v3.push(<crate::defs::p777::types::CommandNode as Generate>::generate(g));
1281 }
1282 v3
1283 };
1284 let v4 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1285 Self {
1286 nodes: v1,
1287 root_index: v4,
1288 }
1289 }
1290 }
1291}
1292
1293#[cfg(feature = "v26_3")]
1294#[derive(Debug, Clone, PartialEq)]
1296pub struct WindowItems<const V: i32> {
1297 pub window_id: i32,
1299 pub state_id: i32,
1301 pub items: Vec<crate::defs::p777::types::Slot>,
1303 pub carried_item: crate::defs::p777::types::Slot,
1305}
1306#[cfg(feature = "v26_3")]
1307impl<const V: i32> Decode for WindowItems<V> {
1308 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1309 Ok({
1310 let v1 = r.read_varint()?;
1311 let v2 = r.read_varint()?;
1312 let v3 = {
1313 let v4 = {
1314 let c = r.read_varint()?;
1315 r.check_count(i64::from(c), 1)?
1316 };
1317 let mut v5 = Vec::with_capacity(v4.min(crate::codec::PREALLOC_LIMIT));
1318 for _ in 0..v4 {
1319 v5.push(<crate::defs::p777::types::Slot as Decode>::decode(r)?);
1320 }
1321 v5
1322 };
1323 let v6 = <crate::defs::p777::types::Slot as Decode>::decode(r)?;
1324 Self {
1325 window_id: v1,
1326 state_id: v2,
1327 items: v3,
1328 carried_item: v6,
1329 }
1330 })
1331 }
1332}
1333#[cfg(feature = "v26_3")]
1334impl<const V: i32> Encode for WindowItems<V> {
1335 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1336 w.put_varint((*self).window_id);
1337 w.put_varint((*self).state_id);
1338 w.put_len_varint((*self).items.len())?;
1339 for v1 in (*self).items.iter() {
1340 (*v1).encode(w)?;
1341 }
1342 (*self).carried_item.encode(w)?;
1343 Ok(())
1344 }
1345}
1346#[cfg(feature = "v26_3")]
1347#[cfg(feature = "testgen")]
1348impl<const V: i32> Generate for WindowItems<V> {
1349 fn generate(g: &mut Gen) -> Self {
1350 {
1351 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1352 let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1353 let v3 = {
1354 let v4 = g.count();
1355 let mut v5 = Vec::with_capacity(v4.min(crate::codec::PREALLOC_LIMIT));
1356 for _ in 0..v4 {
1357 v5.push(<crate::defs::p777::types::Slot as Generate>::generate(g));
1358 }
1359 v5
1360 };
1361 let v6 = <crate::defs::p777::types::Slot as Generate>::generate(g);
1362 Self {
1363 window_id: v1,
1364 state_id: v2,
1365 items: v3,
1366 carried_item: v6,
1367 }
1368 }
1369 }
1370}
1371
1372#[cfg(feature = "v26_3")]
1373#[derive(Debug, Clone, PartialEq)]
1375pub struct SetSlot<const V: i32> {
1376 pub window_id: i32,
1378 pub state_id: i32,
1380 pub slot: i16,
1382 pub item: crate::defs::p777::types::Slot,
1384}
1385#[cfg(feature = "v26_3")]
1386impl<const V: i32> Decode for SetSlot<V> {
1387 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1388 Ok({
1389 let v1 = r.read_varint()?;
1390 let v2 = r.read_varint()?;
1391 let v3 = r.read_i16()?;
1392 let v4 = <crate::defs::p777::types::Slot as Decode>::decode(r)?;
1393 Self {
1394 window_id: v1,
1395 state_id: v2,
1396 slot: v3,
1397 item: v4,
1398 }
1399 })
1400 }
1401}
1402#[cfg(feature = "v26_3")]
1403impl<const V: i32> Encode for SetSlot<V> {
1404 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1405 w.put_varint((*self).window_id);
1406 w.put_varint((*self).state_id);
1407 w.put_i16((*self).slot);
1408 (*self).item.encode(w)?;
1409 Ok(())
1410 }
1411}
1412#[cfg(feature = "v26_3")]
1413#[cfg(feature = "testgen")]
1414impl<const V: i32> Generate for SetSlot<V> {
1415 fn generate(g: &mut Gen) -> Self {
1416 {
1417 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1418 let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1419 let v3 = (g.int_in(-32768, 32767, &[]) as i16);
1420 let v4 = <crate::defs::p777::types::Slot as Generate>::generate(g);
1421 Self {
1422 window_id: v1,
1423 state_id: v2,
1424 slot: v3,
1425 item: v4,
1426 }
1427 }
1428 }
1429}
1430
1431#[cfg(feature = "v26_3")]
1432#[derive(Debug, Clone, PartialEq)]
1434pub struct DebugBlockValue<const V: i32> {
1435 pub block_pos: BlockPos,
1437 pub update: crate::defs::p777::types::DebugSubscriptionUpdate,
1439}
1440#[cfg(feature = "v26_3")]
1441impl<const V: i32> Decode for DebugBlockValue<V> {
1442 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1443 Ok({
1444 let v1 = BlockPos::read(r, PositionLayout::Xzy)?;
1445 let v2 = <crate::defs::p777::types::DebugSubscriptionUpdate as Decode>::decode(r)?;
1446 Self {
1447 block_pos: v1,
1448 update: v2,
1449 }
1450 })
1451 }
1452}
1453#[cfg(feature = "v26_3")]
1454impl<const V: i32> Encode for DebugBlockValue<V> {
1455 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1456 (*self).block_pos.write(w, PositionLayout::Xzy)?;
1457 (*self).update.encode(w)?;
1458 Ok(())
1459 }
1460}
1461#[cfg(feature = "v26_3")]
1462#[cfg(feature = "testgen")]
1463impl<const V: i32> Generate for DebugBlockValue<V> {
1464 fn generate(g: &mut Gen) -> Self {
1465 {
1466 let v1 = g.position();
1467 let v2 = <crate::defs::p777::types::DebugSubscriptionUpdate as Generate>::generate(g);
1468 Self {
1469 block_pos: v1,
1470 update: v2,
1471 }
1472 }
1473 }
1474}
1475
1476#[cfg(feature = "v26_3")]
1477#[derive(Debug, Clone, PartialEq)]
1479pub struct DebugChunkValue<const V: i32> {
1480 pub chunk_pos: crate::defs::p775::types::PackedChunkPos,
1482 pub update: crate::defs::p777::types::DebugSubscriptionUpdate,
1484}
1485#[cfg(feature = "v26_3")]
1486impl<const V: i32> Decode for DebugChunkValue<V> {
1487 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1488 Ok({
1489 let v1 = <crate::defs::p775::types::PackedChunkPos as Decode>::decode(r)?;
1490 let v2 = <crate::defs::p777::types::DebugSubscriptionUpdate as Decode>::decode(r)?;
1491 Self {
1492 chunk_pos: v1,
1493 update: v2,
1494 }
1495 })
1496 }
1497}
1498#[cfg(feature = "v26_3")]
1499impl<const V: i32> Encode for DebugChunkValue<V> {
1500 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1501 (*self).chunk_pos.encode(w)?;
1502 (*self).update.encode(w)?;
1503 Ok(())
1504 }
1505}
1506#[cfg(feature = "v26_3")]
1507#[cfg(feature = "testgen")]
1508impl<const V: i32> Generate for DebugChunkValue<V> {
1509 fn generate(g: &mut Gen) -> Self {
1510 {
1511 let v1 = <crate::defs::p775::types::PackedChunkPos as Generate>::generate(g);
1512 let v2 = <crate::defs::p777::types::DebugSubscriptionUpdate as Generate>::generate(g);
1513 Self {
1514 chunk_pos: v1,
1515 update: v2,
1516 }
1517 }
1518 }
1519}
1520
1521#[cfg(feature = "v26_3")]
1522#[derive(Debug, Clone, PartialEq)]
1524pub struct DebugEntityValue<const V: i32> {
1525 pub entity_id: i32,
1527 pub update: crate::defs::p777::types::DebugSubscriptionUpdate,
1529}
1530#[cfg(feature = "v26_3")]
1531impl<const V: i32> Decode for DebugEntityValue<V> {
1532 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1533 Ok({
1534 let v1 = r.read_varint()?;
1535 let v2 = <crate::defs::p777::types::DebugSubscriptionUpdate as Decode>::decode(r)?;
1536 Self {
1537 entity_id: v1,
1538 update: v2,
1539 }
1540 })
1541 }
1542}
1543#[cfg(feature = "v26_3")]
1544impl<const V: i32> Encode for DebugEntityValue<V> {
1545 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1546 w.put_varint((*self).entity_id);
1547 (*self).update.encode(w)?;
1548 Ok(())
1549 }
1550}
1551#[cfg(feature = "v26_3")]
1552#[cfg(feature = "testgen")]
1553impl<const V: i32> Generate for DebugEntityValue<V> {
1554 fn generate(g: &mut Gen) -> Self {
1555 {
1556 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1557 let v2 = <crate::defs::p777::types::DebugSubscriptionUpdate as Generate>::generate(g);
1558 Self {
1559 entity_id: v1,
1560 update: v2,
1561 }
1562 }
1563 }
1564}
1565
1566#[cfg(feature = "v26_3")]
1567#[derive(Debug, Clone, PartialEq)]
1569pub struct DebugEvent<const V: i32> {
1570 pub event: crate::defs::p777::types::DebugSubscriptionEvent,
1572}
1573#[cfg(feature = "v26_3")]
1574impl<const V: i32> Decode for DebugEvent<V> {
1575 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1576 Ok({
1577 let v1 = <crate::defs::p777::types::DebugSubscriptionEvent as Decode>::decode(r)?;
1578 Self { event: v1 }
1579 })
1580 }
1581}
1582#[cfg(feature = "v26_3")]
1583impl<const V: i32> Encode for DebugEvent<V> {
1584 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1585 (*self).event.encode(w)?;
1586 Ok(())
1587 }
1588}
1589#[cfg(feature = "v26_3")]
1590#[cfg(feature = "testgen")]
1591impl<const V: i32> Generate for DebugEvent<V> {
1592 fn generate(g: &mut Gen) -> Self {
1593 {
1594 let v1 = <crate::defs::p777::types::DebugSubscriptionEvent as Generate>::generate(g);
1595 Self { event: v1 }
1596 }
1597 }
1598}
1599
1600#[cfg(feature = "v26_3")]
1601#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
1603#[non_exhaustive]
1604pub struct SyncEntityPositionPathType(pub i32);
1605#[cfg(feature = "v26_3")]
1606impl SyncEntityPositionPathType {
1607 pub const fn new(v: i32) -> Self {
1609 Self(v)
1610 }
1611 pub const LINEAR: Self = Self(0);
1613 pub const STEPPED: Self = Self(1);
1615 pub const fn name(self) -> Option<&'static str> {
1617 match self.0 {
1618 0 => Some("linear"),
1619 1 => Some("stepped"),
1620 _ => None,
1621 }
1622 }
1623}
1624#[cfg(feature = "v26_3")]
1625impl std::fmt::Debug for SyncEntityPositionPathType {
1626 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1627 match self.name() {
1628 Some(n) => write!(f, "SyncEntityPositionPathType::{n}"),
1629 None => write!(f, "SyncEntityPositionPathType({})", self.0),
1630 }
1631 }
1632}
1633
1634#[cfg(feature = "v26_3")]
1635#[derive(Debug, Clone, PartialEq)]
1637pub struct SyncEntityPositionPathDataStepped {
1638 pub position: crate::defs::p775::types::Vec3f64,
1640 pub tick_offset: i32,
1642}
1643
1644#[cfg(feature = "v26_3")]
1645#[derive(Debug, Clone, PartialEq)]
1647#[non_exhaustive]
1648pub enum SyncEntityPositionPathData {
1649 Linear(crate::defs::p775::types::Vec3f64),
1651 Stepped(Vec<crate::defs::p777::play::clientbound::SyncEntityPositionPathDataStepped>),
1653 Other,
1655}
1656
1657#[cfg(feature = "v26_3")]
1658#[derive(Debug, Clone, PartialEq)]
1660pub struct SyncEntityPositionPath {
1661 pub r#type: crate::defs::p777::play::clientbound::SyncEntityPositionPathType,
1663 pub data: crate::defs::p777::play::clientbound::SyncEntityPositionPathData,
1665}
1666
1667#[cfg(feature = "v26_3")]
1668#[derive(Debug, Clone, PartialEq)]
1670pub struct SyncEntityPosition<const V: i32> {
1671 pub entity_id: i32,
1673 pub path: crate::defs::p777::play::clientbound::SyncEntityPositionPath,
1675 pub yaw: f32,
1677 pub pitch: f32,
1679 pub on_ground: bool,
1681}
1682#[cfg(feature = "v26_3")]
1683impl<const V: i32> Decode for SyncEntityPosition<V> {
1684 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1685 Ok({
1686 let v1 = r.read_varint()?;
1687 let v2 = {
1688 let v3 = crate::defs::p777::play::clientbound::SyncEntityPositionPathType(
1689 r.read_varint()?,
1690 );
1691 let v4 = (if (v3.0 == 0) {
1692 crate::defs::p777::play::clientbound::SyncEntityPositionPathData::Linear(
1693 <crate::defs::p775::types::Vec3f64 as Decode>::decode(r)?,
1694 )
1695 } else if (v3.0 == 1) {
1696 crate::defs::p777::play::clientbound::SyncEntityPositionPathData::Stepped({
1697 let v5 = {
1698 let c = r.read_varint()?;
1699 r.check_count(i64::from(c), 25)?
1700 };
1701 let mut v6 = Vec::with_capacity(v5.min(crate::codec::PREALLOC_LIMIT));
1702 for _ in 0..v5 {
1703 v6.push({ let v7 = <crate::defs::p775::types::Vec3f64 as Decode>::decode(r)?;let v8 = r.read_varint()?; crate::defs::p777::play::clientbound::SyncEntityPositionPathDataStepped { position: v7, tick_offset: v8 } });
1704 }
1705 v6
1706 })
1707 } else {
1708 crate::defs::p777::play::clientbound::SyncEntityPositionPathData::Other
1709 });
1710 crate::defs::p777::play::clientbound::SyncEntityPositionPath {
1711 r#type: v3,
1712 data: v4,
1713 }
1714 };
1715 let v9 = r.read_f32()?;
1716 let v10 = r.read_f32()?;
1717 let v11 = r.read_bool()?;
1718 Self {
1719 entity_id: v1,
1720 path: v2,
1721 yaw: v9,
1722 pitch: v10,
1723 on_ground: v11,
1724 }
1725 })
1726 }
1727}
1728#[cfg(feature = "v26_3")]
1729impl<const V: i32> Encode for SyncEntityPosition<V> {
1730 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1731 w.put_varint((*self).entity_id);
1732 w.put_varint((*self).path.r#type.0);
1733 match &(*self).path.data {
1734 crate::defs::p777::play::clientbound::SyncEntityPositionPathData::Linear(v1) => {
1735 if !((*self).path.r#type.0 == 0) {
1736 return Err(EncodeError::SwitchMismatch(
1737 "play.clientbound.sync_entity_position.path.data",
1738 ));
1739 }
1740 (*v1).encode(w)?;
1741 }
1742 crate::defs::p777::play::clientbound::SyncEntityPositionPathData::Stepped(v2) => {
1743 if !((*self).path.r#type.0 == 1) {
1744 return Err(EncodeError::SwitchMismatch(
1745 "play.clientbound.sync_entity_position.path.data",
1746 ));
1747 }
1748 w.put_len_varint((*v2).len())?;
1749 for v3 in (*v2).iter() {
1750 (*v3).position.encode(w)?;
1751 w.put_varint((*v3).tick_offset);
1752 }
1753 }
1754 crate::defs::p777::play::clientbound::SyncEntityPositionPathData::Other => {
1755 if !(!(((*self).path.r#type.0 == 0) || ((*self).path.r#type.0 == 1))) {
1756 return Err(EncodeError::SwitchMismatch(
1757 "play.clientbound.sync_entity_position.path.data",
1758 ));
1759 }
1760 }
1761 }
1762 w.put_f32((*self).yaw);
1763 w.put_f32((*self).pitch);
1764 w.put_bool((*self).on_ground);
1765 Ok(())
1766 }
1767}
1768#[cfg(feature = "v26_3")]
1769#[cfg(feature = "testgen")]
1770impl<const V: i32> Generate for SyncEntityPosition<V> {
1771 fn generate(g: &mut Gen) -> Self {
1772 {
1773 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1774 let v2 = {
1775 let v3 = crate::defs::p777::play::clientbound::SyncEntityPositionPathType(
1776 g.int_in(-2147483648, 2147483647, &[0, 1]) as i32,
1777 );
1778 let v4 = (if (v3.0 == 0) {
1779 crate::defs::p777::play::clientbound::SyncEntityPositionPathData::Linear(
1780 <crate::defs::p775::types::Vec3f64 as Generate>::generate(g),
1781 )
1782 } else if (v3.0 == 1) {
1783 crate::defs::p777::play::clientbound::SyncEntityPositionPathData::Stepped({
1784 let v5 = g.count();
1785 let mut v6 = Vec::with_capacity(v5.min(crate::codec::PREALLOC_LIMIT));
1786 for _ in 0..v5 {
1787 v6.push({ let v7 = <crate::defs::p775::types::Vec3f64 as Generate>::generate(g);let v8 = (g.int_in(-2147483648, 2147483647, &[]) as i32); crate::defs::p777::play::clientbound::SyncEntityPositionPathDataStepped { position: v7, tick_offset: v8 } });
1788 }
1789 v6
1790 })
1791 } else {
1792 crate::defs::p777::play::clientbound::SyncEntityPositionPathData::Other
1793 });
1794 crate::defs::p777::play::clientbound::SyncEntityPositionPath {
1795 r#type: v3,
1796 data: v4,
1797 }
1798 };
1799 let v9 = g.f32();
1800 let v10 = g.f32();
1801 let v11 = g.bool();
1802 Self {
1803 entity_id: v1,
1804 path: v2,
1805 yaw: v9,
1806 pitch: v10,
1807 on_ground: v11,
1808 }
1809 }
1810 }
1811}
1812
1813#[cfg(feature = "v26_3")]
1814#[derive(Debug, Clone, PartialEq)]
1816pub struct Explosion<const V: i32> {
1817 pub center: crate::defs::p775::types::Vec3f64,
1819 pub radius: f32,
1821 pub block_count: i32,
1823 pub player_knockback: Option<crate::defs::p775::types::Vec3f64>,
1825 pub explosion_particle: crate::defs::p777::types::Particle,
1827 pub sound: Holder<crate::defs::p775::types::ItemSoundEvent>,
1829 pub block_particles: Vec<crate::defs::p777::play::clientbound::ExplosionParticleEntry>,
1831 pub play_sound: bool,
1833}
1834#[cfg(feature = "v26_3")]
1835impl<const V: i32> Decode for Explosion<V> {
1836 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1837 Ok({
1838 let v1 = <crate::defs::p775::types::Vec3f64 as Decode>::decode(r)?;
1839 let v2 = r.read_f32()?;
1840 let v3 = r.read_i32()?;
1841 let v4 = if r.read_bool()? {
1842 Some(<crate::defs::p775::types::Vec3f64 as Decode>::decode(r)?)
1843 } else {
1844 None
1845 };
1846 let v5 = <crate::defs::p777::types::Particle as Decode>::decode(r)?;
1847 let v6 = {
1848 let id = r.read_varint()?;
1849 if id == 0 {
1850 Holder::Inline(<crate::defs::p775::types::ItemSoundEvent as Decode>::decode(r)?)
1851 } else {
1852 Holder::Id(id.wrapping_sub(1))
1853 }
1854 };
1855 let v7 = {
1856 let v8 = {
1857 let c = r.read_varint()?;
1858 r.check_count(i64::from(c), 10)?
1859 };
1860 let mut v9 = Vec::with_capacity(v8.min(crate::codec::PREALLOC_LIMIT));
1861 for _ in 0..v8 {
1862 v9.push(<crate::defs::p777::play::clientbound::ExplosionParticleEntry as Decode>::decode(r)?);
1863 }
1864 v9
1865 };
1866 let v10 = r.read_bool()?;
1867 Self {
1868 center: v1,
1869 radius: v2,
1870 block_count: v3,
1871 player_knockback: v4,
1872 explosion_particle: v5,
1873 sound: v6,
1874 block_particles: v7,
1875 play_sound: v10,
1876 }
1877 })
1878 }
1879}
1880#[cfg(feature = "v26_3")]
1881impl<const V: i32> Encode for Explosion<V> {
1882 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1883 (*self).center.encode(w)?;
1884 w.put_f32((*self).radius);
1885 w.put_i32((*self).block_count);
1886 match &(*self).player_knockback {
1887 Some(v1) => {
1888 w.put_u8(1);
1889 (*v1).encode(w)?;
1890 }
1891 None => w.put_u8(0),
1892 }
1893 (*self).explosion_particle.encode(w)?;
1894 match &(*self).sound {
1895 Holder::Id(v3) => {
1896 if *v3 == -1 {
1897 return Err(EncodeError::OutOfRange("holder id"));
1898 }
1899 w.put_varint(v3.wrapping_add(1));
1900 }
1901 Holder::Inline(v2) => {
1902 w.put_varint(0);
1903 (*v2).encode(w)?;
1904 }
1905 }
1906 w.put_len_varint((*self).block_particles.len())?;
1907 for v4 in (*self).block_particles.iter() {
1908 (*v4).encode(w)?;
1909 }
1910 w.put_bool((*self).play_sound);
1911 Ok(())
1912 }
1913}
1914#[cfg(feature = "v26_3")]
1915#[cfg(feature = "testgen")]
1916impl<const V: i32> Generate for Explosion<V> {
1917 fn generate(g: &mut Gen) -> Self {
1918 {
1919 let v1 = <crate::defs::p775::types::Vec3f64 as Generate>::generate(g);
1920 let v2 = g.f32();
1921 let v3 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1922 let v4 = if g.bool() {
1923 Some(<crate::defs::p775::types::Vec3f64 as Generate>::generate(g))
1924 } else {
1925 None
1926 };
1927 let v5 = <crate::defs::p777::types::Particle as Generate>::generate(g);
1928 let v6 = if g.bool() {
1929 Holder::Id(match g.int_in(-2147483648, 2147483647, &[0, 1, 2]) as i32 {
1930 -1 => 0,
1931 v => v,
1932 })
1933 } else {
1934 Holder::Inline(<crate::defs::p775::types::ItemSoundEvent as Generate>::generate(g))
1935 };
1936 let v7 = {
1937 let v8 = g.count();
1938 let mut v9 = Vec::with_capacity(v8.min(crate::codec::PREALLOC_LIMIT));
1939 for _ in 0..v8 {
1940 v9.push(<crate::defs::p777::play::clientbound::ExplosionParticleEntry as Generate>::generate(g));
1941 }
1942 v9
1943 };
1944 let v10 = g.bool();
1945 Self {
1946 center: v1,
1947 radius: v2,
1948 block_count: v3,
1949 player_knockback: v4,
1950 explosion_particle: v5,
1951 sound: v6,
1952 block_particles: v7,
1953 play_sound: v10,
1954 }
1955 }
1956 }
1957}
1958
1959#[cfg(feature = "v26_3")]
1960#[derive(Debug, Clone, PartialEq)]
1962pub struct AddTransientBlock<const V: i32> {
1963 pub location: BlockPos,
1965 pub block_state: i32,
1967}
1968#[cfg(feature = "v26_3")]
1969impl<const V: i32> Decode for AddTransientBlock<V> {
1970 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1971 Ok({
1972 let v1 = BlockPos::read(r, PositionLayout::Xzy)?;
1973 let v2 = r.read_varint()?;
1974 Self {
1975 location: v1,
1976 block_state: v2,
1977 }
1978 })
1979 }
1980}
1981#[cfg(feature = "v26_3")]
1982impl<const V: i32> Encode for AddTransientBlock<V> {
1983 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1984 (*self).location.write(w, PositionLayout::Xzy)?;
1985 w.put_varint((*self).block_state);
1986 Ok(())
1987 }
1988}
1989#[cfg(feature = "v26_3")]
1990#[cfg(feature = "testgen")]
1991impl<const V: i32> Generate for AddTransientBlock<V> {
1992 fn generate(g: &mut Gen) -> Self {
1993 {
1994 let v1 = g.position();
1995 let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1996 Self {
1997 location: v1,
1998 block_state: v2,
1999 }
2000 }
2001 }
2002}
2003
2004#[cfg(feature = "v26_3")]
2005#[derive(Debug, Clone, PartialEq)]
2007pub struct MapChunk<const V: i32> {
2008 pub x: i32,
2010 pub z: i32,
2012 pub heightmaps: Vec<crate::defs::p775::play::clientbound::MapChunkHeightmaps>,
2014 pub chunk_data: Bytes,
2016 pub block_entities: Vec<crate::defs::p775::types::ChunkBlockEntity>,
2018 pub sky_light_mask: Bytes,
2020 pub block_light_mask: Bytes,
2022 pub empty_sky_light_mask: Bytes,
2024 pub empty_block_light_mask: Bytes,
2026 pub sky_light: Vec<Vec<u8>>,
2028 pub block_light: Vec<Vec<u8>>,
2030}
2031#[cfg(feature = "v26_3")]
2032impl<const V: i32> Decode for MapChunk<V> {
2033 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2034 Ok({
2035 let v1 = r.read_i32()?;
2036 let v2 = r.read_i32()?;
2037 let v3 = {
2038 let v4 = {
2039 let c = r.read_varint()?;
2040 r.check_count(i64::from(c), 2)?
2041 };
2042 let mut v5 = Vec::with_capacity(v4.min(crate::codec::PREALLOC_LIMIT));
2043 for _ in 0..v4 {
2044 v5.push({
2045 let v6 = crate::defs::p775::play::clientbound::MapChunkHeightmapsType(
2046 r.read_varint()?,
2047 );
2048 let v7 = {
2049 let v8 = {
2050 let c = r.read_varint()?;
2051 r.check_count(i64::from(c), 8)?
2052 };
2053 let mut v9 = Vec::with_capacity(v8.min(crate::codec::PREALLOC_LIMIT));
2054 for _ in 0..v8 {
2055 v9.push(r.read_i64()?);
2056 }
2057 v9
2058 };
2059 crate::defs::p775::play::clientbound::MapChunkHeightmaps {
2060 r#type: v6,
2061 data: v7,
2062 }
2063 });
2064 }
2065 v5
2066 };
2067 let v10 = r.read_byte_array()?;
2068 let v11 = {
2069 let v12 = {
2070 let c = r.read_varint()?;
2071 r.check_count(i64::from(c), 5)?
2072 };
2073 let mut v13 = Vec::with_capacity(v12.min(crate::codec::PREALLOC_LIMIT));
2074 for _ in 0..v12 {
2075 v13.push(<crate::defs::p775::types::ChunkBlockEntity as Decode>::decode(r)?);
2076 }
2077 v13
2078 };
2079 let v14 = r.read_byte_array()?;
2080 let v15 = r.read_byte_array()?;
2081 let v16 = r.read_byte_array()?;
2082 let v17 = r.read_byte_array()?;
2083 let v18 = {
2084 let v19 = {
2085 let c = r.read_varint()?;
2086 r.check_count(i64::from(c), 1)?
2087 };
2088 let mut v20 = Vec::with_capacity(v19.min(crate::codec::PREALLOC_LIMIT));
2089 for _ in 0..v19 {
2090 v20.push({
2091 let v21 = {
2092 let c = r.read_varint()?;
2093 r.check_count(i64::from(c), 1)?
2094 };
2095 let mut v22 = Vec::with_capacity(v21.min(crate::codec::PREALLOC_LIMIT));
2096 for _ in 0..v21 {
2097 v22.push(r.read_u8()?);
2098 }
2099 v22
2100 });
2101 }
2102 v20
2103 };
2104 let v23 = {
2105 let v24 = {
2106 let c = r.read_varint()?;
2107 r.check_count(i64::from(c), 1)?
2108 };
2109 let mut v25 = Vec::with_capacity(v24.min(crate::codec::PREALLOC_LIMIT));
2110 for _ in 0..v24 {
2111 v25.push({
2112 let v26 = {
2113 let c = r.read_varint()?;
2114 r.check_count(i64::from(c), 1)?
2115 };
2116 let mut v27 = Vec::with_capacity(v26.min(crate::codec::PREALLOC_LIMIT));
2117 for _ in 0..v26 {
2118 v27.push(r.read_u8()?);
2119 }
2120 v27
2121 });
2122 }
2123 v25
2124 };
2125 Self {
2126 x: v1,
2127 z: v2,
2128 heightmaps: v3,
2129 chunk_data: v10,
2130 block_entities: v11,
2131 sky_light_mask: v14,
2132 block_light_mask: v15,
2133 empty_sky_light_mask: v16,
2134 empty_block_light_mask: v17,
2135 sky_light: v18,
2136 block_light: v23,
2137 }
2138 })
2139 }
2140}
2141#[cfg(feature = "v26_3")]
2142impl<const V: i32> Encode for MapChunk<V> {
2143 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2144 w.put_i32((*self).x);
2145 w.put_i32((*self).z);
2146 w.put_len_varint((*self).heightmaps.len())?;
2147 for v1 in (*self).heightmaps.iter() {
2148 w.put_varint((*v1).r#type.0);
2149 w.put_len_varint((*v1).data.len())?;
2150 for v2 in (*v1).data.iter() {
2151 w.put_i64((*v2));
2152 }
2153 }
2154 w.put_byte_array(&(*self).chunk_data)?;
2155 w.put_len_varint((*self).block_entities.len())?;
2156 for v3 in (*self).block_entities.iter() {
2157 (*v3).encode(w)?;
2158 }
2159 w.put_byte_array(&(*self).sky_light_mask)?;
2160 w.put_byte_array(&(*self).block_light_mask)?;
2161 w.put_byte_array(&(*self).empty_sky_light_mask)?;
2162 w.put_byte_array(&(*self).empty_block_light_mask)?;
2163 w.put_len_varint((*self).sky_light.len())?;
2164 for v4 in (*self).sky_light.iter() {
2165 w.put_len_varint((*v4).len())?;
2166 for v5 in (*v4).iter() {
2167 w.put_u8((*v5));
2168 }
2169 }
2170 w.put_len_varint((*self).block_light.len())?;
2171 for v6 in (*self).block_light.iter() {
2172 w.put_len_varint((*v6).len())?;
2173 for v7 in (*v6).iter() {
2174 w.put_u8((*v7));
2175 }
2176 }
2177 Ok(())
2178 }
2179}
2180#[cfg(feature = "v26_3")]
2181#[cfg(feature = "testgen")]
2182impl<const V: i32> Generate for MapChunk<V> {
2183 fn generate(g: &mut Gen) -> Self {
2184 {
2185 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2186 let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2187 let v3 = {
2188 let v4 = g.count();
2189 let mut v5 = Vec::with_capacity(v4.min(crate::codec::PREALLOC_LIMIT));
2190 for _ in 0..v4 {
2191 v5.push({
2192 let v6 = crate::defs::p775::play::clientbound::MapChunkHeightmapsType(
2193 g.int_in(-2147483648, 2147483647, &[0, 1, 2, 3, 4, 5]) as i32,
2194 );
2195 let v7 = {
2196 let v8 = g.count();
2197 let mut v9 = Vec::with_capacity(v8.min(crate::codec::PREALLOC_LIMIT));
2198 for _ in 0..v8 {
2199 v9.push(g.i64());
2200 }
2201 v9
2202 };
2203 crate::defs::p775::play::clientbound::MapChunkHeightmaps {
2204 r#type: v6,
2205 data: v7,
2206 }
2207 });
2208 }
2209 v5
2210 };
2211 let v10 = g.bytes();
2212 let v11 = {
2213 let v12 = g.count();
2214 let mut v13 = Vec::with_capacity(v12.min(crate::codec::PREALLOC_LIMIT));
2215 for _ in 0..v12 {
2216 v13.push(<crate::defs::p775::types::ChunkBlockEntity as Generate>::generate(g));
2217 }
2218 v13
2219 };
2220 let v14 = g.bytes();
2221 let v15 = g.bytes();
2222 let v16 = g.bytes();
2223 let v17 = g.bytes();
2224 let v18 = {
2225 let v19 = g.count();
2226 let mut v20 = Vec::with_capacity(v19.min(crate::codec::PREALLOC_LIMIT));
2227 for _ in 0..v19 {
2228 v20.push({
2229 let v21 = g.count();
2230 let mut v22 = Vec::with_capacity(v21.min(crate::codec::PREALLOC_LIMIT));
2231 for _ in 0..v21 {
2232 v22.push((g.int_in(0, 255, &[]) as u8));
2233 }
2234 v22
2235 });
2236 }
2237 v20
2238 };
2239 let v23 = {
2240 let v24 = g.count();
2241 let mut v25 = Vec::with_capacity(v24.min(crate::codec::PREALLOC_LIMIT));
2242 for _ in 0..v24 {
2243 v25.push({
2244 let v26 = g.count();
2245 let mut v27 = Vec::with_capacity(v26.min(crate::codec::PREALLOC_LIMIT));
2246 for _ in 0..v26 {
2247 v27.push((g.int_in(0, 255, &[]) as u8));
2248 }
2249 v27
2250 });
2251 }
2252 v25
2253 };
2254 Self {
2255 x: v1,
2256 z: v2,
2257 heightmaps: v3,
2258 chunk_data: v10,
2259 block_entities: v11,
2260 sky_light_mask: v14,
2261 block_light_mask: v15,
2262 empty_sky_light_mask: v16,
2263 empty_block_light_mask: v17,
2264 sky_light: v18,
2265 block_light: v23,
2266 }
2267 }
2268 }
2269}
2270
2271#[cfg(feature = "v26_3")]
2272#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
2274#[non_exhaustive]
2275pub struct WorldParticlesRandomization(pub i32);
2276#[cfg(feature = "v26_3")]
2277impl WorldParticlesRandomization {
2278 pub const fn new(v: i32) -> Self {
2280 Self(v)
2281 }
2282 pub const DEFAULT: Self = Self(0);
2284 pub const ALTERNATIVE: Self = Self(1);
2286 pub const ALTERNATIVE_WITH_SPEED: Self = Self(2);
2288 pub const fn name(self) -> Option<&'static str> {
2290 match self.0 {
2291 0 => Some("default"),
2292 1 => Some("alternative"),
2293 2 => Some("alternative_with_speed"),
2294 _ => None,
2295 }
2296 }
2297}
2298#[cfg(feature = "v26_3")]
2299impl std::fmt::Debug for WorldParticlesRandomization {
2300 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2301 match self.name() {
2302 Some(n) => write!(f, "WorldParticlesRandomization::{n}"),
2303 None => write!(f, "WorldParticlesRandomization({})", self.0),
2304 }
2305 }
2306}
2307
2308#[cfg(feature = "v26_3")]
2309#[derive(Debug, Clone, PartialEq)]
2311pub struct WorldParticles<const V: i32> {
2312 pub particle: crate::defs::p777::types::Particle,
2314 pub long_distance: bool,
2316 pub always_show: bool,
2318 pub x: f64,
2320 pub y: f64,
2322 pub z: f64,
2324 pub offset_x: f32,
2326 pub offset_y: f32,
2328 pub offset_z: f32,
2330 pub velocity_offset_x: f32,
2332 pub velocity_offset_y: f32,
2334 pub velocity_offset_z: f32,
2336 pub amount: i32,
2338 pub randomization: crate::defs::p777::play::clientbound::WorldParticlesRandomization,
2340}
2341#[cfg(feature = "v26_3")]
2342impl<const V: i32> Decode for WorldParticles<V> {
2343 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2344 Ok({
2345 let v1 = <crate::defs::p777::types::Particle as Decode>::decode(r)?;
2346 let v2 = r.read_bool()?;
2347 let v3 = r.read_bool()?;
2348 let v4 = r.read_f64()?;
2349 let v5 = r.read_f64()?;
2350 let v6 = r.read_f64()?;
2351 let v7 = r.read_f32()?;
2352 let v8 = r.read_f32()?;
2353 let v9 = r.read_f32()?;
2354 let v10 = r.read_f32()?;
2355 let v11 = r.read_f32()?;
2356 let v12 = r.read_f32()?;
2357 let v13 = r.read_varint()?;
2358 let v14 =
2359 crate::defs::p777::play::clientbound::WorldParticlesRandomization(r.read_varint()?);
2360 Self {
2361 particle: v1,
2362 long_distance: v2,
2363 always_show: v3,
2364 x: v4,
2365 y: v5,
2366 z: v6,
2367 offset_x: v7,
2368 offset_y: v8,
2369 offset_z: v9,
2370 velocity_offset_x: v10,
2371 velocity_offset_y: v11,
2372 velocity_offset_z: v12,
2373 amount: v13,
2374 randomization: v14,
2375 }
2376 })
2377 }
2378}
2379#[cfg(feature = "v26_3")]
2380impl<const V: i32> Encode for WorldParticles<V> {
2381 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2382 (*self).particle.encode(w)?;
2383 w.put_bool((*self).long_distance);
2384 w.put_bool((*self).always_show);
2385 w.put_f64((*self).x);
2386 w.put_f64((*self).y);
2387 w.put_f64((*self).z);
2388 w.put_f32((*self).offset_x);
2389 w.put_f32((*self).offset_y);
2390 w.put_f32((*self).offset_z);
2391 w.put_f32((*self).velocity_offset_x);
2392 w.put_f32((*self).velocity_offset_y);
2393 w.put_f32((*self).velocity_offset_z);
2394 w.put_varint((*self).amount);
2395 w.put_varint((*self).randomization.0);
2396 Ok(())
2397 }
2398}
2399#[cfg(feature = "v26_3")]
2400#[cfg(feature = "testgen")]
2401impl<const V: i32> Generate for WorldParticles<V> {
2402 fn generate(g: &mut Gen) -> Self {
2403 {
2404 let v1 = <crate::defs::p777::types::Particle as Generate>::generate(g);
2405 let v2 = g.bool();
2406 let v3 = g.bool();
2407 let v4 = g.f64();
2408 let v5 = g.f64();
2409 let v6 = g.f64();
2410 let v7 = g.f32();
2411 let v8 = g.f32();
2412 let v9 = g.f32();
2413 let v10 = g.f32();
2414 let v11 = g.f32();
2415 let v12 = g.f32();
2416 let v13 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2417 let v14 = crate::defs::p777::play::clientbound::WorldParticlesRandomization(g.int_in(
2418 -2147483648,
2419 2147483647,
2420 &[0, 1, 2],
2421 )
2422 as i32);
2423 Self {
2424 particle: v1,
2425 long_distance: v2,
2426 always_show: v3,
2427 x: v4,
2428 y: v5,
2429 z: v6,
2430 offset_x: v7,
2431 offset_y: v8,
2432 offset_z: v9,
2433 velocity_offset_x: v10,
2434 velocity_offset_y: v11,
2435 velocity_offset_z: v12,
2436 amount: v13,
2437 randomization: v14,
2438 }
2439 }
2440 }
2441}
2442
2443#[cfg(feature = "v26_3")]
2444#[derive(Debug, Clone, PartialEq)]
2446pub struct UpdateLight<const V: i32> {
2447 pub chunk_x: i32,
2449 pub chunk_z: i32,
2451 pub sky_light_mask: Bytes,
2453 pub block_light_mask: Bytes,
2455 pub empty_sky_light_mask: Bytes,
2457 pub empty_block_light_mask: Bytes,
2459 pub sky_light: Vec<Vec<u8>>,
2461 pub block_light: Vec<Vec<u8>>,
2463}
2464#[cfg(feature = "v26_3")]
2465impl<const V: i32> Decode for UpdateLight<V> {
2466 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2467 Ok({
2468 let v1 = r.read_varint()?;
2469 let v2 = r.read_varint()?;
2470 let v3 = r.read_byte_array()?;
2471 let v4 = r.read_byte_array()?;
2472 let v5 = r.read_byte_array()?;
2473 let v6 = r.read_byte_array()?;
2474 let v7 = {
2475 let v8 = {
2476 let c = r.read_varint()?;
2477 r.check_count(i64::from(c), 1)?
2478 };
2479 let mut v9 = Vec::with_capacity(v8.min(crate::codec::PREALLOC_LIMIT));
2480 for _ in 0..v8 {
2481 v9.push({
2482 let v10 = {
2483 let c = r.read_varint()?;
2484 r.check_count(i64::from(c), 1)?
2485 };
2486 let mut v11 = Vec::with_capacity(v10.min(crate::codec::PREALLOC_LIMIT));
2487 for _ in 0..v10 {
2488 v11.push(r.read_u8()?);
2489 }
2490 v11
2491 });
2492 }
2493 v9
2494 };
2495 let v12 = {
2496 let v13 = {
2497 let c = r.read_varint()?;
2498 r.check_count(i64::from(c), 1)?
2499 };
2500 let mut v14 = Vec::with_capacity(v13.min(crate::codec::PREALLOC_LIMIT));
2501 for _ in 0..v13 {
2502 v14.push({
2503 let v15 = {
2504 let c = r.read_varint()?;
2505 r.check_count(i64::from(c), 1)?
2506 };
2507 let mut v16 = Vec::with_capacity(v15.min(crate::codec::PREALLOC_LIMIT));
2508 for _ in 0..v15 {
2509 v16.push(r.read_u8()?);
2510 }
2511 v16
2512 });
2513 }
2514 v14
2515 };
2516 Self {
2517 chunk_x: v1,
2518 chunk_z: v2,
2519 sky_light_mask: v3,
2520 block_light_mask: v4,
2521 empty_sky_light_mask: v5,
2522 empty_block_light_mask: v6,
2523 sky_light: v7,
2524 block_light: v12,
2525 }
2526 })
2527 }
2528}
2529#[cfg(feature = "v26_3")]
2530impl<const V: i32> Encode for UpdateLight<V> {
2531 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2532 w.put_varint((*self).chunk_x);
2533 w.put_varint((*self).chunk_z);
2534 w.put_byte_array(&(*self).sky_light_mask)?;
2535 w.put_byte_array(&(*self).block_light_mask)?;
2536 w.put_byte_array(&(*self).empty_sky_light_mask)?;
2537 w.put_byte_array(&(*self).empty_block_light_mask)?;
2538 w.put_len_varint((*self).sky_light.len())?;
2539 for v1 in (*self).sky_light.iter() {
2540 w.put_len_varint((*v1).len())?;
2541 for v2 in (*v1).iter() {
2542 w.put_u8((*v2));
2543 }
2544 }
2545 w.put_len_varint((*self).block_light.len())?;
2546 for v3 in (*self).block_light.iter() {
2547 w.put_len_varint((*v3).len())?;
2548 for v4 in (*v3).iter() {
2549 w.put_u8((*v4));
2550 }
2551 }
2552 Ok(())
2553 }
2554}
2555#[cfg(feature = "v26_3")]
2556#[cfg(feature = "testgen")]
2557impl<const V: i32> Generate for UpdateLight<V> {
2558 fn generate(g: &mut Gen) -> Self {
2559 {
2560 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2561 let v2 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2562 let v3 = g.bytes();
2563 let v4 = g.bytes();
2564 let v5 = g.bytes();
2565 let v6 = g.bytes();
2566 let v7 = {
2567 let v8 = g.count();
2568 let mut v9 = Vec::with_capacity(v8.min(crate::codec::PREALLOC_LIMIT));
2569 for _ in 0..v8 {
2570 v9.push({
2571 let v10 = g.count();
2572 let mut v11 = Vec::with_capacity(v10.min(crate::codec::PREALLOC_LIMIT));
2573 for _ in 0..v10 {
2574 v11.push((g.int_in(0, 255, &[]) as u8));
2575 }
2576 v11
2577 });
2578 }
2579 v9
2580 };
2581 let v12 = {
2582 let v13 = g.count();
2583 let mut v14 = Vec::with_capacity(v13.min(crate::codec::PREALLOC_LIMIT));
2584 for _ in 0..v13 {
2585 v14.push({
2586 let v15 = g.count();
2587 let mut v16 = Vec::with_capacity(v15.min(crate::codec::PREALLOC_LIMIT));
2588 for _ in 0..v15 {
2589 v16.push((g.int_in(0, 255, &[]) as u8));
2590 }
2591 v16
2592 });
2593 }
2594 v14
2595 };
2596 Self {
2597 chunk_x: v1,
2598 chunk_z: v2,
2599 sky_light_mask: v3,
2600 block_light_mask: v4,
2601 empty_sky_light_mask: v5,
2602 empty_block_light_mask: v6,
2603 sky_light: v7,
2604 block_light: v12,
2605 }
2606 }
2607 }
2608}
2609
2610#[cfg(feature = "v26_3")]
2611#[derive(Debug, Clone, PartialEq)]
2613pub struct Login<const V: i32> {
2614 pub entity_id: i32,
2616 pub is_hardcore: bool,
2618 pub world_names: Vec<ByteString>,
2620 pub max_players: i32,
2622 pub view_distance: i32,
2624 pub simulation_distance: i32,
2626 pub reduced_debug_info: bool,
2628 pub enable_respawn_screen: bool,
2630 pub do_limited_crafting: bool,
2632 pub world_state: crate::defs::p777::play::clientbound::SpawnInfo,
2634 pub online_mode: bool,
2636 pub enforces_secure_chat: bool,
2638}
2639#[cfg(feature = "v26_3")]
2640impl<const V: i32> Decode for Login<V> {
2641 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2642 Ok({
2643 let v1 = r.read_i32()?;
2644 let v2 = r.read_bool()?;
2645 let v3 = {
2646 let v4 = {
2647 let c = r.read_varint()?;
2648 r.check_count(i64::from(c), 1)?
2649 };
2650 let mut v5 = Vec::with_capacity(v4.min(crate::codec::PREALLOC_LIMIT));
2651 for _ in 0..v4 {
2652 v5.push(r.read_string()?);
2653 }
2654 v5
2655 };
2656 let v6 = r.read_varint()?;
2657 let v7 = r.read_varint()?;
2658 let v8 = r.read_varint()?;
2659 let v9 = r.read_bool()?;
2660 let v10 = r.read_bool()?;
2661 let v11 = r.read_bool()?;
2662 let v12 = <crate::defs::p777::play::clientbound::SpawnInfo as Decode>::decode(r)?;
2663 let v13 = r.read_bool()?;
2664 let v14 = r.read_bool()?;
2665 Self {
2666 entity_id: v1,
2667 is_hardcore: v2,
2668 world_names: v3,
2669 max_players: v6,
2670 view_distance: v7,
2671 simulation_distance: v8,
2672 reduced_debug_info: v9,
2673 enable_respawn_screen: v10,
2674 do_limited_crafting: v11,
2675 world_state: v12,
2676 online_mode: v13,
2677 enforces_secure_chat: v14,
2678 }
2679 })
2680 }
2681}
2682#[cfg(feature = "v26_3")]
2683impl<const V: i32> Encode for Login<V> {
2684 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2685 w.put_i32((*self).entity_id);
2686 w.put_bool((*self).is_hardcore);
2687 w.put_len_varint((*self).world_names.len())?;
2688 for v1 in (*self).world_names.iter() {
2689 w.put_string(&(*v1))?;
2690 }
2691 w.put_varint((*self).max_players);
2692 w.put_varint((*self).view_distance);
2693 w.put_varint((*self).simulation_distance);
2694 w.put_bool((*self).reduced_debug_info);
2695 w.put_bool((*self).enable_respawn_screen);
2696 w.put_bool((*self).do_limited_crafting);
2697 (*self).world_state.encode(w)?;
2698 w.put_bool((*self).online_mode);
2699 w.put_bool((*self).enforces_secure_chat);
2700 Ok(())
2701 }
2702}
2703#[cfg(feature = "v26_3")]
2704#[cfg(feature = "testgen")]
2705impl<const V: i32> Generate for Login<V> {
2706 fn generate(g: &mut Gen) -> Self {
2707 {
2708 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2709 let v2 = g.bool();
2710 let v3 = {
2711 let v4 = g.count();
2712 let mut v5 = Vec::with_capacity(v4.min(crate::codec::PREALLOC_LIMIT));
2713 for _ in 0..v4 {
2714 v5.push(g.string());
2715 }
2716 v5
2717 };
2718 let v6 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2719 let v7 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2720 let v8 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2721 let v9 = g.bool();
2722 let v10 = g.bool();
2723 let v11 = g.bool();
2724 let v12 = <crate::defs::p777::play::clientbound::SpawnInfo as Generate>::generate(g);
2725 let v13 = g.bool();
2726 let v14 = g.bool();
2727 Self {
2728 entity_id: v1,
2729 is_hardcore: v2,
2730 world_names: v3,
2731 max_players: v6,
2732 view_distance: v7,
2733 simulation_distance: v8,
2734 reduced_debug_info: v9,
2735 enable_respawn_screen: v10,
2736 do_limited_crafting: v11,
2737 world_state: v12,
2738 online_mode: v13,
2739 enforces_secure_chat: v14,
2740 }
2741 }
2742 }
2743}
2744
2745#[cfg(feature = "v26_3")]
2746#[derive(Debug, Clone, PartialEq)]
2748pub struct TradeListTradesInputItem1 {
2749 pub item_id: i32,
2751 pub item_count: i32,
2753 pub components: Vec<crate::defs::p777::types::SlotComponent>,
2755}
2756
2757#[cfg(feature = "v26_3")]
2758#[derive(Debug, Clone, PartialEq)]
2760pub struct TradeListTradesInputItem2 {
2761 pub item_id: i32,
2763 pub item_count: i32,
2765 pub components: Vec<crate::defs::p777::types::SlotComponent>,
2767}
2768
2769#[cfg(feature = "v26_3")]
2770#[derive(Debug, Clone, PartialEq)]
2772pub struct TradeListTrades {
2773 pub input_item1: crate::defs::p777::play::clientbound::TradeListTradesInputItem1,
2775 pub output_item: crate::defs::p777::types::Slot,
2777 pub input_item2: Option<crate::defs::p777::play::clientbound::TradeListTradesInputItem2>,
2779 pub trade_disabled: bool,
2781 pub nb_trade_uses: i32,
2783 pub maximum_nb_trade_uses: i32,
2785 pub xp: i32,
2787 pub special_price: i32,
2789 pub price_multiplier: f32,
2791 pub demand: i32,
2793}
2794
2795#[cfg(feature = "v26_3")]
2796#[derive(Debug, Clone, PartialEq)]
2798pub struct TradeList<const V: i32> {
2799 pub window_id: i32,
2801 pub trades: Vec<crate::defs::p777::play::clientbound::TradeListTrades>,
2803 pub villager_level: i32,
2805 pub experience: i32,
2807 pub is_regular_villager: bool,
2809 pub can_restock: bool,
2811}
2812#[cfg(feature = "v26_3")]
2813impl<const V: i32> Decode for TradeList<V> {
2814 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2815 Ok({
2816 let v1 = r.read_varint()?;
2817 let v2 = {
2818 let v3 = {
2819 let c = r.read_varint()?;
2820 r.check_count(i64::from(c), 30)?
2821 };
2822 let mut v4 = Vec::with_capacity(v3.min(crate::codec::PREALLOC_LIMIT));
2823 for _ in 0..v3 {
2824 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::p777::types::SlotComponent as Decode>::decode(r)?); } v10 }; crate::defs::p777::play::clientbound::TradeListTradesInputItem1 { item_id: v6, item_count: v7, components: v8 } };let v11 = <crate::defs::p777::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::p777::types::SlotComponent as Decode>::decode(r)?); } v17 }; crate::defs::p777::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::p777::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 } });
2825 }
2826 v4
2827 };
2828 let v25 = r.read_varint()?;
2829 let v26 = r.read_varint()?;
2830 let v27 = r.read_bool()?;
2831 let v28 = r.read_bool()?;
2832 Self {
2833 window_id: v1,
2834 trades: v2,
2835 villager_level: v25,
2836 experience: v26,
2837 is_regular_villager: v27,
2838 can_restock: v28,
2839 }
2840 })
2841 }
2842}
2843#[cfg(feature = "v26_3")]
2844impl<const V: i32> Encode for TradeList<V> {
2845 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2846 w.put_varint((*self).window_id);
2847 w.put_len_varint((*self).trades.len())?;
2848 for v1 in (*self).trades.iter() {
2849 w.put_varint((*v1).input_item1.item_id);
2850 w.put_varint((*v1).input_item1.item_count);
2851 w.put_len_varint((*v1).input_item1.components.len())?;
2852 for v2 in (*v1).input_item1.components.iter() {
2853 (*v2).encode(w)?;
2854 }
2855 (*v1).output_item.encode(w)?;
2856 match &(*v1).input_item2 {
2857 Some(v3) => {
2858 w.put_u8(1);
2859 w.put_varint((*v3).item_id);
2860 w.put_varint((*v3).item_count);
2861 w.put_len_varint((*v3).components.len())?;
2862 for v4 in (*v3).components.iter() {
2863 (*v4).encode(w)?;
2864 }
2865 }
2866 None => w.put_u8(0),
2867 }
2868 w.put_bool((*v1).trade_disabled);
2869 w.put_i32((*v1).nb_trade_uses);
2870 w.put_i32((*v1).maximum_nb_trade_uses);
2871 w.put_i32((*v1).xp);
2872 w.put_i32((*v1).special_price);
2873 w.put_f32((*v1).price_multiplier);
2874 w.put_i32((*v1).demand);
2875 }
2876 w.put_varint((*self).villager_level);
2877 w.put_varint((*self).experience);
2878 w.put_bool((*self).is_regular_villager);
2879 w.put_bool((*self).can_restock);
2880 Ok(())
2881 }
2882}
2883#[cfg(feature = "v26_3")]
2884#[cfg(feature = "testgen")]
2885impl<const V: i32> Generate for TradeList<V> {
2886 fn generate(g: &mut Gen) -> Self {
2887 {
2888 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2889 let v2 = {
2890 let v3 = g.count();
2891 let mut v4 = Vec::with_capacity(v3.min(crate::codec::PREALLOC_LIMIT));
2892 for _ in 0..v3 {
2893 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::p777::types::SlotComponent as Generate>::generate(g)); } v10 }; crate::defs::p777::play::clientbound::TradeListTradesInputItem1 { item_id: v6, item_count: v7, components: v8 } };let v11 = <crate::defs::p777::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::p777::types::SlotComponent as Generate>::generate(g)); } v17 }; crate::defs::p777::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::p777::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 } });
2894 }
2895 v4
2896 };
2897 let v25 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2898 let v26 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2899 let v27 = g.bool();
2900 let v28 = g.bool();
2901 Self {
2902 window_id: v1,
2903 trades: v2,
2904 villager_level: v25,
2905 experience: v26,
2906 is_regular_villager: v27,
2907 can_restock: v28,
2908 }
2909 }
2910 }
2911}
2912
2913#[cfg(feature = "v26_3")]
2914#[derive(Debug, Clone, PartialEq)]
2916pub struct RelEntityMove<const V: i32> {
2917 pub entity_id: i32,
2919 pub delta: crate::types::EntityMoveDelta,
2921}
2922#[cfg(feature = "v26_3")]
2923impl<const V: i32> Decode for RelEntityMove<V> {
2924 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2925 Ok({
2926 let v1 = r.read_varint()?;
2927 let v2 = crate::types::EntityMoveDelta::read(r)?;
2928 Self {
2929 entity_id: v1,
2930 delta: v2,
2931 }
2932 })
2933 }
2934}
2935#[cfg(feature = "v26_3")]
2936impl<const V: i32> Encode for RelEntityMove<V> {
2937 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2938 w.put_varint((*self).entity_id);
2939 (*self).delta.write(w);
2940 Ok(())
2941 }
2942}
2943#[cfg(feature = "v26_3")]
2944#[cfg(feature = "testgen")]
2945impl<const V: i32> Generate for RelEntityMove<V> {
2946 fn generate(g: &mut Gen) -> Self {
2947 {
2948 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2949 let v2 = <crate::types::EntityMoveDelta as Generate>::generate(g);
2950 Self {
2951 entity_id: v1,
2952 delta: v2,
2953 }
2954 }
2955 }
2956}
2957
2958#[cfg(feature = "v26_3")]
2959#[derive(Debug, Clone, PartialEq)]
2961pub struct EntityMoveLook<const V: i32> {
2962 pub entity_id: i32,
2964 pub delta: crate::types::EntityMoveDelta,
2966 pub yaw: i8,
2968 pub pitch: i8,
2970}
2971#[cfg(feature = "v26_3")]
2972impl<const V: i32> Decode for EntityMoveLook<V> {
2973 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2974 Ok({
2975 let v1 = r.read_varint()?;
2976 let v2 = crate::types::EntityMoveDelta::read(r)?;
2977 let v3 = r.read_i8()?;
2978 let v4 = r.read_i8()?;
2979 Self {
2980 entity_id: v1,
2981 delta: v2,
2982 yaw: v3,
2983 pitch: v4,
2984 }
2985 })
2986 }
2987}
2988#[cfg(feature = "v26_3")]
2989impl<const V: i32> Encode for EntityMoveLook<V> {
2990 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2991 w.put_varint((*self).entity_id);
2992 (*self).delta.write(w);
2993 w.put_i8((*self).yaw);
2994 w.put_i8((*self).pitch);
2995 Ok(())
2996 }
2997}
2998#[cfg(feature = "v26_3")]
2999#[cfg(feature = "testgen")]
3000impl<const V: i32> Generate for EntityMoveLook<V> {
3001 fn generate(g: &mut Gen) -> Self {
3002 {
3003 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
3004 let v2 = <crate::types::EntityMoveDelta as Generate>::generate(g);
3005 let v3 = (g.int_in(-128, 127, &[]) as i8);
3006 let v4 = (g.int_in(-128, 127, &[]) as i8);
3007 Self {
3008 entity_id: v1,
3009 delta: v2,
3010 yaw: v3,
3011 pitch: v4,
3012 }
3013 }
3014 }
3015}
3016
3017#[cfg(feature = "v26_3")]
3018#[derive(Debug, Clone, PartialEq)]
3020pub struct EntityLook<const V: i32> {
3021 pub entity_id: i32,
3023 pub on_ground: bool,
3025 pub yaw: i8,
3027 pub pitch: i8,
3029}
3030#[cfg(feature = "v26_3")]
3031impl<const V: i32> Decode for EntityLook<V> {
3032 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
3033 Ok({
3034 let v1 = r.read_varint()?;
3035 let v2 = r.read_bool()?;
3036 let v3 = r.read_i8()?;
3037 let v4 = r.read_i8()?;
3038 Self {
3039 entity_id: v1,
3040 on_ground: v2,
3041 yaw: v3,
3042 pitch: v4,
3043 }
3044 })
3045 }
3046}
3047#[cfg(feature = "v26_3")]
3048impl<const V: i32> Encode for EntityLook<V> {
3049 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3050 w.put_varint((*self).entity_id);
3051 w.put_bool((*self).on_ground);
3052 w.put_i8((*self).yaw);
3053 w.put_i8((*self).pitch);
3054 Ok(())
3055 }
3056}
3057#[cfg(feature = "v26_3")]
3058#[cfg(feature = "testgen")]
3059impl<const V: i32> Generate for EntityLook<V> {
3060 fn generate(g: &mut Gen) -> Self {
3061 {
3062 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
3063 let v2 = g.bool();
3064 let v3 = (g.int_in(-128, 127, &[]) as i8);
3065 let v4 = (g.int_in(-128, 127, &[]) as i8);
3066 Self {
3067 entity_id: v1,
3068 on_ground: v2,
3069 yaw: v3,
3070 pitch: v4,
3071 }
3072 }
3073 }
3074}
3075
3076#[cfg(feature = "v26_3")]
3077#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
3079#[non_exhaustive]
3080pub struct OpenSignEntitySide(pub i32);
3081#[cfg(feature = "v26_3")]
3082impl OpenSignEntitySide {
3083 pub const fn new(v: i32) -> Self {
3085 Self(v)
3086 }
3087 pub const BACK: Self = Self(0);
3089 pub const FRONT: Self = Self(1);
3091 pub const fn name(self) -> Option<&'static str> {
3093 match self.0 {
3094 0 => Some("back"),
3095 1 => Some("front"),
3096 _ => None,
3097 }
3098 }
3099}
3100#[cfg(feature = "v26_3")]
3101impl std::fmt::Debug for OpenSignEntitySide {
3102 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3103 match self.name() {
3104 Some(n) => write!(f, "OpenSignEntitySide::{n}"),
3105 None => write!(f, "OpenSignEntitySide({})", self.0),
3106 }
3107 }
3108}
3109
3110#[cfg(feature = "v26_3")]
3111#[derive(Debug, Clone, PartialEq)]
3113pub struct OpenSignEntity<const V: i32> {
3114 pub location: BlockPos,
3116 pub side: crate::defs::p777::play::clientbound::OpenSignEntitySide,
3118}
3119#[cfg(feature = "v26_3")]
3120impl<const V: i32> Decode for OpenSignEntity<V> {
3121 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
3122 Ok({
3123 let v1 = BlockPos::read(r, PositionLayout::Xzy)?;
3124 let v2 = crate::defs::p777::play::clientbound::OpenSignEntitySide(r.read_varint()?);
3125 Self {
3126 location: v1,
3127 side: v2,
3128 }
3129 })
3130 }
3131}
3132#[cfg(feature = "v26_3")]
3133impl<const V: i32> Encode for OpenSignEntity<V> {
3134 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3135 (*self).location.write(w, PositionLayout::Xzy)?;
3136 w.put_varint((*self).side.0);
3137 Ok(())
3138 }
3139}
3140#[cfg(feature = "v26_3")]
3141#[cfg(feature = "testgen")]
3142impl<const V: i32> Generate for OpenSignEntity<V> {
3143 fn generate(g: &mut Gen) -> Self {
3144 {
3145 let v1 = g.position();
3146 let v2 = crate::defs::p777::play::clientbound::OpenSignEntitySide(g.int_in(
3147 -2147483648,
3148 2147483647,
3149 &[0, 1],
3150 ) as i32);
3151 Self {
3152 location: v1,
3153 side: v2,
3154 }
3155 }
3156 }
3157}
3158
3159#[cfg(feature = "v26_3")]
3160#[derive(Debug, Clone, PartialEq)]
3162pub struct CraftRecipeResponse<const V: i32> {
3163 pub window_id: i32,
3165 pub recipe_display: crate::defs::p777::play::clientbound::RecipeDisplay,
3167}
3168#[cfg(feature = "v26_3")]
3169impl<const V: i32> Decode for CraftRecipeResponse<V> {
3170 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
3171 Ok({
3172 let v1 = r.read_varint()?;
3173 let v2 = <crate::defs::p777::play::clientbound::RecipeDisplay as Decode>::decode(r)?;
3174 Self {
3175 window_id: v1,
3176 recipe_display: v2,
3177 }
3178 })
3179 }
3180}
3181#[cfg(feature = "v26_3")]
3182impl<const V: i32> Encode for CraftRecipeResponse<V> {
3183 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3184 w.put_varint((*self).window_id);
3185 (*self).recipe_display.encode(w)?;
3186 Ok(())
3187 }
3188}
3189#[cfg(feature = "v26_3")]
3190#[cfg(feature = "testgen")]
3191impl<const V: i32> Generate for CraftRecipeResponse<V> {
3192 fn generate(g: &mut Gen) -> Self {
3193 {
3194 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
3195 let v2 = <crate::defs::p777::play::clientbound::RecipeDisplay as Generate>::generate(g);
3196 Self {
3197 window_id: v1,
3198 recipe_display: v2,
3199 }
3200 }
3201 }
3202}
3203
3204#[cfg(feature = "v26_3")]
3205#[derive(Debug, Clone, PartialEq)]
3207pub struct PlayerChat<const V: i32> {
3208 pub global_index: i32,
3210 pub sender_uuid: Uuid,
3212 pub index: i32,
3214 pub signature: Option<Bytes>,
3216 pub plain_message: ByteString,
3218 pub timestamp: i64,
3220 pub salt: i64,
3222 pub previous_messages: Vec<crate::defs::p775::types::PreviousMessages>,
3224 pub unsigned_chat_content: Option<AnonNbt>,
3226 pub filter_type: i32,
3228 pub filter_type_mask: Option<Bytes>,
3230 pub r#type: Holder<crate::defs::p775::play::clientbound::ChatTypes>,
3232 pub network_name: AnonNbt,
3234 pub network_target_name: Option<AnonNbt>,
3236}
3237#[cfg(feature = "v26_3")]
3238impl<const V: i32> Decode for PlayerChat<V> {
3239 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
3240 Ok({
3241 let v1 = r.read_varint()?;
3242 let v2 = r.read_uuid()?;
3243 let v3 = r.read_varint()?;
3244 let v4 = if r.read_bool()? {
3245 Some(r.read_bytes(256)?)
3246 } else {
3247 None
3248 };
3249 let v5 = r.read_string()?;
3250 let v6 = r.read_i64()?;
3251 let v7 = r.read_i64()?;
3252 let v8 = {
3253 let v9 = {
3254 let c = r.read_varint()?;
3255 r.check_count(i64::from(c), 1)?
3256 };
3257 let mut v10 = Vec::with_capacity(v9.min(crate::codec::PREALLOC_LIMIT));
3258 for _ in 0..v9 {
3259 v10.push({
3260 let v11 = r.read_varint()?;
3261 let v12 = if (v11 == 0) {
3262 Some(r.read_bytes(256)?)
3263 } else {
3264 None
3265 };
3266 crate::defs::p775::types::PreviousMessages {
3267 id: v11,
3268 signature: v12,
3269 }
3270 });
3271 }
3272 v10
3273 };
3274 let v13 = if r.read_bool()? {
3275 Some(AnonNbt::read(r)?)
3276 } else {
3277 None
3278 };
3279 let v14 = r.read_varint()?;
3280 let v15 = if (v14 == 2) {
3281 Some(r.read_byte_array()?)
3282 } else {
3283 None
3284 };
3285 let v16 = {
3286 let id = r.read_varint()?;
3287 if id == 0 {
3288 Holder::Inline(
3289 <crate::defs::p775::play::clientbound::ChatTypes as Decode>::decode(r)?,
3290 )
3291 } else {
3292 Holder::Id(id.wrapping_sub(1))
3293 }
3294 };
3295 let v17 = AnonNbt::read(r)?;
3296 let v18 = if r.read_bool()? {
3297 Some(AnonNbt::read(r)?)
3298 } else {
3299 None
3300 };
3301 Self {
3302 global_index: v1,
3303 sender_uuid: v2,
3304 index: v3,
3305 signature: v4,
3306 plain_message: v5,
3307 timestamp: v6,
3308 salt: v7,
3309 previous_messages: v8,
3310 unsigned_chat_content: v13,
3311 filter_type: v14,
3312 filter_type_mask: v15,
3313 r#type: v16,
3314 network_name: v17,
3315 network_target_name: v18,
3316 }
3317 })
3318 }
3319}
3320#[cfg(feature = "v26_3")]
3321impl<const V: i32> Encode for PlayerChat<V> {
3322 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3323 w.put_varint((*self).global_index);
3324 w.put_uuid(&(*self).sender_uuid);
3325 w.put_varint((*self).index);
3326 match &(*self).signature {
3327 Some(v1) => {
3328 w.put_u8(1);
3329 if (*v1).len() != 256 {
3330 return Err(EncodeError::CountMismatch {
3331 field: "fixed buffer",
3332 expected: 256,
3333 actual: (*v1).len(),
3334 });
3335 }
3336 w.put_slice(&(*v1));
3337 }
3338 None => w.put_u8(0),
3339 }
3340 w.put_string(&(*self).plain_message)?;
3341 w.put_i64((*self).timestamp);
3342 w.put_i64((*self).salt);
3343 w.put_len_varint((*self).previous_messages.len())?;
3344 for v2 in (*self).previous_messages.iter() {
3345 w.put_varint((*v2).id);
3346 match (&(*v2).signature, ((*v2).id == 0)) {
3347 (Some(v3), true) => {
3348 if (*v3).len() != 256 {
3349 return Err(EncodeError::CountMismatch {
3350 field: "fixed buffer",
3351 expected: 256,
3352 actual: (*v3).len(),
3353 });
3354 }
3355 w.put_slice(&(*v3));
3356 }
3357 (None, false) => {}
3358 _ => {
3359 return Err(EncodeError::SwitchMismatch(
3360 "play.clientbound.player_chat.previousMessages.signature",
3361 ));
3362 }
3363 }
3364 }
3365 match &(*self).unsigned_chat_content {
3366 Some(v4) => {
3367 w.put_u8(1);
3368 (*v4).write(w);
3369 }
3370 None => w.put_u8(0),
3371 }
3372 w.put_varint((*self).filter_type);
3373 match (&(*self).filter_type_mask, ((*self).filter_type == 2)) {
3374 (Some(v5), true) => {
3375 w.put_byte_array(&(*v5))?;
3376 }
3377 (None, false) => {}
3378 _ => {
3379 return Err(EncodeError::SwitchMismatch(
3380 "play.clientbound.player_chat.filterTypeMask",
3381 ));
3382 }
3383 }
3384 match &(*self).r#type {
3385 Holder::Id(v7) => {
3386 if *v7 == -1 {
3387 return Err(EncodeError::OutOfRange("holder id"));
3388 }
3389 w.put_varint(v7.wrapping_add(1));
3390 }
3391 Holder::Inline(v6) => {
3392 w.put_varint(0);
3393 (*v6).encode(w)?;
3394 }
3395 }
3396 (*self).network_name.write(w);
3397 match &(*self).network_target_name {
3398 Some(v8) => {
3399 w.put_u8(1);
3400 (*v8).write(w);
3401 }
3402 None => w.put_u8(0),
3403 }
3404 Ok(())
3405 }
3406}
3407#[cfg(feature = "v26_3")]
3408#[cfg(feature = "testgen")]
3409impl<const V: i32> Generate for PlayerChat<V> {
3410 fn generate(g: &mut Gen) -> Self {
3411 {
3412 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
3413 let v2 = g.uuid();
3414 let v3 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
3415 let v4 = if g.bool() {
3416 Some(g.fixed_bytes(256))
3417 } else {
3418 None
3419 };
3420 let v5 = g.string();
3421 let v6 = g.i64();
3422 let v7 = g.i64();
3423 let v8 = {
3424 let v9 = g.count();
3425 let mut v10 = Vec::with_capacity(v9.min(crate::codec::PREALLOC_LIMIT));
3426 for _ in 0..v9 {
3427 v10.push({
3428 let v11 = (g.int_in(-2147483648, 2147483647, &[0]) as i32);
3429 let v12 = if (v11 == 0) {
3430 Some(g.fixed_bytes(256))
3431 } else {
3432 None
3433 };
3434 crate::defs::p775::types::PreviousMessages {
3435 id: v11,
3436 signature: v12,
3437 }
3438 });
3439 }
3440 v10
3441 };
3442 let v13 = if g.bool() { Some(g.anon_nbt()) } else { None };
3443 let v14 = (g.int_in(-2147483648, 2147483647, &[2]) as i32);
3444 let v15 = if (v14 == 2) { Some(g.bytes()) } else { None };
3445 let v16 = if g.bool() {
3446 Holder::Id(match g.int_in(-2147483648, 2147483647, &[0, 1, 2]) as i32 {
3447 -1 => 0,
3448 v => v,
3449 })
3450 } else {
3451 Holder::Inline(
3452 <crate::defs::p775::play::clientbound::ChatTypes as Generate>::generate(g),
3453 )
3454 };
3455 let v17 = g.anon_nbt();
3456 let v18 = if g.bool() { Some(g.anon_nbt()) } else { None };
3457 Self {
3458 global_index: v1,
3459 sender_uuid: v2,
3460 index: v3,
3461 signature: v4,
3462 plain_message: v5,
3463 timestamp: v6,
3464 salt: v7,
3465 previous_messages: v8,
3466 unsigned_chat_content: v13,
3467 filter_type: v14,
3468 filter_type_mask: v15,
3469 r#type: v16,
3470 network_name: v17,
3471 network_target_name: v18,
3472 }
3473 }
3474 }
3475}
3476
3477#[cfg(feature = "v26_3")]
3478#[derive(Debug, Clone, PartialEq)]
3480pub struct RecipeBookAddEntriesRecipe {
3481 pub display_id: i32,
3483 pub display: crate::defs::p777::play::clientbound::RecipeDisplay,
3485 pub group: i32,
3487 pub category: crate::defs::p775::play::clientbound::RecipeBookAddEntriesRecipeCategory,
3489 pub crafting_requirements: Option<Vec<HolderSet>>,
3491}
3492
3493#[cfg(feature = "v26_3")]
3494#[derive(Debug, Clone, PartialEq)]
3496pub struct RecipeBookAddEntries {
3497 pub recipe: crate::defs::p777::play::clientbound::RecipeBookAddEntriesRecipe,
3499 pub flags: crate::defs::p775::play::clientbound::RecipeBookAddEntriesFlags,
3501}
3502
3503#[cfg(feature = "v26_3")]
3504#[derive(Debug, Clone, PartialEq)]
3506pub struct RecipeBookAdd<const V: i32> {
3507 pub entries: Vec<crate::defs::p777::play::clientbound::RecipeBookAddEntries>,
3509 pub replace: bool,
3511}
3512#[cfg(feature = "v26_3")]
3513impl<const V: i32> Decode for RecipeBookAdd<V> {
3514 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
3515 Ok({
3516 let v1 = {
3517 let v2 = {
3518 let c = r.read_varint()?;
3519 r.check_count(i64::from(c), 6)?
3520 };
3521 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
3522 for _ in 0..v2 {
3523 v3.push({ let v4 = { let v5 = r.read_varint()?;let v6 = <crate::defs::p777::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::p777::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::p777::play::clientbound::RecipeBookAddEntries { recipe: v4, flags: v12 } });
3524 }
3525 v3
3526 };
3527 let v13 = r.read_bool()?;
3528 Self {
3529 entries: v1,
3530 replace: v13,
3531 }
3532 })
3533 }
3534}
3535#[cfg(feature = "v26_3")]
3536impl<const V: i32> Encode for RecipeBookAdd<V> {
3537 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3538 w.put_len_varint((*self).entries.len())?;
3539 for v1 in (*self).entries.iter() {
3540 w.put_varint((*v1).recipe.display_id);
3541 (*v1).recipe.display.encode(w)?;
3542 w.put_varint((*v1).recipe.group);
3543 w.put_varint((*v1).recipe.category.0);
3544 match &(*v1).recipe.crafting_requirements {
3545 Some(v2) => {
3546 w.put_u8(1);
3547 w.put_len_varint((*v2).len())?;
3548 for v3 in (*v2).iter() {
3549 (*v3).encode(w)?;
3550 }
3551 }
3552 None => w.put_u8(0),
3553 }
3554 w.put_u8((*v1).flags.0);
3555 }
3556 w.put_bool((*self).replace);
3557 Ok(())
3558 }
3559}
3560#[cfg(feature = "v26_3")]
3561#[cfg(feature = "testgen")]
3562impl<const V: i32> Generate for RecipeBookAdd<V> {
3563 fn generate(g: &mut Gen) -> Self {
3564 {
3565 let v1 = {
3566 let v2 = g.count();
3567 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
3568 for _ in 0..v2 {
3569 v3.push({ let v4 = { let v5 = (g.int_in(-2147483648, 2147483647, &[]) as i32);let v6 = <crate::defs::p777::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::p777::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::p777::play::clientbound::RecipeBookAddEntries { recipe: v4, flags: v12 } });
3570 }
3571 v3
3572 };
3573 let v13 = g.bool();
3574 Self {
3575 entries: v1,
3576 replace: v13,
3577 }
3578 }
3579 }
3580}
3581
3582#[cfg(feature = "v26_3")]
3583#[derive(Debug, Clone, PartialEq)]
3585pub struct PostEffects<const V: i32> {
3586 pub effects: Vec<ByteString>,
3588}
3589#[cfg(feature = "v26_3")]
3590impl<const V: i32> Decode for PostEffects<V> {
3591 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
3592 Ok({
3593 let v1 = {
3594 let v2 = {
3595 let c = r.read_varint()?;
3596 r.check_count(i64::from(c), 1)?
3597 };
3598 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
3599 for _ in 0..v2 {
3600 v3.push(r.read_string()?);
3601 }
3602 v3
3603 };
3604 Self { effects: v1 }
3605 })
3606 }
3607}
3608#[cfg(feature = "v26_3")]
3609impl<const V: i32> Encode for PostEffects<V> {
3610 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3611 w.put_len_varint((*self).effects.len())?;
3612 for v1 in (*self).effects.iter() {
3613 w.put_string(&(*v1))?;
3614 }
3615 Ok(())
3616 }
3617}
3618#[cfg(feature = "v26_3")]
3619#[cfg(feature = "testgen")]
3620impl<const V: i32> Generate for PostEffects<V> {
3621 fn generate(g: &mut Gen) -> Self {
3622 {
3623 let v1 = {
3624 let v2 = g.count();
3625 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
3626 for _ in 0..v2 {
3627 v3.push(g.string());
3628 }
3629 v3
3630 };
3631 Self { effects: v1 }
3632 }
3633 }
3634}
3635
3636#[cfg(feature = "v26_3")]
3637#[derive(Debug, Clone, PartialEq)]
3639pub struct Respawn<const V: i32> {
3640 pub world_state: crate::defs::p777::play::clientbound::SpawnInfo,
3642 pub copy_metadata: u8,
3644}
3645#[cfg(feature = "v26_3")]
3646impl<const V: i32> Decode for Respawn<V> {
3647 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
3648 Ok({
3649 let v1 = <crate::defs::p777::play::clientbound::SpawnInfo as Decode>::decode(r)?;
3650 let v2 = r.read_u8()?;
3651 Self {
3652 world_state: v1,
3653 copy_metadata: v2,
3654 }
3655 })
3656 }
3657}
3658#[cfg(feature = "v26_3")]
3659impl<const V: i32> Encode for Respawn<V> {
3660 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3661 (*self).world_state.encode(w)?;
3662 w.put_u8((*self).copy_metadata);
3663 Ok(())
3664 }
3665}
3666#[cfg(feature = "v26_3")]
3667#[cfg(feature = "testgen")]
3668impl<const V: i32> Generate for Respawn<V> {
3669 fn generate(g: &mut Gen) -> Self {
3670 {
3671 let v1 = <crate::defs::p777::play::clientbound::SpawnInfo as Generate>::generate(g);
3672 let v2 = (g.int_in(0, 255, &[]) as u8);
3673 Self {
3674 world_state: v1,
3675 copy_metadata: v2,
3676 }
3677 }
3678 }
3679}
3680
3681#[cfg(feature = "v26_3")]
3682#[derive(Debug, Clone, PartialEq)]
3684pub struct SetCursorItem<const V: i32> {
3685 pub contents: crate::defs::p777::types::Slot,
3687}
3688#[cfg(feature = "v26_3")]
3689impl<const V: i32> Decode for SetCursorItem<V> {
3690 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
3691 Ok({
3692 let v1 = <crate::defs::p777::types::Slot as Decode>::decode(r)?;
3693 Self { contents: v1 }
3694 })
3695 }
3696}
3697#[cfg(feature = "v26_3")]
3698impl<const V: i32> Encode for SetCursorItem<V> {
3699 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3700 (*self).contents.encode(w)?;
3701 Ok(())
3702 }
3703}
3704#[cfg(feature = "v26_3")]
3705#[cfg(feature = "testgen")]
3706impl<const V: i32> Generate for SetCursorItem<V> {
3707 fn generate(g: &mut Gen) -> Self {
3708 {
3709 let v1 = <crate::defs::p777::types::Slot as Generate>::generate(g);
3710 Self { contents: v1 }
3711 }
3712 }
3713}
3714
3715#[cfg(feature = "v26_3")]
3716#[derive(Debug, Clone, PartialEq)]
3718pub struct EntityMetadata<const V: i32> {
3719 pub entity_id: i32,
3721 pub metadata: Vec<crate::defs::p777::types::EntityMetadataEntry>,
3723}
3724#[cfg(feature = "v26_3")]
3725impl<const V: i32> Decode for EntityMetadata<V> {
3726 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
3727 Ok({
3728 let v1 = r.read_varint()?;
3729 let v2 = {
3730 let mut v3 = Vec::new();
3731 loop {
3732 if r.peek_u8()? == 255 {
3733 r.skip(1)?;
3734 break;
3735 }
3736 v3.push(<crate::defs::p777::types::EntityMetadataEntry as Decode>::decode(r)?);
3737 }
3738 v3
3739 };
3740 Self {
3741 entity_id: v1,
3742 metadata: v2,
3743 }
3744 })
3745 }
3746}
3747#[cfg(feature = "v26_3")]
3748impl<const V: i32> Encode for EntityMetadata<V> {
3749 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3750 w.put_varint((*self).entity_id);
3751 for v1 in (*self).metadata.iter() {
3752 let v2 = w.len();
3753 (*v1).encode(w)?;
3754 if w.get(v2) == Some(&255) {
3755 return Err(EncodeError::OutOfRange(
3756 "play.clientbound.entity_metadata.metadata",
3757 ));
3758 }
3759 }
3760 w.put_u8(255);
3761 Ok(())
3762 }
3763}
3764#[cfg(feature = "v26_3")]
3765#[cfg(feature = "testgen")]
3766impl<const V: i32> Generate for EntityMetadata<V> {
3767 fn generate(g: &mut Gen) -> Self {
3768 {
3769 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
3770 let v2 = {
3771 let n = g.count();
3772 let mut v3 = Vec::with_capacity(n);
3773 for _ in 0..n {
3774 v3.push(loop {
3775 let v4 =
3776 <crate::defs::p777::types::EntityMetadataEntry as Generate>::generate(
3777 g,
3778 );
3779 if crate::testgen::first_byte_ok(
3780 |w: &mut BytesMut| -> EncodeResult {
3781 v4.encode(w)?;
3782 Ok(())
3783 },
3784 |b| b != 255,
3785 ) {
3786 break v4;
3787 }
3788 });
3789 }
3790 v3
3791 };
3792 Self {
3793 entity_id: v1,
3794 metadata: v2,
3795 }
3796 }
3797 }
3798}
3799
3800#[cfg(feature = "v26_3")]
3801#[derive(Debug, Clone, PartialEq)]
3803pub struct EntityEquipmentEquipments {
3804 pub slot: i8,
3806 pub item: crate::defs::p777::types::Slot,
3808}
3809
3810#[cfg(feature = "v26_3")]
3811#[derive(Debug, Clone, PartialEq)]
3813pub struct EntityEquipment<const V: i32> {
3814 pub entity_id: i32,
3816 pub equipments: Vec<crate::defs::p777::play::clientbound::EntityEquipmentEquipments>,
3818}
3819#[cfg(feature = "v26_3")]
3820impl<const V: i32> Decode for EntityEquipment<V> {
3821 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
3822 Ok({
3823 let v1 = r.read_varint()?;
3824 let v2 = {
3825 let mut v3 = Vec::new();
3826 loop {
3827 let v4 = r.read_u8()?;
3828 v3.push({
3829 let v5 = ((v4 & 0x7f) as i8);
3830 let v6 = <crate::defs::p777::types::Slot as Decode>::decode(r)?;
3831 crate::defs::p777::play::clientbound::EntityEquipmentEquipments {
3832 slot: v5,
3833 item: v6,
3834 }
3835 });
3836 if v4 & 0x80 == 0 {
3837 break;
3838 }
3839 }
3840 v3
3841 };
3842 Self {
3843 entity_id: v1,
3844 equipments: v2,
3845 }
3846 })
3847 }
3848}
3849#[cfg(feature = "v26_3")]
3850impl<const V: i32> Encode for EntityEquipment<V> {
3851 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3852 w.put_varint((*self).entity_id);
3853 if (*self).equipments.is_empty() {
3854 return Err(EncodeError::CountMismatch {
3855 field: "play.clientbound.entity_equipment.equipments",
3856 expected: 1,
3857 actual: 0,
3858 });
3859 }
3860 for (v2, v1) in (*self).equipments.iter().enumerate() {
3861 let v3 = w.len();
3862 w.put_i8((*v1).slot);
3863 (*v1).item.encode(w)?;
3864 match w.get_mut(v3) {
3865 Some(b) if *b & 0x80 == 0 => {
3866 if v2 + 1 < (*self).equipments.len() {
3867 *b |= 0x80;
3868 }
3869 }
3870 _ => {
3871 return Err(EncodeError::OutOfRange(
3872 "play.clientbound.entity_equipment.equipments",
3873 ));
3874 }
3875 }
3876 }
3877 Ok(())
3878 }
3879}
3880#[cfg(feature = "v26_3")]
3881#[cfg(feature = "testgen")]
3882impl<const V: i32> Generate for EntityEquipment<V> {
3883 fn generate(g: &mut Gen) -> Self {
3884 {
3885 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
3886 let v2 = {
3887 let n = 1 + g.count();
3888 let mut v3 = Vec::with_capacity(n);
3889 for _ in 0..n {
3890 v3.push(loop {
3891 let v4 = {
3892 let v5 = (g.int_in(-128, 127, &[]) as i8);
3893 let v6 = <crate::defs::p777::types::Slot as Generate>::generate(g);
3894 crate::defs::p777::play::clientbound::EntityEquipmentEquipments {
3895 slot: v5,
3896 item: v6,
3897 }
3898 };
3899 if crate::testgen::first_byte_ok(
3900 |w: &mut BytesMut| -> EncodeResult {
3901 w.put_i8(v4.slot);
3902 v4.item.encode(w)?;
3903 Ok(())
3904 },
3905 |b| b & 0x80 == 0,
3906 ) {
3907 break v4;
3908 }
3909 });
3910 }
3911 v3
3912 };
3913 Self {
3914 entity_id: v1,
3915 equipments: v2,
3916 }
3917 }
3918 }
3919}
3920
3921#[cfg(feature = "v26_3")]
3922#[derive(Debug, Clone, PartialEq)]
3924pub struct SetPlayerInventory<const V: i32> {
3925 pub slot_id: i32,
3927 pub contents: crate::defs::p777::types::Slot,
3929}
3930#[cfg(feature = "v26_3")]
3931impl<const V: i32> Decode for SetPlayerInventory<V> {
3932 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
3933 Ok({
3934 let v1 = r.read_varint()?;
3935 let v2 = <crate::defs::p777::types::Slot as Decode>::decode(r)?;
3936 Self {
3937 slot_id: v1,
3938 contents: v2,
3939 }
3940 })
3941 }
3942}
3943#[cfg(feature = "v26_3")]
3944impl<const V: i32> Encode for SetPlayerInventory<V> {
3945 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3946 w.put_varint((*self).slot_id);
3947 (*self).contents.encode(w)?;
3948 Ok(())
3949 }
3950}
3951#[cfg(feature = "v26_3")]
3952#[cfg(feature = "testgen")]
3953impl<const V: i32> Generate for SetPlayerInventory<V> {
3954 fn generate(g: &mut Gen) -> Self {
3955 {
3956 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
3957 let v2 = <crate::defs::p777::types::Slot as Generate>::generate(g);
3958 Self {
3959 slot_id: v1,
3960 contents: v2,
3961 }
3962 }
3963 }
3964}
3965
3966#[cfg(feature = "v26_3")]
3967#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
3969#[non_exhaustive]
3970pub struct SwingAnimationHand(pub i32);
3971#[cfg(feature = "v26_3")]
3972impl SwingAnimationHand {
3973 pub const fn new(v: i32) -> Self {
3975 Self(v)
3976 }
3977 pub const MAIN_HAND: Self = Self(0);
3979 pub const OFF_HAND: Self = Self(1);
3981 pub const fn name(self) -> Option<&'static str> {
3983 match self.0 {
3984 0 => Some("main_hand"),
3985 1 => Some("off_hand"),
3986 _ => None,
3987 }
3988 }
3989}
3990#[cfg(feature = "v26_3")]
3991impl std::fmt::Debug for SwingAnimationHand {
3992 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3993 match self.name() {
3994 Some(n) => write!(f, "SwingAnimationHand::{n}"),
3995 None => write!(f, "SwingAnimationHand({})", self.0),
3996 }
3997 }
3998}
3999
4000#[cfg(feature = "v26_3")]
4001#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
4003#[non_exhaustive]
4004pub struct SwingAnimationAnimationType(pub i32);
4005#[cfg(feature = "v26_3")]
4006impl SwingAnimationAnimationType {
4007 pub const fn new(v: i32) -> Self {
4009 Self(v)
4010 }
4011 pub const NONE: Self = Self(0);
4013 pub const WHACK: Self = Self(1);
4015 pub const STAB: Self = Self(2);
4017 pub const fn name(self) -> Option<&'static str> {
4019 match self.0 {
4020 0 => Some("none"),
4021 1 => Some("whack"),
4022 2 => Some("stab"),
4023 _ => None,
4024 }
4025 }
4026}
4027#[cfg(feature = "v26_3")]
4028impl std::fmt::Debug for SwingAnimationAnimationType {
4029 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4030 match self.name() {
4031 Some(n) => write!(f, "SwingAnimationAnimationType::{n}"),
4032 None => write!(f, "SwingAnimationAnimationType({})", self.0),
4033 }
4034 }
4035}
4036
4037#[cfg(feature = "v26_3")]
4038#[derive(Debug, Clone, PartialEq)]
4040pub struct SwingAnimationAnimation {
4041 pub r#type: crate::defs::p777::play::clientbound::SwingAnimationAnimationType,
4043 pub duration: i32,
4045}
4046
4047#[cfg(feature = "v26_3")]
4048#[derive(Debug, Clone, PartialEq)]
4050pub struct SwingAnimation<const V: i32> {
4051 pub entity_id: i32,
4053 pub hand: crate::defs::p777::play::clientbound::SwingAnimationHand,
4055 pub animation: crate::defs::p777::play::clientbound::SwingAnimationAnimation,
4057}
4058#[cfg(feature = "v26_3")]
4059impl<const V: i32> Decode for SwingAnimation<V> {
4060 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
4061 Ok({
4062 let v1 = r.read_varint()?;
4063 let v2 = crate::defs::p777::play::clientbound::SwingAnimationHand(r.read_varint()?);
4064 let v3 = {
4065 let v4 = crate::defs::p777::play::clientbound::SwingAnimationAnimationType(
4066 r.read_varint()?,
4067 );
4068 let v5 = r.read_varint()?;
4069 crate::defs::p777::play::clientbound::SwingAnimationAnimation {
4070 r#type: v4,
4071 duration: v5,
4072 }
4073 };
4074 Self {
4075 entity_id: v1,
4076 hand: v2,
4077 animation: v3,
4078 }
4079 })
4080 }
4081}
4082#[cfg(feature = "v26_3")]
4083impl<const V: i32> Encode for SwingAnimation<V> {
4084 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
4085 w.put_varint((*self).entity_id);
4086 w.put_varint((*self).hand.0);
4087 w.put_varint((*self).animation.r#type.0);
4088 w.put_varint((*self).animation.duration);
4089 Ok(())
4090 }
4091}
4092#[cfg(feature = "v26_3")]
4093#[cfg(feature = "testgen")]
4094impl<const V: i32> Generate for SwingAnimation<V> {
4095 fn generate(g: &mut Gen) -> Self {
4096 {
4097 let v1 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
4098 let v2 = crate::defs::p777::play::clientbound::SwingAnimationHand(g.int_in(
4099 -2147483648,
4100 2147483647,
4101 &[0, 1],
4102 ) as i32);
4103 let v3 = {
4104 let v4 = crate::defs::p777::play::clientbound::SwingAnimationAnimationType(
4105 g.int_in(-2147483648, 2147483647, &[0, 1, 2]) as i32,
4106 );
4107 let v5 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
4108 crate::defs::p777::play::clientbound::SwingAnimationAnimation {
4109 r#type: v4,
4110 duration: v5,
4111 }
4112 };
4113 Self {
4114 entity_id: v1,
4115 hand: v2,
4116 animation: v3,
4117 }
4118 }
4119 }
4120}
4121
4122#[cfg(feature = "v26_3")]
4123#[derive(Debug, Clone, PartialEq)]
4125pub struct AdvancementsAdvancementMappingValueDisplayData {
4126 pub title: AnonNbt,
4128 pub description: AnonNbt,
4130 pub icon: crate::defs::p777::types::ItemStackTemplate,
4132 pub frame_type: i32,
4134 pub flags:
4136 crate::defs::p775::play::clientbound::AdvancementsAdvancementMappingValueDisplayDataFlags,
4137 pub background_texture: Option<ByteString>,
4139}
4140
4141#[cfg(feature = "v26_3")]
4142#[derive(Debug, Clone, PartialEq)]
4144pub struct AdvancementsAdvancementMappingValue {
4145 pub parent_id: Option<ByteString>,
4147 pub display_data: Option<
4149 crate::defs::p777::play::clientbound::AdvancementsAdvancementMappingValueDisplayData,
4150 >,
4151 pub requirements: Vec<Vec<ByteString>>,
4153 pub sends_telemtry_data: bool,
4155}
4156
4157#[cfg(feature = "v26_3")]
4158#[derive(Debug, Clone, PartialEq)]
4160pub struct AdvancementsAdvancementMapping {
4161 pub key: ByteString,
4163 pub value: crate::defs::p777::play::clientbound::AdvancementsAdvancementMappingValue,
4165 pub x_cord: f32,
4167 pub y_cord: f32,
4169}
4170
4171#[cfg(feature = "v26_3")]
4172#[derive(Debug, Clone, PartialEq)]
4174pub struct Advancements<const V: i32> {
4175 pub reset: bool,
4177 pub advancement_mapping:
4179 Vec<crate::defs::p777::play::clientbound::AdvancementsAdvancementMapping>,
4180 pub identifiers: Vec<ByteString>,
4182 pub progress_mapping: Vec<crate::defs::p340::play::clientbound::AdvancementsProgressMapping>,
4184 pub show_advancements: bool,
4186}
4187#[cfg(feature = "v26_3")]
4188impl<const V: i32> Decode for Advancements<V> {
4189 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
4190 Ok({
4191 let v1 = r.read_bool()?;
4192 let v2 = {
4193 let v3 = {
4194 let c = r.read_varint()?;
4195 r.check_count(i64::from(c), 13)?
4196 };
4197 let mut v4 = Vec::with_capacity(v3.min(crate::codec::PREALLOC_LIMIT));
4198 for _ in 0..v3 {
4199 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::p777::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 }; crate::defs::p777::play::clientbound::AdvancementsAdvancementMappingValueDisplayData { title: v9, description: v10, icon: v11, frame_type: v12, flags: v13, background_texture: v15 } }) } else { None };let v16 = { let v17 = { let c = r.read_varint()?; r.check_count(i64::from(c), 1)? }; let mut v18 = Vec::with_capacity(v17.min(crate::codec::PREALLOC_LIMIT)); for _ in 0..v17 { v18.push({ 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(r.read_string()?); } v20 }); } v18 };let v21 = r.read_bool()?; crate::defs::p777::play::clientbound::AdvancementsAdvancementMappingValue { parent_id: v7, display_data: v8, requirements: v16, sends_telemtry_data: v21 } };let v22 = r.read_f32()?;let v23 = r.read_f32()?; crate::defs::p777::play::clientbound::AdvancementsAdvancementMapping { key: v5, value: v6, x_cord: v22, y_cord: v23 } });
4200 }
4201 v4
4202 };
4203 let v24 = {
4204 let v25 = {
4205 let c = r.read_varint()?;
4206 r.check_count(i64::from(c), 1)?
4207 };
4208 let mut v26 = Vec::with_capacity(v25.min(crate::codec::PREALLOC_LIMIT));
4209 for _ in 0..v25 {
4210 v26.push(r.read_string()?);
4211 }
4212 v26
4213 };
4214 let v27 = {
4215 let v28 = {
4216 let c = r.read_varint()?;
4217 r.check_count(i64::from(c), 2)?
4218 };
4219 let mut v29 = Vec::with_capacity(v28.min(crate::codec::PREALLOC_LIMIT));
4220 for _ in 0..v28 {
4221 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 } });
4222 }
4223 v29
4224 };
4225 let v36 = r.read_bool()?;
4226 Self {
4227 reset: v1,
4228 advancement_mapping: v2,
4229 identifiers: v24,
4230 progress_mapping: v27,
4231 show_advancements: v36,
4232 }
4233 })
4234 }
4235}
4236#[cfg(feature = "v26_3")]
4237impl<const V: i32> Encode for Advancements<V> {
4238 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
4239 w.put_bool((*self).reset);
4240 w.put_len_varint((*self).advancement_mapping.len())?;
4241 for v1 in (*self).advancement_mapping.iter() {
4242 w.put_string(&(*v1).key)?;
4243 match &(*v1).value.parent_id {
4244 Some(v2) => {
4245 w.put_u8(1);
4246 w.put_string(&(*v2))?;
4247 }
4248 None => w.put_u8(0),
4249 }
4250 match &(*v1).value.display_data {
4251 Some(v3) => {
4252 w.put_u8(1);
4253 (*v3).title.write(w);
4254 (*v3).description.write(w);
4255 (*v3).icon.encode(w)?;
4256 w.put_varint((*v3).frame_type);
4257 {
4258 let mut bits: u64 = 0;
4259 {
4260 let x = i128::from((*v3).flags.unused);
4261 if x < 0 || x > 536870911 {
4262 return Err(EncodeError::OutOfRange("unused"));
4263 }
4264 bits = (bits << 29) | ((x as u64) & 0x1fffffff);
4265 }
4266 {
4267 let x = i128::from((*v3).flags.hidden);
4268 if x < 0 || x > 1 {
4269 return Err(EncodeError::OutOfRange("hidden"));
4270 }
4271 bits = (bits << 1) | ((x as u64) & 0x1);
4272 }
4273 {
4274 let x = i128::from((*v3).flags.show_toast);
4275 if x < 0 || x > 1 {
4276 return Err(EncodeError::OutOfRange("show_toast"));
4277 }
4278 bits = (bits << 1) | ((x as u64) & 0x1);
4279 }
4280 {
4281 let x = i128::from((*v3).flags.has_background_texture);
4282 if x < 0 || x > 1 {
4283 return Err(EncodeError::OutOfRange("has_background_texture"));
4284 }
4285 bits = (bits << 1) | ((x as u64) & 0x1);
4286 }
4287 w.put_u32(bits as u32);
4288 }
4289 match (
4290 &(*v3).background_texture,
4291 ((*v3).flags.has_background_texture == 1),
4292 ) {
4293 (Some(v4), true) => {
4294 w.put_string(&(*v4))?;
4295 }
4296 (None, false) => {}
4297 _ => {
4298 return Err(EncodeError::SwitchMismatch(
4299 "play.clientbound.advancements.advancementMapping.value.displayData.backgroundTexture",
4300 ));
4301 }
4302 }
4303 }
4304 None => w.put_u8(0),
4305 }
4306 w.put_len_varint((*v1).value.requirements.len())?;
4307 for v5 in (*v1).value.requirements.iter() {
4308 w.put_len_varint((*v5).len())?;
4309 for v6 in (*v5).iter() {
4310 w.put_string(&(*v6))?;
4311 }
4312 }
4313 w.put_bool((*v1).value.sends_telemtry_data);
4314 w.put_f32((*v1).x_cord);
4315 w.put_f32((*v1).y_cord);
4316 }
4317 w.put_len_varint((*self).identifiers.len())?;
4318 for v7 in (*self).identifiers.iter() {
4319 w.put_string(&(*v7))?;
4320 }
4321 w.put_len_varint((*self).progress_mapping.len())?;
4322 for v8 in (*self).progress_mapping.iter() {
4323 w.put_string(&(*v8).key)?;
4324 w.put_len_varint((*v8).value.len())?;
4325 for v9 in (*v8).value.iter() {
4326 w.put_string(&(*v9).criterion_identifier)?;
4327 match &(*v9).criterion_progress {
4328 Some(v10) => {
4329 w.put_u8(1);
4330 w.put_i64((*v10));
4331 }
4332 None => w.put_u8(0),
4333 }
4334 }
4335 }
4336 w.put_bool((*self).show_advancements);
4337 Ok(())
4338 }
4339}
4340#[cfg(feature = "v26_3")]
4341#[cfg(feature = "testgen")]
4342impl<const V: i32> Generate for Advancements<V> {
4343 fn generate(g: &mut Gen) -> Self {
4344 {
4345 let v1 = g.bool();
4346 let v2 = {
4347 let v3 = g.count();
4348 let mut v4 = Vec::with_capacity(v3.min(crate::codec::PREALLOC_LIMIT));
4349 for _ in 0..v3 {
4350 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::p777::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 }; crate::defs::p777::play::clientbound::AdvancementsAdvancementMappingValueDisplayData { title: v9, description: v10, icon: v11, frame_type: v12, flags: v13, background_texture: v15 } }) } else { None };let v16 = { let v17 = g.count(); let mut v18 = Vec::with_capacity(v17.min(crate::codec::PREALLOC_LIMIT)); for _ in 0..v17 { v18.push({ let v19 = g.count(); let mut v20 = Vec::with_capacity(v19.min(crate::codec::PREALLOC_LIMIT)); for _ in 0..v19 { v20.push(g.string()); } v20 }); } v18 };let v21 = g.bool(); crate::defs::p777::play::clientbound::AdvancementsAdvancementMappingValue { parent_id: v7, display_data: v8, requirements: v16, sends_telemtry_data: v21 } };let v22 = g.f32();let v23 = g.f32(); crate::defs::p777::play::clientbound::AdvancementsAdvancementMapping { key: v5, value: v6, x_cord: v22, y_cord: v23 } });
4351 }
4352 v4
4353 };
4354 let v24 = {
4355 let v25 = g.count();
4356 let mut v26 = Vec::with_capacity(v25.min(crate::codec::PREALLOC_LIMIT));
4357 for _ in 0..v25 {
4358 v26.push(g.string());
4359 }
4360 v26
4361 };
4362 let v27 = {
4363 let v28 = g.count();
4364 let mut v29 = Vec::with_capacity(v28.min(crate::codec::PREALLOC_LIMIT));
4365 for _ in 0..v28 {
4366 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 } });
4367 }
4368 v29
4369 };
4370 let v36 = g.bool();
4371 Self {
4372 reset: v1,
4373 advancement_mapping: v2,
4374 identifiers: v24,
4375 progress_mapping: v27,
4376 show_advancements: v36,
4377 }
4378 }
4379 }
4380}
4381
4382#[cfg(feature = "v26_3")]
4383#[derive(Debug, Clone, PartialEq)]
4385pub struct DeclareRecipesStoneCutterRecipes {
4386 pub input: HolderSet,
4388 pub slot_display: crate::defs::p777::play::clientbound::SlotDisplay,
4390}
4391
4392#[cfg(feature = "v26_3")]
4393#[derive(Debug, Clone, PartialEq)]
4395pub struct DeclareRecipes<const V: i32> {
4396 pub recipes: Vec<crate::defs::p775::play::clientbound::DeclareRecipesRecipes>,
4398 pub stone_cutter_recipes:
4400 Vec<crate::defs::p777::play::clientbound::DeclareRecipesStoneCutterRecipes>,
4401}
4402#[cfg(feature = "v26_3")]
4403impl<const V: i32> Decode for DeclareRecipes<V> {
4404 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
4405 Ok({
4406 let v1 = {
4407 let v2 = {
4408 let c = r.read_varint()?;
4409 r.check_count(i64::from(c), 2)?
4410 };
4411 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
4412 for _ in 0..v2 {
4413 v3.push({
4414 let v4 = r.read_string()?;
4415 let v5 = {
4416 let v6 = {
4417 let c = r.read_varint()?;
4418 r.check_count(i64::from(c), 1)?
4419 };
4420 let mut v7 = Vec::with_capacity(v6.min(crate::codec::PREALLOC_LIMIT));
4421 for _ in 0..v6 {
4422 v7.push(r.read_varint()?);
4423 }
4424 v7
4425 };
4426 crate::defs::p775::play::clientbound::DeclareRecipesRecipes {
4427 name: v4,
4428 items: v5,
4429 }
4430 });
4431 }
4432 v3
4433 };
4434 let v8 = {
4435 let v9 = {
4436 let c = r.read_varint()?;
4437 r.check_count(i64::from(c), 2)?
4438 };
4439 let mut v10 = Vec::with_capacity(v9.min(crate::codec::PREALLOC_LIMIT));
4440 for _ in 0..v9 {
4441 v10.push({
4442 let v11 = <HolderSet as Decode>::decode(r)?;
4443 let v12 =
4444 <crate::defs::p777::play::clientbound::SlotDisplay as Decode>::decode(
4445 r,
4446 )?;
4447 crate::defs::p777::play::clientbound::DeclareRecipesStoneCutterRecipes {
4448 input: v11,
4449 slot_display: v12,
4450 }
4451 });
4452 }
4453 v10
4454 };
4455 Self {
4456 recipes: v1,
4457 stone_cutter_recipes: v8,
4458 }
4459 })
4460 }
4461}
4462#[cfg(feature = "v26_3")]
4463impl<const V: i32> Encode for DeclareRecipes<V> {
4464 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
4465 w.put_len_varint((*self).recipes.len())?;
4466 for v1 in (*self).recipes.iter() {
4467 w.put_string(&(*v1).name)?;
4468 w.put_len_varint((*v1).items.len())?;
4469 for v2 in (*v1).items.iter() {
4470 w.put_varint((*v2));
4471 }
4472 }
4473 w.put_len_varint((*self).stone_cutter_recipes.len())?;
4474 for v3 in (*self).stone_cutter_recipes.iter() {
4475 (*v3).input.encode(w)?;
4476 (*v3).slot_display.encode(w)?;
4477 }
4478 Ok(())
4479 }
4480}
4481#[cfg(feature = "v26_3")]
4482#[cfg(feature = "testgen")]
4483impl<const V: i32> Generate for DeclareRecipes<V> {
4484 fn generate(g: &mut Gen) -> Self {
4485 {
4486 let v1 = {
4487 let v2 = g.count();
4488 let mut v3 = Vec::with_capacity(v2.min(crate::codec::PREALLOC_LIMIT));
4489 for _ in 0..v2 {
4490 v3.push({
4491 let v4 = g.string();
4492 let v5 = {
4493 let v6 = g.count();
4494 let mut v7 = Vec::with_capacity(v6.min(crate::codec::PREALLOC_LIMIT));
4495 for _ in 0..v6 {
4496 v7.push((g.int_in(-2147483648, 2147483647, &[]) as i32));
4497 }
4498 v7
4499 };
4500 crate::defs::p775::play::clientbound::DeclareRecipesRecipes {
4501 name: v4,
4502 items: v5,
4503 }
4504 });
4505 }
4506 v3
4507 };
4508 let v8 = {
4509 let v9 = g.count();
4510 let mut v10 = Vec::with_capacity(v9.min(crate::codec::PREALLOC_LIMIT));
4511 for _ in 0..v9 {
4512 v10.push({ let v11 = <HolderSet as Generate>::generate(g);let v12 = <crate::defs::p777::play::clientbound::SlotDisplay as Generate>::generate(g); crate::defs::p777::play::clientbound::DeclareRecipesStoneCutterRecipes { input: v11, slot_display: v12 } });
4513 }
4514 v10
4515 };
4516 Self {
4517 recipes: v1,
4518 stone_cutter_recipes: v8,
4519 }
4520 }
4521 }
4522}