1#![allow(
8 unused_imports,
9 unused_variables,
10 unused_mut,
11 unused_parens,
12 unused_braces,
13 clippy::all,
14 clippy::pedantic,
15 non_camel_case_types,
16 non_snake_case
17)]
18use crate::codec::{Decode, DecodeResult, Encode, EncodeResult, McWrite, Reader, decode_exact};
19use crate::error::{DecodeError, EncodeError};
20use crate::nbt::RawNbt;
21use crate::packet::{Direction, PacketSet, RawPacket, State};
22#[cfg(feature = "testgen")]
23use crate::testgen::{Gen, Generate};
24use crate::types::{BlockPos, ByteString, PositionLayout, Uuid};
25use crate::v1_16_5::types;
26use bytes::{BufMut, Bytes, BytesMut};
27
28#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
30pub struct SetDifficultyNewDifficulty(pub u8);
31impl SetDifficultyNewDifficulty {
32 pub const PEACEFUL: Self = Self(0);
34 pub const EASY: Self = Self(1);
36 pub const NORMAL: Self = Self(2);
38 pub const HARD: Self = Self(3);
40 pub const fn name(self) -> Option<&'static str> {
42 match self.0 {
43 0 => Some("peaceful"),
44 1 => Some("easy"),
45 2 => Some("normal"),
46 3 => Some("hard"),
47 _ => None,
48 }
49 }
50}
51impl std::fmt::Debug for SetDifficultyNewDifficulty {
52 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
53 match self.name() {
54 Some(n) => write!(f, "SetDifficultyNewDifficulty::{n}"),
55 None => write!(f, "SetDifficultyNewDifficulty({})", self.0),
56 }
57 }
58}
59
60#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
62pub struct ClientCommandActionId(pub i32);
63impl ClientCommandActionId {
64 pub const PERFORM_RESPAWN: Self = Self(0);
66 pub const REQUEST_STATS: Self = Self(1);
68 pub const fn name(self) -> Option<&'static str> {
70 match self.0 {
71 0 => Some("perform_respawn"),
72 1 => Some("request_stats"),
73 _ => None,
74 }
75 }
76}
77impl std::fmt::Debug for ClientCommandActionId {
78 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
79 match self.name() {
80 Some(n) => write!(f, "ClientCommandActionId::{n}"),
81 None => write!(f, "ClientCommandActionId({})", self.0),
82 }
83 }
84}
85
86#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
88pub struct EntityActionActionId(pub i32);
89impl EntityActionActionId {
90 pub const START_SNEAKING: Self = Self(0);
92 pub const STOP_SNEAKING: Self = Self(1);
94 pub const STOP_SLEEPING: Self = Self(2);
96 pub const START_SPRINTING: Self = Self(3);
98 pub const STOP_SPRINTING: Self = Self(4);
100 pub const START_RIDING_JUMP: Self = Self(5);
102 pub const STOP_RIDING_JUMP: Self = Self(6);
104 pub const OPEN_INVENTORY: Self = Self(7);
106 pub const START_FALL_FLYING: Self = Self(8);
108 pub const fn name(self) -> Option<&'static str> {
110 match self.0 {
111 0 => Some("start_sneaking"),
112 1 => Some("stop_sneaking"),
113 2 => Some("stop_sleeping"),
114 3 => Some("start_sprinting"),
115 4 => Some("stop_sprinting"),
116 5 => Some("start_riding_jump"),
117 6 => Some("stop_riding_jump"),
118 7 => Some("open_inventory"),
119 8 => Some("start_fall_flying"),
120 _ => None,
121 }
122 }
123}
124impl std::fmt::Debug for EntityActionActionId {
125 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
126 match self.name() {
127 Some(n) => write!(f, "EntityActionActionId::{n}"),
128 None => write!(f, "EntityActionActionId({})", self.0),
129 }
130 }
131}
132
133pub mod id {
135 pub const TELEPORT_CONFIRM: i32 = 0x00;
137 pub const QUERY_BLOCK_NBT: i32 = 0x01;
139 pub const SET_DIFFICULTY: i32 = 0x02;
141 pub const CHAT: i32 = 0x03;
143 pub const CLIENT_COMMAND: i32 = 0x04;
145 pub const SETTINGS: i32 = 0x05;
147 pub const TAB_COMPLETE: i32 = 0x06;
149 pub const TRANSACTION: i32 = 0x07;
151 pub const ENCHANT_ITEM: i32 = 0x08;
153 pub const WINDOW_CLICK: i32 = 0x09;
155 pub const CLOSE_WINDOW: i32 = 0x0a;
157 pub const CUSTOM_PAYLOAD: i32 = 0x0b;
159 pub const EDIT_BOOK: i32 = 0x0c;
161 pub const QUERY_ENTITY_NBT: i32 = 0x0d;
163 pub const USE_ENTITY: i32 = 0x0e;
165 pub const GENERATE_STRUCTURE: i32 = 0x0f;
167 pub const KEEP_ALIVE: i32 = 0x10;
169 pub const LOCK_DIFFICULTY: i32 = 0x11;
171 pub const POSITION: i32 = 0x12;
173 pub const POSITION_LOOK: i32 = 0x13;
175 pub const LOOK: i32 = 0x14;
177 pub const FLYING: i32 = 0x15;
179 pub const VEHICLE_MOVE: i32 = 0x16;
181 pub const STEER_BOAT: i32 = 0x17;
183 pub const PICK_ITEM: i32 = 0x18;
185 pub const CRAFT_RECIPE_REQUEST: i32 = 0x19;
187 pub const ABILITIES: i32 = 0x1a;
189 pub const BLOCK_DIG: i32 = 0x1b;
191 pub const ENTITY_ACTION: i32 = 0x1c;
193 pub const STEER_VEHICLE: i32 = 0x1d;
195 pub const RECIPE_BOOK: i32 = 0x1e;
197 pub const DISPLAYED_RECIPE: i32 = 0x1f;
199 pub const NAME_ITEM: i32 = 0x20;
201 pub const RESOURCE_PACK_RECEIVE: i32 = 0x21;
203 pub const ADVANCEMENT_TAB: i32 = 0x22;
205 pub const SELECT_TRADE: i32 = 0x23;
207 pub const SET_BEACON_EFFECT: i32 = 0x24;
209 pub const HELD_ITEM_SLOT: i32 = 0x25;
211 pub const UPDATE_COMMAND_BLOCK: i32 = 0x26;
213 pub const UPDATE_COMMAND_BLOCK_MINECART: i32 = 0x27;
215 pub const SET_CREATIVE_SLOT: i32 = 0x28;
217 pub const UPDATE_JIGSAW_BLOCK: i32 = 0x29;
219 pub const UPDATE_STRUCTURE_BLOCK: i32 = 0x2a;
221 pub const UPDATE_SIGN: i32 = 0x2b;
223 pub const ARM_ANIMATION: i32 = 0x2c;
225 pub const SPECTATE: i32 = 0x2d;
227 pub const BLOCK_PLACE: i32 = 0x2e;
229 pub const USE_ITEM: i32 = 0x2f;
231}
232
233#[derive(Debug, Clone, PartialEq)]
235pub struct TeleportConfirm {
236 pub teleport_id: i32,
238}
239impl crate::packet::Packet for TeleportConfirm {
240 const ID: i32 = id::TELEPORT_CONFIRM;
241 const NAME: &'static str = "teleport_confirm";
242 const STATE: State = State::Play;
243 const DIRECTION: Direction = Direction::Serverbound;
244}
245impl Decode for TeleportConfirm {
246 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
247 Ok({
248 let v1338 = r.read_varint()?;
249 TeleportConfirm { teleport_id: v1338 }
250 })
251 }
252}
253impl Encode for TeleportConfirm {
254 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
255 w.put_varint((*self).teleport_id);
256 Ok(())
257 }
258}
259#[cfg(feature = "testgen")]
260impl Generate for TeleportConfirm {
261 fn generate(g: &mut Gen) -> Self {
262 {
263 let v1339 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
264 TeleportConfirm { teleport_id: v1339 }
265 }
266 }
267}
268impl From<TeleportConfirm> for ServerboundPlayPacket {
269 fn from(p: TeleportConfirm) -> Self {
270 Self::TeleportConfirm(p)
271 }
272}
273
274#[derive(Debug, Clone, PartialEq)]
276pub struct QueryBlockNbt {
277 pub transaction_id: i32,
279 pub location: BlockPos,
281}
282impl crate::packet::Packet for QueryBlockNbt {
283 const ID: i32 = id::QUERY_BLOCK_NBT;
284 const NAME: &'static str = "query_block_nbt";
285 const STATE: State = State::Play;
286 const DIRECTION: Direction = Direction::Serverbound;
287}
288impl Decode for QueryBlockNbt {
289 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
290 Ok({
291 let v1340 = r.read_varint()?;
292 let v1341 = BlockPos::read(r, PositionLayout::Xzy)?;
293 QueryBlockNbt {
294 transaction_id: v1340,
295 location: v1341,
296 }
297 })
298 }
299}
300impl Encode for QueryBlockNbt {
301 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
302 w.put_varint((*self).transaction_id);
303 (*self).location.write(w, PositionLayout::Xzy)?;
304 Ok(())
305 }
306}
307#[cfg(feature = "testgen")]
308impl Generate for QueryBlockNbt {
309 fn generate(g: &mut Gen) -> Self {
310 {
311 let v1342 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
312 let v1343 = g.position();
313 QueryBlockNbt {
314 transaction_id: v1342,
315 location: v1343,
316 }
317 }
318 }
319}
320impl From<QueryBlockNbt> for ServerboundPlayPacket {
321 fn from(p: QueryBlockNbt) -> Self {
322 Self::QueryBlockNbt(p)
323 }
324}
325
326#[derive(Debug, Clone, PartialEq)]
328pub struct SetDifficulty {
329 pub new_difficulty: SetDifficultyNewDifficulty,
331}
332impl crate::packet::Packet for SetDifficulty {
333 const ID: i32 = id::SET_DIFFICULTY;
334 const NAME: &'static str = "set_difficulty";
335 const STATE: State = State::Play;
336 const DIRECTION: Direction = Direction::Serverbound;
337}
338impl Decode for SetDifficulty {
339 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
340 Ok({
341 let v1344 = SetDifficultyNewDifficulty(r.read_u8()?);
342 SetDifficulty {
343 new_difficulty: v1344,
344 }
345 })
346 }
347}
348impl Encode for SetDifficulty {
349 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
350 w.put_u8((*self).new_difficulty.0);
351 Ok(())
352 }
353}
354#[cfg(feature = "testgen")]
355impl Generate for SetDifficulty {
356 fn generate(g: &mut Gen) -> Self {
357 {
358 let v1345 = SetDifficultyNewDifficulty(g.int_in(0, 255, &[0, 1, 2, 3]) as u8);
359 SetDifficulty {
360 new_difficulty: v1345,
361 }
362 }
363 }
364}
365impl From<SetDifficulty> for ServerboundPlayPacket {
366 fn from(p: SetDifficulty) -> Self {
367 Self::SetDifficulty(p)
368 }
369}
370
371#[derive(Debug, Clone, PartialEq)]
373pub struct Chat {
374 pub message: ByteString,
376}
377impl crate::packet::Packet for Chat {
378 const ID: i32 = id::CHAT;
379 const NAME: &'static str = "chat";
380 const STATE: State = State::Play;
381 const DIRECTION: Direction = Direction::Serverbound;
382}
383impl Decode for Chat {
384 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
385 Ok({
386 let v1346 = r.read_string()?;
387 Chat { message: v1346 }
388 })
389 }
390}
391impl Encode for Chat {
392 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
393 w.put_string(&(*self).message)?;
394 Ok(())
395 }
396}
397#[cfg(feature = "testgen")]
398impl Generate for Chat {
399 fn generate(g: &mut Gen) -> Self {
400 {
401 let v1347 = g.string();
402 Chat { message: v1347 }
403 }
404 }
405}
406impl From<Chat> for ServerboundPlayPacket {
407 fn from(p: Chat) -> Self {
408 Self::Chat(p)
409 }
410}
411
412#[derive(Debug, Clone, PartialEq)]
414pub struct ClientCommand {
415 pub action_id: ClientCommandActionId,
417}
418impl crate::packet::Packet for ClientCommand {
419 const ID: i32 = id::CLIENT_COMMAND;
420 const NAME: &'static str = "client_command";
421 const STATE: State = State::Play;
422 const DIRECTION: Direction = Direction::Serverbound;
423}
424impl Decode for ClientCommand {
425 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
426 Ok({
427 let v1348 = ClientCommandActionId(r.read_varint()?);
428 ClientCommand { action_id: v1348 }
429 })
430 }
431}
432impl Encode for ClientCommand {
433 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
434 w.put_varint((*self).action_id.0);
435 Ok(())
436 }
437}
438#[cfg(feature = "testgen")]
439impl Generate for ClientCommand {
440 fn generate(g: &mut Gen) -> Self {
441 {
442 let v1349 = ClientCommandActionId(g.int_in(-2147483648, 2147483647, &[0, 1]) as i32);
443 ClientCommand { action_id: v1349 }
444 }
445 }
446}
447impl From<ClientCommand> for ServerboundPlayPacket {
448 fn from(p: ClientCommand) -> Self {
449 Self::ClientCommand(p)
450 }
451}
452
453#[derive(Debug, Clone, PartialEq)]
455pub struct Settings {
456 pub locale: ByteString,
458 pub view_distance: i8,
460 pub chat_flags: i32,
462 pub chat_colors: bool,
464 pub skin_parts: u8,
466 pub main_hand: i32,
468}
469impl crate::packet::Packet for Settings {
470 const ID: i32 = id::SETTINGS;
471 const NAME: &'static str = "settings";
472 const STATE: State = State::Play;
473 const DIRECTION: Direction = Direction::Serverbound;
474}
475impl Decode for Settings {
476 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
477 Ok({
478 let v1350 = r.read_string()?;
479 let v1351 = r.read_i8()?;
480 let v1352 = r.read_varint()?;
481 let v1353 = r.read_bool()?;
482 let v1354 = r.read_u8()?;
483 let v1355 = r.read_varint()?;
484 Settings {
485 locale: v1350,
486 view_distance: v1351,
487 chat_flags: v1352,
488 chat_colors: v1353,
489 skin_parts: v1354,
490 main_hand: v1355,
491 }
492 })
493 }
494}
495impl Encode for Settings {
496 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
497 w.put_string(&(*self).locale)?;
498 w.put_i8((*self).view_distance);
499 w.put_varint((*self).chat_flags);
500 w.put_bool((*self).chat_colors);
501 w.put_u8((*self).skin_parts);
502 w.put_varint((*self).main_hand);
503 Ok(())
504 }
505}
506#[cfg(feature = "testgen")]
507impl Generate for Settings {
508 fn generate(g: &mut Gen) -> Self {
509 {
510 let v1356 = g.string();
511 let v1357 = (g.int_in(-128, 127, &[]) as i8);
512 let v1358 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
513 let v1359 = g.bool();
514 let v1360 = (g.int_in(0, 255, &[]) as u8);
515 let v1361 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
516 Settings {
517 locale: v1356,
518 view_distance: v1357,
519 chat_flags: v1358,
520 chat_colors: v1359,
521 skin_parts: v1360,
522 main_hand: v1361,
523 }
524 }
525 }
526}
527impl From<Settings> for ServerboundPlayPacket {
528 fn from(p: Settings) -> Self {
529 Self::Settings(p)
530 }
531}
532
533#[derive(Debug, Clone, PartialEq)]
535pub struct TabComplete {
536 pub transaction_id: i32,
538 pub text: ByteString,
540}
541impl crate::packet::Packet for TabComplete {
542 const ID: i32 = id::TAB_COMPLETE;
543 const NAME: &'static str = "tab_complete";
544 const STATE: State = State::Play;
545 const DIRECTION: Direction = Direction::Serverbound;
546}
547impl Decode for TabComplete {
548 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
549 Ok({
550 let v1362 = r.read_varint()?;
551 let v1363 = r.read_string()?;
552 TabComplete {
553 transaction_id: v1362,
554 text: v1363,
555 }
556 })
557 }
558}
559impl Encode for TabComplete {
560 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
561 w.put_varint((*self).transaction_id);
562 w.put_string(&(*self).text)?;
563 Ok(())
564 }
565}
566#[cfg(feature = "testgen")]
567impl Generate for TabComplete {
568 fn generate(g: &mut Gen) -> Self {
569 {
570 let v1364 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
571 let v1365 = g.string();
572 TabComplete {
573 transaction_id: v1364,
574 text: v1365,
575 }
576 }
577 }
578}
579impl From<TabComplete> for ServerboundPlayPacket {
580 fn from(p: TabComplete) -> Self {
581 Self::TabComplete(p)
582 }
583}
584
585#[derive(Debug, Clone, PartialEq)]
587pub struct Transaction {
588 pub window_id: i8,
590 pub action: i16,
592 pub accepted: bool,
594}
595impl crate::packet::Packet for Transaction {
596 const ID: i32 = id::TRANSACTION;
597 const NAME: &'static str = "transaction";
598 const STATE: State = State::Play;
599 const DIRECTION: Direction = Direction::Serverbound;
600}
601impl Decode for Transaction {
602 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
603 Ok({
604 let v1366 = r.read_i8()?;
605 let v1367 = r.read_i16()?;
606 let v1368 = r.read_bool()?;
607 Transaction {
608 window_id: v1366,
609 action: v1367,
610 accepted: v1368,
611 }
612 })
613 }
614}
615impl Encode for Transaction {
616 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
617 w.put_i8((*self).window_id);
618 w.put_i16((*self).action);
619 w.put_bool((*self).accepted);
620 Ok(())
621 }
622}
623#[cfg(feature = "testgen")]
624impl Generate for Transaction {
625 fn generate(g: &mut Gen) -> Self {
626 {
627 let v1369 = (g.int_in(-128, 127, &[]) as i8);
628 let v1370 = (g.int_in(-32768, 32767, &[]) as i16);
629 let v1371 = g.bool();
630 Transaction {
631 window_id: v1369,
632 action: v1370,
633 accepted: v1371,
634 }
635 }
636 }
637}
638impl From<Transaction> for ServerboundPlayPacket {
639 fn from(p: Transaction) -> Self {
640 Self::Transaction(p)
641 }
642}
643
644#[derive(Debug, Clone, PartialEq)]
646pub struct EnchantItem {
647 pub window_id: i8,
649 pub enchantment: i8,
651}
652impl crate::packet::Packet for EnchantItem {
653 const ID: i32 = id::ENCHANT_ITEM;
654 const NAME: &'static str = "enchant_item";
655 const STATE: State = State::Play;
656 const DIRECTION: Direction = Direction::Serverbound;
657}
658impl Decode for EnchantItem {
659 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
660 Ok({
661 let v1372 = r.read_i8()?;
662 let v1373 = r.read_i8()?;
663 EnchantItem {
664 window_id: v1372,
665 enchantment: v1373,
666 }
667 })
668 }
669}
670impl Encode for EnchantItem {
671 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
672 w.put_i8((*self).window_id);
673 w.put_i8((*self).enchantment);
674 Ok(())
675 }
676}
677#[cfg(feature = "testgen")]
678impl Generate for EnchantItem {
679 fn generate(g: &mut Gen) -> Self {
680 {
681 let v1374 = (g.int_in(-128, 127, &[]) as i8);
682 let v1375 = (g.int_in(-128, 127, &[]) as i8);
683 EnchantItem {
684 window_id: v1374,
685 enchantment: v1375,
686 }
687 }
688 }
689}
690impl From<EnchantItem> for ServerboundPlayPacket {
691 fn from(p: EnchantItem) -> Self {
692 Self::EnchantItem(p)
693 }
694}
695
696#[derive(Debug, Clone, PartialEq)]
698pub struct WindowClick {
699 pub window_id: u8,
701 pub slot: i16,
703 pub mouse_button: i8,
705 pub action: i16,
707 pub mode: i8,
709 pub item: types::Slot,
711}
712impl crate::packet::Packet for WindowClick {
713 const ID: i32 = id::WINDOW_CLICK;
714 const NAME: &'static str = "window_click";
715 const STATE: State = State::Play;
716 const DIRECTION: Direction = Direction::Serverbound;
717}
718impl Decode for WindowClick {
719 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
720 Ok({
721 let v1376 = r.read_u8()?;
722 let v1377 = r.read_i16()?;
723 let v1378 = r.read_i8()?;
724 let v1379 = r.read_i16()?;
725 let v1380 = r.read_i8()?;
726 let v1381 = <types::Slot as Decode>::decode(r)?;
727 WindowClick {
728 window_id: v1376,
729 slot: v1377,
730 mouse_button: v1378,
731 action: v1379,
732 mode: v1380,
733 item: v1381,
734 }
735 })
736 }
737}
738impl Encode for WindowClick {
739 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
740 w.put_u8((*self).window_id);
741 w.put_i16((*self).slot);
742 w.put_i8((*self).mouse_button);
743 w.put_i16((*self).action);
744 w.put_i8((*self).mode);
745 (*self).item.encode(w)?;
746 Ok(())
747 }
748}
749#[cfg(feature = "testgen")]
750impl Generate for WindowClick {
751 fn generate(g: &mut Gen) -> Self {
752 {
753 let v1382 = (g.int_in(0, 255, &[]) as u8);
754 let v1383 = (g.int_in(-32768, 32767, &[]) as i16);
755 let v1384 = (g.int_in(-128, 127, &[]) as i8);
756 let v1385 = (g.int_in(-32768, 32767, &[]) as i16);
757 let v1386 = (g.int_in(-128, 127, &[]) as i8);
758 let v1387 = <types::Slot as Generate>::generate(g);
759 WindowClick {
760 window_id: v1382,
761 slot: v1383,
762 mouse_button: v1384,
763 action: v1385,
764 mode: v1386,
765 item: v1387,
766 }
767 }
768 }
769}
770impl From<WindowClick> for ServerboundPlayPacket {
771 fn from(p: WindowClick) -> Self {
772 Self::WindowClick(p)
773 }
774}
775
776#[derive(Debug, Clone, PartialEq)]
778pub struct CloseWindow {
779 pub window_id: u8,
781}
782impl crate::packet::Packet for CloseWindow {
783 const ID: i32 = id::CLOSE_WINDOW;
784 const NAME: &'static str = "close_window";
785 const STATE: State = State::Play;
786 const DIRECTION: Direction = Direction::Serverbound;
787}
788impl Decode for CloseWindow {
789 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
790 Ok({
791 let v1388 = r.read_u8()?;
792 CloseWindow { window_id: v1388 }
793 })
794 }
795}
796impl Encode for CloseWindow {
797 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
798 w.put_u8((*self).window_id);
799 Ok(())
800 }
801}
802#[cfg(feature = "testgen")]
803impl Generate for CloseWindow {
804 fn generate(g: &mut Gen) -> Self {
805 {
806 let v1389 = (g.int_in(0, 255, &[]) as u8);
807 CloseWindow { window_id: v1389 }
808 }
809 }
810}
811impl From<CloseWindow> for ServerboundPlayPacket {
812 fn from(p: CloseWindow) -> Self {
813 Self::CloseWindow(p)
814 }
815}
816
817#[derive(Debug, Clone, PartialEq)]
819pub struct CustomPayload {
820 pub channel: ByteString,
822 pub data: Bytes,
824}
825impl crate::packet::Packet for CustomPayload {
826 const ID: i32 = id::CUSTOM_PAYLOAD;
827 const NAME: &'static str = "custom_payload";
828 const STATE: State = State::Play;
829 const DIRECTION: Direction = Direction::Serverbound;
830}
831impl Decode for CustomPayload {
832 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
833 Ok({
834 let v1390 = r.read_string()?;
835 let v1391 = r.read_rest();
836 CustomPayload {
837 channel: v1390,
838 data: v1391,
839 }
840 })
841 }
842}
843impl Encode for CustomPayload {
844 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
845 w.put_string(&(*self).channel)?;
846 w.put_slice(&(*self).data);
847 Ok(())
848 }
849}
850#[cfg(feature = "testgen")]
851impl Generate for CustomPayload {
852 fn generate(g: &mut Gen) -> Self {
853 {
854 let v1392 = g.string();
855 let v1393 = g.bytes();
856 CustomPayload {
857 channel: v1392,
858 data: v1393,
859 }
860 }
861 }
862}
863impl From<CustomPayload> for ServerboundPlayPacket {
864 fn from(p: CustomPayload) -> Self {
865 Self::CustomPayload(p)
866 }
867}
868
869#[derive(Debug, Clone, PartialEq)]
871pub struct EditBook {
872 pub new_book: types::Slot,
874 pub signing: bool,
876 pub hand: i32,
878}
879impl crate::packet::Packet for EditBook {
880 const ID: i32 = id::EDIT_BOOK;
881 const NAME: &'static str = "edit_book";
882 const STATE: State = State::Play;
883 const DIRECTION: Direction = Direction::Serverbound;
884}
885impl Decode for EditBook {
886 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
887 Ok({
888 let v1394 = <types::Slot as Decode>::decode(r)?;
889 let v1395 = r.read_bool()?;
890 let v1396 = r.read_varint()?;
891 EditBook {
892 new_book: v1394,
893 signing: v1395,
894 hand: v1396,
895 }
896 })
897 }
898}
899impl Encode for EditBook {
900 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
901 (*self).new_book.encode(w)?;
902 w.put_bool((*self).signing);
903 w.put_varint((*self).hand);
904 Ok(())
905 }
906}
907#[cfg(feature = "testgen")]
908impl Generate for EditBook {
909 fn generate(g: &mut Gen) -> Self {
910 {
911 let v1397 = <types::Slot as Generate>::generate(g);
912 let v1398 = g.bool();
913 let v1399 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
914 EditBook {
915 new_book: v1397,
916 signing: v1398,
917 hand: v1399,
918 }
919 }
920 }
921}
922impl From<EditBook> for ServerboundPlayPacket {
923 fn from(p: EditBook) -> Self {
924 Self::EditBook(p)
925 }
926}
927
928#[derive(Debug, Clone, PartialEq)]
930pub struct QueryEntityNbt {
931 pub transaction_id: i32,
933 pub entity_id: i32,
935}
936impl crate::packet::Packet for QueryEntityNbt {
937 const ID: i32 = id::QUERY_ENTITY_NBT;
938 const NAME: &'static str = "query_entity_nbt";
939 const STATE: State = State::Play;
940 const DIRECTION: Direction = Direction::Serverbound;
941}
942impl Decode for QueryEntityNbt {
943 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
944 Ok({
945 let v1400 = r.read_varint()?;
946 let v1401 = r.read_varint()?;
947 QueryEntityNbt {
948 transaction_id: v1400,
949 entity_id: v1401,
950 }
951 })
952 }
953}
954impl Encode for QueryEntityNbt {
955 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
956 w.put_varint((*self).transaction_id);
957 w.put_varint((*self).entity_id);
958 Ok(())
959 }
960}
961#[cfg(feature = "testgen")]
962impl Generate for QueryEntityNbt {
963 fn generate(g: &mut Gen) -> Self {
964 {
965 let v1402 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
966 let v1403 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
967 QueryEntityNbt {
968 transaction_id: v1402,
969 entity_id: v1403,
970 }
971 }
972 }
973}
974impl From<QueryEntityNbt> for ServerboundPlayPacket {
975 fn from(p: QueryEntityNbt) -> Self {
976 Self::QueryEntityNbt(p)
977 }
978}
979
980#[derive(Debug, Clone, PartialEq)]
982pub struct UseEntity {
983 pub target: i32,
985 pub mouse: i32,
987 pub x: Option<f32>,
989 pub y: Option<f32>,
991 pub z: Option<f32>,
993 pub hand: Option<i32>,
995 pub sneaking: bool,
997}
998impl crate::packet::Packet for UseEntity {
999 const ID: i32 = id::USE_ENTITY;
1000 const NAME: &'static str = "use_entity";
1001 const STATE: State = State::Play;
1002 const DIRECTION: Direction = Direction::Serverbound;
1003}
1004impl Decode for UseEntity {
1005 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1006 Ok({
1007 let v1404 = r.read_varint()?;
1008 let v1405 = r.read_varint()?;
1009 let v1406 = if (v1405 == 2) {
1010 Some(r.read_f32()?)
1011 } else {
1012 None
1013 };
1014 let v1407 = if (v1405 == 2) {
1015 Some(r.read_f32()?)
1016 } else {
1017 None
1018 };
1019 let v1408 = if (v1405 == 2) {
1020 Some(r.read_f32()?)
1021 } else {
1022 None
1023 };
1024 let v1409 = if (v1405 == 0) || (v1405 == 2) {
1025 Some(r.read_varint()?)
1026 } else {
1027 None
1028 };
1029 let v1410 = r.read_bool()?;
1030 UseEntity {
1031 target: v1404,
1032 mouse: v1405,
1033 x: v1406,
1034 y: v1407,
1035 z: v1408,
1036 hand: v1409,
1037 sneaking: v1410,
1038 }
1039 })
1040 }
1041}
1042impl Encode for UseEntity {
1043 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1044 w.put_varint((*self).target);
1045 w.put_varint((*self).mouse);
1046 match (&(*self).x, ((*self).mouse == 2)) {
1047 (Some(v1411), true) => {
1048 w.put_f32((*v1411));
1049 }
1050 (None, false) => {}
1051 _ => return Err(EncodeError::SwitchMismatch("play.serverbound.use_entity.x")),
1052 }
1053 match (&(*self).y, ((*self).mouse == 2)) {
1054 (Some(v1412), true) => {
1055 w.put_f32((*v1412));
1056 }
1057 (None, false) => {}
1058 _ => return Err(EncodeError::SwitchMismatch("play.serverbound.use_entity.y")),
1059 }
1060 match (&(*self).z, ((*self).mouse == 2)) {
1061 (Some(v1413), true) => {
1062 w.put_f32((*v1413));
1063 }
1064 (None, false) => {}
1065 _ => return Err(EncodeError::SwitchMismatch("play.serverbound.use_entity.z")),
1066 }
1067 match (&(*self).hand, ((*self).mouse == 0) || ((*self).mouse == 2)) {
1068 (Some(v1414), true) => {
1069 w.put_varint((*v1414));
1070 }
1071 (None, false) => {}
1072 _ => {
1073 return Err(EncodeError::SwitchMismatch(
1074 "play.serverbound.use_entity.hand",
1075 ));
1076 }
1077 }
1078 w.put_bool((*self).sneaking);
1079 Ok(())
1080 }
1081}
1082#[cfg(feature = "testgen")]
1083impl Generate for UseEntity {
1084 fn generate(g: &mut Gen) -> Self {
1085 {
1086 let v1415 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1087 let v1416 = (g.int_in(-2147483648, 2147483647, &[2, 2, 2, 0, 2]) as i32);
1088 let v1417 = if (v1416 == 2) { Some(g.f32()) } else { None };
1089 let v1418 = if (v1416 == 2) { Some(g.f32()) } else { None };
1090 let v1419 = if (v1416 == 2) { Some(g.f32()) } else { None };
1091 let v1420 = if (v1416 == 0) || (v1416 == 2) {
1092 Some((g.int_in(-2147483648, 2147483647, &[]) as i32))
1093 } else {
1094 None
1095 };
1096 let v1421 = g.bool();
1097 UseEntity {
1098 target: v1415,
1099 mouse: v1416,
1100 x: v1417,
1101 y: v1418,
1102 z: v1419,
1103 hand: v1420,
1104 sneaking: v1421,
1105 }
1106 }
1107 }
1108}
1109impl From<UseEntity> for ServerboundPlayPacket {
1110 fn from(p: UseEntity) -> Self {
1111 Self::UseEntity(p)
1112 }
1113}
1114
1115#[derive(Debug, Clone, PartialEq)]
1117pub struct GenerateStructure {
1118 pub location: BlockPos,
1120 pub levels: i32,
1122 pub keep_jigsaws: bool,
1124}
1125impl crate::packet::Packet for GenerateStructure {
1126 const ID: i32 = id::GENERATE_STRUCTURE;
1127 const NAME: &'static str = "generate_structure";
1128 const STATE: State = State::Play;
1129 const DIRECTION: Direction = Direction::Serverbound;
1130}
1131impl Decode for GenerateStructure {
1132 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1133 Ok({
1134 let v1422 = BlockPos::read(r, PositionLayout::Xzy)?;
1135 let v1423 = r.read_varint()?;
1136 let v1424 = r.read_bool()?;
1137 GenerateStructure {
1138 location: v1422,
1139 levels: v1423,
1140 keep_jigsaws: v1424,
1141 }
1142 })
1143 }
1144}
1145impl Encode for GenerateStructure {
1146 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1147 (*self).location.write(w, PositionLayout::Xzy)?;
1148 w.put_varint((*self).levels);
1149 w.put_bool((*self).keep_jigsaws);
1150 Ok(())
1151 }
1152}
1153#[cfg(feature = "testgen")]
1154impl Generate for GenerateStructure {
1155 fn generate(g: &mut Gen) -> Self {
1156 {
1157 let v1425 = g.position();
1158 let v1426 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1159 let v1427 = g.bool();
1160 GenerateStructure {
1161 location: v1425,
1162 levels: v1426,
1163 keep_jigsaws: v1427,
1164 }
1165 }
1166 }
1167}
1168impl From<GenerateStructure> for ServerboundPlayPacket {
1169 fn from(p: GenerateStructure) -> Self {
1170 Self::GenerateStructure(p)
1171 }
1172}
1173
1174#[derive(Debug, Clone, PartialEq)]
1176pub struct KeepAlive {
1177 pub keep_alive_id: i64,
1179}
1180impl crate::packet::Packet for KeepAlive {
1181 const ID: i32 = id::KEEP_ALIVE;
1182 const NAME: &'static str = "keep_alive";
1183 const STATE: State = State::Play;
1184 const DIRECTION: Direction = Direction::Serverbound;
1185}
1186impl Decode for KeepAlive {
1187 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1188 Ok({
1189 let v1428 = r.read_i64()?;
1190 KeepAlive {
1191 keep_alive_id: v1428,
1192 }
1193 })
1194 }
1195}
1196impl Encode for KeepAlive {
1197 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1198 w.put_i64((*self).keep_alive_id);
1199 Ok(())
1200 }
1201}
1202#[cfg(feature = "testgen")]
1203impl Generate for KeepAlive {
1204 fn generate(g: &mut Gen) -> Self {
1205 {
1206 let v1429 = g.i64();
1207 KeepAlive {
1208 keep_alive_id: v1429,
1209 }
1210 }
1211 }
1212}
1213impl From<KeepAlive> for ServerboundPlayPacket {
1214 fn from(p: KeepAlive) -> Self {
1215 Self::KeepAlive(p)
1216 }
1217}
1218
1219#[derive(Debug, Clone, PartialEq)]
1221pub struct LockDifficulty {
1222 pub locked: bool,
1224}
1225impl crate::packet::Packet for LockDifficulty {
1226 const ID: i32 = id::LOCK_DIFFICULTY;
1227 const NAME: &'static str = "lock_difficulty";
1228 const STATE: State = State::Play;
1229 const DIRECTION: Direction = Direction::Serverbound;
1230}
1231impl Decode for LockDifficulty {
1232 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1233 Ok({
1234 let v1430 = r.read_bool()?;
1235 LockDifficulty { locked: v1430 }
1236 })
1237 }
1238}
1239impl Encode for LockDifficulty {
1240 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1241 w.put_bool((*self).locked);
1242 Ok(())
1243 }
1244}
1245#[cfg(feature = "testgen")]
1246impl Generate for LockDifficulty {
1247 fn generate(g: &mut Gen) -> Self {
1248 {
1249 let v1431 = g.bool();
1250 LockDifficulty { locked: v1431 }
1251 }
1252 }
1253}
1254impl From<LockDifficulty> for ServerboundPlayPacket {
1255 fn from(p: LockDifficulty) -> Self {
1256 Self::LockDifficulty(p)
1257 }
1258}
1259
1260#[derive(Debug, Clone, PartialEq)]
1262pub struct Position {
1263 pub x: f64,
1265 pub y: f64,
1267 pub z: f64,
1269 pub on_ground: bool,
1271}
1272impl crate::packet::Packet for Position {
1273 const ID: i32 = id::POSITION;
1274 const NAME: &'static str = "position";
1275 const STATE: State = State::Play;
1276 const DIRECTION: Direction = Direction::Serverbound;
1277}
1278impl Decode for Position {
1279 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1280 Ok({
1281 let v1432 = r.read_f64()?;
1282 let v1433 = r.read_f64()?;
1283 let v1434 = r.read_f64()?;
1284 let v1435 = r.read_bool()?;
1285 Position {
1286 x: v1432,
1287 y: v1433,
1288 z: v1434,
1289 on_ground: v1435,
1290 }
1291 })
1292 }
1293}
1294impl Encode for Position {
1295 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1296 w.put_f64((*self).x);
1297 w.put_f64((*self).y);
1298 w.put_f64((*self).z);
1299 w.put_bool((*self).on_ground);
1300 Ok(())
1301 }
1302}
1303#[cfg(feature = "testgen")]
1304impl Generate for Position {
1305 fn generate(g: &mut Gen) -> Self {
1306 {
1307 let v1436 = g.f64();
1308 let v1437 = g.f64();
1309 let v1438 = g.f64();
1310 let v1439 = g.bool();
1311 Position {
1312 x: v1436,
1313 y: v1437,
1314 z: v1438,
1315 on_ground: v1439,
1316 }
1317 }
1318 }
1319}
1320impl From<Position> for ServerboundPlayPacket {
1321 fn from(p: Position) -> Self {
1322 Self::Position(p)
1323 }
1324}
1325
1326#[derive(Debug, Clone, PartialEq)]
1328pub struct PositionLook {
1329 pub x: f64,
1331 pub y: f64,
1333 pub z: f64,
1335 pub yaw: f32,
1337 pub pitch: f32,
1339 pub on_ground: bool,
1341}
1342impl crate::packet::Packet for PositionLook {
1343 const ID: i32 = id::POSITION_LOOK;
1344 const NAME: &'static str = "position_look";
1345 const STATE: State = State::Play;
1346 const DIRECTION: Direction = Direction::Serverbound;
1347}
1348impl Decode for PositionLook {
1349 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1350 Ok({
1351 let v1440 = r.read_f64()?;
1352 let v1441 = r.read_f64()?;
1353 let v1442 = r.read_f64()?;
1354 let v1443 = r.read_f32()?;
1355 let v1444 = r.read_f32()?;
1356 let v1445 = r.read_bool()?;
1357 PositionLook {
1358 x: v1440,
1359 y: v1441,
1360 z: v1442,
1361 yaw: v1443,
1362 pitch: v1444,
1363 on_ground: v1445,
1364 }
1365 })
1366 }
1367}
1368impl Encode for PositionLook {
1369 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1370 w.put_f64((*self).x);
1371 w.put_f64((*self).y);
1372 w.put_f64((*self).z);
1373 w.put_f32((*self).yaw);
1374 w.put_f32((*self).pitch);
1375 w.put_bool((*self).on_ground);
1376 Ok(())
1377 }
1378}
1379#[cfg(feature = "testgen")]
1380impl Generate for PositionLook {
1381 fn generate(g: &mut Gen) -> Self {
1382 {
1383 let v1446 = g.f64();
1384 let v1447 = g.f64();
1385 let v1448 = g.f64();
1386 let v1449 = g.f32();
1387 let v1450 = g.f32();
1388 let v1451 = g.bool();
1389 PositionLook {
1390 x: v1446,
1391 y: v1447,
1392 z: v1448,
1393 yaw: v1449,
1394 pitch: v1450,
1395 on_ground: v1451,
1396 }
1397 }
1398 }
1399}
1400impl From<PositionLook> for ServerboundPlayPacket {
1401 fn from(p: PositionLook) -> Self {
1402 Self::PositionLook(p)
1403 }
1404}
1405
1406#[derive(Debug, Clone, PartialEq)]
1408pub struct Look {
1409 pub yaw: f32,
1411 pub pitch: f32,
1413 pub on_ground: bool,
1415}
1416impl crate::packet::Packet for Look {
1417 const ID: i32 = id::LOOK;
1418 const NAME: &'static str = "look";
1419 const STATE: State = State::Play;
1420 const DIRECTION: Direction = Direction::Serverbound;
1421}
1422impl Decode for Look {
1423 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1424 Ok({
1425 let v1452 = r.read_f32()?;
1426 let v1453 = r.read_f32()?;
1427 let v1454 = r.read_bool()?;
1428 Look {
1429 yaw: v1452,
1430 pitch: v1453,
1431 on_ground: v1454,
1432 }
1433 })
1434 }
1435}
1436impl Encode for Look {
1437 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1438 w.put_f32((*self).yaw);
1439 w.put_f32((*self).pitch);
1440 w.put_bool((*self).on_ground);
1441 Ok(())
1442 }
1443}
1444#[cfg(feature = "testgen")]
1445impl Generate for Look {
1446 fn generate(g: &mut Gen) -> Self {
1447 {
1448 let v1455 = g.f32();
1449 let v1456 = g.f32();
1450 let v1457 = g.bool();
1451 Look {
1452 yaw: v1455,
1453 pitch: v1456,
1454 on_ground: v1457,
1455 }
1456 }
1457 }
1458}
1459impl From<Look> for ServerboundPlayPacket {
1460 fn from(p: Look) -> Self {
1461 Self::Look(p)
1462 }
1463}
1464
1465#[derive(Debug, Clone, PartialEq)]
1467pub struct Flying {
1468 pub on_ground: bool,
1470}
1471impl crate::packet::Packet for Flying {
1472 const ID: i32 = id::FLYING;
1473 const NAME: &'static str = "flying";
1474 const STATE: State = State::Play;
1475 const DIRECTION: Direction = Direction::Serverbound;
1476}
1477impl Decode for Flying {
1478 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1479 Ok({
1480 let v1458 = r.read_bool()?;
1481 Flying { on_ground: v1458 }
1482 })
1483 }
1484}
1485impl Encode for Flying {
1486 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1487 w.put_bool((*self).on_ground);
1488 Ok(())
1489 }
1490}
1491#[cfg(feature = "testgen")]
1492impl Generate for Flying {
1493 fn generate(g: &mut Gen) -> Self {
1494 {
1495 let v1459 = g.bool();
1496 Flying { on_ground: v1459 }
1497 }
1498 }
1499}
1500impl From<Flying> for ServerboundPlayPacket {
1501 fn from(p: Flying) -> Self {
1502 Self::Flying(p)
1503 }
1504}
1505
1506#[derive(Debug, Clone, PartialEq)]
1508pub struct VehicleMove {
1509 pub x: f64,
1511 pub y: f64,
1513 pub z: f64,
1515 pub yaw: f32,
1517 pub pitch: f32,
1519}
1520impl crate::packet::Packet for VehicleMove {
1521 const ID: i32 = id::VEHICLE_MOVE;
1522 const NAME: &'static str = "vehicle_move";
1523 const STATE: State = State::Play;
1524 const DIRECTION: Direction = Direction::Serverbound;
1525}
1526impl Decode for VehicleMove {
1527 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1528 Ok({
1529 let v1460 = r.read_f64()?;
1530 let v1461 = r.read_f64()?;
1531 let v1462 = r.read_f64()?;
1532 let v1463 = r.read_f32()?;
1533 let v1464 = r.read_f32()?;
1534 VehicleMove {
1535 x: v1460,
1536 y: v1461,
1537 z: v1462,
1538 yaw: v1463,
1539 pitch: v1464,
1540 }
1541 })
1542 }
1543}
1544impl Encode for VehicleMove {
1545 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1546 w.put_f64((*self).x);
1547 w.put_f64((*self).y);
1548 w.put_f64((*self).z);
1549 w.put_f32((*self).yaw);
1550 w.put_f32((*self).pitch);
1551 Ok(())
1552 }
1553}
1554#[cfg(feature = "testgen")]
1555impl Generate for VehicleMove {
1556 fn generate(g: &mut Gen) -> Self {
1557 {
1558 let v1465 = g.f64();
1559 let v1466 = g.f64();
1560 let v1467 = g.f64();
1561 let v1468 = g.f32();
1562 let v1469 = g.f32();
1563 VehicleMove {
1564 x: v1465,
1565 y: v1466,
1566 z: v1467,
1567 yaw: v1468,
1568 pitch: v1469,
1569 }
1570 }
1571 }
1572}
1573impl From<VehicleMove> for ServerboundPlayPacket {
1574 fn from(p: VehicleMove) -> Self {
1575 Self::VehicleMove(p)
1576 }
1577}
1578
1579#[derive(Debug, Clone, PartialEq)]
1581pub struct SteerBoat {
1582 pub left_paddle: bool,
1584 pub right_paddle: bool,
1586}
1587impl crate::packet::Packet for SteerBoat {
1588 const ID: i32 = id::STEER_BOAT;
1589 const NAME: &'static str = "steer_boat";
1590 const STATE: State = State::Play;
1591 const DIRECTION: Direction = Direction::Serverbound;
1592}
1593impl Decode for SteerBoat {
1594 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1595 Ok({
1596 let v1470 = r.read_bool()?;
1597 let v1471 = r.read_bool()?;
1598 SteerBoat {
1599 left_paddle: v1470,
1600 right_paddle: v1471,
1601 }
1602 })
1603 }
1604}
1605impl Encode for SteerBoat {
1606 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1607 w.put_bool((*self).left_paddle);
1608 w.put_bool((*self).right_paddle);
1609 Ok(())
1610 }
1611}
1612#[cfg(feature = "testgen")]
1613impl Generate for SteerBoat {
1614 fn generate(g: &mut Gen) -> Self {
1615 {
1616 let v1472 = g.bool();
1617 let v1473 = g.bool();
1618 SteerBoat {
1619 left_paddle: v1472,
1620 right_paddle: v1473,
1621 }
1622 }
1623 }
1624}
1625impl From<SteerBoat> for ServerboundPlayPacket {
1626 fn from(p: SteerBoat) -> Self {
1627 Self::SteerBoat(p)
1628 }
1629}
1630
1631#[derive(Debug, Clone, PartialEq)]
1633pub struct PickItem {
1634 pub slot: i32,
1636}
1637impl crate::packet::Packet for PickItem {
1638 const ID: i32 = id::PICK_ITEM;
1639 const NAME: &'static str = "pick_item";
1640 const STATE: State = State::Play;
1641 const DIRECTION: Direction = Direction::Serverbound;
1642}
1643impl Decode for PickItem {
1644 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1645 Ok({
1646 let v1474 = r.read_varint()?;
1647 PickItem { slot: v1474 }
1648 })
1649 }
1650}
1651impl Encode for PickItem {
1652 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1653 w.put_varint((*self).slot);
1654 Ok(())
1655 }
1656}
1657#[cfg(feature = "testgen")]
1658impl Generate for PickItem {
1659 fn generate(g: &mut Gen) -> Self {
1660 {
1661 let v1475 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1662 PickItem { slot: v1475 }
1663 }
1664 }
1665}
1666impl From<PickItem> for ServerboundPlayPacket {
1667 fn from(p: PickItem) -> Self {
1668 Self::PickItem(p)
1669 }
1670}
1671
1672#[derive(Debug, Clone, PartialEq)]
1674pub struct CraftRecipeRequest {
1675 pub window_id: i8,
1677 pub recipe: ByteString,
1679 pub make_all: bool,
1681}
1682impl crate::packet::Packet for CraftRecipeRequest {
1683 const ID: i32 = id::CRAFT_RECIPE_REQUEST;
1684 const NAME: &'static str = "craft_recipe_request";
1685 const STATE: State = State::Play;
1686 const DIRECTION: Direction = Direction::Serverbound;
1687}
1688impl Decode for CraftRecipeRequest {
1689 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1690 Ok({
1691 let v1476 = r.read_i8()?;
1692 let v1477 = r.read_string()?;
1693 let v1478 = r.read_bool()?;
1694 CraftRecipeRequest {
1695 window_id: v1476,
1696 recipe: v1477,
1697 make_all: v1478,
1698 }
1699 })
1700 }
1701}
1702impl Encode for CraftRecipeRequest {
1703 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1704 w.put_i8((*self).window_id);
1705 w.put_string(&(*self).recipe)?;
1706 w.put_bool((*self).make_all);
1707 Ok(())
1708 }
1709}
1710#[cfg(feature = "testgen")]
1711impl Generate for CraftRecipeRequest {
1712 fn generate(g: &mut Gen) -> Self {
1713 {
1714 let v1479 = (g.int_in(-128, 127, &[]) as i8);
1715 let v1480 = g.string();
1716 let v1481 = g.bool();
1717 CraftRecipeRequest {
1718 window_id: v1479,
1719 recipe: v1480,
1720 make_all: v1481,
1721 }
1722 }
1723 }
1724}
1725impl From<CraftRecipeRequest> for ServerboundPlayPacket {
1726 fn from(p: CraftRecipeRequest) -> Self {
1727 Self::CraftRecipeRequest(p)
1728 }
1729}
1730
1731#[derive(Debug, Clone, PartialEq)]
1733pub struct Abilities {
1734 pub flags: i8,
1736}
1737impl crate::packet::Packet for Abilities {
1738 const ID: i32 = id::ABILITIES;
1739 const NAME: &'static str = "abilities";
1740 const STATE: State = State::Play;
1741 const DIRECTION: Direction = Direction::Serverbound;
1742}
1743impl Decode for Abilities {
1744 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1745 Ok({
1746 let v1482 = r.read_i8()?;
1747 Abilities { flags: v1482 }
1748 })
1749 }
1750}
1751impl Encode for Abilities {
1752 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1753 w.put_i8((*self).flags);
1754 Ok(())
1755 }
1756}
1757#[cfg(feature = "testgen")]
1758impl Generate for Abilities {
1759 fn generate(g: &mut Gen) -> Self {
1760 {
1761 let v1483 = (g.int_in(-128, 127, &[]) as i8);
1762 Abilities { flags: v1483 }
1763 }
1764 }
1765}
1766impl From<Abilities> for ServerboundPlayPacket {
1767 fn from(p: Abilities) -> Self {
1768 Self::Abilities(p)
1769 }
1770}
1771
1772#[derive(Debug, Clone, PartialEq)]
1774pub struct BlockDig {
1775 pub status: i32,
1777 pub location: BlockPos,
1779 pub face: i8,
1781}
1782impl crate::packet::Packet for BlockDig {
1783 const ID: i32 = id::BLOCK_DIG;
1784 const NAME: &'static str = "block_dig";
1785 const STATE: State = State::Play;
1786 const DIRECTION: Direction = Direction::Serverbound;
1787}
1788impl Decode for BlockDig {
1789 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1790 Ok({
1791 let v1484 = r.read_varint()?;
1792 let v1485 = BlockPos::read(r, PositionLayout::Xzy)?;
1793 let v1486 = r.read_i8()?;
1794 BlockDig {
1795 status: v1484,
1796 location: v1485,
1797 face: v1486,
1798 }
1799 })
1800 }
1801}
1802impl Encode for BlockDig {
1803 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1804 w.put_varint((*self).status);
1805 (*self).location.write(w, PositionLayout::Xzy)?;
1806 w.put_i8((*self).face);
1807 Ok(())
1808 }
1809}
1810#[cfg(feature = "testgen")]
1811impl Generate for BlockDig {
1812 fn generate(g: &mut Gen) -> Self {
1813 {
1814 let v1487 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1815 let v1488 = g.position();
1816 let v1489 = (g.int_in(-128, 127, &[]) as i8);
1817 BlockDig {
1818 status: v1487,
1819 location: v1488,
1820 face: v1489,
1821 }
1822 }
1823 }
1824}
1825impl From<BlockDig> for ServerboundPlayPacket {
1826 fn from(p: BlockDig) -> Self {
1827 Self::BlockDig(p)
1828 }
1829}
1830
1831#[derive(Debug, Clone, PartialEq)]
1833pub struct EntityAction {
1834 pub entity_id: i32,
1836 pub action_id: EntityActionActionId,
1838 pub jump_boost: i32,
1840}
1841impl crate::packet::Packet for EntityAction {
1842 const ID: i32 = id::ENTITY_ACTION;
1843 const NAME: &'static str = "entity_action";
1844 const STATE: State = State::Play;
1845 const DIRECTION: Direction = Direction::Serverbound;
1846}
1847impl Decode for EntityAction {
1848 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1849 Ok({
1850 let v1490 = r.read_varint()?;
1851 let v1491 = EntityActionActionId(r.read_varint()?);
1852 let v1492 = r.read_varint()?;
1853 EntityAction {
1854 entity_id: v1490,
1855 action_id: v1491,
1856 jump_boost: v1492,
1857 }
1858 })
1859 }
1860}
1861impl Encode for EntityAction {
1862 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1863 w.put_varint((*self).entity_id);
1864 w.put_varint((*self).action_id.0);
1865 w.put_varint((*self).jump_boost);
1866 Ok(())
1867 }
1868}
1869#[cfg(feature = "testgen")]
1870impl Generate for EntityAction {
1871 fn generate(g: &mut Gen) -> Self {
1872 {
1873 let v1493 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1874 let v1494 =
1875 EntityActionActionId(
1876 g.int_in(-2147483648, 2147483647, &[0, 1, 2, 3, 4, 5, 6, 7, 8]) as i32,
1877 );
1878 let v1495 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1879 EntityAction {
1880 entity_id: v1493,
1881 action_id: v1494,
1882 jump_boost: v1495,
1883 }
1884 }
1885 }
1886}
1887impl From<EntityAction> for ServerboundPlayPacket {
1888 fn from(p: EntityAction) -> Self {
1889 Self::EntityAction(p)
1890 }
1891}
1892
1893#[derive(Debug, Clone, PartialEq)]
1895pub struct SteerVehicle {
1896 pub sideways: f32,
1898 pub forward: f32,
1900 pub jump: u8,
1902}
1903impl crate::packet::Packet for SteerVehicle {
1904 const ID: i32 = id::STEER_VEHICLE;
1905 const NAME: &'static str = "steer_vehicle";
1906 const STATE: State = State::Play;
1907 const DIRECTION: Direction = Direction::Serverbound;
1908}
1909impl Decode for SteerVehicle {
1910 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1911 Ok({
1912 let v1496 = r.read_f32()?;
1913 let v1497 = r.read_f32()?;
1914 let v1498 = r.read_u8()?;
1915 SteerVehicle {
1916 sideways: v1496,
1917 forward: v1497,
1918 jump: v1498,
1919 }
1920 })
1921 }
1922}
1923impl Encode for SteerVehicle {
1924 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1925 w.put_f32((*self).sideways);
1926 w.put_f32((*self).forward);
1927 w.put_u8((*self).jump);
1928 Ok(())
1929 }
1930}
1931#[cfg(feature = "testgen")]
1932impl Generate for SteerVehicle {
1933 fn generate(g: &mut Gen) -> Self {
1934 {
1935 let v1499 = g.f32();
1936 let v1500 = g.f32();
1937 let v1501 = (g.int_in(0, 255, &[]) as u8);
1938 SteerVehicle {
1939 sideways: v1499,
1940 forward: v1500,
1941 jump: v1501,
1942 }
1943 }
1944 }
1945}
1946impl From<SteerVehicle> for ServerboundPlayPacket {
1947 fn from(p: SteerVehicle) -> Self {
1948 Self::SteerVehicle(p)
1949 }
1950}
1951
1952#[derive(Debug, Clone, PartialEq)]
1954pub struct RecipeBook {
1955 pub book_id: i32,
1957 pub book_open: bool,
1959 pub filter_active: bool,
1961}
1962impl crate::packet::Packet for RecipeBook {
1963 const ID: i32 = id::RECIPE_BOOK;
1964 const NAME: &'static str = "recipe_book";
1965 const STATE: State = State::Play;
1966 const DIRECTION: Direction = Direction::Serverbound;
1967}
1968impl Decode for RecipeBook {
1969 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
1970 Ok({
1971 let v1502 = r.read_varint()?;
1972 let v1503 = r.read_bool()?;
1973 let v1504 = r.read_bool()?;
1974 RecipeBook {
1975 book_id: v1502,
1976 book_open: v1503,
1977 filter_active: v1504,
1978 }
1979 })
1980 }
1981}
1982impl Encode for RecipeBook {
1983 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
1984 w.put_varint((*self).book_id);
1985 w.put_bool((*self).book_open);
1986 w.put_bool((*self).filter_active);
1987 Ok(())
1988 }
1989}
1990#[cfg(feature = "testgen")]
1991impl Generate for RecipeBook {
1992 fn generate(g: &mut Gen) -> Self {
1993 {
1994 let v1505 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
1995 let v1506 = g.bool();
1996 let v1507 = g.bool();
1997 RecipeBook {
1998 book_id: v1505,
1999 book_open: v1506,
2000 filter_active: v1507,
2001 }
2002 }
2003 }
2004}
2005impl From<RecipeBook> for ServerboundPlayPacket {
2006 fn from(p: RecipeBook) -> Self {
2007 Self::RecipeBook(p)
2008 }
2009}
2010
2011#[derive(Debug, Clone, PartialEq)]
2013pub struct DisplayedRecipe {
2014 pub recipe_id: ByteString,
2016}
2017impl crate::packet::Packet for DisplayedRecipe {
2018 const ID: i32 = id::DISPLAYED_RECIPE;
2019 const NAME: &'static str = "displayed_recipe";
2020 const STATE: State = State::Play;
2021 const DIRECTION: Direction = Direction::Serverbound;
2022}
2023impl Decode for DisplayedRecipe {
2024 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2025 Ok({
2026 let v1508 = r.read_string()?;
2027 DisplayedRecipe { recipe_id: v1508 }
2028 })
2029 }
2030}
2031impl Encode for DisplayedRecipe {
2032 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2033 w.put_string(&(*self).recipe_id)?;
2034 Ok(())
2035 }
2036}
2037#[cfg(feature = "testgen")]
2038impl Generate for DisplayedRecipe {
2039 fn generate(g: &mut Gen) -> Self {
2040 {
2041 let v1509 = g.string();
2042 DisplayedRecipe { recipe_id: v1509 }
2043 }
2044 }
2045}
2046impl From<DisplayedRecipe> for ServerboundPlayPacket {
2047 fn from(p: DisplayedRecipe) -> Self {
2048 Self::DisplayedRecipe(p)
2049 }
2050}
2051
2052#[derive(Debug, Clone, PartialEq)]
2054pub struct NameItem {
2055 pub name: ByteString,
2057}
2058impl crate::packet::Packet for NameItem {
2059 const ID: i32 = id::NAME_ITEM;
2060 const NAME: &'static str = "name_item";
2061 const STATE: State = State::Play;
2062 const DIRECTION: Direction = Direction::Serverbound;
2063}
2064impl Decode for NameItem {
2065 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2066 Ok({
2067 let v1510 = r.read_string()?;
2068 NameItem { name: v1510 }
2069 })
2070 }
2071}
2072impl Encode for NameItem {
2073 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2074 w.put_string(&(*self).name)?;
2075 Ok(())
2076 }
2077}
2078#[cfg(feature = "testgen")]
2079impl Generate for NameItem {
2080 fn generate(g: &mut Gen) -> Self {
2081 {
2082 let v1511 = g.string();
2083 NameItem { name: v1511 }
2084 }
2085 }
2086}
2087impl From<NameItem> for ServerboundPlayPacket {
2088 fn from(p: NameItem) -> Self {
2089 Self::NameItem(p)
2090 }
2091}
2092
2093#[derive(Debug, Clone, PartialEq)]
2095pub struct ResourcePackReceive {
2096 pub result: i32,
2098}
2099impl crate::packet::Packet for ResourcePackReceive {
2100 const ID: i32 = id::RESOURCE_PACK_RECEIVE;
2101 const NAME: &'static str = "resource_pack_receive";
2102 const STATE: State = State::Play;
2103 const DIRECTION: Direction = Direction::Serverbound;
2104}
2105impl Decode for ResourcePackReceive {
2106 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2107 Ok({
2108 let v1512 = r.read_varint()?;
2109 ResourcePackReceive { result: v1512 }
2110 })
2111 }
2112}
2113impl Encode for ResourcePackReceive {
2114 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2115 w.put_varint((*self).result);
2116 Ok(())
2117 }
2118}
2119#[cfg(feature = "testgen")]
2120impl Generate for ResourcePackReceive {
2121 fn generate(g: &mut Gen) -> Self {
2122 {
2123 let v1513 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2124 ResourcePackReceive { result: v1513 }
2125 }
2126 }
2127}
2128impl From<ResourcePackReceive> for ServerboundPlayPacket {
2129 fn from(p: ResourcePackReceive) -> Self {
2130 Self::ResourcePackReceive(p)
2131 }
2132}
2133
2134#[derive(Debug, Clone, PartialEq)]
2136pub struct AdvancementTab {
2137 pub action: i32,
2139 pub tab_id: Option<ByteString>,
2141}
2142impl crate::packet::Packet for AdvancementTab {
2143 const ID: i32 = id::ADVANCEMENT_TAB;
2144 const NAME: &'static str = "advancement_tab";
2145 const STATE: State = State::Play;
2146 const DIRECTION: Direction = Direction::Serverbound;
2147}
2148impl Decode for AdvancementTab {
2149 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2150 Ok({
2151 let v1514 = r.read_varint()?;
2152 let v1515 = if (v1514 == 0) {
2153 Some(r.read_string()?)
2154 } else {
2155 None
2156 };
2157 AdvancementTab {
2158 action: v1514,
2159 tab_id: v1515,
2160 }
2161 })
2162 }
2163}
2164impl Encode for AdvancementTab {
2165 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2166 w.put_varint((*self).action);
2167 match (&(*self).tab_id, ((*self).action == 0)) {
2168 (Some(v1516), true) => {
2169 w.put_string(&(*v1516))?;
2170 }
2171 (None, false) => {}
2172 _ => {
2173 return Err(EncodeError::SwitchMismatch(
2174 "play.serverbound.advancement_tab.tabId",
2175 ));
2176 }
2177 }
2178 Ok(())
2179 }
2180}
2181#[cfg(feature = "testgen")]
2182impl Generate for AdvancementTab {
2183 fn generate(g: &mut Gen) -> Self {
2184 {
2185 let v1517 = (g.int_in(-2147483648, 2147483647, &[0, 1]) as i32);
2186 let v1518 = if (v1517 == 0) { Some(g.string()) } else { None };
2187 AdvancementTab {
2188 action: v1517,
2189 tab_id: v1518,
2190 }
2191 }
2192 }
2193}
2194impl From<AdvancementTab> for ServerboundPlayPacket {
2195 fn from(p: AdvancementTab) -> Self {
2196 Self::AdvancementTab(p)
2197 }
2198}
2199
2200#[derive(Debug, Clone, PartialEq)]
2202pub struct SelectTrade {
2203 pub slot: i32,
2205}
2206impl crate::packet::Packet for SelectTrade {
2207 const ID: i32 = id::SELECT_TRADE;
2208 const NAME: &'static str = "select_trade";
2209 const STATE: State = State::Play;
2210 const DIRECTION: Direction = Direction::Serverbound;
2211}
2212impl Decode for SelectTrade {
2213 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2214 Ok({
2215 let v1519 = r.read_varint()?;
2216 SelectTrade { slot: v1519 }
2217 })
2218 }
2219}
2220impl Encode for SelectTrade {
2221 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2222 w.put_varint((*self).slot);
2223 Ok(())
2224 }
2225}
2226#[cfg(feature = "testgen")]
2227impl Generate for SelectTrade {
2228 fn generate(g: &mut Gen) -> Self {
2229 {
2230 let v1520 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2231 SelectTrade { slot: v1520 }
2232 }
2233 }
2234}
2235impl From<SelectTrade> for ServerboundPlayPacket {
2236 fn from(p: SelectTrade) -> Self {
2237 Self::SelectTrade(p)
2238 }
2239}
2240
2241#[derive(Debug, Clone, PartialEq)]
2243pub struct SetBeaconEffect {
2244 pub primary_effect: i32,
2246 pub secondary_effect: i32,
2248}
2249impl crate::packet::Packet for SetBeaconEffect {
2250 const ID: i32 = id::SET_BEACON_EFFECT;
2251 const NAME: &'static str = "set_beacon_effect";
2252 const STATE: State = State::Play;
2253 const DIRECTION: Direction = Direction::Serverbound;
2254}
2255impl Decode for SetBeaconEffect {
2256 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2257 Ok({
2258 let v1521 = r.read_varint()?;
2259 let v1522 = r.read_varint()?;
2260 SetBeaconEffect {
2261 primary_effect: v1521,
2262 secondary_effect: v1522,
2263 }
2264 })
2265 }
2266}
2267impl Encode for SetBeaconEffect {
2268 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2269 w.put_varint((*self).primary_effect);
2270 w.put_varint((*self).secondary_effect);
2271 Ok(())
2272 }
2273}
2274#[cfg(feature = "testgen")]
2275impl Generate for SetBeaconEffect {
2276 fn generate(g: &mut Gen) -> Self {
2277 {
2278 let v1523 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2279 let v1524 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2280 SetBeaconEffect {
2281 primary_effect: v1523,
2282 secondary_effect: v1524,
2283 }
2284 }
2285 }
2286}
2287impl From<SetBeaconEffect> for ServerboundPlayPacket {
2288 fn from(p: SetBeaconEffect) -> Self {
2289 Self::SetBeaconEffect(p)
2290 }
2291}
2292
2293#[derive(Debug, Clone, PartialEq)]
2295pub struct HeldItemSlot {
2296 pub slot_id: i16,
2298}
2299impl crate::packet::Packet for HeldItemSlot {
2300 const ID: i32 = id::HELD_ITEM_SLOT;
2301 const NAME: &'static str = "held_item_slot";
2302 const STATE: State = State::Play;
2303 const DIRECTION: Direction = Direction::Serverbound;
2304}
2305impl Decode for HeldItemSlot {
2306 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2307 Ok({
2308 let v1525 = r.read_i16()?;
2309 HeldItemSlot { slot_id: v1525 }
2310 })
2311 }
2312}
2313impl Encode for HeldItemSlot {
2314 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2315 w.put_i16((*self).slot_id);
2316 Ok(())
2317 }
2318}
2319#[cfg(feature = "testgen")]
2320impl Generate for HeldItemSlot {
2321 fn generate(g: &mut Gen) -> Self {
2322 {
2323 let v1526 = (g.int_in(-32768, 32767, &[]) as i16);
2324 HeldItemSlot { slot_id: v1526 }
2325 }
2326 }
2327}
2328impl From<HeldItemSlot> for ServerboundPlayPacket {
2329 fn from(p: HeldItemSlot) -> Self {
2330 Self::HeldItemSlot(p)
2331 }
2332}
2333
2334#[derive(Debug, Clone, PartialEq)]
2336pub struct UpdateCommandBlock {
2337 pub location: BlockPos,
2339 pub command: ByteString,
2341 pub mode: i32,
2343 pub flags: u8,
2345}
2346impl crate::packet::Packet for UpdateCommandBlock {
2347 const ID: i32 = id::UPDATE_COMMAND_BLOCK;
2348 const NAME: &'static str = "update_command_block";
2349 const STATE: State = State::Play;
2350 const DIRECTION: Direction = Direction::Serverbound;
2351}
2352impl Decode for UpdateCommandBlock {
2353 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2354 Ok({
2355 let v1527 = BlockPos::read(r, PositionLayout::Xzy)?;
2356 let v1528 = r.read_string()?;
2357 let v1529 = r.read_varint()?;
2358 let v1530 = r.read_u8()?;
2359 UpdateCommandBlock {
2360 location: v1527,
2361 command: v1528,
2362 mode: v1529,
2363 flags: v1530,
2364 }
2365 })
2366 }
2367}
2368impl Encode for UpdateCommandBlock {
2369 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2370 (*self).location.write(w, PositionLayout::Xzy)?;
2371 w.put_string(&(*self).command)?;
2372 w.put_varint((*self).mode);
2373 w.put_u8((*self).flags);
2374 Ok(())
2375 }
2376}
2377#[cfg(feature = "testgen")]
2378impl Generate for UpdateCommandBlock {
2379 fn generate(g: &mut Gen) -> Self {
2380 {
2381 let v1531 = g.position();
2382 let v1532 = g.string();
2383 let v1533 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2384 let v1534 = (g.int_in(0, 255, &[]) as u8);
2385 UpdateCommandBlock {
2386 location: v1531,
2387 command: v1532,
2388 mode: v1533,
2389 flags: v1534,
2390 }
2391 }
2392 }
2393}
2394impl From<UpdateCommandBlock> for ServerboundPlayPacket {
2395 fn from(p: UpdateCommandBlock) -> Self {
2396 Self::UpdateCommandBlock(p)
2397 }
2398}
2399
2400#[derive(Debug, Clone, PartialEq)]
2402pub struct UpdateCommandBlockMinecart {
2403 pub entity_id: i32,
2405 pub command: ByteString,
2407 pub track_output: bool,
2409}
2410impl crate::packet::Packet for UpdateCommandBlockMinecart {
2411 const ID: i32 = id::UPDATE_COMMAND_BLOCK_MINECART;
2412 const NAME: &'static str = "update_command_block_minecart";
2413 const STATE: State = State::Play;
2414 const DIRECTION: Direction = Direction::Serverbound;
2415}
2416impl Decode for UpdateCommandBlockMinecart {
2417 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2418 Ok({
2419 let v1535 = r.read_varint()?;
2420 let v1536 = r.read_string()?;
2421 let v1537 = r.read_bool()?;
2422 UpdateCommandBlockMinecart {
2423 entity_id: v1535,
2424 command: v1536,
2425 track_output: v1537,
2426 }
2427 })
2428 }
2429}
2430impl Encode for UpdateCommandBlockMinecart {
2431 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2432 w.put_varint((*self).entity_id);
2433 w.put_string(&(*self).command)?;
2434 w.put_bool((*self).track_output);
2435 Ok(())
2436 }
2437}
2438#[cfg(feature = "testgen")]
2439impl Generate for UpdateCommandBlockMinecart {
2440 fn generate(g: &mut Gen) -> Self {
2441 {
2442 let v1538 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2443 let v1539 = g.string();
2444 let v1540 = g.bool();
2445 UpdateCommandBlockMinecart {
2446 entity_id: v1538,
2447 command: v1539,
2448 track_output: v1540,
2449 }
2450 }
2451 }
2452}
2453impl From<UpdateCommandBlockMinecart> for ServerboundPlayPacket {
2454 fn from(p: UpdateCommandBlockMinecart) -> Self {
2455 Self::UpdateCommandBlockMinecart(p)
2456 }
2457}
2458
2459#[derive(Debug, Clone, PartialEq)]
2461pub struct SetCreativeSlot {
2462 pub slot: i16,
2464 pub item: types::Slot,
2466}
2467impl crate::packet::Packet for SetCreativeSlot {
2468 const ID: i32 = id::SET_CREATIVE_SLOT;
2469 const NAME: &'static str = "set_creative_slot";
2470 const STATE: State = State::Play;
2471 const DIRECTION: Direction = Direction::Serverbound;
2472}
2473impl Decode for SetCreativeSlot {
2474 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2475 Ok({
2476 let v1541 = r.read_i16()?;
2477 let v1542 = <types::Slot as Decode>::decode(r)?;
2478 SetCreativeSlot {
2479 slot: v1541,
2480 item: v1542,
2481 }
2482 })
2483 }
2484}
2485impl Encode for SetCreativeSlot {
2486 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2487 w.put_i16((*self).slot);
2488 (*self).item.encode(w)?;
2489 Ok(())
2490 }
2491}
2492#[cfg(feature = "testgen")]
2493impl Generate for SetCreativeSlot {
2494 fn generate(g: &mut Gen) -> Self {
2495 {
2496 let v1543 = (g.int_in(-32768, 32767, &[]) as i16);
2497 let v1544 = <types::Slot as Generate>::generate(g);
2498 SetCreativeSlot {
2499 slot: v1543,
2500 item: v1544,
2501 }
2502 }
2503 }
2504}
2505impl From<SetCreativeSlot> for ServerboundPlayPacket {
2506 fn from(p: SetCreativeSlot) -> Self {
2507 Self::SetCreativeSlot(p)
2508 }
2509}
2510
2511#[derive(Debug, Clone, PartialEq)]
2513pub struct UpdateJigsawBlock {
2514 pub location: BlockPos,
2516 pub name: ByteString,
2518 pub target: ByteString,
2520 pub pool: ByteString,
2522 pub final_state: ByteString,
2524 pub joint_type: ByteString,
2526}
2527impl crate::packet::Packet for UpdateJigsawBlock {
2528 const ID: i32 = id::UPDATE_JIGSAW_BLOCK;
2529 const NAME: &'static str = "update_jigsaw_block";
2530 const STATE: State = State::Play;
2531 const DIRECTION: Direction = Direction::Serverbound;
2532}
2533impl Decode for UpdateJigsawBlock {
2534 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2535 Ok({
2536 let v1545 = BlockPos::read(r, PositionLayout::Xzy)?;
2537 let v1546 = r.read_string()?;
2538 let v1547 = r.read_string()?;
2539 let v1548 = r.read_string()?;
2540 let v1549 = r.read_string()?;
2541 let v1550 = r.read_string()?;
2542 UpdateJigsawBlock {
2543 location: v1545,
2544 name: v1546,
2545 target: v1547,
2546 pool: v1548,
2547 final_state: v1549,
2548 joint_type: v1550,
2549 }
2550 })
2551 }
2552}
2553impl Encode for UpdateJigsawBlock {
2554 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2555 (*self).location.write(w, PositionLayout::Xzy)?;
2556 w.put_string(&(*self).name)?;
2557 w.put_string(&(*self).target)?;
2558 w.put_string(&(*self).pool)?;
2559 w.put_string(&(*self).final_state)?;
2560 w.put_string(&(*self).joint_type)?;
2561 Ok(())
2562 }
2563}
2564#[cfg(feature = "testgen")]
2565impl Generate for UpdateJigsawBlock {
2566 fn generate(g: &mut Gen) -> Self {
2567 {
2568 let v1551 = g.position();
2569 let v1552 = g.string();
2570 let v1553 = g.string();
2571 let v1554 = g.string();
2572 let v1555 = g.string();
2573 let v1556 = g.string();
2574 UpdateJigsawBlock {
2575 location: v1551,
2576 name: v1552,
2577 target: v1553,
2578 pool: v1554,
2579 final_state: v1555,
2580 joint_type: v1556,
2581 }
2582 }
2583 }
2584}
2585impl From<UpdateJigsawBlock> for ServerboundPlayPacket {
2586 fn from(p: UpdateJigsawBlock) -> Self {
2587 Self::UpdateJigsawBlock(p)
2588 }
2589}
2590
2591#[derive(Debug, Clone, PartialEq)]
2593pub struct UpdateStructureBlock {
2594 pub location: BlockPos,
2596 pub action: i32,
2598 pub mode: i32,
2600 pub name: ByteString,
2602 pub offset_x: i8,
2604 pub offset_y: i8,
2606 pub offset_z: i8,
2608 pub size_x: i8,
2610 pub size_y: i8,
2612 pub size_z: i8,
2614 pub mirror: i32,
2616 pub rotation: i32,
2618 pub metadata: ByteString,
2620 pub integrity: f32,
2622 pub seed: i64,
2624 pub flags: u8,
2626}
2627impl crate::packet::Packet for UpdateStructureBlock {
2628 const ID: i32 = id::UPDATE_STRUCTURE_BLOCK;
2629 const NAME: &'static str = "update_structure_block";
2630 const STATE: State = State::Play;
2631 const DIRECTION: Direction = Direction::Serverbound;
2632}
2633impl Decode for UpdateStructureBlock {
2634 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2635 Ok({
2636 let v1557 = BlockPos::read(r, PositionLayout::Xzy)?;
2637 let v1558 = r.read_varint()?;
2638 let v1559 = r.read_varint()?;
2639 let v1560 = r.read_string()?;
2640 let v1561 = r.read_i8()?;
2641 let v1562 = r.read_i8()?;
2642 let v1563 = r.read_i8()?;
2643 let v1564 = r.read_i8()?;
2644 let v1565 = r.read_i8()?;
2645 let v1566 = r.read_i8()?;
2646 let v1567 = r.read_varint()?;
2647 let v1568 = r.read_varint()?;
2648 let v1569 = r.read_string()?;
2649 let v1570 = r.read_f32()?;
2650 let v1571 = r.read_varlong()?;
2651 let v1572 = r.read_u8()?;
2652 UpdateStructureBlock {
2653 location: v1557,
2654 action: v1558,
2655 mode: v1559,
2656 name: v1560,
2657 offset_x: v1561,
2658 offset_y: v1562,
2659 offset_z: v1563,
2660 size_x: v1564,
2661 size_y: v1565,
2662 size_z: v1566,
2663 mirror: v1567,
2664 rotation: v1568,
2665 metadata: v1569,
2666 integrity: v1570,
2667 seed: v1571,
2668 flags: v1572,
2669 }
2670 })
2671 }
2672}
2673impl Encode for UpdateStructureBlock {
2674 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2675 (*self).location.write(w, PositionLayout::Xzy)?;
2676 w.put_varint((*self).action);
2677 w.put_varint((*self).mode);
2678 w.put_string(&(*self).name)?;
2679 w.put_i8((*self).offset_x);
2680 w.put_i8((*self).offset_y);
2681 w.put_i8((*self).offset_z);
2682 w.put_i8((*self).size_x);
2683 w.put_i8((*self).size_y);
2684 w.put_i8((*self).size_z);
2685 w.put_varint((*self).mirror);
2686 w.put_varint((*self).rotation);
2687 w.put_string(&(*self).metadata)?;
2688 w.put_f32((*self).integrity);
2689 w.put_varlong((*self).seed);
2690 w.put_u8((*self).flags);
2691 Ok(())
2692 }
2693}
2694#[cfg(feature = "testgen")]
2695impl Generate for UpdateStructureBlock {
2696 fn generate(g: &mut Gen) -> Self {
2697 {
2698 let v1573 = g.position();
2699 let v1574 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2700 let v1575 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2701 let v1576 = g.string();
2702 let v1577 = (g.int_in(-128, 127, &[]) as i8);
2703 let v1578 = (g.int_in(-128, 127, &[]) as i8);
2704 let v1579 = (g.int_in(-128, 127, &[]) as i8);
2705 let v1580 = (g.int_in(-128, 127, &[]) as i8);
2706 let v1581 = (g.int_in(-128, 127, &[]) as i8);
2707 let v1582 = (g.int_in(-128, 127, &[]) as i8);
2708 let v1583 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2709 let v1584 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2710 let v1585 = g.string();
2711 let v1586 = g.f32();
2712 let v1587 = g.varlong();
2713 let v1588 = (g.int_in(0, 255, &[]) as u8);
2714 UpdateStructureBlock {
2715 location: v1573,
2716 action: v1574,
2717 mode: v1575,
2718 name: v1576,
2719 offset_x: v1577,
2720 offset_y: v1578,
2721 offset_z: v1579,
2722 size_x: v1580,
2723 size_y: v1581,
2724 size_z: v1582,
2725 mirror: v1583,
2726 rotation: v1584,
2727 metadata: v1585,
2728 integrity: v1586,
2729 seed: v1587,
2730 flags: v1588,
2731 }
2732 }
2733 }
2734}
2735impl From<UpdateStructureBlock> for ServerboundPlayPacket {
2736 fn from(p: UpdateStructureBlock) -> Self {
2737 Self::UpdateStructureBlock(p)
2738 }
2739}
2740
2741#[derive(Debug, Clone, PartialEq)]
2743pub struct UpdateSign {
2744 pub location: BlockPos,
2746 pub text1: ByteString,
2748 pub text2: ByteString,
2750 pub text3: ByteString,
2752 pub text4: ByteString,
2754}
2755impl crate::packet::Packet for UpdateSign {
2756 const ID: i32 = id::UPDATE_SIGN;
2757 const NAME: &'static str = "update_sign";
2758 const STATE: State = State::Play;
2759 const DIRECTION: Direction = Direction::Serverbound;
2760}
2761impl Decode for UpdateSign {
2762 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2763 Ok({
2764 let v1589 = BlockPos::read(r, PositionLayout::Xzy)?;
2765 let v1590 = r.read_string()?;
2766 let v1591 = r.read_string()?;
2767 let v1592 = r.read_string()?;
2768 let v1593 = r.read_string()?;
2769 UpdateSign {
2770 location: v1589,
2771 text1: v1590,
2772 text2: v1591,
2773 text3: v1592,
2774 text4: v1593,
2775 }
2776 })
2777 }
2778}
2779impl Encode for UpdateSign {
2780 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2781 (*self).location.write(w, PositionLayout::Xzy)?;
2782 w.put_string(&(*self).text1)?;
2783 w.put_string(&(*self).text2)?;
2784 w.put_string(&(*self).text3)?;
2785 w.put_string(&(*self).text4)?;
2786 Ok(())
2787 }
2788}
2789#[cfg(feature = "testgen")]
2790impl Generate for UpdateSign {
2791 fn generate(g: &mut Gen) -> Self {
2792 {
2793 let v1594 = g.position();
2794 let v1595 = g.string();
2795 let v1596 = g.string();
2796 let v1597 = g.string();
2797 let v1598 = g.string();
2798 UpdateSign {
2799 location: v1594,
2800 text1: v1595,
2801 text2: v1596,
2802 text3: v1597,
2803 text4: v1598,
2804 }
2805 }
2806 }
2807}
2808impl From<UpdateSign> for ServerboundPlayPacket {
2809 fn from(p: UpdateSign) -> Self {
2810 Self::UpdateSign(p)
2811 }
2812}
2813
2814#[derive(Debug, Clone, PartialEq)]
2816pub struct ArmAnimation {
2817 pub hand: i32,
2819}
2820impl crate::packet::Packet for ArmAnimation {
2821 const ID: i32 = id::ARM_ANIMATION;
2822 const NAME: &'static str = "arm_animation";
2823 const STATE: State = State::Play;
2824 const DIRECTION: Direction = Direction::Serverbound;
2825}
2826impl Decode for ArmAnimation {
2827 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2828 Ok({
2829 let v1599 = r.read_varint()?;
2830 ArmAnimation { hand: v1599 }
2831 })
2832 }
2833}
2834impl Encode for ArmAnimation {
2835 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2836 w.put_varint((*self).hand);
2837 Ok(())
2838 }
2839}
2840#[cfg(feature = "testgen")]
2841impl Generate for ArmAnimation {
2842 fn generate(g: &mut Gen) -> Self {
2843 {
2844 let v1600 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2845 ArmAnimation { hand: v1600 }
2846 }
2847 }
2848}
2849impl From<ArmAnimation> for ServerboundPlayPacket {
2850 fn from(p: ArmAnimation) -> Self {
2851 Self::ArmAnimation(p)
2852 }
2853}
2854
2855#[derive(Debug, Clone, PartialEq)]
2857pub struct Spectate {
2858 pub target: Uuid,
2860}
2861impl crate::packet::Packet for Spectate {
2862 const ID: i32 = id::SPECTATE;
2863 const NAME: &'static str = "spectate";
2864 const STATE: State = State::Play;
2865 const DIRECTION: Direction = Direction::Serverbound;
2866}
2867impl Decode for Spectate {
2868 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2869 Ok({
2870 let v1601 = r.read_uuid()?;
2871 Spectate { target: v1601 }
2872 })
2873 }
2874}
2875impl Encode for Spectate {
2876 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2877 w.put_uuid(&(*self).target);
2878 Ok(())
2879 }
2880}
2881#[cfg(feature = "testgen")]
2882impl Generate for Spectate {
2883 fn generate(g: &mut Gen) -> Self {
2884 {
2885 let v1602 = g.uuid();
2886 Spectate { target: v1602 }
2887 }
2888 }
2889}
2890impl From<Spectate> for ServerboundPlayPacket {
2891 fn from(p: Spectate) -> Self {
2892 Self::Spectate(p)
2893 }
2894}
2895
2896#[derive(Debug, Clone, PartialEq)]
2898pub struct BlockPlace {
2899 pub hand: i32,
2901 pub location: BlockPos,
2903 pub direction: i32,
2905 pub cursor_x: f32,
2907 pub cursor_y: f32,
2909 pub cursor_z: f32,
2911 pub inside_block: bool,
2913}
2914impl crate::packet::Packet for BlockPlace {
2915 const ID: i32 = id::BLOCK_PLACE;
2916 const NAME: &'static str = "block_place";
2917 const STATE: State = State::Play;
2918 const DIRECTION: Direction = Direction::Serverbound;
2919}
2920impl Decode for BlockPlace {
2921 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2922 Ok({
2923 let v1603 = r.read_varint()?;
2924 let v1604 = BlockPos::read(r, PositionLayout::Xzy)?;
2925 let v1605 = r.read_varint()?;
2926 let v1606 = r.read_f32()?;
2927 let v1607 = r.read_f32()?;
2928 let v1608 = r.read_f32()?;
2929 let v1609 = r.read_bool()?;
2930 BlockPlace {
2931 hand: v1603,
2932 location: v1604,
2933 direction: v1605,
2934 cursor_x: v1606,
2935 cursor_y: v1607,
2936 cursor_z: v1608,
2937 inside_block: v1609,
2938 }
2939 })
2940 }
2941}
2942impl Encode for BlockPlace {
2943 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
2944 w.put_varint((*self).hand);
2945 (*self).location.write(w, PositionLayout::Xzy)?;
2946 w.put_varint((*self).direction);
2947 w.put_f32((*self).cursor_x);
2948 w.put_f32((*self).cursor_y);
2949 w.put_f32((*self).cursor_z);
2950 w.put_bool((*self).inside_block);
2951 Ok(())
2952 }
2953}
2954#[cfg(feature = "testgen")]
2955impl Generate for BlockPlace {
2956 fn generate(g: &mut Gen) -> Self {
2957 {
2958 let v1610 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2959 let v1611 = g.position();
2960 let v1612 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
2961 let v1613 = g.f32();
2962 let v1614 = g.f32();
2963 let v1615 = g.f32();
2964 let v1616 = g.bool();
2965 BlockPlace {
2966 hand: v1610,
2967 location: v1611,
2968 direction: v1612,
2969 cursor_x: v1613,
2970 cursor_y: v1614,
2971 cursor_z: v1615,
2972 inside_block: v1616,
2973 }
2974 }
2975 }
2976}
2977impl From<BlockPlace> for ServerboundPlayPacket {
2978 fn from(p: BlockPlace) -> Self {
2979 Self::BlockPlace(p)
2980 }
2981}
2982
2983#[derive(Debug, Clone, PartialEq)]
2985pub struct UseItem {
2986 pub hand: i32,
2988}
2989impl crate::packet::Packet for UseItem {
2990 const ID: i32 = id::USE_ITEM;
2991 const NAME: &'static str = "use_item";
2992 const STATE: State = State::Play;
2993 const DIRECTION: Direction = Direction::Serverbound;
2994}
2995impl Decode for UseItem {
2996 fn decode(r: &mut Reader<'_>) -> DecodeResult<Self> {
2997 Ok({
2998 let v1617 = r.read_varint()?;
2999 UseItem { hand: v1617 }
3000 })
3001 }
3002}
3003impl Encode for UseItem {
3004 fn encode(&self, w: &mut BytesMut) -> EncodeResult {
3005 w.put_varint((*self).hand);
3006 Ok(())
3007 }
3008}
3009#[cfg(feature = "testgen")]
3010impl Generate for UseItem {
3011 fn generate(g: &mut Gen) -> Self {
3012 {
3013 let v1618 = (g.int_in(-2147483648, 2147483647, &[]) as i32);
3014 UseItem { hand: v1618 }
3015 }
3016 }
3017}
3018impl From<UseItem> for ServerboundPlayPacket {
3019 fn from(p: UseItem) -> Self {
3020 Self::UseItem(p)
3021 }
3022}
3023
3024#[derive(Debug, Clone, PartialEq)]
3026pub enum ServerboundPlayPacket {
3027 TeleportConfirm(TeleportConfirm),
3029 QueryBlockNbt(QueryBlockNbt),
3031 SetDifficulty(SetDifficulty),
3033 Chat(Chat),
3035 ClientCommand(ClientCommand),
3037 Settings(Settings),
3039 TabComplete(TabComplete),
3041 Transaction(Transaction),
3043 EnchantItem(EnchantItem),
3045 WindowClick(WindowClick),
3047 CloseWindow(CloseWindow),
3049 CustomPayload(CustomPayload),
3051 EditBook(EditBook),
3053 QueryEntityNbt(QueryEntityNbt),
3055 UseEntity(UseEntity),
3057 GenerateStructure(GenerateStructure),
3059 KeepAlive(KeepAlive),
3061 LockDifficulty(LockDifficulty),
3063 Position(Position),
3065 PositionLook(PositionLook),
3067 Look(Look),
3069 Flying(Flying),
3071 VehicleMove(VehicleMove),
3073 SteerBoat(SteerBoat),
3075 PickItem(PickItem),
3077 CraftRecipeRequest(CraftRecipeRequest),
3079 Abilities(Abilities),
3081 BlockDig(BlockDig),
3083 EntityAction(EntityAction),
3085 SteerVehicle(SteerVehicle),
3087 RecipeBook(RecipeBook),
3089 DisplayedRecipe(DisplayedRecipe),
3091 NameItem(NameItem),
3093 ResourcePackReceive(ResourcePackReceive),
3095 AdvancementTab(AdvancementTab),
3097 SelectTrade(SelectTrade),
3099 SetBeaconEffect(SetBeaconEffect),
3101 HeldItemSlot(HeldItemSlot),
3103 UpdateCommandBlock(UpdateCommandBlock),
3105 UpdateCommandBlockMinecart(UpdateCommandBlockMinecart),
3107 SetCreativeSlot(SetCreativeSlot),
3109 UpdateJigsawBlock(UpdateJigsawBlock),
3111 UpdateStructureBlock(UpdateStructureBlock),
3113 UpdateSign(UpdateSign),
3115 ArmAnimation(ArmAnimation),
3117 Spectate(Spectate),
3119 BlockPlace(BlockPlace),
3121 UseItem(UseItem),
3123}
3124
3125impl PacketSet for ServerboundPlayPacket {
3126 const STATE: State = State::Play;
3127 const DIRECTION: Direction = Direction::Serverbound;
3128 fn decode_raw(raw: &RawPacket) -> DecodeResult<Self> {
3129 match raw.id {
3130 id::TELEPORT_CONFIRM => decode_exact(&raw.body).map(Self::TeleportConfirm),
3131 id::QUERY_BLOCK_NBT => decode_exact(&raw.body).map(Self::QueryBlockNbt),
3132 id::SET_DIFFICULTY => decode_exact(&raw.body).map(Self::SetDifficulty),
3133 id::CHAT => decode_exact(&raw.body).map(Self::Chat),
3134 id::CLIENT_COMMAND => decode_exact(&raw.body).map(Self::ClientCommand),
3135 id::SETTINGS => decode_exact(&raw.body).map(Self::Settings),
3136 id::TAB_COMPLETE => decode_exact(&raw.body).map(Self::TabComplete),
3137 id::TRANSACTION => decode_exact(&raw.body).map(Self::Transaction),
3138 id::ENCHANT_ITEM => decode_exact(&raw.body).map(Self::EnchantItem),
3139 id::WINDOW_CLICK => decode_exact(&raw.body).map(Self::WindowClick),
3140 id::CLOSE_WINDOW => decode_exact(&raw.body).map(Self::CloseWindow),
3141 id::CUSTOM_PAYLOAD => decode_exact(&raw.body).map(Self::CustomPayload),
3142 id::EDIT_BOOK => decode_exact(&raw.body).map(Self::EditBook),
3143 id::QUERY_ENTITY_NBT => decode_exact(&raw.body).map(Self::QueryEntityNbt),
3144 id::USE_ENTITY => decode_exact(&raw.body).map(Self::UseEntity),
3145 id::GENERATE_STRUCTURE => decode_exact(&raw.body).map(Self::GenerateStructure),
3146 id::KEEP_ALIVE => decode_exact(&raw.body).map(Self::KeepAlive),
3147 id::LOCK_DIFFICULTY => decode_exact(&raw.body).map(Self::LockDifficulty),
3148 id::POSITION => decode_exact(&raw.body).map(Self::Position),
3149 id::POSITION_LOOK => decode_exact(&raw.body).map(Self::PositionLook),
3150 id::LOOK => decode_exact(&raw.body).map(Self::Look),
3151 id::FLYING => decode_exact(&raw.body).map(Self::Flying),
3152 id::VEHICLE_MOVE => decode_exact(&raw.body).map(Self::VehicleMove),
3153 id::STEER_BOAT => decode_exact(&raw.body).map(Self::SteerBoat),
3154 id::PICK_ITEM => decode_exact(&raw.body).map(Self::PickItem),
3155 id::CRAFT_RECIPE_REQUEST => decode_exact(&raw.body).map(Self::CraftRecipeRequest),
3156 id::ABILITIES => decode_exact(&raw.body).map(Self::Abilities),
3157 id::BLOCK_DIG => decode_exact(&raw.body).map(Self::BlockDig),
3158 id::ENTITY_ACTION => decode_exact(&raw.body).map(Self::EntityAction),
3159 id::STEER_VEHICLE => decode_exact(&raw.body).map(Self::SteerVehicle),
3160 id::RECIPE_BOOK => decode_exact(&raw.body).map(Self::RecipeBook),
3161 id::DISPLAYED_RECIPE => decode_exact(&raw.body).map(Self::DisplayedRecipe),
3162 id::NAME_ITEM => decode_exact(&raw.body).map(Self::NameItem),
3163 id::RESOURCE_PACK_RECEIVE => decode_exact(&raw.body).map(Self::ResourcePackReceive),
3164 id::ADVANCEMENT_TAB => decode_exact(&raw.body).map(Self::AdvancementTab),
3165 id::SELECT_TRADE => decode_exact(&raw.body).map(Self::SelectTrade),
3166 id::SET_BEACON_EFFECT => decode_exact(&raw.body).map(Self::SetBeaconEffect),
3167 id::HELD_ITEM_SLOT => decode_exact(&raw.body).map(Self::HeldItemSlot),
3168 id::UPDATE_COMMAND_BLOCK => decode_exact(&raw.body).map(Self::UpdateCommandBlock),
3169 id::UPDATE_COMMAND_BLOCK_MINECART => {
3170 decode_exact(&raw.body).map(Self::UpdateCommandBlockMinecart)
3171 }
3172 id::SET_CREATIVE_SLOT => decode_exact(&raw.body).map(Self::SetCreativeSlot),
3173 id::UPDATE_JIGSAW_BLOCK => decode_exact(&raw.body).map(Self::UpdateJigsawBlock),
3174 id::UPDATE_STRUCTURE_BLOCK => decode_exact(&raw.body).map(Self::UpdateStructureBlock),
3175 id::UPDATE_SIGN => decode_exact(&raw.body).map(Self::UpdateSign),
3176 id::ARM_ANIMATION => decode_exact(&raw.body).map(Self::ArmAnimation),
3177 id::SPECTATE => decode_exact(&raw.body).map(Self::Spectate),
3178 id::BLOCK_PLACE => decode_exact(&raw.body).map(Self::BlockPlace),
3179 id::USE_ITEM => decode_exact(&raw.body).map(Self::UseItem),
3180 other => Err(DecodeError::UnknownPacketId(other)),
3181 }
3182 }
3183 fn id(&self) -> i32 {
3184 match *self {
3185 Self::TeleportConfirm(_) => id::TELEPORT_CONFIRM,
3186 Self::QueryBlockNbt(_) => id::QUERY_BLOCK_NBT,
3187 Self::SetDifficulty(_) => id::SET_DIFFICULTY,
3188 Self::Chat(_) => id::CHAT,
3189 Self::ClientCommand(_) => id::CLIENT_COMMAND,
3190 Self::Settings(_) => id::SETTINGS,
3191 Self::TabComplete(_) => id::TAB_COMPLETE,
3192 Self::Transaction(_) => id::TRANSACTION,
3193 Self::EnchantItem(_) => id::ENCHANT_ITEM,
3194 Self::WindowClick(_) => id::WINDOW_CLICK,
3195 Self::CloseWindow(_) => id::CLOSE_WINDOW,
3196 Self::CustomPayload(_) => id::CUSTOM_PAYLOAD,
3197 Self::EditBook(_) => id::EDIT_BOOK,
3198 Self::QueryEntityNbt(_) => id::QUERY_ENTITY_NBT,
3199 Self::UseEntity(_) => id::USE_ENTITY,
3200 Self::GenerateStructure(_) => id::GENERATE_STRUCTURE,
3201 Self::KeepAlive(_) => id::KEEP_ALIVE,
3202 Self::LockDifficulty(_) => id::LOCK_DIFFICULTY,
3203 Self::Position(_) => id::POSITION,
3204 Self::PositionLook(_) => id::POSITION_LOOK,
3205 Self::Look(_) => id::LOOK,
3206 Self::Flying(_) => id::FLYING,
3207 Self::VehicleMove(_) => id::VEHICLE_MOVE,
3208 Self::SteerBoat(_) => id::STEER_BOAT,
3209 Self::PickItem(_) => id::PICK_ITEM,
3210 Self::CraftRecipeRequest(_) => id::CRAFT_RECIPE_REQUEST,
3211 Self::Abilities(_) => id::ABILITIES,
3212 Self::BlockDig(_) => id::BLOCK_DIG,
3213 Self::EntityAction(_) => id::ENTITY_ACTION,
3214 Self::SteerVehicle(_) => id::STEER_VEHICLE,
3215 Self::RecipeBook(_) => id::RECIPE_BOOK,
3216 Self::DisplayedRecipe(_) => id::DISPLAYED_RECIPE,
3217 Self::NameItem(_) => id::NAME_ITEM,
3218 Self::ResourcePackReceive(_) => id::RESOURCE_PACK_RECEIVE,
3219 Self::AdvancementTab(_) => id::ADVANCEMENT_TAB,
3220 Self::SelectTrade(_) => id::SELECT_TRADE,
3221 Self::SetBeaconEffect(_) => id::SET_BEACON_EFFECT,
3222 Self::HeldItemSlot(_) => id::HELD_ITEM_SLOT,
3223 Self::UpdateCommandBlock(_) => id::UPDATE_COMMAND_BLOCK,
3224 Self::UpdateCommandBlockMinecart(_) => id::UPDATE_COMMAND_BLOCK_MINECART,
3225 Self::SetCreativeSlot(_) => id::SET_CREATIVE_SLOT,
3226 Self::UpdateJigsawBlock(_) => id::UPDATE_JIGSAW_BLOCK,
3227 Self::UpdateStructureBlock(_) => id::UPDATE_STRUCTURE_BLOCK,
3228 Self::UpdateSign(_) => id::UPDATE_SIGN,
3229 Self::ArmAnimation(_) => id::ARM_ANIMATION,
3230 Self::Spectate(_) => id::SPECTATE,
3231 Self::BlockPlace(_) => id::BLOCK_PLACE,
3232 Self::UseItem(_) => id::USE_ITEM,
3233 }
3234 }
3235 fn name(&self) -> &'static str {
3236 match *self {
3237 Self::TeleportConfirm(_) => "teleport_confirm",
3238 Self::QueryBlockNbt(_) => "query_block_nbt",
3239 Self::SetDifficulty(_) => "set_difficulty",
3240 Self::Chat(_) => "chat",
3241 Self::ClientCommand(_) => "client_command",
3242 Self::Settings(_) => "settings",
3243 Self::TabComplete(_) => "tab_complete",
3244 Self::Transaction(_) => "transaction",
3245 Self::EnchantItem(_) => "enchant_item",
3246 Self::WindowClick(_) => "window_click",
3247 Self::CloseWindow(_) => "close_window",
3248 Self::CustomPayload(_) => "custom_payload",
3249 Self::EditBook(_) => "edit_book",
3250 Self::QueryEntityNbt(_) => "query_entity_nbt",
3251 Self::UseEntity(_) => "use_entity",
3252 Self::GenerateStructure(_) => "generate_structure",
3253 Self::KeepAlive(_) => "keep_alive",
3254 Self::LockDifficulty(_) => "lock_difficulty",
3255 Self::Position(_) => "position",
3256 Self::PositionLook(_) => "position_look",
3257 Self::Look(_) => "look",
3258 Self::Flying(_) => "flying",
3259 Self::VehicleMove(_) => "vehicle_move",
3260 Self::SteerBoat(_) => "steer_boat",
3261 Self::PickItem(_) => "pick_item",
3262 Self::CraftRecipeRequest(_) => "craft_recipe_request",
3263 Self::Abilities(_) => "abilities",
3264 Self::BlockDig(_) => "block_dig",
3265 Self::EntityAction(_) => "entity_action",
3266 Self::SteerVehicle(_) => "steer_vehicle",
3267 Self::RecipeBook(_) => "recipe_book",
3268 Self::DisplayedRecipe(_) => "displayed_recipe",
3269 Self::NameItem(_) => "name_item",
3270 Self::ResourcePackReceive(_) => "resource_pack_receive",
3271 Self::AdvancementTab(_) => "advancement_tab",
3272 Self::SelectTrade(_) => "select_trade",
3273 Self::SetBeaconEffect(_) => "set_beacon_effect",
3274 Self::HeldItemSlot(_) => "held_item_slot",
3275 Self::UpdateCommandBlock(_) => "update_command_block",
3276 Self::UpdateCommandBlockMinecart(_) => "update_command_block_minecart",
3277 Self::SetCreativeSlot(_) => "set_creative_slot",
3278 Self::UpdateJigsawBlock(_) => "update_jigsaw_block",
3279 Self::UpdateStructureBlock(_) => "update_structure_block",
3280 Self::UpdateSign(_) => "update_sign",
3281 Self::ArmAnimation(_) => "arm_animation",
3282 Self::Spectate(_) => "spectate",
3283 Self::BlockPlace(_) => "block_place",
3284 Self::UseItem(_) => "use_item",
3285 }
3286 }
3287 fn encode_body(&self, w: &mut BytesMut) -> EncodeResult {
3288 match *self {
3289 Self::TeleportConfirm(ref p) => p.encode(w),
3290 Self::QueryBlockNbt(ref p) => p.encode(w),
3291 Self::SetDifficulty(ref p) => p.encode(w),
3292 Self::Chat(ref p) => p.encode(w),
3293 Self::ClientCommand(ref p) => p.encode(w),
3294 Self::Settings(ref p) => p.encode(w),
3295 Self::TabComplete(ref p) => p.encode(w),
3296 Self::Transaction(ref p) => p.encode(w),
3297 Self::EnchantItem(ref p) => p.encode(w),
3298 Self::WindowClick(ref p) => p.encode(w),
3299 Self::CloseWindow(ref p) => p.encode(w),
3300 Self::CustomPayload(ref p) => p.encode(w),
3301 Self::EditBook(ref p) => p.encode(w),
3302 Self::QueryEntityNbt(ref p) => p.encode(w),
3303 Self::UseEntity(ref p) => p.encode(w),
3304 Self::GenerateStructure(ref p) => p.encode(w),
3305 Self::KeepAlive(ref p) => p.encode(w),
3306 Self::LockDifficulty(ref p) => p.encode(w),
3307 Self::Position(ref p) => p.encode(w),
3308 Self::PositionLook(ref p) => p.encode(w),
3309 Self::Look(ref p) => p.encode(w),
3310 Self::Flying(ref p) => p.encode(w),
3311 Self::VehicleMove(ref p) => p.encode(w),
3312 Self::SteerBoat(ref p) => p.encode(w),
3313 Self::PickItem(ref p) => p.encode(w),
3314 Self::CraftRecipeRequest(ref p) => p.encode(w),
3315 Self::Abilities(ref p) => p.encode(w),
3316 Self::BlockDig(ref p) => p.encode(w),
3317 Self::EntityAction(ref p) => p.encode(w),
3318 Self::SteerVehicle(ref p) => p.encode(w),
3319 Self::RecipeBook(ref p) => p.encode(w),
3320 Self::DisplayedRecipe(ref p) => p.encode(w),
3321 Self::NameItem(ref p) => p.encode(w),
3322 Self::ResourcePackReceive(ref p) => p.encode(w),
3323 Self::AdvancementTab(ref p) => p.encode(w),
3324 Self::SelectTrade(ref p) => p.encode(w),
3325 Self::SetBeaconEffect(ref p) => p.encode(w),
3326 Self::HeldItemSlot(ref p) => p.encode(w),
3327 Self::UpdateCommandBlock(ref p) => p.encode(w),
3328 Self::UpdateCommandBlockMinecart(ref p) => p.encode(w),
3329 Self::SetCreativeSlot(ref p) => p.encode(w),
3330 Self::UpdateJigsawBlock(ref p) => p.encode(w),
3331 Self::UpdateStructureBlock(ref p) => p.encode(w),
3332 Self::UpdateSign(ref p) => p.encode(w),
3333 Self::ArmAnimation(ref p) => p.encode(w),
3334 Self::Spectate(ref p) => p.encode(w),
3335 Self::BlockPlace(ref p) => p.encode(w),
3336 Self::UseItem(ref p) => p.encode(w),
3337 }
3338 }
3339 fn name_of(id: i32) -> Option<&'static str> {
3340 match id {
3341 id::TELEPORT_CONFIRM => Some("teleport_confirm"),
3342 id::QUERY_BLOCK_NBT => Some("query_block_nbt"),
3343 id::SET_DIFFICULTY => Some("set_difficulty"),
3344 id::CHAT => Some("chat"),
3345 id::CLIENT_COMMAND => Some("client_command"),
3346 id::SETTINGS => Some("settings"),
3347 id::TAB_COMPLETE => Some("tab_complete"),
3348 id::TRANSACTION => Some("transaction"),
3349 id::ENCHANT_ITEM => Some("enchant_item"),
3350 id::WINDOW_CLICK => Some("window_click"),
3351 id::CLOSE_WINDOW => Some("close_window"),
3352 id::CUSTOM_PAYLOAD => Some("custom_payload"),
3353 id::EDIT_BOOK => Some("edit_book"),
3354 id::QUERY_ENTITY_NBT => Some("query_entity_nbt"),
3355 id::USE_ENTITY => Some("use_entity"),
3356 id::GENERATE_STRUCTURE => Some("generate_structure"),
3357 id::KEEP_ALIVE => Some("keep_alive"),
3358 id::LOCK_DIFFICULTY => Some("lock_difficulty"),
3359 id::POSITION => Some("position"),
3360 id::POSITION_LOOK => Some("position_look"),
3361 id::LOOK => Some("look"),
3362 id::FLYING => Some("flying"),
3363 id::VEHICLE_MOVE => Some("vehicle_move"),
3364 id::STEER_BOAT => Some("steer_boat"),
3365 id::PICK_ITEM => Some("pick_item"),
3366 id::CRAFT_RECIPE_REQUEST => Some("craft_recipe_request"),
3367 id::ABILITIES => Some("abilities"),
3368 id::BLOCK_DIG => Some("block_dig"),
3369 id::ENTITY_ACTION => Some("entity_action"),
3370 id::STEER_VEHICLE => Some("steer_vehicle"),
3371 id::RECIPE_BOOK => Some("recipe_book"),
3372 id::DISPLAYED_RECIPE => Some("displayed_recipe"),
3373 id::NAME_ITEM => Some("name_item"),
3374 id::RESOURCE_PACK_RECEIVE => Some("resource_pack_receive"),
3375 id::ADVANCEMENT_TAB => Some("advancement_tab"),
3376 id::SELECT_TRADE => Some("select_trade"),
3377 id::SET_BEACON_EFFECT => Some("set_beacon_effect"),
3378 id::HELD_ITEM_SLOT => Some("held_item_slot"),
3379 id::UPDATE_COMMAND_BLOCK => Some("update_command_block"),
3380 id::UPDATE_COMMAND_BLOCK_MINECART => Some("update_command_block_minecart"),
3381 id::SET_CREATIVE_SLOT => Some("set_creative_slot"),
3382 id::UPDATE_JIGSAW_BLOCK => Some("update_jigsaw_block"),
3383 id::UPDATE_STRUCTURE_BLOCK => Some("update_structure_block"),
3384 id::UPDATE_SIGN => Some("update_sign"),
3385 id::ARM_ANIMATION => Some("arm_animation"),
3386 id::SPECTATE => Some("spectate"),
3387 id::BLOCK_PLACE => Some("block_place"),
3388 id::USE_ITEM => Some("use_item"),
3389 _ => None,
3390 }
3391 }
3392}
3393
3394impl ServerboundPlayPacket {
3395 pub const IDS: &'static [i32] = &[
3397 id::TELEPORT_CONFIRM,
3398 id::QUERY_BLOCK_NBT,
3399 id::SET_DIFFICULTY,
3400 id::CHAT,
3401 id::CLIENT_COMMAND,
3402 id::SETTINGS,
3403 id::TAB_COMPLETE,
3404 id::TRANSACTION,
3405 id::ENCHANT_ITEM,
3406 id::WINDOW_CLICK,
3407 id::CLOSE_WINDOW,
3408 id::CUSTOM_PAYLOAD,
3409 id::EDIT_BOOK,
3410 id::QUERY_ENTITY_NBT,
3411 id::USE_ENTITY,
3412 id::GENERATE_STRUCTURE,
3413 id::KEEP_ALIVE,
3414 id::LOCK_DIFFICULTY,
3415 id::POSITION,
3416 id::POSITION_LOOK,
3417 id::LOOK,
3418 id::FLYING,
3419 id::VEHICLE_MOVE,
3420 id::STEER_BOAT,
3421 id::PICK_ITEM,
3422 id::CRAFT_RECIPE_REQUEST,
3423 id::ABILITIES,
3424 id::BLOCK_DIG,
3425 id::ENTITY_ACTION,
3426 id::STEER_VEHICLE,
3427 id::RECIPE_BOOK,
3428 id::DISPLAYED_RECIPE,
3429 id::NAME_ITEM,
3430 id::RESOURCE_PACK_RECEIVE,
3431 id::ADVANCEMENT_TAB,
3432 id::SELECT_TRADE,
3433 id::SET_BEACON_EFFECT,
3434 id::HELD_ITEM_SLOT,
3435 id::UPDATE_COMMAND_BLOCK,
3436 id::UPDATE_COMMAND_BLOCK_MINECART,
3437 id::SET_CREATIVE_SLOT,
3438 id::UPDATE_JIGSAW_BLOCK,
3439 id::UPDATE_STRUCTURE_BLOCK,
3440 id::UPDATE_SIGN,
3441 id::ARM_ANIMATION,
3442 id::SPECTATE,
3443 id::BLOCK_PLACE,
3444 id::USE_ITEM,
3445 ];
3446 #[cfg(feature = "testgen")]
3448 pub fn generate_by_id(id: i32, g: &mut Gen) -> Option<Self> {
3449 match id {
3450 id::TELEPORT_CONFIRM => Some(Self::TeleportConfirm(
3451 <TeleportConfirm as Generate>::generate(g),
3452 )),
3453 id::QUERY_BLOCK_NBT => Some(Self::QueryBlockNbt(
3454 <QueryBlockNbt as Generate>::generate(g),
3455 )),
3456 id::SET_DIFFICULTY => Some(Self::SetDifficulty(<SetDifficulty as Generate>::generate(
3457 g,
3458 ))),
3459 id::CHAT => Some(Self::Chat(<Chat as Generate>::generate(g))),
3460 id::CLIENT_COMMAND => Some(Self::ClientCommand(<ClientCommand as Generate>::generate(
3461 g,
3462 ))),
3463 id::SETTINGS => Some(Self::Settings(<Settings as Generate>::generate(g))),
3464 id::TAB_COMPLETE => Some(Self::TabComplete(<TabComplete as Generate>::generate(g))),
3465 id::TRANSACTION => Some(Self::Transaction(<Transaction as Generate>::generate(g))),
3466 id::ENCHANT_ITEM => Some(Self::EnchantItem(<EnchantItem as Generate>::generate(g))),
3467 id::WINDOW_CLICK => Some(Self::WindowClick(<WindowClick as Generate>::generate(g))),
3468 id::CLOSE_WINDOW => Some(Self::CloseWindow(<CloseWindow as Generate>::generate(g))),
3469 id::CUSTOM_PAYLOAD => Some(Self::CustomPayload(<CustomPayload as Generate>::generate(
3470 g,
3471 ))),
3472 id::EDIT_BOOK => Some(Self::EditBook(<EditBook as Generate>::generate(g))),
3473 id::QUERY_ENTITY_NBT => Some(Self::QueryEntityNbt(
3474 <QueryEntityNbt as Generate>::generate(g),
3475 )),
3476 id::USE_ENTITY => Some(Self::UseEntity(<UseEntity as Generate>::generate(g))),
3477 id::GENERATE_STRUCTURE => Some(Self::GenerateStructure(
3478 <GenerateStructure as Generate>::generate(g),
3479 )),
3480 id::KEEP_ALIVE => Some(Self::KeepAlive(<KeepAlive as Generate>::generate(g))),
3481 id::LOCK_DIFFICULTY => Some(Self::LockDifficulty(
3482 <LockDifficulty as Generate>::generate(g),
3483 )),
3484 id::POSITION => Some(Self::Position(<Position as Generate>::generate(g))),
3485 id::POSITION_LOOK => Some(Self::PositionLook(<PositionLook as Generate>::generate(g))),
3486 id::LOOK => Some(Self::Look(<Look as Generate>::generate(g))),
3487 id::FLYING => Some(Self::Flying(<Flying as Generate>::generate(g))),
3488 id::VEHICLE_MOVE => Some(Self::VehicleMove(<VehicleMove as Generate>::generate(g))),
3489 id::STEER_BOAT => Some(Self::SteerBoat(<SteerBoat as Generate>::generate(g))),
3490 id::PICK_ITEM => Some(Self::PickItem(<PickItem as Generate>::generate(g))),
3491 id::CRAFT_RECIPE_REQUEST => Some(Self::CraftRecipeRequest(
3492 <CraftRecipeRequest as Generate>::generate(g),
3493 )),
3494 id::ABILITIES => Some(Self::Abilities(<Abilities as Generate>::generate(g))),
3495 id::BLOCK_DIG => Some(Self::BlockDig(<BlockDig as Generate>::generate(g))),
3496 id::ENTITY_ACTION => Some(Self::EntityAction(<EntityAction as Generate>::generate(g))),
3497 id::STEER_VEHICLE => Some(Self::SteerVehicle(<SteerVehicle as Generate>::generate(g))),
3498 id::RECIPE_BOOK => Some(Self::RecipeBook(<RecipeBook as Generate>::generate(g))),
3499 id::DISPLAYED_RECIPE => Some(Self::DisplayedRecipe(
3500 <DisplayedRecipe as Generate>::generate(g),
3501 )),
3502 id::NAME_ITEM => Some(Self::NameItem(<NameItem as Generate>::generate(g))),
3503 id::RESOURCE_PACK_RECEIVE => Some(Self::ResourcePackReceive(
3504 <ResourcePackReceive as Generate>::generate(g),
3505 )),
3506 id::ADVANCEMENT_TAB => Some(Self::AdvancementTab(
3507 <AdvancementTab as Generate>::generate(g),
3508 )),
3509 id::SELECT_TRADE => Some(Self::SelectTrade(<SelectTrade as Generate>::generate(g))),
3510 id::SET_BEACON_EFFECT => Some(Self::SetBeaconEffect(
3511 <SetBeaconEffect as Generate>::generate(g),
3512 )),
3513 id::HELD_ITEM_SLOT => Some(Self::HeldItemSlot(<HeldItemSlot as Generate>::generate(g))),
3514 id::UPDATE_COMMAND_BLOCK => Some(Self::UpdateCommandBlock(
3515 <UpdateCommandBlock as Generate>::generate(g),
3516 )),
3517 id::UPDATE_COMMAND_BLOCK_MINECART => Some(Self::UpdateCommandBlockMinecart(
3518 <UpdateCommandBlockMinecart as Generate>::generate(g),
3519 )),
3520 id::SET_CREATIVE_SLOT => Some(Self::SetCreativeSlot(
3521 <SetCreativeSlot as Generate>::generate(g),
3522 )),
3523 id::UPDATE_JIGSAW_BLOCK => Some(Self::UpdateJigsawBlock(
3524 <UpdateJigsawBlock as Generate>::generate(g),
3525 )),
3526 id::UPDATE_STRUCTURE_BLOCK => Some(Self::UpdateStructureBlock(
3527 <UpdateStructureBlock as Generate>::generate(g),
3528 )),
3529 id::UPDATE_SIGN => Some(Self::UpdateSign(<UpdateSign as Generate>::generate(g))),
3530 id::ARM_ANIMATION => Some(Self::ArmAnimation(<ArmAnimation as Generate>::generate(g))),
3531 id::SPECTATE => Some(Self::Spectate(<Spectate as Generate>::generate(g))),
3532 id::BLOCK_PLACE => Some(Self::BlockPlace(<BlockPlace as Generate>::generate(g))),
3533 id::USE_ITEM => Some(Self::UseItem(<UseItem as Generate>::generate(g))),
3534 _ => None,
3535 }
3536 }
3537}