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 QUERY_BLOCK_NBT: i32 = 0x01;
34 pub const SET_DIFFICULTY: i32 = 0x02;
36 pub const CHAT: i32 = 0x03;
38 pub const CLIENT_COMMAND: i32 = 0x04;
40 pub const SETTINGS: i32 = 0x05;
42 pub const TAB_COMPLETE: i32 = 0x06;
44 pub const TRANSACTION: i32 = 0x07;
46 pub const ENCHANT_ITEM: i32 = 0x08;
48 pub const WINDOW_CLICK: i32 = 0x09;
50 pub const CLOSE_WINDOW: i32 = 0x0a;
52 pub const CUSTOM_PAYLOAD: i32 = 0x0b;
54 pub const EDIT_BOOK: i32 = 0x0c;
56 pub const QUERY_ENTITY_NBT: i32 = 0x0d;
58 pub const USE_ENTITY: i32 = 0x0e;
60 pub const GENERATE_STRUCTURE: i32 = 0x0f;
62 pub const KEEP_ALIVE: i32 = 0x10;
64 pub const LOCK_DIFFICULTY: i32 = 0x11;
66 pub const POSITION: i32 = 0x12;
68 pub const POSITION_LOOK: i32 = 0x13;
70 pub const LOOK: i32 = 0x14;
72 pub const FLYING: i32 = 0x15;
74 pub const VEHICLE_MOVE: i32 = 0x16;
76 pub const STEER_BOAT: i32 = 0x17;
78 pub const PICK_ITEM: i32 = 0x18;
80 pub const CRAFT_RECIPE_REQUEST: i32 = 0x19;
82 pub const ABILITIES: i32 = 0x1a;
84 pub const BLOCK_DIG: i32 = 0x1b;
86 pub const ENTITY_ACTION: i32 = 0x1c;
88 pub const STEER_VEHICLE: i32 = 0x1d;
90 pub const RECIPE_BOOK: i32 = 0x1e;
92 pub const DISPLAYED_RECIPE: i32 = 0x1f;
94 pub const NAME_ITEM: i32 = 0x20;
96 pub const RESOURCE_PACK_RECEIVE: i32 = 0x21;
98 pub const ADVANCEMENT_TAB: i32 = 0x22;
100 pub const SELECT_TRADE: i32 = 0x23;
102 pub const SET_BEACON_EFFECT: i32 = 0x24;
104 pub const HELD_ITEM_SLOT: i32 = 0x25;
106 pub const UPDATE_COMMAND_BLOCK: i32 = 0x26;
108 pub const UPDATE_COMMAND_BLOCK_MINECART: i32 = 0x27;
110 pub const SET_CREATIVE_SLOT: i32 = 0x28;
112 pub const UPDATE_JIGSAW_BLOCK: i32 = 0x29;
114 pub const UPDATE_STRUCTURE_BLOCK: i32 = 0x2a;
116 pub const UPDATE_SIGN: i32 = 0x2b;
118 pub const ARM_ANIMATION: i32 = 0x2c;
120 pub const SPECTATE: i32 = 0x2d;
122 pub const BLOCK_PLACE: i32 = 0x2e;
124 pub const USE_ITEM: i32 = 0x2f;
126}
127
128pub use crate::defs::p340::play::serverbound::ClientCommandActionId;
129pub use crate::defs::p340::play::serverbound::EntityActionActionId;
130pub use crate::defs::p754::play::serverbound::SetDifficultyNewDifficulty;
131
132pub type TeleportConfirm = crate::defs::p340::play::serverbound::TeleportConfirm<754>;
134impl crate::packet::Packet for TeleportConfirm {
135 const ID: i32 = id::TELEPORT_CONFIRM;
136 const NAME: &'static str = "teleport_confirm";
137 const STATE: State = State::Play;
138 const DIRECTION: Direction = Direction::Serverbound;
139}
140impl From<TeleportConfirm> for ServerboundPlayPacket {
141 fn from(p: TeleportConfirm) -> Self {
142 Self::TeleportConfirm(p)
143 }
144}
145
146pub type QueryBlockNbt = crate::defs::p754::play::serverbound::QueryBlockNbt<754>;
148impl crate::packet::Packet for QueryBlockNbt {
149 const ID: i32 = id::QUERY_BLOCK_NBT;
150 const NAME: &'static str = "query_block_nbt";
151 const STATE: State = State::Play;
152 const DIRECTION: Direction = Direction::Serverbound;
153}
154impl From<QueryBlockNbt> for ServerboundPlayPacket {
155 fn from(p: QueryBlockNbt) -> Self {
156 Self::QueryBlockNbt(p)
157 }
158}
159
160pub type SetDifficulty = crate::defs::p754::play::serverbound::SetDifficulty<754>;
162impl crate::packet::Packet for SetDifficulty {
163 const ID: i32 = id::SET_DIFFICULTY;
164 const NAME: &'static str = "set_difficulty";
165 const STATE: State = State::Play;
166 const DIRECTION: Direction = Direction::Serverbound;
167}
168impl From<SetDifficulty> for ServerboundPlayPacket {
169 fn from(p: SetDifficulty) -> Self {
170 Self::SetDifficulty(p)
171 }
172}
173
174pub type Chat = crate::defs::p47::play::serverbound::Chat<754>;
176impl crate::packet::Packet for Chat {
177 const ID: i32 = id::CHAT;
178 const NAME: &'static str = "chat";
179 const STATE: State = State::Play;
180 const DIRECTION: Direction = Direction::Serverbound;
181}
182impl From<Chat> for ServerboundPlayPacket {
183 fn from(p: Chat) -> Self {
184 Self::Chat(p)
185 }
186}
187
188pub type ClientCommand = crate::defs::p340::play::serverbound::ClientCommand<754>;
190impl crate::packet::Packet for ClientCommand {
191 const ID: i32 = id::CLIENT_COMMAND;
192 const NAME: &'static str = "client_command";
193 const STATE: State = State::Play;
194 const DIRECTION: Direction = Direction::Serverbound;
195}
196impl From<ClientCommand> for ServerboundPlayPacket {
197 fn from(p: ClientCommand) -> Self {
198 Self::ClientCommand(p)
199 }
200}
201
202pub type Settings = crate::defs::p340::play::serverbound::Settings<754>;
204impl crate::packet::Packet for Settings {
205 const ID: i32 = id::SETTINGS;
206 const NAME: &'static str = "settings";
207 const STATE: State = State::Play;
208 const DIRECTION: Direction = Direction::Serverbound;
209}
210impl From<Settings> for ServerboundPlayPacket {
211 fn from(p: Settings) -> Self {
212 Self::Settings(p)
213 }
214}
215
216pub type TabComplete = crate::defs::p754::play::serverbound::TabComplete<754>;
218impl crate::packet::Packet for TabComplete {
219 const ID: i32 = id::TAB_COMPLETE;
220 const NAME: &'static str = "tab_complete";
221 const STATE: State = State::Play;
222 const DIRECTION: Direction = Direction::Serverbound;
223}
224impl From<TabComplete> for ServerboundPlayPacket {
225 fn from(p: TabComplete) -> Self {
226 Self::TabComplete(p)
227 }
228}
229
230pub type Transaction = crate::defs::p47::play::serverbound::Transaction<754>;
232impl crate::packet::Packet for Transaction {
233 const ID: i32 = id::TRANSACTION;
234 const NAME: &'static str = "transaction";
235 const STATE: State = State::Play;
236 const DIRECTION: Direction = Direction::Serverbound;
237}
238impl From<Transaction> for ServerboundPlayPacket {
239 fn from(p: Transaction) -> Self {
240 Self::Transaction(p)
241 }
242}
243
244pub type EnchantItem = crate::defs::p47::play::serverbound::EnchantItem<754>;
246impl crate::packet::Packet for EnchantItem {
247 const ID: i32 = id::ENCHANT_ITEM;
248 const NAME: &'static str = "enchant_item";
249 const STATE: State = State::Play;
250 const DIRECTION: Direction = Direction::Serverbound;
251}
252impl From<EnchantItem> for ServerboundPlayPacket {
253 fn from(p: EnchantItem) -> Self {
254 Self::EnchantItem(p)
255 }
256}
257
258pub type WindowClick = crate::defs::p754::play::serverbound::WindowClick<754>;
260impl crate::packet::Packet for WindowClick {
261 const ID: i32 = id::WINDOW_CLICK;
262 const NAME: &'static str = "window_click";
263 const STATE: State = State::Play;
264 const DIRECTION: Direction = Direction::Serverbound;
265}
266impl From<WindowClick> for ServerboundPlayPacket {
267 fn from(p: WindowClick) -> Self {
268 Self::WindowClick(p)
269 }
270}
271
272pub type CloseWindow = crate::defs::p47::play::serverbound::CloseWindow<754>;
274impl crate::packet::Packet for CloseWindow {
275 const ID: i32 = id::CLOSE_WINDOW;
276 const NAME: &'static str = "close_window";
277 const STATE: State = State::Play;
278 const DIRECTION: Direction = Direction::Serverbound;
279}
280impl From<CloseWindow> for ServerboundPlayPacket {
281 fn from(p: CloseWindow) -> Self {
282 Self::CloseWindow(p)
283 }
284}
285
286pub type CustomPayload = crate::defs::p47::play::serverbound::CustomPayload<754>;
288impl crate::packet::Packet for CustomPayload {
289 const ID: i32 = id::CUSTOM_PAYLOAD;
290 const NAME: &'static str = "custom_payload";
291 const STATE: State = State::Play;
292 const DIRECTION: Direction = Direction::Serverbound;
293}
294impl From<CustomPayload> for ServerboundPlayPacket {
295 fn from(p: CustomPayload) -> Self {
296 Self::CustomPayload(p)
297 }
298}
299
300pub type EditBook = crate::defs::p754::play::serverbound::EditBook<754>;
302impl crate::packet::Packet for EditBook {
303 const ID: i32 = id::EDIT_BOOK;
304 const NAME: &'static str = "edit_book";
305 const STATE: State = State::Play;
306 const DIRECTION: Direction = Direction::Serverbound;
307}
308impl From<EditBook> for ServerboundPlayPacket {
309 fn from(p: EditBook) -> Self {
310 Self::EditBook(p)
311 }
312}
313
314pub type QueryEntityNbt = crate::defs::p754::play::serverbound::QueryEntityNbt<754>;
316impl crate::packet::Packet for QueryEntityNbt {
317 const ID: i32 = id::QUERY_ENTITY_NBT;
318 const NAME: &'static str = "query_entity_nbt";
319 const STATE: State = State::Play;
320 const DIRECTION: Direction = Direction::Serverbound;
321}
322impl From<QueryEntityNbt> for ServerboundPlayPacket {
323 fn from(p: QueryEntityNbt) -> Self {
324 Self::QueryEntityNbt(p)
325 }
326}
327
328pub type UseEntity = crate::defs::p754::play::serverbound::UseEntity<754>;
330impl crate::packet::Packet for UseEntity {
331 const ID: i32 = id::USE_ENTITY;
332 const NAME: &'static str = "use_entity";
333 const STATE: State = State::Play;
334 const DIRECTION: Direction = Direction::Serverbound;
335}
336impl From<UseEntity> for ServerboundPlayPacket {
337 fn from(p: UseEntity) -> Self {
338 Self::UseEntity(p)
339 }
340}
341
342pub type GenerateStructure = crate::defs::p754::play::serverbound::GenerateStructure<754>;
344impl crate::packet::Packet for GenerateStructure {
345 const ID: i32 = id::GENERATE_STRUCTURE;
346 const NAME: &'static str = "generate_structure";
347 const STATE: State = State::Play;
348 const DIRECTION: Direction = Direction::Serverbound;
349}
350impl From<GenerateStructure> for ServerboundPlayPacket {
351 fn from(p: GenerateStructure) -> Self {
352 Self::GenerateStructure(p)
353 }
354}
355
356pub type KeepAlive = crate::defs::p340::play::serverbound::KeepAlive<754>;
358impl crate::packet::Packet for KeepAlive {
359 const ID: i32 = id::KEEP_ALIVE;
360 const NAME: &'static str = "keep_alive";
361 const STATE: State = State::Play;
362 const DIRECTION: Direction = Direction::Serverbound;
363}
364impl From<KeepAlive> for ServerboundPlayPacket {
365 fn from(p: KeepAlive) -> Self {
366 Self::KeepAlive(p)
367 }
368}
369
370pub type LockDifficulty = crate::defs::p754::play::serverbound::LockDifficulty<754>;
372impl crate::packet::Packet for LockDifficulty {
373 const ID: i32 = id::LOCK_DIFFICULTY;
374 const NAME: &'static str = "lock_difficulty";
375 const STATE: State = State::Play;
376 const DIRECTION: Direction = Direction::Serverbound;
377}
378impl From<LockDifficulty> for ServerboundPlayPacket {
379 fn from(p: LockDifficulty) -> Self {
380 Self::LockDifficulty(p)
381 }
382}
383
384pub type Position = crate::defs::p47::play::serverbound::Position<754>;
386impl crate::packet::Packet for Position {
387 const ID: i32 = id::POSITION;
388 const NAME: &'static str = "position";
389 const STATE: State = State::Play;
390 const DIRECTION: Direction = Direction::Serverbound;
391}
392impl From<Position> for ServerboundPlayPacket {
393 fn from(p: Position) -> Self {
394 Self::Position(p)
395 }
396}
397
398pub type PositionLook = crate::defs::p47::play::serverbound::PositionLook<754>;
400impl crate::packet::Packet for PositionLook {
401 const ID: i32 = id::POSITION_LOOK;
402 const NAME: &'static str = "position_look";
403 const STATE: State = State::Play;
404 const DIRECTION: Direction = Direction::Serverbound;
405}
406impl From<PositionLook> for ServerboundPlayPacket {
407 fn from(p: PositionLook) -> Self {
408 Self::PositionLook(p)
409 }
410}
411
412pub type Look = crate::defs::p47::play::serverbound::Look<754>;
414impl crate::packet::Packet for Look {
415 const ID: i32 = id::LOOK;
416 const NAME: &'static str = "look";
417 const STATE: State = State::Play;
418 const DIRECTION: Direction = Direction::Serverbound;
419}
420impl From<Look> for ServerboundPlayPacket {
421 fn from(p: Look) -> Self {
422 Self::Look(p)
423 }
424}
425
426pub type Flying = crate::defs::p47::play::serverbound::Flying<754>;
428impl crate::packet::Packet for Flying {
429 const ID: i32 = id::FLYING;
430 const NAME: &'static str = "flying";
431 const STATE: State = State::Play;
432 const DIRECTION: Direction = Direction::Serverbound;
433}
434impl From<Flying> for ServerboundPlayPacket {
435 fn from(p: Flying) -> Self {
436 Self::Flying(p)
437 }
438}
439
440pub type VehicleMove = crate::defs::p340::play::serverbound::VehicleMove<754>;
442impl crate::packet::Packet for VehicleMove {
443 const ID: i32 = id::VEHICLE_MOVE;
444 const NAME: &'static str = "vehicle_move";
445 const STATE: State = State::Play;
446 const DIRECTION: Direction = Direction::Serverbound;
447}
448impl From<VehicleMove> for ServerboundPlayPacket {
449 fn from(p: VehicleMove) -> Self {
450 Self::VehicleMove(p)
451 }
452}
453
454pub type SteerBoat = crate::defs::p340::play::serverbound::SteerBoat<754>;
456impl crate::packet::Packet for SteerBoat {
457 const ID: i32 = id::STEER_BOAT;
458 const NAME: &'static str = "steer_boat";
459 const STATE: State = State::Play;
460 const DIRECTION: Direction = Direction::Serverbound;
461}
462impl From<SteerBoat> for ServerboundPlayPacket {
463 fn from(p: SteerBoat) -> Self {
464 Self::SteerBoat(p)
465 }
466}
467
468pub type PickItem = crate::defs::p754::play::serverbound::PickItem<754>;
470impl crate::packet::Packet for PickItem {
471 const ID: i32 = id::PICK_ITEM;
472 const NAME: &'static str = "pick_item";
473 const STATE: State = State::Play;
474 const DIRECTION: Direction = Direction::Serverbound;
475}
476impl From<PickItem> for ServerboundPlayPacket {
477 fn from(p: PickItem) -> Self {
478 Self::PickItem(p)
479 }
480}
481
482pub type CraftRecipeRequest = crate::defs::p754::play::serverbound::CraftRecipeRequest<754>;
484impl crate::packet::Packet for CraftRecipeRequest {
485 const ID: i32 = id::CRAFT_RECIPE_REQUEST;
486 const NAME: &'static str = "craft_recipe_request";
487 const STATE: State = State::Play;
488 const DIRECTION: Direction = Direction::Serverbound;
489}
490impl From<CraftRecipeRequest> for ServerboundPlayPacket {
491 fn from(p: CraftRecipeRequest) -> Self {
492 Self::CraftRecipeRequest(p)
493 }
494}
495
496pub type Abilities = crate::defs::p754::play::serverbound::Abilities<754>;
498impl crate::packet::Packet for Abilities {
499 const ID: i32 = id::ABILITIES;
500 const NAME: &'static str = "abilities";
501 const STATE: State = State::Play;
502 const DIRECTION: Direction = Direction::Serverbound;
503}
504impl From<Abilities> for ServerboundPlayPacket {
505 fn from(p: Abilities) -> Self {
506 Self::Abilities(p)
507 }
508}
509
510pub type BlockDig = crate::defs::p754::play::serverbound::BlockDig<754>;
512impl crate::packet::Packet for BlockDig {
513 const ID: i32 = id::BLOCK_DIG;
514 const NAME: &'static str = "block_dig";
515 const STATE: State = State::Play;
516 const DIRECTION: Direction = Direction::Serverbound;
517}
518impl From<BlockDig> for ServerboundPlayPacket {
519 fn from(p: BlockDig) -> Self {
520 Self::BlockDig(p)
521 }
522}
523
524pub type EntityAction = crate::defs::p340::play::serverbound::EntityAction<754>;
526impl crate::packet::Packet for EntityAction {
527 const ID: i32 = id::ENTITY_ACTION;
528 const NAME: &'static str = "entity_action";
529 const STATE: State = State::Play;
530 const DIRECTION: Direction = Direction::Serverbound;
531}
532impl From<EntityAction> for ServerboundPlayPacket {
533 fn from(p: EntityAction) -> Self {
534 Self::EntityAction(p)
535 }
536}
537
538pub type SteerVehicle = crate::defs::p47::play::serverbound::SteerVehicle<754>;
540impl crate::packet::Packet for SteerVehicle {
541 const ID: i32 = id::STEER_VEHICLE;
542 const NAME: &'static str = "steer_vehicle";
543 const STATE: State = State::Play;
544 const DIRECTION: Direction = Direction::Serverbound;
545}
546impl From<SteerVehicle> for ServerboundPlayPacket {
547 fn from(p: SteerVehicle) -> Self {
548 Self::SteerVehicle(p)
549 }
550}
551
552pub type RecipeBook = crate::defs::p754::play::serverbound::RecipeBook<754>;
554impl crate::packet::Packet for RecipeBook {
555 const ID: i32 = id::RECIPE_BOOK;
556 const NAME: &'static str = "recipe_book";
557 const STATE: State = State::Play;
558 const DIRECTION: Direction = Direction::Serverbound;
559}
560impl From<RecipeBook> for ServerboundPlayPacket {
561 fn from(p: RecipeBook) -> Self {
562 Self::RecipeBook(p)
563 }
564}
565
566pub type DisplayedRecipe = crate::defs::p754::play::serverbound::DisplayedRecipe<754>;
568impl crate::packet::Packet for DisplayedRecipe {
569 const ID: i32 = id::DISPLAYED_RECIPE;
570 const NAME: &'static str = "displayed_recipe";
571 const STATE: State = State::Play;
572 const DIRECTION: Direction = Direction::Serverbound;
573}
574impl From<DisplayedRecipe> for ServerboundPlayPacket {
575 fn from(p: DisplayedRecipe) -> Self {
576 Self::DisplayedRecipe(p)
577 }
578}
579
580pub type NameItem = crate::defs::p754::play::serverbound::NameItem<754>;
582impl crate::packet::Packet for NameItem {
583 const ID: i32 = id::NAME_ITEM;
584 const NAME: &'static str = "name_item";
585 const STATE: State = State::Play;
586 const DIRECTION: Direction = Direction::Serverbound;
587}
588impl From<NameItem> for ServerboundPlayPacket {
589 fn from(p: NameItem) -> Self {
590 Self::NameItem(p)
591 }
592}
593
594pub type ResourcePackReceive = crate::defs::p340::play::serverbound::ResourcePackReceive<754>;
596impl crate::packet::Packet for ResourcePackReceive {
597 const ID: i32 = id::RESOURCE_PACK_RECEIVE;
598 const NAME: &'static str = "resource_pack_receive";
599 const STATE: State = State::Play;
600 const DIRECTION: Direction = Direction::Serverbound;
601}
602impl From<ResourcePackReceive> for ServerboundPlayPacket {
603 fn from(p: ResourcePackReceive) -> Self {
604 Self::ResourcePackReceive(p)
605 }
606}
607
608pub type AdvancementTab = crate::defs::p340::play::serverbound::AdvancementTab<754>;
610impl crate::packet::Packet for AdvancementTab {
611 const ID: i32 = id::ADVANCEMENT_TAB;
612 const NAME: &'static str = "advancement_tab";
613 const STATE: State = State::Play;
614 const DIRECTION: Direction = Direction::Serverbound;
615}
616impl From<AdvancementTab> for ServerboundPlayPacket {
617 fn from(p: AdvancementTab) -> Self {
618 Self::AdvancementTab(p)
619 }
620}
621
622pub type SelectTrade = crate::defs::p754::play::serverbound::SelectTrade<754>;
624impl crate::packet::Packet for SelectTrade {
625 const ID: i32 = id::SELECT_TRADE;
626 const NAME: &'static str = "select_trade";
627 const STATE: State = State::Play;
628 const DIRECTION: Direction = Direction::Serverbound;
629}
630impl From<SelectTrade> for ServerboundPlayPacket {
631 fn from(p: SelectTrade) -> Self {
632 Self::SelectTrade(p)
633 }
634}
635
636pub type SetBeaconEffect = crate::defs::p754::play::serverbound::SetBeaconEffect<754>;
638impl crate::packet::Packet for SetBeaconEffect {
639 const ID: i32 = id::SET_BEACON_EFFECT;
640 const NAME: &'static str = "set_beacon_effect";
641 const STATE: State = State::Play;
642 const DIRECTION: Direction = Direction::Serverbound;
643}
644impl From<SetBeaconEffect> for ServerboundPlayPacket {
645 fn from(p: SetBeaconEffect) -> Self {
646 Self::SetBeaconEffect(p)
647 }
648}
649
650pub type HeldItemSlot = crate::defs::p47::play::serverbound::HeldItemSlot<754>;
652impl crate::packet::Packet for HeldItemSlot {
653 const ID: i32 = id::HELD_ITEM_SLOT;
654 const NAME: &'static str = "held_item_slot";
655 const STATE: State = State::Play;
656 const DIRECTION: Direction = Direction::Serverbound;
657}
658impl From<HeldItemSlot> for ServerboundPlayPacket {
659 fn from(p: HeldItemSlot) -> Self {
660 Self::HeldItemSlot(p)
661 }
662}
663
664pub type UpdateCommandBlock = crate::defs::p754::play::serverbound::UpdateCommandBlock<754>;
666impl crate::packet::Packet for UpdateCommandBlock {
667 const ID: i32 = id::UPDATE_COMMAND_BLOCK;
668 const NAME: &'static str = "update_command_block";
669 const STATE: State = State::Play;
670 const DIRECTION: Direction = Direction::Serverbound;
671}
672impl From<UpdateCommandBlock> for ServerboundPlayPacket {
673 fn from(p: UpdateCommandBlock) -> Self {
674 Self::UpdateCommandBlock(p)
675 }
676}
677
678pub type UpdateCommandBlockMinecart =
680 crate::defs::p754::play::serverbound::UpdateCommandBlockMinecart<754>;
681impl crate::packet::Packet for UpdateCommandBlockMinecart {
682 const ID: i32 = id::UPDATE_COMMAND_BLOCK_MINECART;
683 const NAME: &'static str = "update_command_block_minecart";
684 const STATE: State = State::Play;
685 const DIRECTION: Direction = Direction::Serverbound;
686}
687impl From<UpdateCommandBlockMinecart> for ServerboundPlayPacket {
688 fn from(p: UpdateCommandBlockMinecart) -> Self {
689 Self::UpdateCommandBlockMinecart(p)
690 }
691}
692
693pub type SetCreativeSlot = crate::defs::p754::play::serverbound::SetCreativeSlot<754>;
695impl crate::packet::Packet for SetCreativeSlot {
696 const ID: i32 = id::SET_CREATIVE_SLOT;
697 const NAME: &'static str = "set_creative_slot";
698 const STATE: State = State::Play;
699 const DIRECTION: Direction = Direction::Serverbound;
700}
701impl From<SetCreativeSlot> for ServerboundPlayPacket {
702 fn from(p: SetCreativeSlot) -> Self {
703 Self::SetCreativeSlot(p)
704 }
705}
706
707pub type UpdateJigsawBlock = crate::defs::p754::play::serverbound::UpdateJigsawBlock<754>;
709impl crate::packet::Packet for UpdateJigsawBlock {
710 const ID: i32 = id::UPDATE_JIGSAW_BLOCK;
711 const NAME: &'static str = "update_jigsaw_block";
712 const STATE: State = State::Play;
713 const DIRECTION: Direction = Direction::Serverbound;
714}
715impl From<UpdateJigsawBlock> for ServerboundPlayPacket {
716 fn from(p: UpdateJigsawBlock) -> Self {
717 Self::UpdateJigsawBlock(p)
718 }
719}
720
721pub type UpdateStructureBlock = crate::defs::p754::play::serverbound::UpdateStructureBlock<754>;
723impl crate::packet::Packet for UpdateStructureBlock {
724 const ID: i32 = id::UPDATE_STRUCTURE_BLOCK;
725 const NAME: &'static str = "update_structure_block";
726 const STATE: State = State::Play;
727 const DIRECTION: Direction = Direction::Serverbound;
728}
729impl From<UpdateStructureBlock> for ServerboundPlayPacket {
730 fn from(p: UpdateStructureBlock) -> Self {
731 Self::UpdateStructureBlock(p)
732 }
733}
734
735pub type UpdateSign = crate::defs::p754::play::serverbound::UpdateSign<754>;
737impl crate::packet::Packet for UpdateSign {
738 const ID: i32 = id::UPDATE_SIGN;
739 const NAME: &'static str = "update_sign";
740 const STATE: State = State::Play;
741 const DIRECTION: Direction = Direction::Serverbound;
742}
743impl From<UpdateSign> for ServerboundPlayPacket {
744 fn from(p: UpdateSign) -> Self {
745 Self::UpdateSign(p)
746 }
747}
748
749pub type ArmAnimation = crate::defs::p340::play::serverbound::ArmAnimation<754>;
751impl crate::packet::Packet for ArmAnimation {
752 const ID: i32 = id::ARM_ANIMATION;
753 const NAME: &'static str = "arm_animation";
754 const STATE: State = State::Play;
755 const DIRECTION: Direction = Direction::Serverbound;
756}
757impl From<ArmAnimation> for ServerboundPlayPacket {
758 fn from(p: ArmAnimation) -> Self {
759 Self::ArmAnimation(p)
760 }
761}
762
763pub type Spectate = crate::defs::p47::play::serverbound::Spectate<754>;
765impl crate::packet::Packet for Spectate {
766 const ID: i32 = id::SPECTATE;
767 const NAME: &'static str = "spectate";
768 const STATE: State = State::Play;
769 const DIRECTION: Direction = Direction::Serverbound;
770}
771impl From<Spectate> for ServerboundPlayPacket {
772 fn from(p: Spectate) -> Self {
773 Self::Spectate(p)
774 }
775}
776
777pub type BlockPlace = crate::defs::p754::play::serverbound::BlockPlace<754>;
779impl crate::packet::Packet for BlockPlace {
780 const ID: i32 = id::BLOCK_PLACE;
781 const NAME: &'static str = "block_place";
782 const STATE: State = State::Play;
783 const DIRECTION: Direction = Direction::Serverbound;
784}
785impl From<BlockPlace> for ServerboundPlayPacket {
786 fn from(p: BlockPlace) -> Self {
787 Self::BlockPlace(p)
788 }
789}
790
791pub type UseItem = crate::defs::p340::play::serverbound::UseItem<754>;
793impl crate::packet::Packet for UseItem {
794 const ID: i32 = id::USE_ITEM;
795 const NAME: &'static str = "use_item";
796 const STATE: State = State::Play;
797 const DIRECTION: Direction = Direction::Serverbound;
798}
799impl From<UseItem> for ServerboundPlayPacket {
800 fn from(p: UseItem) -> Self {
801 Self::UseItem(p)
802 }
803}
804
805#[derive(Debug, Clone, PartialEq)]
807pub enum ServerboundPlayPacket {
808 TeleportConfirm(TeleportConfirm),
810 QueryBlockNbt(QueryBlockNbt),
812 SetDifficulty(SetDifficulty),
814 Chat(Chat),
816 ClientCommand(ClientCommand),
818 Settings(Settings),
820 TabComplete(TabComplete),
822 Transaction(Transaction),
824 EnchantItem(EnchantItem),
826 WindowClick(WindowClick),
828 CloseWindow(CloseWindow),
830 CustomPayload(CustomPayload),
832 EditBook(EditBook),
834 QueryEntityNbt(QueryEntityNbt),
836 UseEntity(UseEntity),
838 GenerateStructure(GenerateStructure),
840 KeepAlive(KeepAlive),
842 LockDifficulty(LockDifficulty),
844 Position(Position),
846 PositionLook(PositionLook),
848 Look(Look),
850 Flying(Flying),
852 VehicleMove(VehicleMove),
854 SteerBoat(SteerBoat),
856 PickItem(PickItem),
858 CraftRecipeRequest(CraftRecipeRequest),
860 Abilities(Abilities),
862 BlockDig(BlockDig),
864 EntityAction(EntityAction),
866 SteerVehicle(SteerVehicle),
868 RecipeBook(RecipeBook),
870 DisplayedRecipe(DisplayedRecipe),
872 NameItem(NameItem),
874 ResourcePackReceive(ResourcePackReceive),
876 AdvancementTab(AdvancementTab),
878 SelectTrade(SelectTrade),
880 SetBeaconEffect(SetBeaconEffect),
882 HeldItemSlot(HeldItemSlot),
884 UpdateCommandBlock(UpdateCommandBlock),
886 UpdateCommandBlockMinecart(UpdateCommandBlockMinecart),
888 SetCreativeSlot(SetCreativeSlot),
890 UpdateJigsawBlock(UpdateJigsawBlock),
892 UpdateStructureBlock(UpdateStructureBlock),
894 UpdateSign(UpdateSign),
896 ArmAnimation(ArmAnimation),
898 Spectate(Spectate),
900 BlockPlace(BlockPlace),
902 UseItem(UseItem),
904}
905
906impl PacketSet for ServerboundPlayPacket {
907 const STATE: State = State::Play;
908 const DIRECTION: Direction = Direction::Serverbound;
909 fn decode_raw(raw: &RawPacket) -> DecodeResult<Self> {
910 match raw.id {
911 id::TELEPORT_CONFIRM => decode_exact(&raw.body).map(Self::TeleportConfirm),
912 id::QUERY_BLOCK_NBT => decode_exact(&raw.body).map(Self::QueryBlockNbt),
913 id::SET_DIFFICULTY => decode_exact(&raw.body).map(Self::SetDifficulty),
914 id::CHAT => decode_exact(&raw.body).map(Self::Chat),
915 id::CLIENT_COMMAND => decode_exact(&raw.body).map(Self::ClientCommand),
916 id::SETTINGS => decode_exact(&raw.body).map(Self::Settings),
917 id::TAB_COMPLETE => decode_exact(&raw.body).map(Self::TabComplete),
918 id::TRANSACTION => decode_exact(&raw.body).map(Self::Transaction),
919 id::ENCHANT_ITEM => decode_exact(&raw.body).map(Self::EnchantItem),
920 id::WINDOW_CLICK => decode_exact(&raw.body).map(Self::WindowClick),
921 id::CLOSE_WINDOW => decode_exact(&raw.body).map(Self::CloseWindow),
922 id::CUSTOM_PAYLOAD => decode_exact(&raw.body).map(Self::CustomPayload),
923 id::EDIT_BOOK => decode_exact(&raw.body).map(Self::EditBook),
924 id::QUERY_ENTITY_NBT => decode_exact(&raw.body).map(Self::QueryEntityNbt),
925 id::USE_ENTITY => decode_exact(&raw.body).map(Self::UseEntity),
926 id::GENERATE_STRUCTURE => decode_exact(&raw.body).map(Self::GenerateStructure),
927 id::KEEP_ALIVE => decode_exact(&raw.body).map(Self::KeepAlive),
928 id::LOCK_DIFFICULTY => decode_exact(&raw.body).map(Self::LockDifficulty),
929 id::POSITION => decode_exact(&raw.body).map(Self::Position),
930 id::POSITION_LOOK => decode_exact(&raw.body).map(Self::PositionLook),
931 id::LOOK => decode_exact(&raw.body).map(Self::Look),
932 id::FLYING => decode_exact(&raw.body).map(Self::Flying),
933 id::VEHICLE_MOVE => decode_exact(&raw.body).map(Self::VehicleMove),
934 id::STEER_BOAT => decode_exact(&raw.body).map(Self::SteerBoat),
935 id::PICK_ITEM => decode_exact(&raw.body).map(Self::PickItem),
936 id::CRAFT_RECIPE_REQUEST => decode_exact(&raw.body).map(Self::CraftRecipeRequest),
937 id::ABILITIES => decode_exact(&raw.body).map(Self::Abilities),
938 id::BLOCK_DIG => decode_exact(&raw.body).map(Self::BlockDig),
939 id::ENTITY_ACTION => decode_exact(&raw.body).map(Self::EntityAction),
940 id::STEER_VEHICLE => decode_exact(&raw.body).map(Self::SteerVehicle),
941 id::RECIPE_BOOK => decode_exact(&raw.body).map(Self::RecipeBook),
942 id::DISPLAYED_RECIPE => decode_exact(&raw.body).map(Self::DisplayedRecipe),
943 id::NAME_ITEM => decode_exact(&raw.body).map(Self::NameItem),
944 id::RESOURCE_PACK_RECEIVE => decode_exact(&raw.body).map(Self::ResourcePackReceive),
945 id::ADVANCEMENT_TAB => decode_exact(&raw.body).map(Self::AdvancementTab),
946 id::SELECT_TRADE => decode_exact(&raw.body).map(Self::SelectTrade),
947 id::SET_BEACON_EFFECT => decode_exact(&raw.body).map(Self::SetBeaconEffect),
948 id::HELD_ITEM_SLOT => decode_exact(&raw.body).map(Self::HeldItemSlot),
949 id::UPDATE_COMMAND_BLOCK => decode_exact(&raw.body).map(Self::UpdateCommandBlock),
950 id::UPDATE_COMMAND_BLOCK_MINECART => {
951 decode_exact(&raw.body).map(Self::UpdateCommandBlockMinecart)
952 }
953 id::SET_CREATIVE_SLOT => decode_exact(&raw.body).map(Self::SetCreativeSlot),
954 id::UPDATE_JIGSAW_BLOCK => decode_exact(&raw.body).map(Self::UpdateJigsawBlock),
955 id::UPDATE_STRUCTURE_BLOCK => decode_exact(&raw.body).map(Self::UpdateStructureBlock),
956 id::UPDATE_SIGN => decode_exact(&raw.body).map(Self::UpdateSign),
957 id::ARM_ANIMATION => decode_exact(&raw.body).map(Self::ArmAnimation),
958 id::SPECTATE => decode_exact(&raw.body).map(Self::Spectate),
959 id::BLOCK_PLACE => decode_exact(&raw.body).map(Self::BlockPlace),
960 id::USE_ITEM => decode_exact(&raw.body).map(Self::UseItem),
961 other => Err(DecodeError::UnknownPacketId(other)),
962 }
963 }
964 fn id(&self) -> i32 {
965 match *self {
966 Self::TeleportConfirm(_) => id::TELEPORT_CONFIRM,
967 Self::QueryBlockNbt(_) => id::QUERY_BLOCK_NBT,
968 Self::SetDifficulty(_) => id::SET_DIFFICULTY,
969 Self::Chat(_) => id::CHAT,
970 Self::ClientCommand(_) => id::CLIENT_COMMAND,
971 Self::Settings(_) => id::SETTINGS,
972 Self::TabComplete(_) => id::TAB_COMPLETE,
973 Self::Transaction(_) => id::TRANSACTION,
974 Self::EnchantItem(_) => id::ENCHANT_ITEM,
975 Self::WindowClick(_) => id::WINDOW_CLICK,
976 Self::CloseWindow(_) => id::CLOSE_WINDOW,
977 Self::CustomPayload(_) => id::CUSTOM_PAYLOAD,
978 Self::EditBook(_) => id::EDIT_BOOK,
979 Self::QueryEntityNbt(_) => id::QUERY_ENTITY_NBT,
980 Self::UseEntity(_) => id::USE_ENTITY,
981 Self::GenerateStructure(_) => id::GENERATE_STRUCTURE,
982 Self::KeepAlive(_) => id::KEEP_ALIVE,
983 Self::LockDifficulty(_) => id::LOCK_DIFFICULTY,
984 Self::Position(_) => id::POSITION,
985 Self::PositionLook(_) => id::POSITION_LOOK,
986 Self::Look(_) => id::LOOK,
987 Self::Flying(_) => id::FLYING,
988 Self::VehicleMove(_) => id::VEHICLE_MOVE,
989 Self::SteerBoat(_) => id::STEER_BOAT,
990 Self::PickItem(_) => id::PICK_ITEM,
991 Self::CraftRecipeRequest(_) => id::CRAFT_RECIPE_REQUEST,
992 Self::Abilities(_) => id::ABILITIES,
993 Self::BlockDig(_) => id::BLOCK_DIG,
994 Self::EntityAction(_) => id::ENTITY_ACTION,
995 Self::SteerVehicle(_) => id::STEER_VEHICLE,
996 Self::RecipeBook(_) => id::RECIPE_BOOK,
997 Self::DisplayedRecipe(_) => id::DISPLAYED_RECIPE,
998 Self::NameItem(_) => id::NAME_ITEM,
999 Self::ResourcePackReceive(_) => id::RESOURCE_PACK_RECEIVE,
1000 Self::AdvancementTab(_) => id::ADVANCEMENT_TAB,
1001 Self::SelectTrade(_) => id::SELECT_TRADE,
1002 Self::SetBeaconEffect(_) => id::SET_BEACON_EFFECT,
1003 Self::HeldItemSlot(_) => id::HELD_ITEM_SLOT,
1004 Self::UpdateCommandBlock(_) => id::UPDATE_COMMAND_BLOCK,
1005 Self::UpdateCommandBlockMinecart(_) => id::UPDATE_COMMAND_BLOCK_MINECART,
1006 Self::SetCreativeSlot(_) => id::SET_CREATIVE_SLOT,
1007 Self::UpdateJigsawBlock(_) => id::UPDATE_JIGSAW_BLOCK,
1008 Self::UpdateStructureBlock(_) => id::UPDATE_STRUCTURE_BLOCK,
1009 Self::UpdateSign(_) => id::UPDATE_SIGN,
1010 Self::ArmAnimation(_) => id::ARM_ANIMATION,
1011 Self::Spectate(_) => id::SPECTATE,
1012 Self::BlockPlace(_) => id::BLOCK_PLACE,
1013 Self::UseItem(_) => id::USE_ITEM,
1014 }
1015 }
1016 fn name(&self) -> &'static str {
1017 match *self {
1018 Self::TeleportConfirm(_) => "teleport_confirm",
1019 Self::QueryBlockNbt(_) => "query_block_nbt",
1020 Self::SetDifficulty(_) => "set_difficulty",
1021 Self::Chat(_) => "chat",
1022 Self::ClientCommand(_) => "client_command",
1023 Self::Settings(_) => "settings",
1024 Self::TabComplete(_) => "tab_complete",
1025 Self::Transaction(_) => "transaction",
1026 Self::EnchantItem(_) => "enchant_item",
1027 Self::WindowClick(_) => "window_click",
1028 Self::CloseWindow(_) => "close_window",
1029 Self::CustomPayload(_) => "custom_payload",
1030 Self::EditBook(_) => "edit_book",
1031 Self::QueryEntityNbt(_) => "query_entity_nbt",
1032 Self::UseEntity(_) => "use_entity",
1033 Self::GenerateStructure(_) => "generate_structure",
1034 Self::KeepAlive(_) => "keep_alive",
1035 Self::LockDifficulty(_) => "lock_difficulty",
1036 Self::Position(_) => "position",
1037 Self::PositionLook(_) => "position_look",
1038 Self::Look(_) => "look",
1039 Self::Flying(_) => "flying",
1040 Self::VehicleMove(_) => "vehicle_move",
1041 Self::SteerBoat(_) => "steer_boat",
1042 Self::PickItem(_) => "pick_item",
1043 Self::CraftRecipeRequest(_) => "craft_recipe_request",
1044 Self::Abilities(_) => "abilities",
1045 Self::BlockDig(_) => "block_dig",
1046 Self::EntityAction(_) => "entity_action",
1047 Self::SteerVehicle(_) => "steer_vehicle",
1048 Self::RecipeBook(_) => "recipe_book",
1049 Self::DisplayedRecipe(_) => "displayed_recipe",
1050 Self::NameItem(_) => "name_item",
1051 Self::ResourcePackReceive(_) => "resource_pack_receive",
1052 Self::AdvancementTab(_) => "advancement_tab",
1053 Self::SelectTrade(_) => "select_trade",
1054 Self::SetBeaconEffect(_) => "set_beacon_effect",
1055 Self::HeldItemSlot(_) => "held_item_slot",
1056 Self::UpdateCommandBlock(_) => "update_command_block",
1057 Self::UpdateCommandBlockMinecart(_) => "update_command_block_minecart",
1058 Self::SetCreativeSlot(_) => "set_creative_slot",
1059 Self::UpdateJigsawBlock(_) => "update_jigsaw_block",
1060 Self::UpdateStructureBlock(_) => "update_structure_block",
1061 Self::UpdateSign(_) => "update_sign",
1062 Self::ArmAnimation(_) => "arm_animation",
1063 Self::Spectate(_) => "spectate",
1064 Self::BlockPlace(_) => "block_place",
1065 Self::UseItem(_) => "use_item",
1066 }
1067 }
1068 fn encode_body(&self, w: &mut BytesMut) -> EncodeResult {
1069 match *self {
1070 Self::TeleportConfirm(ref p) => p.encode(w),
1071 Self::QueryBlockNbt(ref p) => p.encode(w),
1072 Self::SetDifficulty(ref p) => p.encode(w),
1073 Self::Chat(ref p) => p.encode(w),
1074 Self::ClientCommand(ref p) => p.encode(w),
1075 Self::Settings(ref p) => p.encode(w),
1076 Self::TabComplete(ref p) => p.encode(w),
1077 Self::Transaction(ref p) => p.encode(w),
1078 Self::EnchantItem(ref p) => p.encode(w),
1079 Self::WindowClick(ref p) => p.encode(w),
1080 Self::CloseWindow(ref p) => p.encode(w),
1081 Self::CustomPayload(ref p) => p.encode(w),
1082 Self::EditBook(ref p) => p.encode(w),
1083 Self::QueryEntityNbt(ref p) => p.encode(w),
1084 Self::UseEntity(ref p) => p.encode(w),
1085 Self::GenerateStructure(ref p) => p.encode(w),
1086 Self::KeepAlive(ref p) => p.encode(w),
1087 Self::LockDifficulty(ref p) => p.encode(w),
1088 Self::Position(ref p) => p.encode(w),
1089 Self::PositionLook(ref p) => p.encode(w),
1090 Self::Look(ref p) => p.encode(w),
1091 Self::Flying(ref p) => p.encode(w),
1092 Self::VehicleMove(ref p) => p.encode(w),
1093 Self::SteerBoat(ref p) => p.encode(w),
1094 Self::PickItem(ref p) => p.encode(w),
1095 Self::CraftRecipeRequest(ref p) => p.encode(w),
1096 Self::Abilities(ref p) => p.encode(w),
1097 Self::BlockDig(ref p) => p.encode(w),
1098 Self::EntityAction(ref p) => p.encode(w),
1099 Self::SteerVehicle(ref p) => p.encode(w),
1100 Self::RecipeBook(ref p) => p.encode(w),
1101 Self::DisplayedRecipe(ref p) => p.encode(w),
1102 Self::NameItem(ref p) => p.encode(w),
1103 Self::ResourcePackReceive(ref p) => p.encode(w),
1104 Self::AdvancementTab(ref p) => p.encode(w),
1105 Self::SelectTrade(ref p) => p.encode(w),
1106 Self::SetBeaconEffect(ref p) => p.encode(w),
1107 Self::HeldItemSlot(ref p) => p.encode(w),
1108 Self::UpdateCommandBlock(ref p) => p.encode(w),
1109 Self::UpdateCommandBlockMinecart(ref p) => p.encode(w),
1110 Self::SetCreativeSlot(ref p) => p.encode(w),
1111 Self::UpdateJigsawBlock(ref p) => p.encode(w),
1112 Self::UpdateStructureBlock(ref p) => p.encode(w),
1113 Self::UpdateSign(ref p) => p.encode(w),
1114 Self::ArmAnimation(ref p) => p.encode(w),
1115 Self::Spectate(ref p) => p.encode(w),
1116 Self::BlockPlace(ref p) => p.encode(w),
1117 Self::UseItem(ref p) => p.encode(w),
1118 }
1119 }
1120 fn name_of(id: i32) -> Option<&'static str> {
1121 match id {
1122 id::TELEPORT_CONFIRM => Some("teleport_confirm"),
1123 id::QUERY_BLOCK_NBT => Some("query_block_nbt"),
1124 id::SET_DIFFICULTY => Some("set_difficulty"),
1125 id::CHAT => Some("chat"),
1126 id::CLIENT_COMMAND => Some("client_command"),
1127 id::SETTINGS => Some("settings"),
1128 id::TAB_COMPLETE => Some("tab_complete"),
1129 id::TRANSACTION => Some("transaction"),
1130 id::ENCHANT_ITEM => Some("enchant_item"),
1131 id::WINDOW_CLICK => Some("window_click"),
1132 id::CLOSE_WINDOW => Some("close_window"),
1133 id::CUSTOM_PAYLOAD => Some("custom_payload"),
1134 id::EDIT_BOOK => Some("edit_book"),
1135 id::QUERY_ENTITY_NBT => Some("query_entity_nbt"),
1136 id::USE_ENTITY => Some("use_entity"),
1137 id::GENERATE_STRUCTURE => Some("generate_structure"),
1138 id::KEEP_ALIVE => Some("keep_alive"),
1139 id::LOCK_DIFFICULTY => Some("lock_difficulty"),
1140 id::POSITION => Some("position"),
1141 id::POSITION_LOOK => Some("position_look"),
1142 id::LOOK => Some("look"),
1143 id::FLYING => Some("flying"),
1144 id::VEHICLE_MOVE => Some("vehicle_move"),
1145 id::STEER_BOAT => Some("steer_boat"),
1146 id::PICK_ITEM => Some("pick_item"),
1147 id::CRAFT_RECIPE_REQUEST => Some("craft_recipe_request"),
1148 id::ABILITIES => Some("abilities"),
1149 id::BLOCK_DIG => Some("block_dig"),
1150 id::ENTITY_ACTION => Some("entity_action"),
1151 id::STEER_VEHICLE => Some("steer_vehicle"),
1152 id::RECIPE_BOOK => Some("recipe_book"),
1153 id::DISPLAYED_RECIPE => Some("displayed_recipe"),
1154 id::NAME_ITEM => Some("name_item"),
1155 id::RESOURCE_PACK_RECEIVE => Some("resource_pack_receive"),
1156 id::ADVANCEMENT_TAB => Some("advancement_tab"),
1157 id::SELECT_TRADE => Some("select_trade"),
1158 id::SET_BEACON_EFFECT => Some("set_beacon_effect"),
1159 id::HELD_ITEM_SLOT => Some("held_item_slot"),
1160 id::UPDATE_COMMAND_BLOCK => Some("update_command_block"),
1161 id::UPDATE_COMMAND_BLOCK_MINECART => Some("update_command_block_minecart"),
1162 id::SET_CREATIVE_SLOT => Some("set_creative_slot"),
1163 id::UPDATE_JIGSAW_BLOCK => Some("update_jigsaw_block"),
1164 id::UPDATE_STRUCTURE_BLOCK => Some("update_structure_block"),
1165 id::UPDATE_SIGN => Some("update_sign"),
1166 id::ARM_ANIMATION => Some("arm_animation"),
1167 id::SPECTATE => Some("spectate"),
1168 id::BLOCK_PLACE => Some("block_place"),
1169 id::USE_ITEM => Some("use_item"),
1170 _ => None,
1171 }
1172 }
1173}
1174
1175impl ServerboundPlayPacket {
1176 pub const IDS: &'static [i32] = &[
1178 id::TELEPORT_CONFIRM,
1179 id::QUERY_BLOCK_NBT,
1180 id::SET_DIFFICULTY,
1181 id::CHAT,
1182 id::CLIENT_COMMAND,
1183 id::SETTINGS,
1184 id::TAB_COMPLETE,
1185 id::TRANSACTION,
1186 id::ENCHANT_ITEM,
1187 id::WINDOW_CLICK,
1188 id::CLOSE_WINDOW,
1189 id::CUSTOM_PAYLOAD,
1190 id::EDIT_BOOK,
1191 id::QUERY_ENTITY_NBT,
1192 id::USE_ENTITY,
1193 id::GENERATE_STRUCTURE,
1194 id::KEEP_ALIVE,
1195 id::LOCK_DIFFICULTY,
1196 id::POSITION,
1197 id::POSITION_LOOK,
1198 id::LOOK,
1199 id::FLYING,
1200 id::VEHICLE_MOVE,
1201 id::STEER_BOAT,
1202 id::PICK_ITEM,
1203 id::CRAFT_RECIPE_REQUEST,
1204 id::ABILITIES,
1205 id::BLOCK_DIG,
1206 id::ENTITY_ACTION,
1207 id::STEER_VEHICLE,
1208 id::RECIPE_BOOK,
1209 id::DISPLAYED_RECIPE,
1210 id::NAME_ITEM,
1211 id::RESOURCE_PACK_RECEIVE,
1212 id::ADVANCEMENT_TAB,
1213 id::SELECT_TRADE,
1214 id::SET_BEACON_EFFECT,
1215 id::HELD_ITEM_SLOT,
1216 id::UPDATE_COMMAND_BLOCK,
1217 id::UPDATE_COMMAND_BLOCK_MINECART,
1218 id::SET_CREATIVE_SLOT,
1219 id::UPDATE_JIGSAW_BLOCK,
1220 id::UPDATE_STRUCTURE_BLOCK,
1221 id::UPDATE_SIGN,
1222 id::ARM_ANIMATION,
1223 id::SPECTATE,
1224 id::BLOCK_PLACE,
1225 id::USE_ITEM,
1226 ];
1227 #[cfg(feature = "testgen")]
1229 pub fn generate_by_id(id: i32, g: &mut Gen) -> Option<Self> {
1230 match id {
1231 id::TELEPORT_CONFIRM => Some(Self::TeleportConfirm(
1232 <TeleportConfirm as Generate>::generate(g),
1233 )),
1234 id::QUERY_BLOCK_NBT => Some(Self::QueryBlockNbt(
1235 <QueryBlockNbt as Generate>::generate(g),
1236 )),
1237 id::SET_DIFFICULTY => Some(Self::SetDifficulty(<SetDifficulty as Generate>::generate(
1238 g,
1239 ))),
1240 id::CHAT => Some(Self::Chat(<Chat as Generate>::generate(g))),
1241 id::CLIENT_COMMAND => Some(Self::ClientCommand(<ClientCommand as Generate>::generate(
1242 g,
1243 ))),
1244 id::SETTINGS => Some(Self::Settings(<Settings as Generate>::generate(g))),
1245 id::TAB_COMPLETE => Some(Self::TabComplete(<TabComplete as Generate>::generate(g))),
1246 id::TRANSACTION => Some(Self::Transaction(<Transaction as Generate>::generate(g))),
1247 id::ENCHANT_ITEM => Some(Self::EnchantItem(<EnchantItem as Generate>::generate(g))),
1248 id::WINDOW_CLICK => Some(Self::WindowClick(<WindowClick as Generate>::generate(g))),
1249 id::CLOSE_WINDOW => Some(Self::CloseWindow(<CloseWindow as Generate>::generate(g))),
1250 id::CUSTOM_PAYLOAD => Some(Self::CustomPayload(<CustomPayload as Generate>::generate(
1251 g,
1252 ))),
1253 id::EDIT_BOOK => Some(Self::EditBook(<EditBook as Generate>::generate(g))),
1254 id::QUERY_ENTITY_NBT => Some(Self::QueryEntityNbt(
1255 <QueryEntityNbt as Generate>::generate(g),
1256 )),
1257 id::USE_ENTITY => Some(Self::UseEntity(<UseEntity as Generate>::generate(g))),
1258 id::GENERATE_STRUCTURE => Some(Self::GenerateStructure(
1259 <GenerateStructure as Generate>::generate(g),
1260 )),
1261 id::KEEP_ALIVE => Some(Self::KeepAlive(<KeepAlive as Generate>::generate(g))),
1262 id::LOCK_DIFFICULTY => Some(Self::LockDifficulty(
1263 <LockDifficulty as Generate>::generate(g),
1264 )),
1265 id::POSITION => Some(Self::Position(<Position as Generate>::generate(g))),
1266 id::POSITION_LOOK => Some(Self::PositionLook(<PositionLook as Generate>::generate(g))),
1267 id::LOOK => Some(Self::Look(<Look as Generate>::generate(g))),
1268 id::FLYING => Some(Self::Flying(<Flying as Generate>::generate(g))),
1269 id::VEHICLE_MOVE => Some(Self::VehicleMove(<VehicleMove as Generate>::generate(g))),
1270 id::STEER_BOAT => Some(Self::SteerBoat(<SteerBoat as Generate>::generate(g))),
1271 id::PICK_ITEM => Some(Self::PickItem(<PickItem as Generate>::generate(g))),
1272 id::CRAFT_RECIPE_REQUEST => Some(Self::CraftRecipeRequest(
1273 <CraftRecipeRequest as Generate>::generate(g),
1274 )),
1275 id::ABILITIES => Some(Self::Abilities(<Abilities as Generate>::generate(g))),
1276 id::BLOCK_DIG => Some(Self::BlockDig(<BlockDig as Generate>::generate(g))),
1277 id::ENTITY_ACTION => Some(Self::EntityAction(<EntityAction as Generate>::generate(g))),
1278 id::STEER_VEHICLE => Some(Self::SteerVehicle(<SteerVehicle as Generate>::generate(g))),
1279 id::RECIPE_BOOK => Some(Self::RecipeBook(<RecipeBook as Generate>::generate(g))),
1280 id::DISPLAYED_RECIPE => Some(Self::DisplayedRecipe(
1281 <DisplayedRecipe as Generate>::generate(g),
1282 )),
1283 id::NAME_ITEM => Some(Self::NameItem(<NameItem as Generate>::generate(g))),
1284 id::RESOURCE_PACK_RECEIVE => Some(Self::ResourcePackReceive(
1285 <ResourcePackReceive as Generate>::generate(g),
1286 )),
1287 id::ADVANCEMENT_TAB => Some(Self::AdvancementTab(
1288 <AdvancementTab as Generate>::generate(g),
1289 )),
1290 id::SELECT_TRADE => Some(Self::SelectTrade(<SelectTrade as Generate>::generate(g))),
1291 id::SET_BEACON_EFFECT => Some(Self::SetBeaconEffect(
1292 <SetBeaconEffect as Generate>::generate(g),
1293 )),
1294 id::HELD_ITEM_SLOT => Some(Self::HeldItemSlot(<HeldItemSlot as Generate>::generate(g))),
1295 id::UPDATE_COMMAND_BLOCK => Some(Self::UpdateCommandBlock(
1296 <UpdateCommandBlock as Generate>::generate(g),
1297 )),
1298 id::UPDATE_COMMAND_BLOCK_MINECART => Some(Self::UpdateCommandBlockMinecart(
1299 <UpdateCommandBlockMinecart as Generate>::generate(g),
1300 )),
1301 id::SET_CREATIVE_SLOT => Some(Self::SetCreativeSlot(
1302 <SetCreativeSlot as Generate>::generate(g),
1303 )),
1304 id::UPDATE_JIGSAW_BLOCK => Some(Self::UpdateJigsawBlock(
1305 <UpdateJigsawBlock as Generate>::generate(g),
1306 )),
1307 id::UPDATE_STRUCTURE_BLOCK => Some(Self::UpdateStructureBlock(
1308 <UpdateStructureBlock as Generate>::generate(g),
1309 )),
1310 id::UPDATE_SIGN => Some(Self::UpdateSign(<UpdateSign as Generate>::generate(g))),
1311 id::ARM_ANIMATION => Some(Self::ArmAnimation(<ArmAnimation as Generate>::generate(g))),
1312 id::SPECTATE => Some(Self::Spectate(<Spectate as Generate>::generate(g))),
1313 id::BLOCK_PLACE => Some(Self::BlockPlace(<BlockPlace as Generate>::generate(g))),
1314 id::USE_ITEM => Some(Self::UseItem(<UseItem as Generate>::generate(g))),
1315 _ => None,
1316 }
1317 }
1318}