1#![allow(
9 unused_imports,
10 unused_variables,
11 unused_mut,
12 unused_parens,
13 unused_braces,
14 clippy::all,
15 clippy::pedantic,
16 non_camel_case_types,
17 non_snake_case
18)]
19use crate::codec::{Decode, DecodeResult, Encode, EncodeResult, McWrite, Reader, decode_exact};
20use crate::error::{DecodeError, EncodeError};
21use crate::nbt::{AnonNbt, RawNbt};
22use crate::packet::{Direction, PacketSet, RawPacket, State};
23#[cfg(feature = "testgen")]
24use crate::testgen::{Gen, Generate};
25use crate::types::{BlockPos, ByteString, Holder, HolderSet, LpVec3, PositionLayout, Uuid};
26use bytes::{BufMut, Bytes, BytesMut};
27
28pub mod id {
30 pub const TELEPORT_CONFIRM: i32 = 0x00;
32 pub const ATTACK: i32 = 0x01;
34 pub const QUERY_BLOCK_NBT: i32 = 0x02;
36 pub const SELECT_BUNDLE_ITEM: i32 = 0x03;
38 pub const SET_DIFFICULTY: i32 = 0x04;
40 pub const CHANGE_GAMEMODE: i32 = 0x05;
42 pub const MESSAGE_ACKNOWLEDGEMENT: i32 = 0x06;
44 pub const CHAT_COMMAND: i32 = 0x07;
46 pub const CHAT_COMMAND_SIGNED: i32 = 0x08;
48 pub const CHAT_MESSAGE: i32 = 0x09;
50 pub const CHAT_SESSION_UPDATE: i32 = 0x0a;
52 pub const CHUNK_BATCH_RECEIVED: i32 = 0x0b;
54 pub const CLIENT_COMMAND: i32 = 0x0c;
56 pub const TICK_END: i32 = 0x0d;
58 pub const SETTINGS: i32 = 0x0e;
60 pub const TAB_COMPLETE: i32 = 0x0f;
62 pub const CONFIGURATION_ACKNOWLEDGED: i32 = 0x10;
64 pub const ENCHANT_ITEM: i32 = 0x11;
66 pub const WINDOW_CLICK: i32 = 0x12;
68 pub const CLOSE_WINDOW: i32 = 0x13;
70 pub const SET_SLOT_STATE: i32 = 0x14;
72 pub const COOKIE_RESPONSE: i32 = 0x15;
74 pub const CUSTOM_PAYLOAD: i32 = 0x16;
76 pub const DEBUG_SUBSCRIPTION_REQUEST: i32 = 0x17;
78 pub const EDIT_BOOK: i32 = 0x18;
80 pub const QUERY_ENTITY_NBT: i32 = 0x19;
82 pub const USE_ENTITY: i32 = 0x1a;
84 pub const GENERATE_STRUCTURE: i32 = 0x1b;
86 pub const KEEP_ALIVE: i32 = 0x1c;
88 pub const LOCK_DIFFICULTY: i32 = 0x1d;
90 pub const POSITION: i32 = 0x1e;
92 pub const POSITION_LOOK: i32 = 0x1f;
94 pub const LOOK: i32 = 0x20;
96 pub const FLYING: i32 = 0x21;
98 pub const VEHICLE_MOVE: i32 = 0x22;
100 pub const STEER_BOAT: i32 = 0x23;
102 pub const PICK_ITEM_FROM_BLOCK: i32 = 0x24;
104 pub const PICK_ITEM_FROM_ENTITY: i32 = 0x25;
106 pub const PING_REQUEST: i32 = 0x26;
108 pub const CRAFT_RECIPE_REQUEST: i32 = 0x27;
110 pub const ABILITIES: i32 = 0x28;
112 pub const BLOCK_DIG: i32 = 0x29;
114 pub const ENTITY_ACTION: i32 = 0x2a;
116 pub const PLAYER_INPUT: i32 = 0x2b;
118 pub const PLAYER_LOADED: i32 = 0x2c;
120 pub const PONG: i32 = 0x2d;
122 pub const RECIPE_BOOK: i32 = 0x2e;
124 pub const DISPLAYED_RECIPE: i32 = 0x2f;
126 pub const NAME_ITEM: i32 = 0x30;
128 pub const RESOURCE_PACK_RECEIVE: i32 = 0x31;
130 pub const ADVANCEMENT_TAB: i32 = 0x32;
132 pub const SELECT_TRADE: i32 = 0x33;
134 pub const SET_BEACON_EFFECT: i32 = 0x34;
136 pub const HELD_ITEM_SLOT: i32 = 0x35;
138 pub const UPDATE_COMMAND_BLOCK: i32 = 0x36;
140 pub const UPDATE_COMMAND_BLOCK_MINECART: i32 = 0x37;
142 pub const SET_CREATIVE_SLOT: i32 = 0x38;
144 pub const SET_GAME_RULE: i32 = 0x39;
146 pub const UPDATE_JIGSAW_BLOCK: i32 = 0x3a;
148 pub const UPDATE_STRUCTURE_BLOCK: i32 = 0x3b;
150 pub const SET_TEST_BLOCK: i32 = 0x3c;
152 pub const UPDATE_SIGN: i32 = 0x3d;
154 pub const SPECTATOR_ACTION: i32 = 0x3e;
156 pub const ARM_ANIMATION: i32 = 0x3f;
158 pub const SPECTATE: i32 = 0x40;
160 pub const TEST_INSTANCE_BLOCK_ACTION: i32 = 0x41;
162 pub const BLOCK_PLACE: i32 = 0x42;
164 pub const USE_ITEM: i32 = 0x43;
166 pub const CUSTOM_CLICK_ACTION: i32 = 0x44;
168}
169
170pub use crate::defs::p775::play::serverbound::ArmAnimationHand;
171pub use crate::defs::p775::play::serverbound::BlockPlaceHand;
172pub use crate::defs::p775::play::serverbound::ChangeGamemodeMode;
173pub use crate::defs::p775::play::serverbound::ChatCommandSignedArgumentSignatures;
174pub use crate::defs::p775::play::serverbound::ClientCommandActionId;
175pub use crate::defs::p775::play::serverbound::EntityActionActionId;
176pub use crate::defs::p775::play::serverbound::MovementFlags;
177pub use crate::defs::p775::play::serverbound::PlayerInputInputs;
178pub use crate::defs::p775::play::serverbound::SetDifficultyNewDifficulty;
179pub use crate::defs::p775::play::serverbound::SettingsParticleStatus;
180pub use crate::defs::p775::play::serverbound::TestInstanceBlockActionData;
181pub use crate::defs::p775::play::serverbound::UpdateStructureBlockFlags;
182pub use crate::defs::p775::play::serverbound::UseEntityHand;
183pub use crate::defs::p775::play::serverbound::UseItemHand;
184pub use crate::defs::p776::play::serverbound::WindowClickChangedSlots;
185
186pub type TeleportConfirm = crate::defs::p340::play::serverbound::TeleportConfirm<776>;
188impl crate::packet::Packet for TeleportConfirm {
189 const ID: i32 = id::TELEPORT_CONFIRM;
190 const NAME: &'static str = "teleport_confirm";
191 const STATE: State = State::Play;
192 const DIRECTION: Direction = Direction::Serverbound;
193}
194impl From<TeleportConfirm> for ServerboundPlayPacket {
195 fn from(p: TeleportConfirm) -> Self {
196 Self::TeleportConfirm(p)
197 }
198}
199
200pub type Attack = crate::defs::p775::play::serverbound::Attack<776>;
202impl crate::packet::Packet for Attack {
203 const ID: i32 = id::ATTACK;
204 const NAME: &'static str = "attack";
205 const STATE: State = State::Play;
206 const DIRECTION: Direction = Direction::Serverbound;
207}
208impl From<Attack> for ServerboundPlayPacket {
209 fn from(p: Attack) -> Self {
210 Self::Attack(p)
211 }
212}
213
214pub type QueryBlockNbt = crate::defs::p754::play::serverbound::QueryBlockNbt<776>;
216impl crate::packet::Packet for QueryBlockNbt {
217 const ID: i32 = id::QUERY_BLOCK_NBT;
218 const NAME: &'static str = "query_block_nbt";
219 const STATE: State = State::Play;
220 const DIRECTION: Direction = Direction::Serverbound;
221}
222impl From<QueryBlockNbt> for ServerboundPlayPacket {
223 fn from(p: QueryBlockNbt) -> Self {
224 Self::QueryBlockNbt(p)
225 }
226}
227
228pub type SelectBundleItem = crate::defs::p775::play::serverbound::SelectBundleItem<776>;
230impl crate::packet::Packet for SelectBundleItem {
231 const ID: i32 = id::SELECT_BUNDLE_ITEM;
232 const NAME: &'static str = "select_bundle_item";
233 const STATE: State = State::Play;
234 const DIRECTION: Direction = Direction::Serverbound;
235}
236impl From<SelectBundleItem> for ServerboundPlayPacket {
237 fn from(p: SelectBundleItem) -> Self {
238 Self::SelectBundleItem(p)
239 }
240}
241
242pub type SetDifficulty = crate::defs::p775::play::serverbound::SetDifficulty<776>;
244impl crate::packet::Packet for SetDifficulty {
245 const ID: i32 = id::SET_DIFFICULTY;
246 const NAME: &'static str = "set_difficulty";
247 const STATE: State = State::Play;
248 const DIRECTION: Direction = Direction::Serverbound;
249}
250impl From<SetDifficulty> for ServerboundPlayPacket {
251 fn from(p: SetDifficulty) -> Self {
252 Self::SetDifficulty(p)
253 }
254}
255
256pub type ChangeGamemode = crate::defs::p775::play::serverbound::ChangeGamemode<776>;
258impl crate::packet::Packet for ChangeGamemode {
259 const ID: i32 = id::CHANGE_GAMEMODE;
260 const NAME: &'static str = "change_gamemode";
261 const STATE: State = State::Play;
262 const DIRECTION: Direction = Direction::Serverbound;
263}
264impl From<ChangeGamemode> for ServerboundPlayPacket {
265 fn from(p: ChangeGamemode) -> Self {
266 Self::ChangeGamemode(p)
267 }
268}
269
270pub type MessageAcknowledgement = crate::defs::p775::play::serverbound::MessageAcknowledgement<776>;
272impl crate::packet::Packet for MessageAcknowledgement {
273 const ID: i32 = id::MESSAGE_ACKNOWLEDGEMENT;
274 const NAME: &'static str = "message_acknowledgement";
275 const STATE: State = State::Play;
276 const DIRECTION: Direction = Direction::Serverbound;
277}
278impl From<MessageAcknowledgement> for ServerboundPlayPacket {
279 fn from(p: MessageAcknowledgement) -> Self {
280 Self::MessageAcknowledgement(p)
281 }
282}
283
284pub type ChatCommand = crate::defs::p775::play::serverbound::ChatCommand<776>;
286impl crate::packet::Packet for ChatCommand {
287 const ID: i32 = id::CHAT_COMMAND;
288 const NAME: &'static str = "chat_command";
289 const STATE: State = State::Play;
290 const DIRECTION: Direction = Direction::Serverbound;
291}
292impl From<ChatCommand> for ServerboundPlayPacket {
293 fn from(p: ChatCommand) -> Self {
294 Self::ChatCommand(p)
295 }
296}
297
298pub type ChatCommandSigned = crate::defs::p775::play::serverbound::ChatCommandSigned<776>;
300impl crate::packet::Packet for ChatCommandSigned {
301 const ID: i32 = id::CHAT_COMMAND_SIGNED;
302 const NAME: &'static str = "chat_command_signed";
303 const STATE: State = State::Play;
304 const DIRECTION: Direction = Direction::Serverbound;
305}
306impl From<ChatCommandSigned> for ServerboundPlayPacket {
307 fn from(p: ChatCommandSigned) -> Self {
308 Self::ChatCommandSigned(p)
309 }
310}
311
312pub type ChatMessage = crate::defs::p775::play::serverbound::ChatMessage<776>;
314impl crate::packet::Packet for ChatMessage {
315 const ID: i32 = id::CHAT_MESSAGE;
316 const NAME: &'static str = "chat_message";
317 const STATE: State = State::Play;
318 const DIRECTION: Direction = Direction::Serverbound;
319}
320impl From<ChatMessage> for ServerboundPlayPacket {
321 fn from(p: ChatMessage) -> Self {
322 Self::ChatMessage(p)
323 }
324}
325
326pub type ChatSessionUpdate = crate::defs::p775::play::serverbound::ChatSessionUpdate<776>;
328impl crate::packet::Packet for ChatSessionUpdate {
329 const ID: i32 = id::CHAT_SESSION_UPDATE;
330 const NAME: &'static str = "chat_session_update";
331 const STATE: State = State::Play;
332 const DIRECTION: Direction = Direction::Serverbound;
333}
334impl From<ChatSessionUpdate> for ServerboundPlayPacket {
335 fn from(p: ChatSessionUpdate) -> Self {
336 Self::ChatSessionUpdate(p)
337 }
338}
339
340pub type ChunkBatchReceived = crate::defs::p775::play::serverbound::ChunkBatchReceived<776>;
342impl crate::packet::Packet for ChunkBatchReceived {
343 const ID: i32 = id::CHUNK_BATCH_RECEIVED;
344 const NAME: &'static str = "chunk_batch_received";
345 const STATE: State = State::Play;
346 const DIRECTION: Direction = Direction::Serverbound;
347}
348impl From<ChunkBatchReceived> for ServerboundPlayPacket {
349 fn from(p: ChunkBatchReceived) -> Self {
350 Self::ChunkBatchReceived(p)
351 }
352}
353
354pub type ClientCommand = crate::defs::p775::play::serverbound::ClientCommand<776>;
356impl crate::packet::Packet for ClientCommand {
357 const ID: i32 = id::CLIENT_COMMAND;
358 const NAME: &'static str = "client_command";
359 const STATE: State = State::Play;
360 const DIRECTION: Direction = Direction::Serverbound;
361}
362impl From<ClientCommand> for ServerboundPlayPacket {
363 fn from(p: ClientCommand) -> Self {
364 Self::ClientCommand(p)
365 }
366}
367
368pub type TickEnd = crate::defs::p775::play::serverbound::TickEnd<776>;
370impl crate::packet::Packet for TickEnd {
371 const ID: i32 = id::TICK_END;
372 const NAME: &'static str = "tick_end";
373 const STATE: State = State::Play;
374 const DIRECTION: Direction = Direction::Serverbound;
375}
376impl From<TickEnd> for ServerboundPlayPacket {
377 fn from(p: TickEnd) -> Self {
378 Self::TickEnd(p)
379 }
380}
381
382pub type Settings = crate::defs::p775::play::serverbound::Settings<776>;
384impl crate::packet::Packet for Settings {
385 const ID: i32 = id::SETTINGS;
386 const NAME: &'static str = "settings";
387 const STATE: State = State::Play;
388 const DIRECTION: Direction = Direction::Serverbound;
389}
390impl From<Settings> for ServerboundPlayPacket {
391 fn from(p: Settings) -> Self {
392 Self::Settings(p)
393 }
394}
395
396pub type TabComplete = crate::defs::p754::play::serverbound::TabComplete<776>;
398impl crate::packet::Packet for TabComplete {
399 const ID: i32 = id::TAB_COMPLETE;
400 const NAME: &'static str = "tab_complete";
401 const STATE: State = State::Play;
402 const DIRECTION: Direction = Direction::Serverbound;
403}
404impl From<TabComplete> for ServerboundPlayPacket {
405 fn from(p: TabComplete) -> Self {
406 Self::TabComplete(p)
407 }
408}
409
410pub type ConfigurationAcknowledged =
412 crate::defs::p775::play::serverbound::ConfigurationAcknowledged<776>;
413impl crate::packet::Packet for ConfigurationAcknowledged {
414 const ID: i32 = id::CONFIGURATION_ACKNOWLEDGED;
415 const NAME: &'static str = "configuration_acknowledged";
416 const STATE: State = State::Play;
417 const DIRECTION: Direction = Direction::Serverbound;
418}
419impl From<ConfigurationAcknowledged> for ServerboundPlayPacket {
420 fn from(p: ConfigurationAcknowledged) -> Self {
421 Self::ConfigurationAcknowledged(p)
422 }
423}
424
425pub type EnchantItem = crate::defs::p775::play::serverbound::EnchantItem<776>;
427impl crate::packet::Packet for EnchantItem {
428 const ID: i32 = id::ENCHANT_ITEM;
429 const NAME: &'static str = "enchant_item";
430 const STATE: State = State::Play;
431 const DIRECTION: Direction = Direction::Serverbound;
432}
433impl From<EnchantItem> for ServerboundPlayPacket {
434 fn from(p: EnchantItem) -> Self {
435 Self::EnchantItem(p)
436 }
437}
438
439pub type WindowClick = crate::defs::p776::play::serverbound::WindowClick<776>;
441impl crate::packet::Packet for WindowClick {
442 const ID: i32 = id::WINDOW_CLICK;
443 const NAME: &'static str = "window_click";
444 const STATE: State = State::Play;
445 const DIRECTION: Direction = Direction::Serverbound;
446}
447impl From<WindowClick> for ServerboundPlayPacket {
448 fn from(p: WindowClick) -> Self {
449 Self::WindowClick(p)
450 }
451}
452
453pub type CloseWindow = crate::defs::p775::play::serverbound::CloseWindow<776>;
455impl crate::packet::Packet for CloseWindow {
456 const ID: i32 = id::CLOSE_WINDOW;
457 const NAME: &'static str = "close_window";
458 const STATE: State = State::Play;
459 const DIRECTION: Direction = Direction::Serverbound;
460}
461impl From<CloseWindow> for ServerboundPlayPacket {
462 fn from(p: CloseWindow) -> Self {
463 Self::CloseWindow(p)
464 }
465}
466
467pub type SetSlotState = crate::defs::p775::play::serverbound::SetSlotState<776>;
469impl crate::packet::Packet for SetSlotState {
470 const ID: i32 = id::SET_SLOT_STATE;
471 const NAME: &'static str = "set_slot_state";
472 const STATE: State = State::Play;
473 const DIRECTION: Direction = Direction::Serverbound;
474}
475impl From<SetSlotState> for ServerboundPlayPacket {
476 fn from(p: SetSlotState) -> Self {
477 Self::SetSlotState(p)
478 }
479}
480
481pub type CookieResponse = crate::defs::p775::play::serverbound::CookieResponse<776>;
483impl crate::packet::Packet for CookieResponse {
484 const ID: i32 = id::COOKIE_RESPONSE;
485 const NAME: &'static str = "cookie_response";
486 const STATE: State = State::Play;
487 const DIRECTION: Direction = Direction::Serverbound;
488}
489impl From<CookieResponse> for ServerboundPlayPacket {
490 fn from(p: CookieResponse) -> Self {
491 Self::CookieResponse(p)
492 }
493}
494
495pub type CustomPayload = crate::defs::p47::play::serverbound::CustomPayload<776>;
497impl crate::packet::Packet for CustomPayload {
498 const ID: i32 = id::CUSTOM_PAYLOAD;
499 const NAME: &'static str = "custom_payload";
500 const STATE: State = State::Play;
501 const DIRECTION: Direction = Direction::Serverbound;
502}
503impl From<CustomPayload> for ServerboundPlayPacket {
504 fn from(p: CustomPayload) -> Self {
505 Self::CustomPayload(p)
506 }
507}
508
509pub type DebugSubscriptionRequest =
511 crate::defs::p775::play::serverbound::DebugSubscriptionRequest<776>;
512impl crate::packet::Packet for DebugSubscriptionRequest {
513 const ID: i32 = id::DEBUG_SUBSCRIPTION_REQUEST;
514 const NAME: &'static str = "debug_subscription_request";
515 const STATE: State = State::Play;
516 const DIRECTION: Direction = Direction::Serverbound;
517}
518impl From<DebugSubscriptionRequest> for ServerboundPlayPacket {
519 fn from(p: DebugSubscriptionRequest) -> Self {
520 Self::DebugSubscriptionRequest(p)
521 }
522}
523
524pub type EditBook = crate::defs::p775::play::serverbound::EditBook<776>;
526impl crate::packet::Packet for EditBook {
527 const ID: i32 = id::EDIT_BOOK;
528 const NAME: &'static str = "edit_book";
529 const STATE: State = State::Play;
530 const DIRECTION: Direction = Direction::Serverbound;
531}
532impl From<EditBook> for ServerboundPlayPacket {
533 fn from(p: EditBook) -> Self {
534 Self::EditBook(p)
535 }
536}
537
538pub type QueryEntityNbt = crate::defs::p754::play::serverbound::QueryEntityNbt<776>;
540impl crate::packet::Packet for QueryEntityNbt {
541 const ID: i32 = id::QUERY_ENTITY_NBT;
542 const NAME: &'static str = "query_entity_nbt";
543 const STATE: State = State::Play;
544 const DIRECTION: Direction = Direction::Serverbound;
545}
546impl From<QueryEntityNbt> for ServerboundPlayPacket {
547 fn from(p: QueryEntityNbt) -> Self {
548 Self::QueryEntityNbt(p)
549 }
550}
551
552pub type UseEntity = crate::defs::p775::play::serverbound::UseEntity<776>;
554impl crate::packet::Packet for UseEntity {
555 const ID: i32 = id::USE_ENTITY;
556 const NAME: &'static str = "use_entity";
557 const STATE: State = State::Play;
558 const DIRECTION: Direction = Direction::Serverbound;
559}
560impl From<UseEntity> for ServerboundPlayPacket {
561 fn from(p: UseEntity) -> Self {
562 Self::UseEntity(p)
563 }
564}
565
566pub type GenerateStructure = crate::defs::p754::play::serverbound::GenerateStructure<776>;
568impl crate::packet::Packet for GenerateStructure {
569 const ID: i32 = id::GENERATE_STRUCTURE;
570 const NAME: &'static str = "generate_structure";
571 const STATE: State = State::Play;
572 const DIRECTION: Direction = Direction::Serverbound;
573}
574impl From<GenerateStructure> for ServerboundPlayPacket {
575 fn from(p: GenerateStructure) -> Self {
576 Self::GenerateStructure(p)
577 }
578}
579
580pub type KeepAlive = crate::defs::p340::play::serverbound::KeepAlive<776>;
582impl crate::packet::Packet for KeepAlive {
583 const ID: i32 = id::KEEP_ALIVE;
584 const NAME: &'static str = "keep_alive";
585 const STATE: State = State::Play;
586 const DIRECTION: Direction = Direction::Serverbound;
587}
588impl From<KeepAlive> for ServerboundPlayPacket {
589 fn from(p: KeepAlive) -> Self {
590 Self::KeepAlive(p)
591 }
592}
593
594pub type LockDifficulty = crate::defs::p754::play::serverbound::LockDifficulty<776>;
596impl crate::packet::Packet for LockDifficulty {
597 const ID: i32 = id::LOCK_DIFFICULTY;
598 const NAME: &'static str = "lock_difficulty";
599 const STATE: State = State::Play;
600 const DIRECTION: Direction = Direction::Serverbound;
601}
602impl From<LockDifficulty> for ServerboundPlayPacket {
603 fn from(p: LockDifficulty) -> Self {
604 Self::LockDifficulty(p)
605 }
606}
607
608pub type Position = crate::defs::p775::play::serverbound::Position<776>;
610impl crate::packet::Packet for Position {
611 const ID: i32 = id::POSITION;
612 const NAME: &'static str = "position";
613 const STATE: State = State::Play;
614 const DIRECTION: Direction = Direction::Serverbound;
615}
616impl From<Position> for ServerboundPlayPacket {
617 fn from(p: Position) -> Self {
618 Self::Position(p)
619 }
620}
621
622pub type PositionLook = crate::defs::p775::play::serverbound::PositionLook<776>;
624impl crate::packet::Packet for PositionLook {
625 const ID: i32 = id::POSITION_LOOK;
626 const NAME: &'static str = "position_look";
627 const STATE: State = State::Play;
628 const DIRECTION: Direction = Direction::Serverbound;
629}
630impl From<PositionLook> for ServerboundPlayPacket {
631 fn from(p: PositionLook) -> Self {
632 Self::PositionLook(p)
633 }
634}
635
636pub type Look = crate::defs::p775::play::serverbound::Look<776>;
638impl crate::packet::Packet for Look {
639 const ID: i32 = id::LOOK;
640 const NAME: &'static str = "look";
641 const STATE: State = State::Play;
642 const DIRECTION: Direction = Direction::Serverbound;
643}
644impl From<Look> for ServerboundPlayPacket {
645 fn from(p: Look) -> Self {
646 Self::Look(p)
647 }
648}
649
650pub type Flying = crate::defs::p775::play::serverbound::Flying<776>;
652impl crate::packet::Packet for Flying {
653 const ID: i32 = id::FLYING;
654 const NAME: &'static str = "flying";
655 const STATE: State = State::Play;
656 const DIRECTION: Direction = Direction::Serverbound;
657}
658impl From<Flying> for ServerboundPlayPacket {
659 fn from(p: Flying) -> Self {
660 Self::Flying(p)
661 }
662}
663
664pub type VehicleMove = crate::defs::p775::play::serverbound::VehicleMove<776>;
666impl crate::packet::Packet for VehicleMove {
667 const ID: i32 = id::VEHICLE_MOVE;
668 const NAME: &'static str = "vehicle_move";
669 const STATE: State = State::Play;
670 const DIRECTION: Direction = Direction::Serverbound;
671}
672impl From<VehicleMove> for ServerboundPlayPacket {
673 fn from(p: VehicleMove) -> Self {
674 Self::VehicleMove(p)
675 }
676}
677
678pub type SteerBoat = crate::defs::p340::play::serverbound::SteerBoat<776>;
680impl crate::packet::Packet for SteerBoat {
681 const ID: i32 = id::STEER_BOAT;
682 const NAME: &'static str = "steer_boat";
683 const STATE: State = State::Play;
684 const DIRECTION: Direction = Direction::Serverbound;
685}
686impl From<SteerBoat> for ServerboundPlayPacket {
687 fn from(p: SteerBoat) -> Self {
688 Self::SteerBoat(p)
689 }
690}
691
692pub type PickItemFromBlock = crate::defs::p775::play::serverbound::PickItemFromBlock<776>;
694impl crate::packet::Packet for PickItemFromBlock {
695 const ID: i32 = id::PICK_ITEM_FROM_BLOCK;
696 const NAME: &'static str = "pick_item_from_block";
697 const STATE: State = State::Play;
698 const DIRECTION: Direction = Direction::Serverbound;
699}
700impl From<PickItemFromBlock> for ServerboundPlayPacket {
701 fn from(p: PickItemFromBlock) -> Self {
702 Self::PickItemFromBlock(p)
703 }
704}
705
706pub type PickItemFromEntity = crate::defs::p775::play::serverbound::PickItemFromEntity<776>;
708impl crate::packet::Packet for PickItemFromEntity {
709 const ID: i32 = id::PICK_ITEM_FROM_ENTITY;
710 const NAME: &'static str = "pick_item_from_entity";
711 const STATE: State = State::Play;
712 const DIRECTION: Direction = Direction::Serverbound;
713}
714impl From<PickItemFromEntity> for ServerboundPlayPacket {
715 fn from(p: PickItemFromEntity) -> Self {
716 Self::PickItemFromEntity(p)
717 }
718}
719
720pub type PingRequest = crate::defs::p775::play::serverbound::PingRequest<776>;
722impl crate::packet::Packet for PingRequest {
723 const ID: i32 = id::PING_REQUEST;
724 const NAME: &'static str = "ping_request";
725 const STATE: State = State::Play;
726 const DIRECTION: Direction = Direction::Serverbound;
727}
728impl From<PingRequest> for ServerboundPlayPacket {
729 fn from(p: PingRequest) -> Self {
730 Self::PingRequest(p)
731 }
732}
733
734pub type CraftRecipeRequest = crate::defs::p775::play::serverbound::CraftRecipeRequest<776>;
736impl crate::packet::Packet for CraftRecipeRequest {
737 const ID: i32 = id::CRAFT_RECIPE_REQUEST;
738 const NAME: &'static str = "craft_recipe_request";
739 const STATE: State = State::Play;
740 const DIRECTION: Direction = Direction::Serverbound;
741}
742impl From<CraftRecipeRequest> for ServerboundPlayPacket {
743 fn from(p: CraftRecipeRequest) -> Self {
744 Self::CraftRecipeRequest(p)
745 }
746}
747
748pub type Abilities = crate::defs::p754::play::serverbound::Abilities<776>;
750impl crate::packet::Packet for Abilities {
751 const ID: i32 = id::ABILITIES;
752 const NAME: &'static str = "abilities";
753 const STATE: State = State::Play;
754 const DIRECTION: Direction = Direction::Serverbound;
755}
756impl From<Abilities> for ServerboundPlayPacket {
757 fn from(p: Abilities) -> Self {
758 Self::Abilities(p)
759 }
760}
761
762pub type BlockDig = crate::defs::p775::play::serverbound::BlockDig<776>;
764impl crate::packet::Packet for BlockDig {
765 const ID: i32 = id::BLOCK_DIG;
766 const NAME: &'static str = "block_dig";
767 const STATE: State = State::Play;
768 const DIRECTION: Direction = Direction::Serverbound;
769}
770impl From<BlockDig> for ServerboundPlayPacket {
771 fn from(p: BlockDig) -> Self {
772 Self::BlockDig(p)
773 }
774}
775
776pub type EntityAction = crate::defs::p775::play::serverbound::EntityAction<776>;
778impl crate::packet::Packet for EntityAction {
779 const ID: i32 = id::ENTITY_ACTION;
780 const NAME: &'static str = "entity_action";
781 const STATE: State = State::Play;
782 const DIRECTION: Direction = Direction::Serverbound;
783}
784impl From<EntityAction> for ServerboundPlayPacket {
785 fn from(p: EntityAction) -> Self {
786 Self::EntityAction(p)
787 }
788}
789
790pub type PlayerInput = crate::defs::p775::play::serverbound::PlayerInput<776>;
792impl crate::packet::Packet for PlayerInput {
793 const ID: i32 = id::PLAYER_INPUT;
794 const NAME: &'static str = "player_input";
795 const STATE: State = State::Play;
796 const DIRECTION: Direction = Direction::Serverbound;
797}
798impl From<PlayerInput> for ServerboundPlayPacket {
799 fn from(p: PlayerInput) -> Self {
800 Self::PlayerInput(p)
801 }
802}
803
804pub type PlayerLoaded = crate::defs::p775::play::serverbound::PlayerLoaded<776>;
806impl crate::packet::Packet for PlayerLoaded {
807 const ID: i32 = id::PLAYER_LOADED;
808 const NAME: &'static str = "player_loaded";
809 const STATE: State = State::Play;
810 const DIRECTION: Direction = Direction::Serverbound;
811}
812impl From<PlayerLoaded> for ServerboundPlayPacket {
813 fn from(p: PlayerLoaded) -> Self {
814 Self::PlayerLoaded(p)
815 }
816}
817
818pub type Pong = crate::defs::p775::play::serverbound::Pong<776>;
820impl crate::packet::Packet for Pong {
821 const ID: i32 = id::PONG;
822 const NAME: &'static str = "pong";
823 const STATE: State = State::Play;
824 const DIRECTION: Direction = Direction::Serverbound;
825}
826impl From<Pong> for ServerboundPlayPacket {
827 fn from(p: Pong) -> Self {
828 Self::Pong(p)
829 }
830}
831
832pub type RecipeBook = crate::defs::p754::play::serverbound::RecipeBook<776>;
834impl crate::packet::Packet for RecipeBook {
835 const ID: i32 = id::RECIPE_BOOK;
836 const NAME: &'static str = "recipe_book";
837 const STATE: State = State::Play;
838 const DIRECTION: Direction = Direction::Serverbound;
839}
840impl From<RecipeBook> for ServerboundPlayPacket {
841 fn from(p: RecipeBook) -> Self {
842 Self::RecipeBook(p)
843 }
844}
845
846pub type DisplayedRecipe = crate::defs::p775::play::serverbound::DisplayedRecipe<776>;
848impl crate::packet::Packet for DisplayedRecipe {
849 const ID: i32 = id::DISPLAYED_RECIPE;
850 const NAME: &'static str = "displayed_recipe";
851 const STATE: State = State::Play;
852 const DIRECTION: Direction = Direction::Serverbound;
853}
854impl From<DisplayedRecipe> for ServerboundPlayPacket {
855 fn from(p: DisplayedRecipe) -> Self {
856 Self::DisplayedRecipe(p)
857 }
858}
859
860pub type NameItem = crate::defs::p754::play::serverbound::NameItem<776>;
862impl crate::packet::Packet for NameItem {
863 const ID: i32 = id::NAME_ITEM;
864 const NAME: &'static str = "name_item";
865 const STATE: State = State::Play;
866 const DIRECTION: Direction = Direction::Serverbound;
867}
868impl From<NameItem> for ServerboundPlayPacket {
869 fn from(p: NameItem) -> Self {
870 Self::NameItem(p)
871 }
872}
873
874pub type ResourcePackReceive = crate::defs::p775::play::serverbound::ResourcePackReceive<776>;
876impl crate::packet::Packet for ResourcePackReceive {
877 const ID: i32 = id::RESOURCE_PACK_RECEIVE;
878 const NAME: &'static str = "resource_pack_receive";
879 const STATE: State = State::Play;
880 const DIRECTION: Direction = Direction::Serverbound;
881}
882impl From<ResourcePackReceive> for ServerboundPlayPacket {
883 fn from(p: ResourcePackReceive) -> Self {
884 Self::ResourcePackReceive(p)
885 }
886}
887
888pub type AdvancementTab = crate::defs::p340::play::serverbound::AdvancementTab<776>;
890impl crate::packet::Packet for AdvancementTab {
891 const ID: i32 = id::ADVANCEMENT_TAB;
892 const NAME: &'static str = "advancement_tab";
893 const STATE: State = State::Play;
894 const DIRECTION: Direction = Direction::Serverbound;
895}
896impl From<AdvancementTab> for ServerboundPlayPacket {
897 fn from(p: AdvancementTab) -> Self {
898 Self::AdvancementTab(p)
899 }
900}
901
902pub type SelectTrade = crate::defs::p754::play::serverbound::SelectTrade<776>;
904impl crate::packet::Packet for SelectTrade {
905 const ID: i32 = id::SELECT_TRADE;
906 const NAME: &'static str = "select_trade";
907 const STATE: State = State::Play;
908 const DIRECTION: Direction = Direction::Serverbound;
909}
910impl From<SelectTrade> for ServerboundPlayPacket {
911 fn from(p: SelectTrade) -> Self {
912 Self::SelectTrade(p)
913 }
914}
915
916pub type SetBeaconEffect = crate::defs::p775::play::serverbound::SetBeaconEffect<776>;
918impl crate::packet::Packet for SetBeaconEffect {
919 const ID: i32 = id::SET_BEACON_EFFECT;
920 const NAME: &'static str = "set_beacon_effect";
921 const STATE: State = State::Play;
922 const DIRECTION: Direction = Direction::Serverbound;
923}
924impl From<SetBeaconEffect> for ServerboundPlayPacket {
925 fn from(p: SetBeaconEffect) -> Self {
926 Self::SetBeaconEffect(p)
927 }
928}
929
930pub type HeldItemSlot = crate::defs::p47::play::serverbound::HeldItemSlot<776>;
932impl crate::packet::Packet for HeldItemSlot {
933 const ID: i32 = id::HELD_ITEM_SLOT;
934 const NAME: &'static str = "held_item_slot";
935 const STATE: State = State::Play;
936 const DIRECTION: Direction = Direction::Serverbound;
937}
938impl From<HeldItemSlot> for ServerboundPlayPacket {
939 fn from(p: HeldItemSlot) -> Self {
940 Self::HeldItemSlot(p)
941 }
942}
943
944pub type UpdateCommandBlock = crate::defs::p754::play::serverbound::UpdateCommandBlock<776>;
946impl crate::packet::Packet for UpdateCommandBlock {
947 const ID: i32 = id::UPDATE_COMMAND_BLOCK;
948 const NAME: &'static str = "update_command_block";
949 const STATE: State = State::Play;
950 const DIRECTION: Direction = Direction::Serverbound;
951}
952impl From<UpdateCommandBlock> for ServerboundPlayPacket {
953 fn from(p: UpdateCommandBlock) -> Self {
954 Self::UpdateCommandBlock(p)
955 }
956}
957
958pub type UpdateCommandBlockMinecart =
960 crate::defs::p754::play::serverbound::UpdateCommandBlockMinecart<776>;
961impl crate::packet::Packet for UpdateCommandBlockMinecart {
962 const ID: i32 = id::UPDATE_COMMAND_BLOCK_MINECART;
963 const NAME: &'static str = "update_command_block_minecart";
964 const STATE: State = State::Play;
965 const DIRECTION: Direction = Direction::Serverbound;
966}
967impl From<UpdateCommandBlockMinecart> for ServerboundPlayPacket {
968 fn from(p: UpdateCommandBlockMinecart) -> Self {
969 Self::UpdateCommandBlockMinecart(p)
970 }
971}
972
973pub type SetCreativeSlot = crate::defs::p776::play::serverbound::SetCreativeSlot<776>;
975impl crate::packet::Packet for SetCreativeSlot {
976 const ID: i32 = id::SET_CREATIVE_SLOT;
977 const NAME: &'static str = "set_creative_slot";
978 const STATE: State = State::Play;
979 const DIRECTION: Direction = Direction::Serverbound;
980}
981impl From<SetCreativeSlot> for ServerboundPlayPacket {
982 fn from(p: SetCreativeSlot) -> Self {
983 Self::SetCreativeSlot(p)
984 }
985}
986
987pub type SetGameRule = crate::defs::p775::play::serverbound::SetGameRule<776>;
989impl crate::packet::Packet for SetGameRule {
990 const ID: i32 = id::SET_GAME_RULE;
991 const NAME: &'static str = "set_game_rule";
992 const STATE: State = State::Play;
993 const DIRECTION: Direction = Direction::Serverbound;
994}
995impl From<SetGameRule> for ServerboundPlayPacket {
996 fn from(p: SetGameRule) -> Self {
997 Self::SetGameRule(p)
998 }
999}
1000
1001pub type UpdateJigsawBlock = crate::defs::p775::play::serverbound::UpdateJigsawBlock<776>;
1003impl crate::packet::Packet for UpdateJigsawBlock {
1004 const ID: i32 = id::UPDATE_JIGSAW_BLOCK;
1005 const NAME: &'static str = "update_jigsaw_block";
1006 const STATE: State = State::Play;
1007 const DIRECTION: Direction = Direction::Serverbound;
1008}
1009impl From<UpdateJigsawBlock> for ServerboundPlayPacket {
1010 fn from(p: UpdateJigsawBlock) -> Self {
1011 Self::UpdateJigsawBlock(p)
1012 }
1013}
1014
1015pub type UpdateStructureBlock = crate::defs::p775::play::serverbound::UpdateStructureBlock<776>;
1017impl crate::packet::Packet for UpdateStructureBlock {
1018 const ID: i32 = id::UPDATE_STRUCTURE_BLOCK;
1019 const NAME: &'static str = "update_structure_block";
1020 const STATE: State = State::Play;
1021 const DIRECTION: Direction = Direction::Serverbound;
1022}
1023impl From<UpdateStructureBlock> for ServerboundPlayPacket {
1024 fn from(p: UpdateStructureBlock) -> Self {
1025 Self::UpdateStructureBlock(p)
1026 }
1027}
1028
1029pub type SetTestBlock = crate::defs::p775::play::serverbound::SetTestBlock<776>;
1031impl crate::packet::Packet for SetTestBlock {
1032 const ID: i32 = id::SET_TEST_BLOCK;
1033 const NAME: &'static str = "set_test_block";
1034 const STATE: State = State::Play;
1035 const DIRECTION: Direction = Direction::Serverbound;
1036}
1037impl From<SetTestBlock> for ServerboundPlayPacket {
1038 fn from(p: SetTestBlock) -> Self {
1039 Self::SetTestBlock(p)
1040 }
1041}
1042
1043pub type UpdateSign = crate::defs::p775::play::serverbound::UpdateSign<776>;
1045impl crate::packet::Packet for UpdateSign {
1046 const ID: i32 = id::UPDATE_SIGN;
1047 const NAME: &'static str = "update_sign";
1048 const STATE: State = State::Play;
1049 const DIRECTION: Direction = Direction::Serverbound;
1050}
1051impl From<UpdateSign> for ServerboundPlayPacket {
1052 fn from(p: UpdateSign) -> Self {
1053 Self::UpdateSign(p)
1054 }
1055}
1056
1057pub type SpectatorAction = crate::defs::p776::play::serverbound::SpectatorAction<776>;
1059impl crate::packet::Packet for SpectatorAction {
1060 const ID: i32 = id::SPECTATOR_ACTION;
1061 const NAME: &'static str = "spectator_action";
1062 const STATE: State = State::Play;
1063 const DIRECTION: Direction = Direction::Serverbound;
1064}
1065impl From<SpectatorAction> for ServerboundPlayPacket {
1066 fn from(p: SpectatorAction) -> Self {
1067 Self::SpectatorAction(p)
1068 }
1069}
1070
1071pub type ArmAnimation = crate::defs::p775::play::serverbound::ArmAnimation<776>;
1073impl crate::packet::Packet for ArmAnimation {
1074 const ID: i32 = id::ARM_ANIMATION;
1075 const NAME: &'static str = "arm_animation";
1076 const STATE: State = State::Play;
1077 const DIRECTION: Direction = Direction::Serverbound;
1078}
1079impl From<ArmAnimation> for ServerboundPlayPacket {
1080 fn from(p: ArmAnimation) -> Self {
1081 Self::ArmAnimation(p)
1082 }
1083}
1084
1085pub type Spectate = crate::defs::p47::play::serverbound::Spectate<776>;
1087impl crate::packet::Packet for Spectate {
1088 const ID: i32 = id::SPECTATE;
1089 const NAME: &'static str = "spectate";
1090 const STATE: State = State::Play;
1091 const DIRECTION: Direction = Direction::Serverbound;
1092}
1093impl From<Spectate> for ServerboundPlayPacket {
1094 fn from(p: Spectate) -> Self {
1095 Self::Spectate(p)
1096 }
1097}
1098
1099pub type TestInstanceBlockAction =
1101 crate::defs::p775::play::serverbound::TestInstanceBlockAction<776>;
1102impl crate::packet::Packet for TestInstanceBlockAction {
1103 const ID: i32 = id::TEST_INSTANCE_BLOCK_ACTION;
1104 const NAME: &'static str = "test_instance_block_action";
1105 const STATE: State = State::Play;
1106 const DIRECTION: Direction = Direction::Serverbound;
1107}
1108impl From<TestInstanceBlockAction> for ServerboundPlayPacket {
1109 fn from(p: TestInstanceBlockAction) -> Self {
1110 Self::TestInstanceBlockAction(p)
1111 }
1112}
1113
1114pub type BlockPlace = crate::defs::p775::play::serverbound::BlockPlace<776>;
1116impl crate::packet::Packet for BlockPlace {
1117 const ID: i32 = id::BLOCK_PLACE;
1118 const NAME: &'static str = "block_place";
1119 const STATE: State = State::Play;
1120 const DIRECTION: Direction = Direction::Serverbound;
1121}
1122impl From<BlockPlace> for ServerboundPlayPacket {
1123 fn from(p: BlockPlace) -> Self {
1124 Self::BlockPlace(p)
1125 }
1126}
1127
1128pub type UseItem = crate::defs::p775::play::serverbound::UseItem<776>;
1130impl crate::packet::Packet for UseItem {
1131 const ID: i32 = id::USE_ITEM;
1132 const NAME: &'static str = "use_item";
1133 const STATE: State = State::Play;
1134 const DIRECTION: Direction = Direction::Serverbound;
1135}
1136impl From<UseItem> for ServerboundPlayPacket {
1137 fn from(p: UseItem) -> Self {
1138 Self::UseItem(p)
1139 }
1140}
1141
1142pub type CustomClickAction = crate::defs::p775::play::serverbound::CustomClickAction<776>;
1144impl crate::packet::Packet for CustomClickAction {
1145 const ID: i32 = id::CUSTOM_CLICK_ACTION;
1146 const NAME: &'static str = "custom_click_action";
1147 const STATE: State = State::Play;
1148 const DIRECTION: Direction = Direction::Serverbound;
1149}
1150impl From<CustomClickAction> for ServerboundPlayPacket {
1151 fn from(p: CustomClickAction) -> Self {
1152 Self::CustomClickAction(p)
1153 }
1154}
1155
1156#[derive(Debug, Clone, PartialEq)]
1158pub enum ServerboundPlayPacket {
1159 TeleportConfirm(TeleportConfirm),
1161 Attack(Attack),
1163 QueryBlockNbt(QueryBlockNbt),
1165 SelectBundleItem(SelectBundleItem),
1167 SetDifficulty(SetDifficulty),
1169 ChangeGamemode(ChangeGamemode),
1171 MessageAcknowledgement(MessageAcknowledgement),
1173 ChatCommand(ChatCommand),
1175 ChatCommandSigned(ChatCommandSigned),
1177 ChatMessage(ChatMessage),
1179 ChatSessionUpdate(ChatSessionUpdate),
1181 ChunkBatchReceived(ChunkBatchReceived),
1183 ClientCommand(ClientCommand),
1185 TickEnd(TickEnd),
1187 Settings(Settings),
1189 TabComplete(TabComplete),
1191 ConfigurationAcknowledged(ConfigurationAcknowledged),
1193 EnchantItem(EnchantItem),
1195 WindowClick(WindowClick),
1197 CloseWindow(CloseWindow),
1199 SetSlotState(SetSlotState),
1201 CookieResponse(CookieResponse),
1203 CustomPayload(CustomPayload),
1205 DebugSubscriptionRequest(DebugSubscriptionRequest),
1207 EditBook(EditBook),
1209 QueryEntityNbt(QueryEntityNbt),
1211 UseEntity(UseEntity),
1213 GenerateStructure(GenerateStructure),
1215 KeepAlive(KeepAlive),
1217 LockDifficulty(LockDifficulty),
1219 Position(Position),
1221 PositionLook(PositionLook),
1223 Look(Look),
1225 Flying(Flying),
1227 VehicleMove(VehicleMove),
1229 SteerBoat(SteerBoat),
1231 PickItemFromBlock(PickItemFromBlock),
1233 PickItemFromEntity(PickItemFromEntity),
1235 PingRequest(PingRequest),
1237 CraftRecipeRequest(CraftRecipeRequest),
1239 Abilities(Abilities),
1241 BlockDig(BlockDig),
1243 EntityAction(EntityAction),
1245 PlayerInput(PlayerInput),
1247 PlayerLoaded(PlayerLoaded),
1249 Pong(Pong),
1251 RecipeBook(RecipeBook),
1253 DisplayedRecipe(DisplayedRecipe),
1255 NameItem(NameItem),
1257 ResourcePackReceive(ResourcePackReceive),
1259 AdvancementTab(AdvancementTab),
1261 SelectTrade(SelectTrade),
1263 SetBeaconEffect(SetBeaconEffect),
1265 HeldItemSlot(HeldItemSlot),
1267 UpdateCommandBlock(UpdateCommandBlock),
1269 UpdateCommandBlockMinecart(UpdateCommandBlockMinecart),
1271 SetCreativeSlot(SetCreativeSlot),
1273 SetGameRule(SetGameRule),
1275 UpdateJigsawBlock(UpdateJigsawBlock),
1277 UpdateStructureBlock(UpdateStructureBlock),
1279 SetTestBlock(SetTestBlock),
1281 UpdateSign(UpdateSign),
1283 SpectatorAction(SpectatorAction),
1285 ArmAnimation(ArmAnimation),
1287 Spectate(Spectate),
1289 TestInstanceBlockAction(TestInstanceBlockAction),
1291 BlockPlace(BlockPlace),
1293 UseItem(UseItem),
1295 CustomClickAction(CustomClickAction),
1297}
1298
1299impl PacketSet for ServerboundPlayPacket {
1300 const STATE: State = State::Play;
1301 const DIRECTION: Direction = Direction::Serverbound;
1302 fn decode_raw(raw: &RawPacket) -> DecodeResult<Self> {
1303 match raw.id {
1304 id::TELEPORT_CONFIRM => decode_exact(&raw.body).map(Self::TeleportConfirm),
1305 id::ATTACK => decode_exact(&raw.body).map(Self::Attack),
1306 id::QUERY_BLOCK_NBT => decode_exact(&raw.body).map(Self::QueryBlockNbt),
1307 id::SELECT_BUNDLE_ITEM => decode_exact(&raw.body).map(Self::SelectBundleItem),
1308 id::SET_DIFFICULTY => decode_exact(&raw.body).map(Self::SetDifficulty),
1309 id::CHANGE_GAMEMODE => decode_exact(&raw.body).map(Self::ChangeGamemode),
1310 id::MESSAGE_ACKNOWLEDGEMENT => {
1311 decode_exact(&raw.body).map(Self::MessageAcknowledgement)
1312 }
1313 id::CHAT_COMMAND => decode_exact(&raw.body).map(Self::ChatCommand),
1314 id::CHAT_COMMAND_SIGNED => decode_exact(&raw.body).map(Self::ChatCommandSigned),
1315 id::CHAT_MESSAGE => decode_exact(&raw.body).map(Self::ChatMessage),
1316 id::CHAT_SESSION_UPDATE => decode_exact(&raw.body).map(Self::ChatSessionUpdate),
1317 id::CHUNK_BATCH_RECEIVED => decode_exact(&raw.body).map(Self::ChunkBatchReceived),
1318 id::CLIENT_COMMAND => decode_exact(&raw.body).map(Self::ClientCommand),
1319 id::TICK_END => decode_exact(&raw.body).map(Self::TickEnd),
1320 id::SETTINGS => decode_exact(&raw.body).map(Self::Settings),
1321 id::TAB_COMPLETE => decode_exact(&raw.body).map(Self::TabComplete),
1322 id::CONFIGURATION_ACKNOWLEDGED => {
1323 decode_exact(&raw.body).map(Self::ConfigurationAcknowledged)
1324 }
1325 id::ENCHANT_ITEM => decode_exact(&raw.body).map(Self::EnchantItem),
1326 id::WINDOW_CLICK => decode_exact(&raw.body).map(Self::WindowClick),
1327 id::CLOSE_WINDOW => decode_exact(&raw.body).map(Self::CloseWindow),
1328 id::SET_SLOT_STATE => decode_exact(&raw.body).map(Self::SetSlotState),
1329 id::COOKIE_RESPONSE => decode_exact(&raw.body).map(Self::CookieResponse),
1330 id::CUSTOM_PAYLOAD => decode_exact(&raw.body).map(Self::CustomPayload),
1331 id::DEBUG_SUBSCRIPTION_REQUEST => {
1332 decode_exact(&raw.body).map(Self::DebugSubscriptionRequest)
1333 }
1334 id::EDIT_BOOK => decode_exact(&raw.body).map(Self::EditBook),
1335 id::QUERY_ENTITY_NBT => decode_exact(&raw.body).map(Self::QueryEntityNbt),
1336 id::USE_ENTITY => decode_exact(&raw.body).map(Self::UseEntity),
1337 id::GENERATE_STRUCTURE => decode_exact(&raw.body).map(Self::GenerateStructure),
1338 id::KEEP_ALIVE => decode_exact(&raw.body).map(Self::KeepAlive),
1339 id::LOCK_DIFFICULTY => decode_exact(&raw.body).map(Self::LockDifficulty),
1340 id::POSITION => decode_exact(&raw.body).map(Self::Position),
1341 id::POSITION_LOOK => decode_exact(&raw.body).map(Self::PositionLook),
1342 id::LOOK => decode_exact(&raw.body).map(Self::Look),
1343 id::FLYING => decode_exact(&raw.body).map(Self::Flying),
1344 id::VEHICLE_MOVE => decode_exact(&raw.body).map(Self::VehicleMove),
1345 id::STEER_BOAT => decode_exact(&raw.body).map(Self::SteerBoat),
1346 id::PICK_ITEM_FROM_BLOCK => decode_exact(&raw.body).map(Self::PickItemFromBlock),
1347 id::PICK_ITEM_FROM_ENTITY => decode_exact(&raw.body).map(Self::PickItemFromEntity),
1348 id::PING_REQUEST => decode_exact(&raw.body).map(Self::PingRequest),
1349 id::CRAFT_RECIPE_REQUEST => decode_exact(&raw.body).map(Self::CraftRecipeRequest),
1350 id::ABILITIES => decode_exact(&raw.body).map(Self::Abilities),
1351 id::BLOCK_DIG => decode_exact(&raw.body).map(Self::BlockDig),
1352 id::ENTITY_ACTION => decode_exact(&raw.body).map(Self::EntityAction),
1353 id::PLAYER_INPUT => decode_exact(&raw.body).map(Self::PlayerInput),
1354 id::PLAYER_LOADED => decode_exact(&raw.body).map(Self::PlayerLoaded),
1355 id::PONG => decode_exact(&raw.body).map(Self::Pong),
1356 id::RECIPE_BOOK => decode_exact(&raw.body).map(Self::RecipeBook),
1357 id::DISPLAYED_RECIPE => decode_exact(&raw.body).map(Self::DisplayedRecipe),
1358 id::NAME_ITEM => decode_exact(&raw.body).map(Self::NameItem),
1359 id::RESOURCE_PACK_RECEIVE => decode_exact(&raw.body).map(Self::ResourcePackReceive),
1360 id::ADVANCEMENT_TAB => decode_exact(&raw.body).map(Self::AdvancementTab),
1361 id::SELECT_TRADE => decode_exact(&raw.body).map(Self::SelectTrade),
1362 id::SET_BEACON_EFFECT => decode_exact(&raw.body).map(Self::SetBeaconEffect),
1363 id::HELD_ITEM_SLOT => decode_exact(&raw.body).map(Self::HeldItemSlot),
1364 id::UPDATE_COMMAND_BLOCK => decode_exact(&raw.body).map(Self::UpdateCommandBlock),
1365 id::UPDATE_COMMAND_BLOCK_MINECART => {
1366 decode_exact(&raw.body).map(Self::UpdateCommandBlockMinecart)
1367 }
1368 id::SET_CREATIVE_SLOT => decode_exact(&raw.body).map(Self::SetCreativeSlot),
1369 id::SET_GAME_RULE => decode_exact(&raw.body).map(Self::SetGameRule),
1370 id::UPDATE_JIGSAW_BLOCK => decode_exact(&raw.body).map(Self::UpdateJigsawBlock),
1371 id::UPDATE_STRUCTURE_BLOCK => decode_exact(&raw.body).map(Self::UpdateStructureBlock),
1372 id::SET_TEST_BLOCK => decode_exact(&raw.body).map(Self::SetTestBlock),
1373 id::UPDATE_SIGN => decode_exact(&raw.body).map(Self::UpdateSign),
1374 id::SPECTATOR_ACTION => decode_exact(&raw.body).map(Self::SpectatorAction),
1375 id::ARM_ANIMATION => decode_exact(&raw.body).map(Self::ArmAnimation),
1376 id::SPECTATE => decode_exact(&raw.body).map(Self::Spectate),
1377 id::TEST_INSTANCE_BLOCK_ACTION => {
1378 decode_exact(&raw.body).map(Self::TestInstanceBlockAction)
1379 }
1380 id::BLOCK_PLACE => decode_exact(&raw.body).map(Self::BlockPlace),
1381 id::USE_ITEM => decode_exact(&raw.body).map(Self::UseItem),
1382 id::CUSTOM_CLICK_ACTION => decode_exact(&raw.body).map(Self::CustomClickAction),
1383 other => Err(DecodeError::UnknownPacketId(other)),
1384 }
1385 }
1386 fn id(&self) -> i32 {
1387 match *self {
1388 Self::TeleportConfirm(_) => id::TELEPORT_CONFIRM,
1389 Self::Attack(_) => id::ATTACK,
1390 Self::QueryBlockNbt(_) => id::QUERY_BLOCK_NBT,
1391 Self::SelectBundleItem(_) => id::SELECT_BUNDLE_ITEM,
1392 Self::SetDifficulty(_) => id::SET_DIFFICULTY,
1393 Self::ChangeGamemode(_) => id::CHANGE_GAMEMODE,
1394 Self::MessageAcknowledgement(_) => id::MESSAGE_ACKNOWLEDGEMENT,
1395 Self::ChatCommand(_) => id::CHAT_COMMAND,
1396 Self::ChatCommandSigned(_) => id::CHAT_COMMAND_SIGNED,
1397 Self::ChatMessage(_) => id::CHAT_MESSAGE,
1398 Self::ChatSessionUpdate(_) => id::CHAT_SESSION_UPDATE,
1399 Self::ChunkBatchReceived(_) => id::CHUNK_BATCH_RECEIVED,
1400 Self::ClientCommand(_) => id::CLIENT_COMMAND,
1401 Self::TickEnd(_) => id::TICK_END,
1402 Self::Settings(_) => id::SETTINGS,
1403 Self::TabComplete(_) => id::TAB_COMPLETE,
1404 Self::ConfigurationAcknowledged(_) => id::CONFIGURATION_ACKNOWLEDGED,
1405 Self::EnchantItem(_) => id::ENCHANT_ITEM,
1406 Self::WindowClick(_) => id::WINDOW_CLICK,
1407 Self::CloseWindow(_) => id::CLOSE_WINDOW,
1408 Self::SetSlotState(_) => id::SET_SLOT_STATE,
1409 Self::CookieResponse(_) => id::COOKIE_RESPONSE,
1410 Self::CustomPayload(_) => id::CUSTOM_PAYLOAD,
1411 Self::DebugSubscriptionRequest(_) => id::DEBUG_SUBSCRIPTION_REQUEST,
1412 Self::EditBook(_) => id::EDIT_BOOK,
1413 Self::QueryEntityNbt(_) => id::QUERY_ENTITY_NBT,
1414 Self::UseEntity(_) => id::USE_ENTITY,
1415 Self::GenerateStructure(_) => id::GENERATE_STRUCTURE,
1416 Self::KeepAlive(_) => id::KEEP_ALIVE,
1417 Self::LockDifficulty(_) => id::LOCK_DIFFICULTY,
1418 Self::Position(_) => id::POSITION,
1419 Self::PositionLook(_) => id::POSITION_LOOK,
1420 Self::Look(_) => id::LOOK,
1421 Self::Flying(_) => id::FLYING,
1422 Self::VehicleMove(_) => id::VEHICLE_MOVE,
1423 Self::SteerBoat(_) => id::STEER_BOAT,
1424 Self::PickItemFromBlock(_) => id::PICK_ITEM_FROM_BLOCK,
1425 Self::PickItemFromEntity(_) => id::PICK_ITEM_FROM_ENTITY,
1426 Self::PingRequest(_) => id::PING_REQUEST,
1427 Self::CraftRecipeRequest(_) => id::CRAFT_RECIPE_REQUEST,
1428 Self::Abilities(_) => id::ABILITIES,
1429 Self::BlockDig(_) => id::BLOCK_DIG,
1430 Self::EntityAction(_) => id::ENTITY_ACTION,
1431 Self::PlayerInput(_) => id::PLAYER_INPUT,
1432 Self::PlayerLoaded(_) => id::PLAYER_LOADED,
1433 Self::Pong(_) => id::PONG,
1434 Self::RecipeBook(_) => id::RECIPE_BOOK,
1435 Self::DisplayedRecipe(_) => id::DISPLAYED_RECIPE,
1436 Self::NameItem(_) => id::NAME_ITEM,
1437 Self::ResourcePackReceive(_) => id::RESOURCE_PACK_RECEIVE,
1438 Self::AdvancementTab(_) => id::ADVANCEMENT_TAB,
1439 Self::SelectTrade(_) => id::SELECT_TRADE,
1440 Self::SetBeaconEffect(_) => id::SET_BEACON_EFFECT,
1441 Self::HeldItemSlot(_) => id::HELD_ITEM_SLOT,
1442 Self::UpdateCommandBlock(_) => id::UPDATE_COMMAND_BLOCK,
1443 Self::UpdateCommandBlockMinecart(_) => id::UPDATE_COMMAND_BLOCK_MINECART,
1444 Self::SetCreativeSlot(_) => id::SET_CREATIVE_SLOT,
1445 Self::SetGameRule(_) => id::SET_GAME_RULE,
1446 Self::UpdateJigsawBlock(_) => id::UPDATE_JIGSAW_BLOCK,
1447 Self::UpdateStructureBlock(_) => id::UPDATE_STRUCTURE_BLOCK,
1448 Self::SetTestBlock(_) => id::SET_TEST_BLOCK,
1449 Self::UpdateSign(_) => id::UPDATE_SIGN,
1450 Self::SpectatorAction(_) => id::SPECTATOR_ACTION,
1451 Self::ArmAnimation(_) => id::ARM_ANIMATION,
1452 Self::Spectate(_) => id::SPECTATE,
1453 Self::TestInstanceBlockAction(_) => id::TEST_INSTANCE_BLOCK_ACTION,
1454 Self::BlockPlace(_) => id::BLOCK_PLACE,
1455 Self::UseItem(_) => id::USE_ITEM,
1456 Self::CustomClickAction(_) => id::CUSTOM_CLICK_ACTION,
1457 }
1458 }
1459 fn name(&self) -> &'static str {
1460 match *self {
1461 Self::TeleportConfirm(_) => "teleport_confirm",
1462 Self::Attack(_) => "attack",
1463 Self::QueryBlockNbt(_) => "query_block_nbt",
1464 Self::SelectBundleItem(_) => "select_bundle_item",
1465 Self::SetDifficulty(_) => "set_difficulty",
1466 Self::ChangeGamemode(_) => "change_gamemode",
1467 Self::MessageAcknowledgement(_) => "message_acknowledgement",
1468 Self::ChatCommand(_) => "chat_command",
1469 Self::ChatCommandSigned(_) => "chat_command_signed",
1470 Self::ChatMessage(_) => "chat_message",
1471 Self::ChatSessionUpdate(_) => "chat_session_update",
1472 Self::ChunkBatchReceived(_) => "chunk_batch_received",
1473 Self::ClientCommand(_) => "client_command",
1474 Self::TickEnd(_) => "tick_end",
1475 Self::Settings(_) => "settings",
1476 Self::TabComplete(_) => "tab_complete",
1477 Self::ConfigurationAcknowledged(_) => "configuration_acknowledged",
1478 Self::EnchantItem(_) => "enchant_item",
1479 Self::WindowClick(_) => "window_click",
1480 Self::CloseWindow(_) => "close_window",
1481 Self::SetSlotState(_) => "set_slot_state",
1482 Self::CookieResponse(_) => "cookie_response",
1483 Self::CustomPayload(_) => "custom_payload",
1484 Self::DebugSubscriptionRequest(_) => "debug_subscription_request",
1485 Self::EditBook(_) => "edit_book",
1486 Self::QueryEntityNbt(_) => "query_entity_nbt",
1487 Self::UseEntity(_) => "use_entity",
1488 Self::GenerateStructure(_) => "generate_structure",
1489 Self::KeepAlive(_) => "keep_alive",
1490 Self::LockDifficulty(_) => "lock_difficulty",
1491 Self::Position(_) => "position",
1492 Self::PositionLook(_) => "position_look",
1493 Self::Look(_) => "look",
1494 Self::Flying(_) => "flying",
1495 Self::VehicleMove(_) => "vehicle_move",
1496 Self::SteerBoat(_) => "steer_boat",
1497 Self::PickItemFromBlock(_) => "pick_item_from_block",
1498 Self::PickItemFromEntity(_) => "pick_item_from_entity",
1499 Self::PingRequest(_) => "ping_request",
1500 Self::CraftRecipeRequest(_) => "craft_recipe_request",
1501 Self::Abilities(_) => "abilities",
1502 Self::BlockDig(_) => "block_dig",
1503 Self::EntityAction(_) => "entity_action",
1504 Self::PlayerInput(_) => "player_input",
1505 Self::PlayerLoaded(_) => "player_loaded",
1506 Self::Pong(_) => "pong",
1507 Self::RecipeBook(_) => "recipe_book",
1508 Self::DisplayedRecipe(_) => "displayed_recipe",
1509 Self::NameItem(_) => "name_item",
1510 Self::ResourcePackReceive(_) => "resource_pack_receive",
1511 Self::AdvancementTab(_) => "advancement_tab",
1512 Self::SelectTrade(_) => "select_trade",
1513 Self::SetBeaconEffect(_) => "set_beacon_effect",
1514 Self::HeldItemSlot(_) => "held_item_slot",
1515 Self::UpdateCommandBlock(_) => "update_command_block",
1516 Self::UpdateCommandBlockMinecart(_) => "update_command_block_minecart",
1517 Self::SetCreativeSlot(_) => "set_creative_slot",
1518 Self::SetGameRule(_) => "set_game_rule",
1519 Self::UpdateJigsawBlock(_) => "update_jigsaw_block",
1520 Self::UpdateStructureBlock(_) => "update_structure_block",
1521 Self::SetTestBlock(_) => "set_test_block",
1522 Self::UpdateSign(_) => "update_sign",
1523 Self::SpectatorAction(_) => "spectator_action",
1524 Self::ArmAnimation(_) => "arm_animation",
1525 Self::Spectate(_) => "spectate",
1526 Self::TestInstanceBlockAction(_) => "test_instance_block_action",
1527 Self::BlockPlace(_) => "block_place",
1528 Self::UseItem(_) => "use_item",
1529 Self::CustomClickAction(_) => "custom_click_action",
1530 }
1531 }
1532 fn encode_body(&self, w: &mut BytesMut) -> EncodeResult {
1533 match *self {
1534 Self::TeleportConfirm(ref p) => p.encode(w),
1535 Self::Attack(ref p) => p.encode(w),
1536 Self::QueryBlockNbt(ref p) => p.encode(w),
1537 Self::SelectBundleItem(ref p) => p.encode(w),
1538 Self::SetDifficulty(ref p) => p.encode(w),
1539 Self::ChangeGamemode(ref p) => p.encode(w),
1540 Self::MessageAcknowledgement(ref p) => p.encode(w),
1541 Self::ChatCommand(ref p) => p.encode(w),
1542 Self::ChatCommandSigned(ref p) => p.encode(w),
1543 Self::ChatMessage(ref p) => p.encode(w),
1544 Self::ChatSessionUpdate(ref p) => p.encode(w),
1545 Self::ChunkBatchReceived(ref p) => p.encode(w),
1546 Self::ClientCommand(ref p) => p.encode(w),
1547 Self::TickEnd(ref p) => p.encode(w),
1548 Self::Settings(ref p) => p.encode(w),
1549 Self::TabComplete(ref p) => p.encode(w),
1550 Self::ConfigurationAcknowledged(ref p) => p.encode(w),
1551 Self::EnchantItem(ref p) => p.encode(w),
1552 Self::WindowClick(ref p) => p.encode(w),
1553 Self::CloseWindow(ref p) => p.encode(w),
1554 Self::SetSlotState(ref p) => p.encode(w),
1555 Self::CookieResponse(ref p) => p.encode(w),
1556 Self::CustomPayload(ref p) => p.encode(w),
1557 Self::DebugSubscriptionRequest(ref p) => p.encode(w),
1558 Self::EditBook(ref p) => p.encode(w),
1559 Self::QueryEntityNbt(ref p) => p.encode(w),
1560 Self::UseEntity(ref p) => p.encode(w),
1561 Self::GenerateStructure(ref p) => p.encode(w),
1562 Self::KeepAlive(ref p) => p.encode(w),
1563 Self::LockDifficulty(ref p) => p.encode(w),
1564 Self::Position(ref p) => p.encode(w),
1565 Self::PositionLook(ref p) => p.encode(w),
1566 Self::Look(ref p) => p.encode(w),
1567 Self::Flying(ref p) => p.encode(w),
1568 Self::VehicleMove(ref p) => p.encode(w),
1569 Self::SteerBoat(ref p) => p.encode(w),
1570 Self::PickItemFromBlock(ref p) => p.encode(w),
1571 Self::PickItemFromEntity(ref p) => p.encode(w),
1572 Self::PingRequest(ref p) => p.encode(w),
1573 Self::CraftRecipeRequest(ref p) => p.encode(w),
1574 Self::Abilities(ref p) => p.encode(w),
1575 Self::BlockDig(ref p) => p.encode(w),
1576 Self::EntityAction(ref p) => p.encode(w),
1577 Self::PlayerInput(ref p) => p.encode(w),
1578 Self::PlayerLoaded(ref p) => p.encode(w),
1579 Self::Pong(ref p) => p.encode(w),
1580 Self::RecipeBook(ref p) => p.encode(w),
1581 Self::DisplayedRecipe(ref p) => p.encode(w),
1582 Self::NameItem(ref p) => p.encode(w),
1583 Self::ResourcePackReceive(ref p) => p.encode(w),
1584 Self::AdvancementTab(ref p) => p.encode(w),
1585 Self::SelectTrade(ref p) => p.encode(w),
1586 Self::SetBeaconEffect(ref p) => p.encode(w),
1587 Self::HeldItemSlot(ref p) => p.encode(w),
1588 Self::UpdateCommandBlock(ref p) => p.encode(w),
1589 Self::UpdateCommandBlockMinecart(ref p) => p.encode(w),
1590 Self::SetCreativeSlot(ref p) => p.encode(w),
1591 Self::SetGameRule(ref p) => p.encode(w),
1592 Self::UpdateJigsawBlock(ref p) => p.encode(w),
1593 Self::UpdateStructureBlock(ref p) => p.encode(w),
1594 Self::SetTestBlock(ref p) => p.encode(w),
1595 Self::UpdateSign(ref p) => p.encode(w),
1596 Self::SpectatorAction(ref p) => p.encode(w),
1597 Self::ArmAnimation(ref p) => p.encode(w),
1598 Self::Spectate(ref p) => p.encode(w),
1599 Self::TestInstanceBlockAction(ref p) => p.encode(w),
1600 Self::BlockPlace(ref p) => p.encode(w),
1601 Self::UseItem(ref p) => p.encode(w),
1602 Self::CustomClickAction(ref p) => p.encode(w),
1603 }
1604 }
1605 fn name_of(id: i32) -> Option<&'static str> {
1606 match id {
1607 id::TELEPORT_CONFIRM => Some("teleport_confirm"),
1608 id::ATTACK => Some("attack"),
1609 id::QUERY_BLOCK_NBT => Some("query_block_nbt"),
1610 id::SELECT_BUNDLE_ITEM => Some("select_bundle_item"),
1611 id::SET_DIFFICULTY => Some("set_difficulty"),
1612 id::CHANGE_GAMEMODE => Some("change_gamemode"),
1613 id::MESSAGE_ACKNOWLEDGEMENT => Some("message_acknowledgement"),
1614 id::CHAT_COMMAND => Some("chat_command"),
1615 id::CHAT_COMMAND_SIGNED => Some("chat_command_signed"),
1616 id::CHAT_MESSAGE => Some("chat_message"),
1617 id::CHAT_SESSION_UPDATE => Some("chat_session_update"),
1618 id::CHUNK_BATCH_RECEIVED => Some("chunk_batch_received"),
1619 id::CLIENT_COMMAND => Some("client_command"),
1620 id::TICK_END => Some("tick_end"),
1621 id::SETTINGS => Some("settings"),
1622 id::TAB_COMPLETE => Some("tab_complete"),
1623 id::CONFIGURATION_ACKNOWLEDGED => Some("configuration_acknowledged"),
1624 id::ENCHANT_ITEM => Some("enchant_item"),
1625 id::WINDOW_CLICK => Some("window_click"),
1626 id::CLOSE_WINDOW => Some("close_window"),
1627 id::SET_SLOT_STATE => Some("set_slot_state"),
1628 id::COOKIE_RESPONSE => Some("cookie_response"),
1629 id::CUSTOM_PAYLOAD => Some("custom_payload"),
1630 id::DEBUG_SUBSCRIPTION_REQUEST => Some("debug_subscription_request"),
1631 id::EDIT_BOOK => Some("edit_book"),
1632 id::QUERY_ENTITY_NBT => Some("query_entity_nbt"),
1633 id::USE_ENTITY => Some("use_entity"),
1634 id::GENERATE_STRUCTURE => Some("generate_structure"),
1635 id::KEEP_ALIVE => Some("keep_alive"),
1636 id::LOCK_DIFFICULTY => Some("lock_difficulty"),
1637 id::POSITION => Some("position"),
1638 id::POSITION_LOOK => Some("position_look"),
1639 id::LOOK => Some("look"),
1640 id::FLYING => Some("flying"),
1641 id::VEHICLE_MOVE => Some("vehicle_move"),
1642 id::STEER_BOAT => Some("steer_boat"),
1643 id::PICK_ITEM_FROM_BLOCK => Some("pick_item_from_block"),
1644 id::PICK_ITEM_FROM_ENTITY => Some("pick_item_from_entity"),
1645 id::PING_REQUEST => Some("ping_request"),
1646 id::CRAFT_RECIPE_REQUEST => Some("craft_recipe_request"),
1647 id::ABILITIES => Some("abilities"),
1648 id::BLOCK_DIG => Some("block_dig"),
1649 id::ENTITY_ACTION => Some("entity_action"),
1650 id::PLAYER_INPUT => Some("player_input"),
1651 id::PLAYER_LOADED => Some("player_loaded"),
1652 id::PONG => Some("pong"),
1653 id::RECIPE_BOOK => Some("recipe_book"),
1654 id::DISPLAYED_RECIPE => Some("displayed_recipe"),
1655 id::NAME_ITEM => Some("name_item"),
1656 id::RESOURCE_PACK_RECEIVE => Some("resource_pack_receive"),
1657 id::ADVANCEMENT_TAB => Some("advancement_tab"),
1658 id::SELECT_TRADE => Some("select_trade"),
1659 id::SET_BEACON_EFFECT => Some("set_beacon_effect"),
1660 id::HELD_ITEM_SLOT => Some("held_item_slot"),
1661 id::UPDATE_COMMAND_BLOCK => Some("update_command_block"),
1662 id::UPDATE_COMMAND_BLOCK_MINECART => Some("update_command_block_minecart"),
1663 id::SET_CREATIVE_SLOT => Some("set_creative_slot"),
1664 id::SET_GAME_RULE => Some("set_game_rule"),
1665 id::UPDATE_JIGSAW_BLOCK => Some("update_jigsaw_block"),
1666 id::UPDATE_STRUCTURE_BLOCK => Some("update_structure_block"),
1667 id::SET_TEST_BLOCK => Some("set_test_block"),
1668 id::UPDATE_SIGN => Some("update_sign"),
1669 id::SPECTATOR_ACTION => Some("spectator_action"),
1670 id::ARM_ANIMATION => Some("arm_animation"),
1671 id::SPECTATE => Some("spectate"),
1672 id::TEST_INSTANCE_BLOCK_ACTION => Some("test_instance_block_action"),
1673 id::BLOCK_PLACE => Some("block_place"),
1674 id::USE_ITEM => Some("use_item"),
1675 id::CUSTOM_CLICK_ACTION => Some("custom_click_action"),
1676 _ => None,
1677 }
1678 }
1679}
1680
1681impl ServerboundPlayPacket {
1682 pub const IDS: &'static [i32] = &[
1684 id::TELEPORT_CONFIRM,
1685 id::ATTACK,
1686 id::QUERY_BLOCK_NBT,
1687 id::SELECT_BUNDLE_ITEM,
1688 id::SET_DIFFICULTY,
1689 id::CHANGE_GAMEMODE,
1690 id::MESSAGE_ACKNOWLEDGEMENT,
1691 id::CHAT_COMMAND,
1692 id::CHAT_COMMAND_SIGNED,
1693 id::CHAT_MESSAGE,
1694 id::CHAT_SESSION_UPDATE,
1695 id::CHUNK_BATCH_RECEIVED,
1696 id::CLIENT_COMMAND,
1697 id::TICK_END,
1698 id::SETTINGS,
1699 id::TAB_COMPLETE,
1700 id::CONFIGURATION_ACKNOWLEDGED,
1701 id::ENCHANT_ITEM,
1702 id::WINDOW_CLICK,
1703 id::CLOSE_WINDOW,
1704 id::SET_SLOT_STATE,
1705 id::COOKIE_RESPONSE,
1706 id::CUSTOM_PAYLOAD,
1707 id::DEBUG_SUBSCRIPTION_REQUEST,
1708 id::EDIT_BOOK,
1709 id::QUERY_ENTITY_NBT,
1710 id::USE_ENTITY,
1711 id::GENERATE_STRUCTURE,
1712 id::KEEP_ALIVE,
1713 id::LOCK_DIFFICULTY,
1714 id::POSITION,
1715 id::POSITION_LOOK,
1716 id::LOOK,
1717 id::FLYING,
1718 id::VEHICLE_MOVE,
1719 id::STEER_BOAT,
1720 id::PICK_ITEM_FROM_BLOCK,
1721 id::PICK_ITEM_FROM_ENTITY,
1722 id::PING_REQUEST,
1723 id::CRAFT_RECIPE_REQUEST,
1724 id::ABILITIES,
1725 id::BLOCK_DIG,
1726 id::ENTITY_ACTION,
1727 id::PLAYER_INPUT,
1728 id::PLAYER_LOADED,
1729 id::PONG,
1730 id::RECIPE_BOOK,
1731 id::DISPLAYED_RECIPE,
1732 id::NAME_ITEM,
1733 id::RESOURCE_PACK_RECEIVE,
1734 id::ADVANCEMENT_TAB,
1735 id::SELECT_TRADE,
1736 id::SET_BEACON_EFFECT,
1737 id::HELD_ITEM_SLOT,
1738 id::UPDATE_COMMAND_BLOCK,
1739 id::UPDATE_COMMAND_BLOCK_MINECART,
1740 id::SET_CREATIVE_SLOT,
1741 id::SET_GAME_RULE,
1742 id::UPDATE_JIGSAW_BLOCK,
1743 id::UPDATE_STRUCTURE_BLOCK,
1744 id::SET_TEST_BLOCK,
1745 id::UPDATE_SIGN,
1746 id::SPECTATOR_ACTION,
1747 id::ARM_ANIMATION,
1748 id::SPECTATE,
1749 id::TEST_INSTANCE_BLOCK_ACTION,
1750 id::BLOCK_PLACE,
1751 id::USE_ITEM,
1752 id::CUSTOM_CLICK_ACTION,
1753 ];
1754 #[cfg(feature = "testgen")]
1756 pub fn generate_by_id(id: i32, g: &mut Gen) -> Option<Self> {
1757 match id {
1758 id::TELEPORT_CONFIRM => Some(Self::TeleportConfirm(
1759 <TeleportConfirm as Generate>::generate(g),
1760 )),
1761 id::ATTACK => Some(Self::Attack(<Attack as Generate>::generate(g))),
1762 id::QUERY_BLOCK_NBT => Some(Self::QueryBlockNbt(
1763 <QueryBlockNbt as Generate>::generate(g),
1764 )),
1765 id::SELECT_BUNDLE_ITEM => Some(Self::SelectBundleItem(
1766 <SelectBundleItem as Generate>::generate(g),
1767 )),
1768 id::SET_DIFFICULTY => Some(Self::SetDifficulty(<SetDifficulty as Generate>::generate(
1769 g,
1770 ))),
1771 id::CHANGE_GAMEMODE => Some(Self::ChangeGamemode(
1772 <ChangeGamemode as Generate>::generate(g),
1773 )),
1774 id::MESSAGE_ACKNOWLEDGEMENT => Some(Self::MessageAcknowledgement(
1775 <MessageAcknowledgement as Generate>::generate(g),
1776 )),
1777 id::CHAT_COMMAND => Some(Self::ChatCommand(<ChatCommand as Generate>::generate(g))),
1778 id::CHAT_COMMAND_SIGNED => Some(Self::ChatCommandSigned(
1779 <ChatCommandSigned as Generate>::generate(g),
1780 )),
1781 id::CHAT_MESSAGE => Some(Self::ChatMessage(<ChatMessage as Generate>::generate(g))),
1782 id::CHAT_SESSION_UPDATE => Some(Self::ChatSessionUpdate(
1783 <ChatSessionUpdate as Generate>::generate(g),
1784 )),
1785 id::CHUNK_BATCH_RECEIVED => Some(Self::ChunkBatchReceived(
1786 <ChunkBatchReceived as Generate>::generate(g),
1787 )),
1788 id::CLIENT_COMMAND => Some(Self::ClientCommand(<ClientCommand as Generate>::generate(
1789 g,
1790 ))),
1791 id::TICK_END => Some(Self::TickEnd(<TickEnd as Generate>::generate(g))),
1792 id::SETTINGS => Some(Self::Settings(<Settings as Generate>::generate(g))),
1793 id::TAB_COMPLETE => Some(Self::TabComplete(<TabComplete as Generate>::generate(g))),
1794 id::CONFIGURATION_ACKNOWLEDGED => Some(Self::ConfigurationAcknowledged(
1795 <ConfigurationAcknowledged as Generate>::generate(g),
1796 )),
1797 id::ENCHANT_ITEM => Some(Self::EnchantItem(<EnchantItem as Generate>::generate(g))),
1798 id::WINDOW_CLICK => Some(Self::WindowClick(<WindowClick as Generate>::generate(g))),
1799 id::CLOSE_WINDOW => Some(Self::CloseWindow(<CloseWindow as Generate>::generate(g))),
1800 id::SET_SLOT_STATE => Some(Self::SetSlotState(<SetSlotState as Generate>::generate(g))),
1801 id::COOKIE_RESPONSE => Some(Self::CookieResponse(
1802 <CookieResponse as Generate>::generate(g),
1803 )),
1804 id::CUSTOM_PAYLOAD => Some(Self::CustomPayload(<CustomPayload as Generate>::generate(
1805 g,
1806 ))),
1807 id::DEBUG_SUBSCRIPTION_REQUEST => Some(Self::DebugSubscriptionRequest(
1808 <DebugSubscriptionRequest as Generate>::generate(g),
1809 )),
1810 id::EDIT_BOOK => Some(Self::EditBook(<EditBook as Generate>::generate(g))),
1811 id::QUERY_ENTITY_NBT => Some(Self::QueryEntityNbt(
1812 <QueryEntityNbt as Generate>::generate(g),
1813 )),
1814 id::USE_ENTITY => Some(Self::UseEntity(<UseEntity as Generate>::generate(g))),
1815 id::GENERATE_STRUCTURE => Some(Self::GenerateStructure(
1816 <GenerateStructure as Generate>::generate(g),
1817 )),
1818 id::KEEP_ALIVE => Some(Self::KeepAlive(<KeepAlive as Generate>::generate(g))),
1819 id::LOCK_DIFFICULTY => Some(Self::LockDifficulty(
1820 <LockDifficulty as Generate>::generate(g),
1821 )),
1822 id::POSITION => Some(Self::Position(<Position as Generate>::generate(g))),
1823 id::POSITION_LOOK => Some(Self::PositionLook(<PositionLook as Generate>::generate(g))),
1824 id::LOOK => Some(Self::Look(<Look as Generate>::generate(g))),
1825 id::FLYING => Some(Self::Flying(<Flying as Generate>::generate(g))),
1826 id::VEHICLE_MOVE => Some(Self::VehicleMove(<VehicleMove as Generate>::generate(g))),
1827 id::STEER_BOAT => Some(Self::SteerBoat(<SteerBoat as Generate>::generate(g))),
1828 id::PICK_ITEM_FROM_BLOCK => Some(Self::PickItemFromBlock(
1829 <PickItemFromBlock as Generate>::generate(g),
1830 )),
1831 id::PICK_ITEM_FROM_ENTITY => Some(Self::PickItemFromEntity(
1832 <PickItemFromEntity as Generate>::generate(g),
1833 )),
1834 id::PING_REQUEST => Some(Self::PingRequest(<PingRequest as Generate>::generate(g))),
1835 id::CRAFT_RECIPE_REQUEST => Some(Self::CraftRecipeRequest(
1836 <CraftRecipeRequest as Generate>::generate(g),
1837 )),
1838 id::ABILITIES => Some(Self::Abilities(<Abilities as Generate>::generate(g))),
1839 id::BLOCK_DIG => Some(Self::BlockDig(<BlockDig as Generate>::generate(g))),
1840 id::ENTITY_ACTION => Some(Self::EntityAction(<EntityAction as Generate>::generate(g))),
1841 id::PLAYER_INPUT => Some(Self::PlayerInput(<PlayerInput as Generate>::generate(g))),
1842 id::PLAYER_LOADED => Some(Self::PlayerLoaded(<PlayerLoaded as Generate>::generate(g))),
1843 id::PONG => Some(Self::Pong(<Pong as Generate>::generate(g))),
1844 id::RECIPE_BOOK => Some(Self::RecipeBook(<RecipeBook as Generate>::generate(g))),
1845 id::DISPLAYED_RECIPE => Some(Self::DisplayedRecipe(
1846 <DisplayedRecipe as Generate>::generate(g),
1847 )),
1848 id::NAME_ITEM => Some(Self::NameItem(<NameItem as Generate>::generate(g))),
1849 id::RESOURCE_PACK_RECEIVE => Some(Self::ResourcePackReceive(
1850 <ResourcePackReceive as Generate>::generate(g),
1851 )),
1852 id::ADVANCEMENT_TAB => Some(Self::AdvancementTab(
1853 <AdvancementTab as Generate>::generate(g),
1854 )),
1855 id::SELECT_TRADE => Some(Self::SelectTrade(<SelectTrade as Generate>::generate(g))),
1856 id::SET_BEACON_EFFECT => Some(Self::SetBeaconEffect(
1857 <SetBeaconEffect as Generate>::generate(g),
1858 )),
1859 id::HELD_ITEM_SLOT => Some(Self::HeldItemSlot(<HeldItemSlot as Generate>::generate(g))),
1860 id::UPDATE_COMMAND_BLOCK => Some(Self::UpdateCommandBlock(
1861 <UpdateCommandBlock as Generate>::generate(g),
1862 )),
1863 id::UPDATE_COMMAND_BLOCK_MINECART => Some(Self::UpdateCommandBlockMinecart(
1864 <UpdateCommandBlockMinecart as Generate>::generate(g),
1865 )),
1866 id::SET_CREATIVE_SLOT => Some(Self::SetCreativeSlot(
1867 <SetCreativeSlot as Generate>::generate(g),
1868 )),
1869 id::SET_GAME_RULE => Some(Self::SetGameRule(<SetGameRule as Generate>::generate(g))),
1870 id::UPDATE_JIGSAW_BLOCK => Some(Self::UpdateJigsawBlock(
1871 <UpdateJigsawBlock as Generate>::generate(g),
1872 )),
1873 id::UPDATE_STRUCTURE_BLOCK => Some(Self::UpdateStructureBlock(
1874 <UpdateStructureBlock as Generate>::generate(g),
1875 )),
1876 id::SET_TEST_BLOCK => Some(Self::SetTestBlock(<SetTestBlock as Generate>::generate(g))),
1877 id::UPDATE_SIGN => Some(Self::UpdateSign(<UpdateSign as Generate>::generate(g))),
1878 id::SPECTATOR_ACTION => Some(Self::SpectatorAction(
1879 <SpectatorAction as Generate>::generate(g),
1880 )),
1881 id::ARM_ANIMATION => Some(Self::ArmAnimation(<ArmAnimation as Generate>::generate(g))),
1882 id::SPECTATE => Some(Self::Spectate(<Spectate as Generate>::generate(g))),
1883 id::TEST_INSTANCE_BLOCK_ACTION => Some(Self::TestInstanceBlockAction(
1884 <TestInstanceBlockAction as Generate>::generate(g),
1885 )),
1886 id::BLOCK_PLACE => Some(Self::BlockPlace(<BlockPlace as Generate>::generate(g))),
1887 id::USE_ITEM => Some(Self::UseItem(<UseItem as Generate>::generate(g))),
1888 id::CUSTOM_CLICK_ACTION => Some(Self::CustomClickAction(
1889 <CustomClickAction as Generate>::generate(g),
1890 )),
1891 _ => None,
1892 }
1893 }
1894}