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 SPAWN_ENTITY: i32 = 0x00;
32 pub const SPAWN_ENTITY_EXPERIENCE_ORB: i32 = 0x01;
34 pub const SPAWN_ENTITY_LIVING: i32 = 0x02;
36 pub const SPAWN_ENTITY_PAINTING: i32 = 0x03;
38 pub const NAMED_ENTITY_SPAWN: i32 = 0x04;
40 pub const ANIMATION: i32 = 0x05;
42 pub const STATISTICS: i32 = 0x06;
44 pub const ACKNOWLEDGE_PLAYER_DIGGING: i32 = 0x07;
46 pub const BLOCK_BREAK_ANIMATION: i32 = 0x08;
48 pub const TILE_ENTITY_DATA: i32 = 0x09;
50 pub const BLOCK_ACTION: i32 = 0x0a;
52 pub const BLOCK_CHANGE: i32 = 0x0b;
54 pub const BOSS_BAR: i32 = 0x0c;
56 pub const DIFFICULTY: i32 = 0x0d;
58 pub const CHAT: i32 = 0x0e;
60 pub const TAB_COMPLETE: i32 = 0x0f;
62 pub const DECLARE_COMMANDS: i32 = 0x10;
64 pub const TRANSACTION: i32 = 0x11;
66 pub const CLOSE_WINDOW: i32 = 0x12;
68 pub const WINDOW_ITEMS: i32 = 0x13;
70 pub const CRAFT_PROGRESS_BAR: i32 = 0x14;
72 pub const SET_SLOT: i32 = 0x15;
74 pub const SET_COOLDOWN: i32 = 0x16;
76 pub const CUSTOM_PAYLOAD: i32 = 0x17;
78 pub const NAMED_SOUND_EFFECT: i32 = 0x18;
80 pub const KICK_DISCONNECT: i32 = 0x19;
82 pub const ENTITY_STATUS: i32 = 0x1a;
84 pub const EXPLOSION: i32 = 0x1b;
86 pub const UNLOAD_CHUNK: i32 = 0x1c;
88 pub const GAME_STATE_CHANGE: i32 = 0x1d;
90 pub const OPEN_HORSE_WINDOW: i32 = 0x1e;
92 pub const KEEP_ALIVE: i32 = 0x1f;
94 pub const MAP_CHUNK: i32 = 0x20;
96 pub const WORLD_EVENT: i32 = 0x21;
98 pub const WORLD_PARTICLES: i32 = 0x22;
100 pub const UPDATE_LIGHT: i32 = 0x23;
102 pub const LOGIN: i32 = 0x24;
104 pub const MAP: i32 = 0x25;
106 pub const TRADE_LIST: i32 = 0x26;
108 pub const REL_ENTITY_MOVE: i32 = 0x27;
110 pub const ENTITY_MOVE_LOOK: i32 = 0x28;
112 pub const ENTITY_LOOK: i32 = 0x29;
114 pub const ENTITY: i32 = 0x2a;
116 pub const VEHICLE_MOVE: i32 = 0x2b;
118 pub const OPEN_BOOK: i32 = 0x2c;
120 pub const OPEN_WINDOW: i32 = 0x2d;
122 pub const OPEN_SIGN_ENTITY: i32 = 0x2e;
124 pub const CRAFT_RECIPE_RESPONSE: i32 = 0x2f;
126 pub const ABILITIES: i32 = 0x30;
128 pub const COMBAT_EVENT: i32 = 0x31;
130 pub const PLAYER_INFO: i32 = 0x32;
132 pub const FACE_PLAYER: i32 = 0x33;
134 pub const POSITION: i32 = 0x34;
136 pub const UNLOCK_RECIPES: i32 = 0x35;
138 pub const ENTITY_DESTROY: i32 = 0x36;
140 pub const REMOVE_ENTITY_EFFECT: i32 = 0x37;
142 pub const RESOURCE_PACK_SEND: i32 = 0x38;
144 pub const RESPAWN: i32 = 0x39;
146 pub const ENTITY_HEAD_ROTATION: i32 = 0x3a;
148 pub const MULTI_BLOCK_CHANGE: i32 = 0x3b;
150 pub const SELECT_ADVANCEMENT_TAB: i32 = 0x3c;
152 pub const WORLD_BORDER: i32 = 0x3d;
154 pub const CAMERA: i32 = 0x3e;
156 pub const HELD_ITEM_SLOT: i32 = 0x3f;
158 pub const UPDATE_VIEW_POSITION: i32 = 0x40;
160 pub const UPDATE_VIEW_DISTANCE: i32 = 0x41;
162 pub const SPAWN_POSITION: i32 = 0x42;
164 pub const SCOREBOARD_DISPLAY_OBJECTIVE: i32 = 0x43;
166 pub const ENTITY_METADATA: i32 = 0x44;
168 pub const ATTACH_ENTITY: i32 = 0x45;
170 pub const ENTITY_VELOCITY: i32 = 0x46;
172 pub const ENTITY_EQUIPMENT: i32 = 0x47;
174 pub const EXPERIENCE: i32 = 0x48;
176 pub const UPDATE_HEALTH: i32 = 0x49;
178 pub const SCOREBOARD_OBJECTIVE: i32 = 0x4a;
180 pub const SET_PASSENGERS: i32 = 0x4b;
182 pub const TEAMS: i32 = 0x4c;
184 pub const SCOREBOARD_SCORE: i32 = 0x4d;
186 pub const UPDATE_TIME: i32 = 0x4e;
188 pub const TITLE: i32 = 0x4f;
190 pub const ENTITY_SOUND_EFFECT: i32 = 0x50;
192 pub const SOUND_EFFECT: i32 = 0x51;
194 pub const STOP_SOUND: i32 = 0x52;
196 pub const PLAYERLIST_HEADER: i32 = 0x53;
198 pub const NBT_QUERY_RESPONSE: i32 = 0x54;
200 pub const COLLECT: i32 = 0x55;
202 pub const ENTITY_TELEPORT: i32 = 0x56;
204 pub const ADVANCEMENTS: i32 = 0x57;
206 pub const ENTITY_UPDATE_ATTRIBUTES: i32 = 0x58;
208 pub const ENTITY_EFFECT: i32 = 0x59;
210 pub const DECLARE_RECIPES: i32 = 0x5a;
212 pub const TAGS: i32 = 0x5b;
214}
215
216pub use crate::defs::p47::play::clientbound::DifficultyDifficulty;
217pub use crate::defs::p47::play::clientbound::ExplosionAffectedBlockOffsets;
218pub use crate::defs::p47::play::clientbound::PlayerInfoAction;
219pub use crate::defs::p47::play::clientbound::PlayerInfoData;
220pub use crate::defs::p47::play::clientbound::PlayerInfoDataBody;
221pub use crate::defs::p47::play::clientbound::PlayerInfoDataBodyAddPlayer;
222pub use crate::defs::p47::play::clientbound::PlayerInfoDataBodyAddPlayerProperties;
223pub use crate::defs::p47::play::clientbound::PlayerInfoDataBodyUpdateDisplayName;
224pub use crate::defs::p47::play::clientbound::PlayerInfoDataBodyUpdateGameMode;
225pub use crate::defs::p47::play::clientbound::PlayerInfoDataBodyUpdateLatency;
226pub use crate::defs::p340::play::clientbound::AdvancementsAdvancementMappingValueCriteria;
227pub use crate::defs::p340::play::clientbound::AdvancementsAdvancementMappingValueDisplayDataFlags;
228pub use crate::defs::p340::play::clientbound::AdvancementsProgressMapping;
229pub use crate::defs::p340::play::clientbound::AdvancementsProgressMappingValue;
230pub use crate::defs::p340::play::clientbound::EntityUpdateAttributesProperties;
231pub use crate::defs::p340::play::clientbound::EntityUpdateAttributesPropertiesModifiers;
232pub use crate::defs::p754::play::clientbound::AdvancementsAdvancementMapping;
233pub use crate::defs::p754::play::clientbound::AdvancementsAdvancementMappingValue;
234pub use crate::defs::p754::play::clientbound::AdvancementsAdvancementMappingValueDisplayData;
235pub use crate::defs::p754::play::clientbound::DeclareRecipesRecipes;
236pub use crate::defs::p754::play::clientbound::DeclareRecipesRecipesData;
237pub use crate::defs::p754::play::clientbound::DeclareRecipesRecipesDataCraftingShaped;
238pub use crate::defs::p754::play::clientbound::DeclareRecipesRecipesDataCraftingShapeless;
239pub use crate::defs::p754::play::clientbound::DeclareRecipesRecipesDataSmithing;
240pub use crate::defs::p754::play::clientbound::DeclareRecipesRecipesDataStonecutting;
241pub use crate::defs::p754::play::clientbound::EntityEquipmentEquipments;
242pub use crate::defs::p754::play::clientbound::GameStateChangeReason;
243pub use crate::defs::p754::play::clientbound::MapIcons;
244pub use crate::defs::p754::play::clientbound::MultiBlockChangeChunkCoordinates;
245pub use crate::defs::p754::play::clientbound::StatisticsEntries;
246pub use crate::defs::p754::play::clientbound::TabCompleteMatches;
247pub use crate::defs::p754::play::clientbound::TradeListTrades;
248
249pub type SpawnEntity = crate::defs::p754::play::clientbound::SpawnEntity<754>;
251impl crate::packet::Packet for SpawnEntity {
252 const ID: i32 = id::SPAWN_ENTITY;
253 const NAME: &'static str = "spawn_entity";
254 const STATE: State = State::Play;
255 const DIRECTION: Direction = Direction::Clientbound;
256}
257impl From<SpawnEntity> for ClientboundPlayPacket {
258 fn from(p: SpawnEntity) -> Self {
259 Self::SpawnEntity(p)
260 }
261}
262
263pub type SpawnEntityExperienceOrb =
265 crate::defs::p340::play::clientbound::SpawnEntityExperienceOrb<754>;
266impl crate::packet::Packet for SpawnEntityExperienceOrb {
267 const ID: i32 = id::SPAWN_ENTITY_EXPERIENCE_ORB;
268 const NAME: &'static str = "spawn_entity_experience_orb";
269 const STATE: State = State::Play;
270 const DIRECTION: Direction = Direction::Clientbound;
271}
272impl From<SpawnEntityExperienceOrb> for ClientboundPlayPacket {
273 fn from(p: SpawnEntityExperienceOrb) -> Self {
274 Self::SpawnEntityExperienceOrb(p)
275 }
276}
277
278pub type SpawnEntityLiving = crate::defs::p754::play::clientbound::SpawnEntityLiving<754>;
280impl crate::packet::Packet for SpawnEntityLiving {
281 const ID: i32 = id::SPAWN_ENTITY_LIVING;
282 const NAME: &'static str = "spawn_entity_living";
283 const STATE: State = State::Play;
284 const DIRECTION: Direction = Direction::Clientbound;
285}
286impl From<SpawnEntityLiving> for ClientboundPlayPacket {
287 fn from(p: SpawnEntityLiving) -> Self {
288 Self::SpawnEntityLiving(p)
289 }
290}
291
292pub type SpawnEntityPainting = crate::defs::p754::play::clientbound::SpawnEntityPainting<754>;
294impl crate::packet::Packet for SpawnEntityPainting {
295 const ID: i32 = id::SPAWN_ENTITY_PAINTING;
296 const NAME: &'static str = "spawn_entity_painting";
297 const STATE: State = State::Play;
298 const DIRECTION: Direction = Direction::Clientbound;
299}
300impl From<SpawnEntityPainting> for ClientboundPlayPacket {
301 fn from(p: SpawnEntityPainting) -> Self {
302 Self::SpawnEntityPainting(p)
303 }
304}
305
306pub type NamedEntitySpawn = crate::defs::p754::play::clientbound::NamedEntitySpawn<754>;
308impl crate::packet::Packet for NamedEntitySpawn {
309 const ID: i32 = id::NAMED_ENTITY_SPAWN;
310 const NAME: &'static str = "named_entity_spawn";
311 const STATE: State = State::Play;
312 const DIRECTION: Direction = Direction::Clientbound;
313}
314impl From<NamedEntitySpawn> for ClientboundPlayPacket {
315 fn from(p: NamedEntitySpawn) -> Self {
316 Self::NamedEntitySpawn(p)
317 }
318}
319
320pub type Animation = crate::defs::p47::play::clientbound::Animation<754>;
322impl crate::packet::Packet for Animation {
323 const ID: i32 = id::ANIMATION;
324 const NAME: &'static str = "animation";
325 const STATE: State = State::Play;
326 const DIRECTION: Direction = Direction::Clientbound;
327}
328impl From<Animation> for ClientboundPlayPacket {
329 fn from(p: Animation) -> Self {
330 Self::Animation(p)
331 }
332}
333
334pub type Statistics = crate::defs::p754::play::clientbound::Statistics<754>;
336impl crate::packet::Packet for Statistics {
337 const ID: i32 = id::STATISTICS;
338 const NAME: &'static str = "statistics";
339 const STATE: State = State::Play;
340 const DIRECTION: Direction = Direction::Clientbound;
341}
342impl From<Statistics> for ClientboundPlayPacket {
343 fn from(p: Statistics) -> Self {
344 Self::Statistics(p)
345 }
346}
347
348pub type AcknowledgePlayerDigging =
350 crate::defs::p754::play::clientbound::AcknowledgePlayerDigging<754>;
351impl crate::packet::Packet for AcknowledgePlayerDigging {
352 const ID: i32 = id::ACKNOWLEDGE_PLAYER_DIGGING;
353 const NAME: &'static str = "acknowledge_player_digging";
354 const STATE: State = State::Play;
355 const DIRECTION: Direction = Direction::Clientbound;
356}
357impl From<AcknowledgePlayerDigging> for ClientboundPlayPacket {
358 fn from(p: AcknowledgePlayerDigging) -> Self {
359 Self::AcknowledgePlayerDigging(p)
360 }
361}
362
363pub type BlockBreakAnimation = crate::defs::p754::play::clientbound::BlockBreakAnimation<754>;
365impl crate::packet::Packet for BlockBreakAnimation {
366 const ID: i32 = id::BLOCK_BREAK_ANIMATION;
367 const NAME: &'static str = "block_break_animation";
368 const STATE: State = State::Play;
369 const DIRECTION: Direction = Direction::Clientbound;
370}
371impl From<BlockBreakAnimation> for ClientboundPlayPacket {
372 fn from(p: BlockBreakAnimation) -> Self {
373 Self::BlockBreakAnimation(p)
374 }
375}
376
377pub type TileEntityData = crate::defs::p754::play::clientbound::TileEntityData<754>;
379impl crate::packet::Packet for TileEntityData {
380 const ID: i32 = id::TILE_ENTITY_DATA;
381 const NAME: &'static str = "tile_entity_data";
382 const STATE: State = State::Play;
383 const DIRECTION: Direction = Direction::Clientbound;
384}
385impl From<TileEntityData> for ClientboundPlayPacket {
386 fn from(p: TileEntityData) -> Self {
387 Self::TileEntityData(p)
388 }
389}
390
391pub type BlockAction = crate::defs::p754::play::clientbound::BlockAction<754>;
393impl crate::packet::Packet for BlockAction {
394 const ID: i32 = id::BLOCK_ACTION;
395 const NAME: &'static str = "block_action";
396 const STATE: State = State::Play;
397 const DIRECTION: Direction = Direction::Clientbound;
398}
399impl From<BlockAction> for ClientboundPlayPacket {
400 fn from(p: BlockAction) -> Self {
401 Self::BlockAction(p)
402 }
403}
404
405pub type BlockChange = crate::defs::p754::play::clientbound::BlockChange<754>;
407impl crate::packet::Packet for BlockChange {
408 const ID: i32 = id::BLOCK_CHANGE;
409 const NAME: &'static str = "block_change";
410 const STATE: State = State::Play;
411 const DIRECTION: Direction = Direction::Clientbound;
412}
413impl From<BlockChange> for ClientboundPlayPacket {
414 fn from(p: BlockChange) -> Self {
415 Self::BlockChange(p)
416 }
417}
418
419pub type BossBar = crate::defs::p340::play::clientbound::BossBar<754>;
421impl crate::packet::Packet for BossBar {
422 const ID: i32 = id::BOSS_BAR;
423 const NAME: &'static str = "boss_bar";
424 const STATE: State = State::Play;
425 const DIRECTION: Direction = Direction::Clientbound;
426}
427impl From<BossBar> for ClientboundPlayPacket {
428 fn from(p: BossBar) -> Self {
429 Self::BossBar(p)
430 }
431}
432
433pub type Difficulty = crate::defs::p754::play::clientbound::Difficulty<754>;
435impl crate::packet::Packet for Difficulty {
436 const ID: i32 = id::DIFFICULTY;
437 const NAME: &'static str = "difficulty";
438 const STATE: State = State::Play;
439 const DIRECTION: Direction = Direction::Clientbound;
440}
441impl From<Difficulty> for ClientboundPlayPacket {
442 fn from(p: Difficulty) -> Self {
443 Self::Difficulty(p)
444 }
445}
446
447pub type Chat = crate::defs::p754::play::clientbound::Chat<754>;
449impl crate::packet::Packet for Chat {
450 const ID: i32 = id::CHAT;
451 const NAME: &'static str = "chat";
452 const STATE: State = State::Play;
453 const DIRECTION: Direction = Direction::Clientbound;
454}
455impl From<Chat> for ClientboundPlayPacket {
456 fn from(p: Chat) -> Self {
457 Self::Chat(p)
458 }
459}
460
461pub type TabComplete = crate::defs::p754::play::clientbound::TabComplete<754>;
463impl crate::packet::Packet for TabComplete {
464 const ID: i32 = id::TAB_COMPLETE;
465 const NAME: &'static str = "tab_complete";
466 const STATE: State = State::Play;
467 const DIRECTION: Direction = Direction::Clientbound;
468}
469impl From<TabComplete> for ClientboundPlayPacket {
470 fn from(p: TabComplete) -> Self {
471 Self::TabComplete(p)
472 }
473}
474
475pub type DeclareCommands = crate::defs::p754::play::clientbound::DeclareCommands<754>;
477impl crate::packet::Packet for DeclareCommands {
478 const ID: i32 = id::DECLARE_COMMANDS;
479 const NAME: &'static str = "declare_commands";
480 const STATE: State = State::Play;
481 const DIRECTION: Direction = Direction::Clientbound;
482}
483impl From<DeclareCommands> for ClientboundPlayPacket {
484 fn from(p: DeclareCommands) -> Self {
485 Self::DeclareCommands(p)
486 }
487}
488
489pub type Transaction = crate::defs::p47::play::clientbound::Transaction<754>;
491impl crate::packet::Packet for Transaction {
492 const ID: i32 = id::TRANSACTION;
493 const NAME: &'static str = "transaction";
494 const STATE: State = State::Play;
495 const DIRECTION: Direction = Direction::Clientbound;
496}
497impl From<Transaction> for ClientboundPlayPacket {
498 fn from(p: Transaction) -> Self {
499 Self::Transaction(p)
500 }
501}
502
503pub type CloseWindow = crate::defs::p47::play::clientbound::CloseWindow<754>;
505impl crate::packet::Packet for CloseWindow {
506 const ID: i32 = id::CLOSE_WINDOW;
507 const NAME: &'static str = "close_window";
508 const STATE: State = State::Play;
509 const DIRECTION: Direction = Direction::Clientbound;
510}
511impl From<CloseWindow> for ClientboundPlayPacket {
512 fn from(p: CloseWindow) -> Self {
513 Self::CloseWindow(p)
514 }
515}
516
517pub type WindowItems = crate::defs::p754::play::clientbound::WindowItems<754>;
519impl crate::packet::Packet for WindowItems {
520 const ID: i32 = id::WINDOW_ITEMS;
521 const NAME: &'static str = "window_items";
522 const STATE: State = State::Play;
523 const DIRECTION: Direction = Direction::Clientbound;
524}
525impl From<WindowItems> for ClientboundPlayPacket {
526 fn from(p: WindowItems) -> Self {
527 Self::WindowItems(p)
528 }
529}
530
531pub type CraftProgressBar = crate::defs::p47::play::clientbound::CraftProgressBar<754>;
533impl crate::packet::Packet for CraftProgressBar {
534 const ID: i32 = id::CRAFT_PROGRESS_BAR;
535 const NAME: &'static str = "craft_progress_bar";
536 const STATE: State = State::Play;
537 const DIRECTION: Direction = Direction::Clientbound;
538}
539impl From<CraftProgressBar> for ClientboundPlayPacket {
540 fn from(p: CraftProgressBar) -> Self {
541 Self::CraftProgressBar(p)
542 }
543}
544
545pub type SetSlot = crate::defs::p754::play::clientbound::SetSlot<754>;
547impl crate::packet::Packet for SetSlot {
548 const ID: i32 = id::SET_SLOT;
549 const NAME: &'static str = "set_slot";
550 const STATE: State = State::Play;
551 const DIRECTION: Direction = Direction::Clientbound;
552}
553impl From<SetSlot> for ClientboundPlayPacket {
554 fn from(p: SetSlot) -> Self {
555 Self::SetSlot(p)
556 }
557}
558
559pub type SetCooldown = crate::defs::p340::play::clientbound::SetCooldown<754>;
561impl crate::packet::Packet for SetCooldown {
562 const ID: i32 = id::SET_COOLDOWN;
563 const NAME: &'static str = "set_cooldown";
564 const STATE: State = State::Play;
565 const DIRECTION: Direction = Direction::Clientbound;
566}
567impl From<SetCooldown> for ClientboundPlayPacket {
568 fn from(p: SetCooldown) -> Self {
569 Self::SetCooldown(p)
570 }
571}
572
573pub type CustomPayload = crate::defs::p47::play::clientbound::CustomPayload<754>;
575impl crate::packet::Packet for CustomPayload {
576 const ID: i32 = id::CUSTOM_PAYLOAD;
577 const NAME: &'static str = "custom_payload";
578 const STATE: State = State::Play;
579 const DIRECTION: Direction = Direction::Clientbound;
580}
581impl From<CustomPayload> for ClientboundPlayPacket {
582 fn from(p: CustomPayload) -> Self {
583 Self::CustomPayload(p)
584 }
585}
586
587pub type NamedSoundEffect = crate::defs::p340::play::clientbound::NamedSoundEffect<754>;
589impl crate::packet::Packet for NamedSoundEffect {
590 const ID: i32 = id::NAMED_SOUND_EFFECT;
591 const NAME: &'static str = "named_sound_effect";
592 const STATE: State = State::Play;
593 const DIRECTION: Direction = Direction::Clientbound;
594}
595impl From<NamedSoundEffect> for ClientboundPlayPacket {
596 fn from(p: NamedSoundEffect) -> Self {
597 Self::NamedSoundEffect(p)
598 }
599}
600
601pub type KickDisconnect = crate::defs::p47::play::clientbound::KickDisconnect<754>;
603impl crate::packet::Packet for KickDisconnect {
604 const ID: i32 = id::KICK_DISCONNECT;
605 const NAME: &'static str = "kick_disconnect";
606 const STATE: State = State::Play;
607 const DIRECTION: Direction = Direction::Clientbound;
608}
609impl From<KickDisconnect> for ClientboundPlayPacket {
610 fn from(p: KickDisconnect) -> Self {
611 Self::KickDisconnect(p)
612 }
613}
614
615pub type EntityStatus = crate::defs::p47::play::clientbound::EntityStatus<754>;
617impl crate::packet::Packet for EntityStatus {
618 const ID: i32 = id::ENTITY_STATUS;
619 const NAME: &'static str = "entity_status";
620 const STATE: State = State::Play;
621 const DIRECTION: Direction = Direction::Clientbound;
622}
623impl From<EntityStatus> for ClientboundPlayPacket {
624 fn from(p: EntityStatus) -> Self {
625 Self::EntityStatus(p)
626 }
627}
628
629pub type Explosion = crate::defs::p47::play::clientbound::Explosion<754>;
631impl crate::packet::Packet for Explosion {
632 const ID: i32 = id::EXPLOSION;
633 const NAME: &'static str = "explosion";
634 const STATE: State = State::Play;
635 const DIRECTION: Direction = Direction::Clientbound;
636}
637impl From<Explosion> for ClientboundPlayPacket {
638 fn from(p: Explosion) -> Self {
639 Self::Explosion(p)
640 }
641}
642
643pub type UnloadChunk = crate::defs::p340::play::clientbound::UnloadChunk<754>;
645impl crate::packet::Packet for UnloadChunk {
646 const ID: i32 = id::UNLOAD_CHUNK;
647 const NAME: &'static str = "unload_chunk";
648 const STATE: State = State::Play;
649 const DIRECTION: Direction = Direction::Clientbound;
650}
651impl From<UnloadChunk> for ClientboundPlayPacket {
652 fn from(p: UnloadChunk) -> Self {
653 Self::UnloadChunk(p)
654 }
655}
656
657pub type GameStateChange = crate::defs::p754::play::clientbound::GameStateChange<754>;
659impl crate::packet::Packet for GameStateChange {
660 const ID: i32 = id::GAME_STATE_CHANGE;
661 const NAME: &'static str = "game_state_change";
662 const STATE: State = State::Play;
663 const DIRECTION: Direction = Direction::Clientbound;
664}
665impl From<GameStateChange> for ClientboundPlayPacket {
666 fn from(p: GameStateChange) -> Self {
667 Self::GameStateChange(p)
668 }
669}
670
671pub type OpenHorseWindow = crate::defs::p754::play::clientbound::OpenHorseWindow<754>;
673impl crate::packet::Packet for OpenHorseWindow {
674 const ID: i32 = id::OPEN_HORSE_WINDOW;
675 const NAME: &'static str = "open_horse_window";
676 const STATE: State = State::Play;
677 const DIRECTION: Direction = Direction::Clientbound;
678}
679impl From<OpenHorseWindow> for ClientboundPlayPacket {
680 fn from(p: OpenHorseWindow) -> Self {
681 Self::OpenHorseWindow(p)
682 }
683}
684
685pub type KeepAlive = crate::defs::p340::play::clientbound::KeepAlive<754>;
687impl crate::packet::Packet for KeepAlive {
688 const ID: i32 = id::KEEP_ALIVE;
689 const NAME: &'static str = "keep_alive";
690 const STATE: State = State::Play;
691 const DIRECTION: Direction = Direction::Clientbound;
692}
693impl From<KeepAlive> for ClientboundPlayPacket {
694 fn from(p: KeepAlive) -> Self {
695 Self::KeepAlive(p)
696 }
697}
698
699pub type MapChunk = crate::defs::p754::play::clientbound::MapChunk<754>;
701impl crate::packet::Packet for MapChunk {
702 const ID: i32 = id::MAP_CHUNK;
703 const NAME: &'static str = "map_chunk";
704 const STATE: State = State::Play;
705 const DIRECTION: Direction = Direction::Clientbound;
706}
707impl From<MapChunk> for ClientboundPlayPacket {
708 fn from(p: MapChunk) -> Self {
709 Self::MapChunk(p)
710 }
711}
712
713pub type WorldEvent = crate::defs::p754::play::clientbound::WorldEvent<754>;
715impl crate::packet::Packet for WorldEvent {
716 const ID: i32 = id::WORLD_EVENT;
717 const NAME: &'static str = "world_event";
718 const STATE: State = State::Play;
719 const DIRECTION: Direction = Direction::Clientbound;
720}
721impl From<WorldEvent> for ClientboundPlayPacket {
722 fn from(p: WorldEvent) -> Self {
723 Self::WorldEvent(p)
724 }
725}
726
727pub type WorldParticles = crate::defs::p754::play::clientbound::WorldParticles<754>;
729impl crate::packet::Packet for WorldParticles {
730 const ID: i32 = id::WORLD_PARTICLES;
731 const NAME: &'static str = "world_particles";
732 const STATE: State = State::Play;
733 const DIRECTION: Direction = Direction::Clientbound;
734}
735impl From<WorldParticles> for ClientboundPlayPacket {
736 fn from(p: WorldParticles) -> Self {
737 Self::WorldParticles(p)
738 }
739}
740
741pub type UpdateLight = crate::defs::p754::play::clientbound::UpdateLight<754>;
743impl crate::packet::Packet for UpdateLight {
744 const ID: i32 = id::UPDATE_LIGHT;
745 const NAME: &'static str = "update_light";
746 const STATE: State = State::Play;
747 const DIRECTION: Direction = Direction::Clientbound;
748}
749impl From<UpdateLight> for ClientboundPlayPacket {
750 fn from(p: UpdateLight) -> Self {
751 Self::UpdateLight(p)
752 }
753}
754
755pub type Login = crate::defs::p754::play::clientbound::Login<754>;
757impl crate::packet::Packet for Login {
758 const ID: i32 = id::LOGIN;
759 const NAME: &'static str = "login";
760 const STATE: State = State::Play;
761 const DIRECTION: Direction = Direction::Clientbound;
762}
763impl From<Login> for ClientboundPlayPacket {
764 fn from(p: Login) -> Self {
765 Self::Login(p)
766 }
767}
768
769pub type Map = crate::defs::p754::play::clientbound::Map<754>;
771impl crate::packet::Packet for Map {
772 const ID: i32 = id::MAP;
773 const NAME: &'static str = "map";
774 const STATE: State = State::Play;
775 const DIRECTION: Direction = Direction::Clientbound;
776}
777impl From<Map> for ClientboundPlayPacket {
778 fn from(p: Map) -> Self {
779 Self::Map(p)
780 }
781}
782
783pub type TradeList = crate::defs::p754::play::clientbound::TradeList<754>;
785impl crate::packet::Packet for TradeList {
786 const ID: i32 = id::TRADE_LIST;
787 const NAME: &'static str = "trade_list";
788 const STATE: State = State::Play;
789 const DIRECTION: Direction = Direction::Clientbound;
790}
791impl From<TradeList> for ClientboundPlayPacket {
792 fn from(p: TradeList) -> Self {
793 Self::TradeList(p)
794 }
795}
796
797pub type RelEntityMove = crate::defs::p340::play::clientbound::RelEntityMove<754>;
799impl crate::packet::Packet for RelEntityMove {
800 const ID: i32 = id::REL_ENTITY_MOVE;
801 const NAME: &'static str = "rel_entity_move";
802 const STATE: State = State::Play;
803 const DIRECTION: Direction = Direction::Clientbound;
804}
805impl From<RelEntityMove> for ClientboundPlayPacket {
806 fn from(p: RelEntityMove) -> Self {
807 Self::RelEntityMove(p)
808 }
809}
810
811pub type EntityMoveLook = crate::defs::p340::play::clientbound::EntityMoveLook<754>;
813impl crate::packet::Packet for EntityMoveLook {
814 const ID: i32 = id::ENTITY_MOVE_LOOK;
815 const NAME: &'static str = "entity_move_look";
816 const STATE: State = State::Play;
817 const DIRECTION: Direction = Direction::Clientbound;
818}
819impl From<EntityMoveLook> for ClientboundPlayPacket {
820 fn from(p: EntityMoveLook) -> Self {
821 Self::EntityMoveLook(p)
822 }
823}
824
825pub type EntityLook = crate::defs::p47::play::clientbound::EntityLook<754>;
827impl crate::packet::Packet for EntityLook {
828 const ID: i32 = id::ENTITY_LOOK;
829 const NAME: &'static str = "entity_look";
830 const STATE: State = State::Play;
831 const DIRECTION: Direction = Direction::Clientbound;
832}
833impl From<EntityLook> for ClientboundPlayPacket {
834 fn from(p: EntityLook) -> Self {
835 Self::EntityLook(p)
836 }
837}
838
839pub type Entity = crate::defs::p47::play::clientbound::Entity<754>;
841impl crate::packet::Packet for Entity {
842 const ID: i32 = id::ENTITY;
843 const NAME: &'static str = "entity";
844 const STATE: State = State::Play;
845 const DIRECTION: Direction = Direction::Clientbound;
846}
847impl From<Entity> for ClientboundPlayPacket {
848 fn from(p: Entity) -> Self {
849 Self::Entity(p)
850 }
851}
852
853pub type VehicleMove = crate::defs::p340::play::clientbound::VehicleMove<754>;
855impl crate::packet::Packet for VehicleMove {
856 const ID: i32 = id::VEHICLE_MOVE;
857 const NAME: &'static str = "vehicle_move";
858 const STATE: State = State::Play;
859 const DIRECTION: Direction = Direction::Clientbound;
860}
861impl From<VehicleMove> for ClientboundPlayPacket {
862 fn from(p: VehicleMove) -> Self {
863 Self::VehicleMove(p)
864 }
865}
866
867pub type OpenBook = crate::defs::p754::play::clientbound::OpenBook<754>;
869impl crate::packet::Packet for OpenBook {
870 const ID: i32 = id::OPEN_BOOK;
871 const NAME: &'static str = "open_book";
872 const STATE: State = State::Play;
873 const DIRECTION: Direction = Direction::Clientbound;
874}
875impl From<OpenBook> for ClientboundPlayPacket {
876 fn from(p: OpenBook) -> Self {
877 Self::OpenBook(p)
878 }
879}
880
881pub type OpenWindow = crate::defs::p754::play::clientbound::OpenWindow<754>;
883impl crate::packet::Packet for OpenWindow {
884 const ID: i32 = id::OPEN_WINDOW;
885 const NAME: &'static str = "open_window";
886 const STATE: State = State::Play;
887 const DIRECTION: Direction = Direction::Clientbound;
888}
889impl From<OpenWindow> for ClientboundPlayPacket {
890 fn from(p: OpenWindow) -> Self {
891 Self::OpenWindow(p)
892 }
893}
894
895pub type OpenSignEntity = crate::defs::p754::play::clientbound::OpenSignEntity<754>;
897impl crate::packet::Packet for OpenSignEntity {
898 const ID: i32 = id::OPEN_SIGN_ENTITY;
899 const NAME: &'static str = "open_sign_entity";
900 const STATE: State = State::Play;
901 const DIRECTION: Direction = Direction::Clientbound;
902}
903impl From<OpenSignEntity> for ClientboundPlayPacket {
904 fn from(p: OpenSignEntity) -> Self {
905 Self::OpenSignEntity(p)
906 }
907}
908
909pub type CraftRecipeResponse = crate::defs::p754::play::clientbound::CraftRecipeResponse<754>;
911impl crate::packet::Packet for CraftRecipeResponse {
912 const ID: i32 = id::CRAFT_RECIPE_RESPONSE;
913 const NAME: &'static str = "craft_recipe_response";
914 const STATE: State = State::Play;
915 const DIRECTION: Direction = Direction::Clientbound;
916}
917impl From<CraftRecipeResponse> for ClientboundPlayPacket {
918 fn from(p: CraftRecipeResponse) -> Self {
919 Self::CraftRecipeResponse(p)
920 }
921}
922
923pub type Abilities = crate::defs::p47::play::clientbound::Abilities<754>;
925impl crate::packet::Packet for Abilities {
926 const ID: i32 = id::ABILITIES;
927 const NAME: &'static str = "abilities";
928 const STATE: State = State::Play;
929 const DIRECTION: Direction = Direction::Clientbound;
930}
931impl From<Abilities> for ClientboundPlayPacket {
932 fn from(p: Abilities) -> Self {
933 Self::Abilities(p)
934 }
935}
936
937pub type CombatEvent = crate::defs::p47::play::clientbound::CombatEvent<754>;
939impl crate::packet::Packet for CombatEvent {
940 const ID: i32 = id::COMBAT_EVENT;
941 const NAME: &'static str = "combat_event";
942 const STATE: State = State::Play;
943 const DIRECTION: Direction = Direction::Clientbound;
944}
945impl From<CombatEvent> for ClientboundPlayPacket {
946 fn from(p: CombatEvent) -> Self {
947 Self::CombatEvent(p)
948 }
949}
950
951pub type PlayerInfo = crate::defs::p47::play::clientbound::PlayerInfo<754>;
953impl crate::packet::Packet for PlayerInfo {
954 const ID: i32 = id::PLAYER_INFO;
955 const NAME: &'static str = "player_info";
956 const STATE: State = State::Play;
957 const DIRECTION: Direction = Direction::Clientbound;
958}
959impl From<PlayerInfo> for ClientboundPlayPacket {
960 fn from(p: PlayerInfo) -> Self {
961 Self::PlayerInfo(p)
962 }
963}
964
965pub type FacePlayer = crate::defs::p754::play::clientbound::FacePlayer<754>;
967impl crate::packet::Packet for FacePlayer {
968 const ID: i32 = id::FACE_PLAYER;
969 const NAME: &'static str = "face_player";
970 const STATE: State = State::Play;
971 const DIRECTION: Direction = Direction::Clientbound;
972}
973impl From<FacePlayer> for ClientboundPlayPacket {
974 fn from(p: FacePlayer) -> Self {
975 Self::FacePlayer(p)
976 }
977}
978
979pub type Position = crate::defs::p340::play::clientbound::Position<754>;
981impl crate::packet::Packet for Position {
982 const ID: i32 = id::POSITION;
983 const NAME: &'static str = "position";
984 const STATE: State = State::Play;
985 const DIRECTION: Direction = Direction::Clientbound;
986}
987impl From<Position> for ClientboundPlayPacket {
988 fn from(p: Position) -> Self {
989 Self::Position(p)
990 }
991}
992
993pub type UnlockRecipes = crate::defs::p754::play::clientbound::UnlockRecipes<754>;
995impl crate::packet::Packet for UnlockRecipes {
996 const ID: i32 = id::UNLOCK_RECIPES;
997 const NAME: &'static str = "unlock_recipes";
998 const STATE: State = State::Play;
999 const DIRECTION: Direction = Direction::Clientbound;
1000}
1001impl From<UnlockRecipes> for ClientboundPlayPacket {
1002 fn from(p: UnlockRecipes) -> Self {
1003 Self::UnlockRecipes(p)
1004 }
1005}
1006
1007pub type EntityDestroy = crate::defs::p47::play::clientbound::EntityDestroy<754>;
1009impl crate::packet::Packet for EntityDestroy {
1010 const ID: i32 = id::ENTITY_DESTROY;
1011 const NAME: &'static str = "entity_destroy";
1012 const STATE: State = State::Play;
1013 const DIRECTION: Direction = Direction::Clientbound;
1014}
1015impl From<EntityDestroy> for ClientboundPlayPacket {
1016 fn from(p: EntityDestroy) -> Self {
1017 Self::EntityDestroy(p)
1018 }
1019}
1020
1021pub type RemoveEntityEffect = crate::defs::p47::play::clientbound::RemoveEntityEffect<754>;
1023impl crate::packet::Packet for RemoveEntityEffect {
1024 const ID: i32 = id::REMOVE_ENTITY_EFFECT;
1025 const NAME: &'static str = "remove_entity_effect";
1026 const STATE: State = State::Play;
1027 const DIRECTION: Direction = Direction::Clientbound;
1028}
1029impl From<RemoveEntityEffect> for ClientboundPlayPacket {
1030 fn from(p: RemoveEntityEffect) -> Self {
1031 Self::RemoveEntityEffect(p)
1032 }
1033}
1034
1035pub type ResourcePackSend = crate::defs::p47::play::clientbound::ResourcePackSend<754>;
1037impl crate::packet::Packet for ResourcePackSend {
1038 const ID: i32 = id::RESOURCE_PACK_SEND;
1039 const NAME: &'static str = "resource_pack_send";
1040 const STATE: State = State::Play;
1041 const DIRECTION: Direction = Direction::Clientbound;
1042}
1043impl From<ResourcePackSend> for ClientboundPlayPacket {
1044 fn from(p: ResourcePackSend) -> Self {
1045 Self::ResourcePackSend(p)
1046 }
1047}
1048
1049pub type Respawn = crate::defs::p754::play::clientbound::Respawn<754>;
1051impl crate::packet::Packet for Respawn {
1052 const ID: i32 = id::RESPAWN;
1053 const NAME: &'static str = "respawn";
1054 const STATE: State = State::Play;
1055 const DIRECTION: Direction = Direction::Clientbound;
1056}
1057impl From<Respawn> for ClientboundPlayPacket {
1058 fn from(p: Respawn) -> Self {
1059 Self::Respawn(p)
1060 }
1061}
1062
1063pub type EntityHeadRotation = crate::defs::p47::play::clientbound::EntityHeadRotation<754>;
1065impl crate::packet::Packet for EntityHeadRotation {
1066 const ID: i32 = id::ENTITY_HEAD_ROTATION;
1067 const NAME: &'static str = "entity_head_rotation";
1068 const STATE: State = State::Play;
1069 const DIRECTION: Direction = Direction::Clientbound;
1070}
1071impl From<EntityHeadRotation> for ClientboundPlayPacket {
1072 fn from(p: EntityHeadRotation) -> Self {
1073 Self::EntityHeadRotation(p)
1074 }
1075}
1076
1077pub type MultiBlockChange = crate::defs::p754::play::clientbound::MultiBlockChange<754>;
1079impl crate::packet::Packet for MultiBlockChange {
1080 const ID: i32 = id::MULTI_BLOCK_CHANGE;
1081 const NAME: &'static str = "multi_block_change";
1082 const STATE: State = State::Play;
1083 const DIRECTION: Direction = Direction::Clientbound;
1084}
1085impl From<MultiBlockChange> for ClientboundPlayPacket {
1086 fn from(p: MultiBlockChange) -> Self {
1087 Self::MultiBlockChange(p)
1088 }
1089}
1090
1091pub type SelectAdvancementTab = crate::defs::p340::play::clientbound::SelectAdvancementTab<754>;
1093impl crate::packet::Packet for SelectAdvancementTab {
1094 const ID: i32 = id::SELECT_ADVANCEMENT_TAB;
1095 const NAME: &'static str = "select_advancement_tab";
1096 const STATE: State = State::Play;
1097 const DIRECTION: Direction = Direction::Clientbound;
1098}
1099impl From<SelectAdvancementTab> for ClientboundPlayPacket {
1100 fn from(p: SelectAdvancementTab) -> Self {
1101 Self::SelectAdvancementTab(p)
1102 }
1103}
1104
1105pub type WorldBorder = crate::defs::p47::play::clientbound::WorldBorder<754>;
1107impl crate::packet::Packet for WorldBorder {
1108 const ID: i32 = id::WORLD_BORDER;
1109 const NAME: &'static str = "world_border";
1110 const STATE: State = State::Play;
1111 const DIRECTION: Direction = Direction::Clientbound;
1112}
1113impl From<WorldBorder> for ClientboundPlayPacket {
1114 fn from(p: WorldBorder) -> Self {
1115 Self::WorldBorder(p)
1116 }
1117}
1118
1119pub type Camera = crate::defs::p47::play::clientbound::Camera<754>;
1121impl crate::packet::Packet for Camera {
1122 const ID: i32 = id::CAMERA;
1123 const NAME: &'static str = "camera";
1124 const STATE: State = State::Play;
1125 const DIRECTION: Direction = Direction::Clientbound;
1126}
1127impl From<Camera> for ClientboundPlayPacket {
1128 fn from(p: Camera) -> Self {
1129 Self::Camera(p)
1130 }
1131}
1132
1133pub type HeldItemSlot = crate::defs::p47::play::clientbound::HeldItemSlot<754>;
1135impl crate::packet::Packet for HeldItemSlot {
1136 const ID: i32 = id::HELD_ITEM_SLOT;
1137 const NAME: &'static str = "held_item_slot";
1138 const STATE: State = State::Play;
1139 const DIRECTION: Direction = Direction::Clientbound;
1140}
1141impl From<HeldItemSlot> for ClientboundPlayPacket {
1142 fn from(p: HeldItemSlot) -> Self {
1143 Self::HeldItemSlot(p)
1144 }
1145}
1146
1147pub type UpdateViewPosition = crate::defs::p754::play::clientbound::UpdateViewPosition<754>;
1149impl crate::packet::Packet for UpdateViewPosition {
1150 const ID: i32 = id::UPDATE_VIEW_POSITION;
1151 const NAME: &'static str = "update_view_position";
1152 const STATE: State = State::Play;
1153 const DIRECTION: Direction = Direction::Clientbound;
1154}
1155impl From<UpdateViewPosition> for ClientboundPlayPacket {
1156 fn from(p: UpdateViewPosition) -> Self {
1157 Self::UpdateViewPosition(p)
1158 }
1159}
1160
1161pub type UpdateViewDistance = crate::defs::p754::play::clientbound::UpdateViewDistance<754>;
1163impl crate::packet::Packet for UpdateViewDistance {
1164 const ID: i32 = id::UPDATE_VIEW_DISTANCE;
1165 const NAME: &'static str = "update_view_distance";
1166 const STATE: State = State::Play;
1167 const DIRECTION: Direction = Direction::Clientbound;
1168}
1169impl From<UpdateViewDistance> for ClientboundPlayPacket {
1170 fn from(p: UpdateViewDistance) -> Self {
1171 Self::UpdateViewDistance(p)
1172 }
1173}
1174
1175pub type SpawnPosition = crate::defs::p754::play::clientbound::SpawnPosition<754>;
1177impl crate::packet::Packet for SpawnPosition {
1178 const ID: i32 = id::SPAWN_POSITION;
1179 const NAME: &'static str = "spawn_position";
1180 const STATE: State = State::Play;
1181 const DIRECTION: Direction = Direction::Clientbound;
1182}
1183impl From<SpawnPosition> for ClientboundPlayPacket {
1184 fn from(p: SpawnPosition) -> Self {
1185 Self::SpawnPosition(p)
1186 }
1187}
1188
1189pub type ScoreboardDisplayObjective =
1191 crate::defs::p47::play::clientbound::ScoreboardDisplayObjective<754>;
1192impl crate::packet::Packet for ScoreboardDisplayObjective {
1193 const ID: i32 = id::SCOREBOARD_DISPLAY_OBJECTIVE;
1194 const NAME: &'static str = "scoreboard_display_objective";
1195 const STATE: State = State::Play;
1196 const DIRECTION: Direction = Direction::Clientbound;
1197}
1198impl From<ScoreboardDisplayObjective> for ClientboundPlayPacket {
1199 fn from(p: ScoreboardDisplayObjective) -> Self {
1200 Self::ScoreboardDisplayObjective(p)
1201 }
1202}
1203
1204pub type EntityMetadata = crate::defs::p754::play::clientbound::EntityMetadata<754>;
1206impl crate::packet::Packet for EntityMetadata {
1207 const ID: i32 = id::ENTITY_METADATA;
1208 const NAME: &'static str = "entity_metadata";
1209 const STATE: State = State::Play;
1210 const DIRECTION: Direction = Direction::Clientbound;
1211}
1212impl From<EntityMetadata> for ClientboundPlayPacket {
1213 fn from(p: EntityMetadata) -> Self {
1214 Self::EntityMetadata(p)
1215 }
1216}
1217
1218pub type AttachEntity = crate::defs::p340::play::clientbound::AttachEntity<754>;
1220impl crate::packet::Packet for AttachEntity {
1221 const ID: i32 = id::ATTACH_ENTITY;
1222 const NAME: &'static str = "attach_entity";
1223 const STATE: State = State::Play;
1224 const DIRECTION: Direction = Direction::Clientbound;
1225}
1226impl From<AttachEntity> for ClientboundPlayPacket {
1227 fn from(p: AttachEntity) -> Self {
1228 Self::AttachEntity(p)
1229 }
1230}
1231
1232pub type EntityVelocity = crate::defs::p47::play::clientbound::EntityVelocity<754>;
1234impl crate::packet::Packet for EntityVelocity {
1235 const ID: i32 = id::ENTITY_VELOCITY;
1236 const NAME: &'static str = "entity_velocity";
1237 const STATE: State = State::Play;
1238 const DIRECTION: Direction = Direction::Clientbound;
1239}
1240impl From<EntityVelocity> for ClientboundPlayPacket {
1241 fn from(p: EntityVelocity) -> Self {
1242 Self::EntityVelocity(p)
1243 }
1244}
1245
1246pub type EntityEquipment = crate::defs::p754::play::clientbound::EntityEquipment<754>;
1248impl crate::packet::Packet for EntityEquipment {
1249 const ID: i32 = id::ENTITY_EQUIPMENT;
1250 const NAME: &'static str = "entity_equipment";
1251 const STATE: State = State::Play;
1252 const DIRECTION: Direction = Direction::Clientbound;
1253}
1254impl From<EntityEquipment> for ClientboundPlayPacket {
1255 fn from(p: EntityEquipment) -> Self {
1256 Self::EntityEquipment(p)
1257 }
1258}
1259
1260pub type Experience = crate::defs::p47::play::clientbound::Experience<754>;
1262impl crate::packet::Packet for Experience {
1263 const ID: i32 = id::EXPERIENCE;
1264 const NAME: &'static str = "experience";
1265 const STATE: State = State::Play;
1266 const DIRECTION: Direction = Direction::Clientbound;
1267}
1268impl From<Experience> for ClientboundPlayPacket {
1269 fn from(p: Experience) -> Self {
1270 Self::Experience(p)
1271 }
1272}
1273
1274pub type UpdateHealth = crate::defs::p47::play::clientbound::UpdateHealth<754>;
1276impl crate::packet::Packet for UpdateHealth {
1277 const ID: i32 = id::UPDATE_HEALTH;
1278 const NAME: &'static str = "update_health";
1279 const STATE: State = State::Play;
1280 const DIRECTION: Direction = Direction::Clientbound;
1281}
1282impl From<UpdateHealth> for ClientboundPlayPacket {
1283 fn from(p: UpdateHealth) -> Self {
1284 Self::UpdateHealth(p)
1285 }
1286}
1287
1288pub type ScoreboardObjective = crate::defs::p754::play::clientbound::ScoreboardObjective<754>;
1290impl crate::packet::Packet for ScoreboardObjective {
1291 const ID: i32 = id::SCOREBOARD_OBJECTIVE;
1292 const NAME: &'static str = "scoreboard_objective";
1293 const STATE: State = State::Play;
1294 const DIRECTION: Direction = Direction::Clientbound;
1295}
1296impl From<ScoreboardObjective> for ClientboundPlayPacket {
1297 fn from(p: ScoreboardObjective) -> Self {
1298 Self::ScoreboardObjective(p)
1299 }
1300}
1301
1302pub type SetPassengers = crate::defs::p340::play::clientbound::SetPassengers<754>;
1304impl crate::packet::Packet for SetPassengers {
1305 const ID: i32 = id::SET_PASSENGERS;
1306 const NAME: &'static str = "set_passengers";
1307 const STATE: State = State::Play;
1308 const DIRECTION: Direction = Direction::Clientbound;
1309}
1310impl From<SetPassengers> for ClientboundPlayPacket {
1311 fn from(p: SetPassengers) -> Self {
1312 Self::SetPassengers(p)
1313 }
1314}
1315
1316pub type Teams = crate::defs::p754::play::clientbound::Teams<754>;
1318impl crate::packet::Packet for Teams {
1319 const ID: i32 = id::TEAMS;
1320 const NAME: &'static str = "teams";
1321 const STATE: State = State::Play;
1322 const DIRECTION: Direction = Direction::Clientbound;
1323}
1324impl From<Teams> for ClientboundPlayPacket {
1325 fn from(p: Teams) -> Self {
1326 Self::Teams(p)
1327 }
1328}
1329
1330pub type ScoreboardScore = crate::defs::p47::play::clientbound::ScoreboardScore<754>;
1332impl crate::packet::Packet for ScoreboardScore {
1333 const ID: i32 = id::SCOREBOARD_SCORE;
1334 const NAME: &'static str = "scoreboard_score";
1335 const STATE: State = State::Play;
1336 const DIRECTION: Direction = Direction::Clientbound;
1337}
1338impl From<ScoreboardScore> for ClientboundPlayPacket {
1339 fn from(p: ScoreboardScore) -> Self {
1340 Self::ScoreboardScore(p)
1341 }
1342}
1343
1344pub type UpdateTime = crate::defs::p47::play::clientbound::UpdateTime<754>;
1346impl crate::packet::Packet for UpdateTime {
1347 const ID: i32 = id::UPDATE_TIME;
1348 const NAME: &'static str = "update_time";
1349 const STATE: State = State::Play;
1350 const DIRECTION: Direction = Direction::Clientbound;
1351}
1352impl From<UpdateTime> for ClientboundPlayPacket {
1353 fn from(p: UpdateTime) -> Self {
1354 Self::UpdateTime(p)
1355 }
1356}
1357
1358pub type Title = crate::defs::p340::play::clientbound::Title<754>;
1360impl crate::packet::Packet for Title {
1361 const ID: i32 = id::TITLE;
1362 const NAME: &'static str = "title";
1363 const STATE: State = State::Play;
1364 const DIRECTION: Direction = Direction::Clientbound;
1365}
1366impl From<Title> for ClientboundPlayPacket {
1367 fn from(p: Title) -> Self {
1368 Self::Title(p)
1369 }
1370}
1371
1372pub type EntitySoundEffect = crate::defs::p754::play::clientbound::EntitySoundEffect<754>;
1374impl crate::packet::Packet for EntitySoundEffect {
1375 const ID: i32 = id::ENTITY_SOUND_EFFECT;
1376 const NAME: &'static str = "entity_sound_effect";
1377 const STATE: State = State::Play;
1378 const DIRECTION: Direction = Direction::Clientbound;
1379}
1380impl From<EntitySoundEffect> for ClientboundPlayPacket {
1381 fn from(p: EntitySoundEffect) -> Self {
1382 Self::EntitySoundEffect(p)
1383 }
1384}
1385
1386pub type SoundEffect = crate::defs::p340::play::clientbound::SoundEffect<754>;
1388impl crate::packet::Packet for SoundEffect {
1389 const ID: i32 = id::SOUND_EFFECT;
1390 const NAME: &'static str = "sound_effect";
1391 const STATE: State = State::Play;
1392 const DIRECTION: Direction = Direction::Clientbound;
1393}
1394impl From<SoundEffect> for ClientboundPlayPacket {
1395 fn from(p: SoundEffect) -> Self {
1396 Self::SoundEffect(p)
1397 }
1398}
1399
1400pub type StopSound = crate::defs::p754::play::clientbound::StopSound<754>;
1402impl crate::packet::Packet for StopSound {
1403 const ID: i32 = id::STOP_SOUND;
1404 const NAME: &'static str = "stop_sound";
1405 const STATE: State = State::Play;
1406 const DIRECTION: Direction = Direction::Clientbound;
1407}
1408impl From<StopSound> for ClientboundPlayPacket {
1409 fn from(p: StopSound) -> Self {
1410 Self::StopSound(p)
1411 }
1412}
1413
1414pub type PlayerlistHeader = crate::defs::p47::play::clientbound::PlayerlistHeader<754>;
1416impl crate::packet::Packet for PlayerlistHeader {
1417 const ID: i32 = id::PLAYERLIST_HEADER;
1418 const NAME: &'static str = "playerlist_header";
1419 const STATE: State = State::Play;
1420 const DIRECTION: Direction = Direction::Clientbound;
1421}
1422impl From<PlayerlistHeader> for ClientboundPlayPacket {
1423 fn from(p: PlayerlistHeader) -> Self {
1424 Self::PlayerlistHeader(p)
1425 }
1426}
1427
1428pub type NbtQueryResponse = crate::defs::p754::play::clientbound::NbtQueryResponse<754>;
1430impl crate::packet::Packet for NbtQueryResponse {
1431 const ID: i32 = id::NBT_QUERY_RESPONSE;
1432 const NAME: &'static str = "nbt_query_response";
1433 const STATE: State = State::Play;
1434 const DIRECTION: Direction = Direction::Clientbound;
1435}
1436impl From<NbtQueryResponse> for ClientboundPlayPacket {
1437 fn from(p: NbtQueryResponse) -> Self {
1438 Self::NbtQueryResponse(p)
1439 }
1440}
1441
1442pub type Collect = crate::defs::p340::play::clientbound::Collect<754>;
1444impl crate::packet::Packet for Collect {
1445 const ID: i32 = id::COLLECT;
1446 const NAME: &'static str = "collect";
1447 const STATE: State = State::Play;
1448 const DIRECTION: Direction = Direction::Clientbound;
1449}
1450impl From<Collect> for ClientboundPlayPacket {
1451 fn from(p: Collect) -> Self {
1452 Self::Collect(p)
1453 }
1454}
1455
1456pub type EntityTeleport = crate::defs::p340::play::clientbound::EntityTeleport<754>;
1458impl crate::packet::Packet for EntityTeleport {
1459 const ID: i32 = id::ENTITY_TELEPORT;
1460 const NAME: &'static str = "entity_teleport";
1461 const STATE: State = State::Play;
1462 const DIRECTION: Direction = Direction::Clientbound;
1463}
1464impl From<EntityTeleport> for ClientboundPlayPacket {
1465 fn from(p: EntityTeleport) -> Self {
1466 Self::EntityTeleport(p)
1467 }
1468}
1469
1470pub type Advancements = crate::defs::p754::play::clientbound::Advancements<754>;
1472impl crate::packet::Packet for Advancements {
1473 const ID: i32 = id::ADVANCEMENTS;
1474 const NAME: &'static str = "advancements";
1475 const STATE: State = State::Play;
1476 const DIRECTION: Direction = Direction::Clientbound;
1477}
1478impl From<Advancements> for ClientboundPlayPacket {
1479 fn from(p: Advancements) -> Self {
1480 Self::Advancements(p)
1481 }
1482}
1483
1484pub type EntityUpdateAttributes = crate::defs::p340::play::clientbound::EntityUpdateAttributes<754>;
1486impl crate::packet::Packet for EntityUpdateAttributes {
1487 const ID: i32 = id::ENTITY_UPDATE_ATTRIBUTES;
1488 const NAME: &'static str = "entity_update_attributes";
1489 const STATE: State = State::Play;
1490 const DIRECTION: Direction = Direction::Clientbound;
1491}
1492impl From<EntityUpdateAttributes> for ClientboundPlayPacket {
1493 fn from(p: EntityUpdateAttributes) -> Self {
1494 Self::EntityUpdateAttributes(p)
1495 }
1496}
1497
1498pub type EntityEffect = crate::defs::p340::play::clientbound::EntityEffect<754>;
1500impl crate::packet::Packet for EntityEffect {
1501 const ID: i32 = id::ENTITY_EFFECT;
1502 const NAME: &'static str = "entity_effect";
1503 const STATE: State = State::Play;
1504 const DIRECTION: Direction = Direction::Clientbound;
1505}
1506impl From<EntityEffect> for ClientboundPlayPacket {
1507 fn from(p: EntityEffect) -> Self {
1508 Self::EntityEffect(p)
1509 }
1510}
1511
1512pub type DeclareRecipes = crate::defs::p754::play::clientbound::DeclareRecipes<754>;
1514impl crate::packet::Packet for DeclareRecipes {
1515 const ID: i32 = id::DECLARE_RECIPES;
1516 const NAME: &'static str = "declare_recipes";
1517 const STATE: State = State::Play;
1518 const DIRECTION: Direction = Direction::Clientbound;
1519}
1520impl From<DeclareRecipes> for ClientboundPlayPacket {
1521 fn from(p: DeclareRecipes) -> Self {
1522 Self::DeclareRecipes(p)
1523 }
1524}
1525
1526pub type Tags = crate::defs::p754::play::clientbound::Tags<754>;
1528impl crate::packet::Packet for Tags {
1529 const ID: i32 = id::TAGS;
1530 const NAME: &'static str = "tags";
1531 const STATE: State = State::Play;
1532 const DIRECTION: Direction = Direction::Clientbound;
1533}
1534impl From<Tags> for ClientboundPlayPacket {
1535 fn from(p: Tags) -> Self {
1536 Self::Tags(p)
1537 }
1538}
1539
1540#[derive(Debug, Clone, PartialEq)]
1542pub enum ClientboundPlayPacket {
1543 SpawnEntity(SpawnEntity),
1545 SpawnEntityExperienceOrb(SpawnEntityExperienceOrb),
1547 SpawnEntityLiving(SpawnEntityLiving),
1549 SpawnEntityPainting(SpawnEntityPainting),
1551 NamedEntitySpawn(NamedEntitySpawn),
1553 Animation(Animation),
1555 Statistics(Statistics),
1557 AcknowledgePlayerDigging(AcknowledgePlayerDigging),
1559 BlockBreakAnimation(BlockBreakAnimation),
1561 TileEntityData(TileEntityData),
1563 BlockAction(BlockAction),
1565 BlockChange(BlockChange),
1567 BossBar(BossBar),
1569 Difficulty(Difficulty),
1571 Chat(Chat),
1573 TabComplete(TabComplete),
1575 DeclareCommands(DeclareCommands),
1577 Transaction(Transaction),
1579 CloseWindow(CloseWindow),
1581 WindowItems(WindowItems),
1583 CraftProgressBar(CraftProgressBar),
1585 SetSlot(SetSlot),
1587 SetCooldown(SetCooldown),
1589 CustomPayload(CustomPayload),
1591 NamedSoundEffect(NamedSoundEffect),
1593 KickDisconnect(KickDisconnect),
1595 EntityStatus(EntityStatus),
1597 Explosion(Explosion),
1599 UnloadChunk(UnloadChunk),
1601 GameStateChange(GameStateChange),
1603 OpenHorseWindow(OpenHorseWindow),
1605 KeepAlive(KeepAlive),
1607 MapChunk(MapChunk),
1609 WorldEvent(WorldEvent),
1611 WorldParticles(WorldParticles),
1613 UpdateLight(UpdateLight),
1615 Login(Login),
1617 Map(Map),
1619 TradeList(TradeList),
1621 RelEntityMove(RelEntityMove),
1623 EntityMoveLook(EntityMoveLook),
1625 EntityLook(EntityLook),
1627 Entity(Entity),
1629 VehicleMove(VehicleMove),
1631 OpenBook(OpenBook),
1633 OpenWindow(OpenWindow),
1635 OpenSignEntity(OpenSignEntity),
1637 CraftRecipeResponse(CraftRecipeResponse),
1639 Abilities(Abilities),
1641 CombatEvent(CombatEvent),
1643 PlayerInfo(PlayerInfo),
1645 FacePlayer(FacePlayer),
1647 Position(Position),
1649 UnlockRecipes(UnlockRecipes),
1651 EntityDestroy(EntityDestroy),
1653 RemoveEntityEffect(RemoveEntityEffect),
1655 ResourcePackSend(ResourcePackSend),
1657 Respawn(Respawn),
1659 EntityHeadRotation(EntityHeadRotation),
1661 MultiBlockChange(MultiBlockChange),
1663 SelectAdvancementTab(SelectAdvancementTab),
1665 WorldBorder(WorldBorder),
1667 Camera(Camera),
1669 HeldItemSlot(HeldItemSlot),
1671 UpdateViewPosition(UpdateViewPosition),
1673 UpdateViewDistance(UpdateViewDistance),
1675 SpawnPosition(SpawnPosition),
1677 ScoreboardDisplayObjective(ScoreboardDisplayObjective),
1679 EntityMetadata(EntityMetadata),
1681 AttachEntity(AttachEntity),
1683 EntityVelocity(EntityVelocity),
1685 EntityEquipment(EntityEquipment),
1687 Experience(Experience),
1689 UpdateHealth(UpdateHealth),
1691 ScoreboardObjective(ScoreboardObjective),
1693 SetPassengers(SetPassengers),
1695 Teams(Teams),
1697 ScoreboardScore(ScoreboardScore),
1699 UpdateTime(UpdateTime),
1701 Title(Title),
1703 EntitySoundEffect(EntitySoundEffect),
1705 SoundEffect(SoundEffect),
1707 StopSound(StopSound),
1709 PlayerlistHeader(PlayerlistHeader),
1711 NbtQueryResponse(NbtQueryResponse),
1713 Collect(Collect),
1715 EntityTeleport(EntityTeleport),
1717 Advancements(Advancements),
1719 EntityUpdateAttributes(EntityUpdateAttributes),
1721 EntityEffect(EntityEffect),
1723 DeclareRecipes(DeclareRecipes),
1725 Tags(Tags),
1727}
1728
1729impl PacketSet for ClientboundPlayPacket {
1730 const STATE: State = State::Play;
1731 const DIRECTION: Direction = Direction::Clientbound;
1732 fn decode_raw(raw: &RawPacket) -> DecodeResult<Self> {
1733 match raw.id {
1734 id::SPAWN_ENTITY => decode_exact(&raw.body).map(Self::SpawnEntity),
1735 id::SPAWN_ENTITY_EXPERIENCE_ORB => {
1736 decode_exact(&raw.body).map(Self::SpawnEntityExperienceOrb)
1737 }
1738 id::SPAWN_ENTITY_LIVING => decode_exact(&raw.body).map(Self::SpawnEntityLiving),
1739 id::SPAWN_ENTITY_PAINTING => decode_exact(&raw.body).map(Self::SpawnEntityPainting),
1740 id::NAMED_ENTITY_SPAWN => decode_exact(&raw.body).map(Self::NamedEntitySpawn),
1741 id::ANIMATION => decode_exact(&raw.body).map(Self::Animation),
1742 id::STATISTICS => decode_exact(&raw.body).map(Self::Statistics),
1743 id::ACKNOWLEDGE_PLAYER_DIGGING => {
1744 decode_exact(&raw.body).map(Self::AcknowledgePlayerDigging)
1745 }
1746 id::BLOCK_BREAK_ANIMATION => decode_exact(&raw.body).map(Self::BlockBreakAnimation),
1747 id::TILE_ENTITY_DATA => decode_exact(&raw.body).map(Self::TileEntityData),
1748 id::BLOCK_ACTION => decode_exact(&raw.body).map(Self::BlockAction),
1749 id::BLOCK_CHANGE => decode_exact(&raw.body).map(Self::BlockChange),
1750 id::BOSS_BAR => decode_exact(&raw.body).map(Self::BossBar),
1751 id::DIFFICULTY => decode_exact(&raw.body).map(Self::Difficulty),
1752 id::CHAT => decode_exact(&raw.body).map(Self::Chat),
1753 id::TAB_COMPLETE => decode_exact(&raw.body).map(Self::TabComplete),
1754 id::DECLARE_COMMANDS => decode_exact(&raw.body).map(Self::DeclareCommands),
1755 id::TRANSACTION => decode_exact(&raw.body).map(Self::Transaction),
1756 id::CLOSE_WINDOW => decode_exact(&raw.body).map(Self::CloseWindow),
1757 id::WINDOW_ITEMS => decode_exact(&raw.body).map(Self::WindowItems),
1758 id::CRAFT_PROGRESS_BAR => decode_exact(&raw.body).map(Self::CraftProgressBar),
1759 id::SET_SLOT => decode_exact(&raw.body).map(Self::SetSlot),
1760 id::SET_COOLDOWN => decode_exact(&raw.body).map(Self::SetCooldown),
1761 id::CUSTOM_PAYLOAD => decode_exact(&raw.body).map(Self::CustomPayload),
1762 id::NAMED_SOUND_EFFECT => decode_exact(&raw.body).map(Self::NamedSoundEffect),
1763 id::KICK_DISCONNECT => decode_exact(&raw.body).map(Self::KickDisconnect),
1764 id::ENTITY_STATUS => decode_exact(&raw.body).map(Self::EntityStatus),
1765 id::EXPLOSION => decode_exact(&raw.body).map(Self::Explosion),
1766 id::UNLOAD_CHUNK => decode_exact(&raw.body).map(Self::UnloadChunk),
1767 id::GAME_STATE_CHANGE => decode_exact(&raw.body).map(Self::GameStateChange),
1768 id::OPEN_HORSE_WINDOW => decode_exact(&raw.body).map(Self::OpenHorseWindow),
1769 id::KEEP_ALIVE => decode_exact(&raw.body).map(Self::KeepAlive),
1770 id::MAP_CHUNK => decode_exact(&raw.body).map(Self::MapChunk),
1771 id::WORLD_EVENT => decode_exact(&raw.body).map(Self::WorldEvent),
1772 id::WORLD_PARTICLES => decode_exact(&raw.body).map(Self::WorldParticles),
1773 id::UPDATE_LIGHT => decode_exact(&raw.body).map(Self::UpdateLight),
1774 id::LOGIN => decode_exact(&raw.body).map(Self::Login),
1775 id::MAP => decode_exact(&raw.body).map(Self::Map),
1776 id::TRADE_LIST => decode_exact(&raw.body).map(Self::TradeList),
1777 id::REL_ENTITY_MOVE => decode_exact(&raw.body).map(Self::RelEntityMove),
1778 id::ENTITY_MOVE_LOOK => decode_exact(&raw.body).map(Self::EntityMoveLook),
1779 id::ENTITY_LOOK => decode_exact(&raw.body).map(Self::EntityLook),
1780 id::ENTITY => decode_exact(&raw.body).map(Self::Entity),
1781 id::VEHICLE_MOVE => decode_exact(&raw.body).map(Self::VehicleMove),
1782 id::OPEN_BOOK => decode_exact(&raw.body).map(Self::OpenBook),
1783 id::OPEN_WINDOW => decode_exact(&raw.body).map(Self::OpenWindow),
1784 id::OPEN_SIGN_ENTITY => decode_exact(&raw.body).map(Self::OpenSignEntity),
1785 id::CRAFT_RECIPE_RESPONSE => decode_exact(&raw.body).map(Self::CraftRecipeResponse),
1786 id::ABILITIES => decode_exact(&raw.body).map(Self::Abilities),
1787 id::COMBAT_EVENT => decode_exact(&raw.body).map(Self::CombatEvent),
1788 id::PLAYER_INFO => decode_exact(&raw.body).map(Self::PlayerInfo),
1789 id::FACE_PLAYER => decode_exact(&raw.body).map(Self::FacePlayer),
1790 id::POSITION => decode_exact(&raw.body).map(Self::Position),
1791 id::UNLOCK_RECIPES => decode_exact(&raw.body).map(Self::UnlockRecipes),
1792 id::ENTITY_DESTROY => decode_exact(&raw.body).map(Self::EntityDestroy),
1793 id::REMOVE_ENTITY_EFFECT => decode_exact(&raw.body).map(Self::RemoveEntityEffect),
1794 id::RESOURCE_PACK_SEND => decode_exact(&raw.body).map(Self::ResourcePackSend),
1795 id::RESPAWN => decode_exact(&raw.body).map(Self::Respawn),
1796 id::ENTITY_HEAD_ROTATION => decode_exact(&raw.body).map(Self::EntityHeadRotation),
1797 id::MULTI_BLOCK_CHANGE => decode_exact(&raw.body).map(Self::MultiBlockChange),
1798 id::SELECT_ADVANCEMENT_TAB => decode_exact(&raw.body).map(Self::SelectAdvancementTab),
1799 id::WORLD_BORDER => decode_exact(&raw.body).map(Self::WorldBorder),
1800 id::CAMERA => decode_exact(&raw.body).map(Self::Camera),
1801 id::HELD_ITEM_SLOT => decode_exact(&raw.body).map(Self::HeldItemSlot),
1802 id::UPDATE_VIEW_POSITION => decode_exact(&raw.body).map(Self::UpdateViewPosition),
1803 id::UPDATE_VIEW_DISTANCE => decode_exact(&raw.body).map(Self::UpdateViewDistance),
1804 id::SPAWN_POSITION => decode_exact(&raw.body).map(Self::SpawnPosition),
1805 id::SCOREBOARD_DISPLAY_OBJECTIVE => {
1806 decode_exact(&raw.body).map(Self::ScoreboardDisplayObjective)
1807 }
1808 id::ENTITY_METADATA => decode_exact(&raw.body).map(Self::EntityMetadata),
1809 id::ATTACH_ENTITY => decode_exact(&raw.body).map(Self::AttachEntity),
1810 id::ENTITY_VELOCITY => decode_exact(&raw.body).map(Self::EntityVelocity),
1811 id::ENTITY_EQUIPMENT => decode_exact(&raw.body).map(Self::EntityEquipment),
1812 id::EXPERIENCE => decode_exact(&raw.body).map(Self::Experience),
1813 id::UPDATE_HEALTH => decode_exact(&raw.body).map(Self::UpdateHealth),
1814 id::SCOREBOARD_OBJECTIVE => decode_exact(&raw.body).map(Self::ScoreboardObjective),
1815 id::SET_PASSENGERS => decode_exact(&raw.body).map(Self::SetPassengers),
1816 id::TEAMS => decode_exact(&raw.body).map(Self::Teams),
1817 id::SCOREBOARD_SCORE => decode_exact(&raw.body).map(Self::ScoreboardScore),
1818 id::UPDATE_TIME => decode_exact(&raw.body).map(Self::UpdateTime),
1819 id::TITLE => decode_exact(&raw.body).map(Self::Title),
1820 id::ENTITY_SOUND_EFFECT => decode_exact(&raw.body).map(Self::EntitySoundEffect),
1821 id::SOUND_EFFECT => decode_exact(&raw.body).map(Self::SoundEffect),
1822 id::STOP_SOUND => decode_exact(&raw.body).map(Self::StopSound),
1823 id::PLAYERLIST_HEADER => decode_exact(&raw.body).map(Self::PlayerlistHeader),
1824 id::NBT_QUERY_RESPONSE => decode_exact(&raw.body).map(Self::NbtQueryResponse),
1825 id::COLLECT => decode_exact(&raw.body).map(Self::Collect),
1826 id::ENTITY_TELEPORT => decode_exact(&raw.body).map(Self::EntityTeleport),
1827 id::ADVANCEMENTS => decode_exact(&raw.body).map(Self::Advancements),
1828 id::ENTITY_UPDATE_ATTRIBUTES => {
1829 decode_exact(&raw.body).map(Self::EntityUpdateAttributes)
1830 }
1831 id::ENTITY_EFFECT => decode_exact(&raw.body).map(Self::EntityEffect),
1832 id::DECLARE_RECIPES => decode_exact(&raw.body).map(Self::DeclareRecipes),
1833 id::TAGS => decode_exact(&raw.body).map(Self::Tags),
1834 other => Err(DecodeError::UnknownPacketId(other)),
1835 }
1836 }
1837 fn id(&self) -> i32 {
1838 match *self {
1839 Self::SpawnEntity(_) => id::SPAWN_ENTITY,
1840 Self::SpawnEntityExperienceOrb(_) => id::SPAWN_ENTITY_EXPERIENCE_ORB,
1841 Self::SpawnEntityLiving(_) => id::SPAWN_ENTITY_LIVING,
1842 Self::SpawnEntityPainting(_) => id::SPAWN_ENTITY_PAINTING,
1843 Self::NamedEntitySpawn(_) => id::NAMED_ENTITY_SPAWN,
1844 Self::Animation(_) => id::ANIMATION,
1845 Self::Statistics(_) => id::STATISTICS,
1846 Self::AcknowledgePlayerDigging(_) => id::ACKNOWLEDGE_PLAYER_DIGGING,
1847 Self::BlockBreakAnimation(_) => id::BLOCK_BREAK_ANIMATION,
1848 Self::TileEntityData(_) => id::TILE_ENTITY_DATA,
1849 Self::BlockAction(_) => id::BLOCK_ACTION,
1850 Self::BlockChange(_) => id::BLOCK_CHANGE,
1851 Self::BossBar(_) => id::BOSS_BAR,
1852 Self::Difficulty(_) => id::DIFFICULTY,
1853 Self::Chat(_) => id::CHAT,
1854 Self::TabComplete(_) => id::TAB_COMPLETE,
1855 Self::DeclareCommands(_) => id::DECLARE_COMMANDS,
1856 Self::Transaction(_) => id::TRANSACTION,
1857 Self::CloseWindow(_) => id::CLOSE_WINDOW,
1858 Self::WindowItems(_) => id::WINDOW_ITEMS,
1859 Self::CraftProgressBar(_) => id::CRAFT_PROGRESS_BAR,
1860 Self::SetSlot(_) => id::SET_SLOT,
1861 Self::SetCooldown(_) => id::SET_COOLDOWN,
1862 Self::CustomPayload(_) => id::CUSTOM_PAYLOAD,
1863 Self::NamedSoundEffect(_) => id::NAMED_SOUND_EFFECT,
1864 Self::KickDisconnect(_) => id::KICK_DISCONNECT,
1865 Self::EntityStatus(_) => id::ENTITY_STATUS,
1866 Self::Explosion(_) => id::EXPLOSION,
1867 Self::UnloadChunk(_) => id::UNLOAD_CHUNK,
1868 Self::GameStateChange(_) => id::GAME_STATE_CHANGE,
1869 Self::OpenHorseWindow(_) => id::OPEN_HORSE_WINDOW,
1870 Self::KeepAlive(_) => id::KEEP_ALIVE,
1871 Self::MapChunk(_) => id::MAP_CHUNK,
1872 Self::WorldEvent(_) => id::WORLD_EVENT,
1873 Self::WorldParticles(_) => id::WORLD_PARTICLES,
1874 Self::UpdateLight(_) => id::UPDATE_LIGHT,
1875 Self::Login(_) => id::LOGIN,
1876 Self::Map(_) => id::MAP,
1877 Self::TradeList(_) => id::TRADE_LIST,
1878 Self::RelEntityMove(_) => id::REL_ENTITY_MOVE,
1879 Self::EntityMoveLook(_) => id::ENTITY_MOVE_LOOK,
1880 Self::EntityLook(_) => id::ENTITY_LOOK,
1881 Self::Entity(_) => id::ENTITY,
1882 Self::VehicleMove(_) => id::VEHICLE_MOVE,
1883 Self::OpenBook(_) => id::OPEN_BOOK,
1884 Self::OpenWindow(_) => id::OPEN_WINDOW,
1885 Self::OpenSignEntity(_) => id::OPEN_SIGN_ENTITY,
1886 Self::CraftRecipeResponse(_) => id::CRAFT_RECIPE_RESPONSE,
1887 Self::Abilities(_) => id::ABILITIES,
1888 Self::CombatEvent(_) => id::COMBAT_EVENT,
1889 Self::PlayerInfo(_) => id::PLAYER_INFO,
1890 Self::FacePlayer(_) => id::FACE_PLAYER,
1891 Self::Position(_) => id::POSITION,
1892 Self::UnlockRecipes(_) => id::UNLOCK_RECIPES,
1893 Self::EntityDestroy(_) => id::ENTITY_DESTROY,
1894 Self::RemoveEntityEffect(_) => id::REMOVE_ENTITY_EFFECT,
1895 Self::ResourcePackSend(_) => id::RESOURCE_PACK_SEND,
1896 Self::Respawn(_) => id::RESPAWN,
1897 Self::EntityHeadRotation(_) => id::ENTITY_HEAD_ROTATION,
1898 Self::MultiBlockChange(_) => id::MULTI_BLOCK_CHANGE,
1899 Self::SelectAdvancementTab(_) => id::SELECT_ADVANCEMENT_TAB,
1900 Self::WorldBorder(_) => id::WORLD_BORDER,
1901 Self::Camera(_) => id::CAMERA,
1902 Self::HeldItemSlot(_) => id::HELD_ITEM_SLOT,
1903 Self::UpdateViewPosition(_) => id::UPDATE_VIEW_POSITION,
1904 Self::UpdateViewDistance(_) => id::UPDATE_VIEW_DISTANCE,
1905 Self::SpawnPosition(_) => id::SPAWN_POSITION,
1906 Self::ScoreboardDisplayObjective(_) => id::SCOREBOARD_DISPLAY_OBJECTIVE,
1907 Self::EntityMetadata(_) => id::ENTITY_METADATA,
1908 Self::AttachEntity(_) => id::ATTACH_ENTITY,
1909 Self::EntityVelocity(_) => id::ENTITY_VELOCITY,
1910 Self::EntityEquipment(_) => id::ENTITY_EQUIPMENT,
1911 Self::Experience(_) => id::EXPERIENCE,
1912 Self::UpdateHealth(_) => id::UPDATE_HEALTH,
1913 Self::ScoreboardObjective(_) => id::SCOREBOARD_OBJECTIVE,
1914 Self::SetPassengers(_) => id::SET_PASSENGERS,
1915 Self::Teams(_) => id::TEAMS,
1916 Self::ScoreboardScore(_) => id::SCOREBOARD_SCORE,
1917 Self::UpdateTime(_) => id::UPDATE_TIME,
1918 Self::Title(_) => id::TITLE,
1919 Self::EntitySoundEffect(_) => id::ENTITY_SOUND_EFFECT,
1920 Self::SoundEffect(_) => id::SOUND_EFFECT,
1921 Self::StopSound(_) => id::STOP_SOUND,
1922 Self::PlayerlistHeader(_) => id::PLAYERLIST_HEADER,
1923 Self::NbtQueryResponse(_) => id::NBT_QUERY_RESPONSE,
1924 Self::Collect(_) => id::COLLECT,
1925 Self::EntityTeleport(_) => id::ENTITY_TELEPORT,
1926 Self::Advancements(_) => id::ADVANCEMENTS,
1927 Self::EntityUpdateAttributes(_) => id::ENTITY_UPDATE_ATTRIBUTES,
1928 Self::EntityEffect(_) => id::ENTITY_EFFECT,
1929 Self::DeclareRecipes(_) => id::DECLARE_RECIPES,
1930 Self::Tags(_) => id::TAGS,
1931 }
1932 }
1933 fn name(&self) -> &'static str {
1934 match *self {
1935 Self::SpawnEntity(_) => "spawn_entity",
1936 Self::SpawnEntityExperienceOrb(_) => "spawn_entity_experience_orb",
1937 Self::SpawnEntityLiving(_) => "spawn_entity_living",
1938 Self::SpawnEntityPainting(_) => "spawn_entity_painting",
1939 Self::NamedEntitySpawn(_) => "named_entity_spawn",
1940 Self::Animation(_) => "animation",
1941 Self::Statistics(_) => "statistics",
1942 Self::AcknowledgePlayerDigging(_) => "acknowledge_player_digging",
1943 Self::BlockBreakAnimation(_) => "block_break_animation",
1944 Self::TileEntityData(_) => "tile_entity_data",
1945 Self::BlockAction(_) => "block_action",
1946 Self::BlockChange(_) => "block_change",
1947 Self::BossBar(_) => "boss_bar",
1948 Self::Difficulty(_) => "difficulty",
1949 Self::Chat(_) => "chat",
1950 Self::TabComplete(_) => "tab_complete",
1951 Self::DeclareCommands(_) => "declare_commands",
1952 Self::Transaction(_) => "transaction",
1953 Self::CloseWindow(_) => "close_window",
1954 Self::WindowItems(_) => "window_items",
1955 Self::CraftProgressBar(_) => "craft_progress_bar",
1956 Self::SetSlot(_) => "set_slot",
1957 Self::SetCooldown(_) => "set_cooldown",
1958 Self::CustomPayload(_) => "custom_payload",
1959 Self::NamedSoundEffect(_) => "named_sound_effect",
1960 Self::KickDisconnect(_) => "kick_disconnect",
1961 Self::EntityStatus(_) => "entity_status",
1962 Self::Explosion(_) => "explosion",
1963 Self::UnloadChunk(_) => "unload_chunk",
1964 Self::GameStateChange(_) => "game_state_change",
1965 Self::OpenHorseWindow(_) => "open_horse_window",
1966 Self::KeepAlive(_) => "keep_alive",
1967 Self::MapChunk(_) => "map_chunk",
1968 Self::WorldEvent(_) => "world_event",
1969 Self::WorldParticles(_) => "world_particles",
1970 Self::UpdateLight(_) => "update_light",
1971 Self::Login(_) => "login",
1972 Self::Map(_) => "map",
1973 Self::TradeList(_) => "trade_list",
1974 Self::RelEntityMove(_) => "rel_entity_move",
1975 Self::EntityMoveLook(_) => "entity_move_look",
1976 Self::EntityLook(_) => "entity_look",
1977 Self::Entity(_) => "entity",
1978 Self::VehicleMove(_) => "vehicle_move",
1979 Self::OpenBook(_) => "open_book",
1980 Self::OpenWindow(_) => "open_window",
1981 Self::OpenSignEntity(_) => "open_sign_entity",
1982 Self::CraftRecipeResponse(_) => "craft_recipe_response",
1983 Self::Abilities(_) => "abilities",
1984 Self::CombatEvent(_) => "combat_event",
1985 Self::PlayerInfo(_) => "player_info",
1986 Self::FacePlayer(_) => "face_player",
1987 Self::Position(_) => "position",
1988 Self::UnlockRecipes(_) => "unlock_recipes",
1989 Self::EntityDestroy(_) => "entity_destroy",
1990 Self::RemoveEntityEffect(_) => "remove_entity_effect",
1991 Self::ResourcePackSend(_) => "resource_pack_send",
1992 Self::Respawn(_) => "respawn",
1993 Self::EntityHeadRotation(_) => "entity_head_rotation",
1994 Self::MultiBlockChange(_) => "multi_block_change",
1995 Self::SelectAdvancementTab(_) => "select_advancement_tab",
1996 Self::WorldBorder(_) => "world_border",
1997 Self::Camera(_) => "camera",
1998 Self::HeldItemSlot(_) => "held_item_slot",
1999 Self::UpdateViewPosition(_) => "update_view_position",
2000 Self::UpdateViewDistance(_) => "update_view_distance",
2001 Self::SpawnPosition(_) => "spawn_position",
2002 Self::ScoreboardDisplayObjective(_) => "scoreboard_display_objective",
2003 Self::EntityMetadata(_) => "entity_metadata",
2004 Self::AttachEntity(_) => "attach_entity",
2005 Self::EntityVelocity(_) => "entity_velocity",
2006 Self::EntityEquipment(_) => "entity_equipment",
2007 Self::Experience(_) => "experience",
2008 Self::UpdateHealth(_) => "update_health",
2009 Self::ScoreboardObjective(_) => "scoreboard_objective",
2010 Self::SetPassengers(_) => "set_passengers",
2011 Self::Teams(_) => "teams",
2012 Self::ScoreboardScore(_) => "scoreboard_score",
2013 Self::UpdateTime(_) => "update_time",
2014 Self::Title(_) => "title",
2015 Self::EntitySoundEffect(_) => "entity_sound_effect",
2016 Self::SoundEffect(_) => "sound_effect",
2017 Self::StopSound(_) => "stop_sound",
2018 Self::PlayerlistHeader(_) => "playerlist_header",
2019 Self::NbtQueryResponse(_) => "nbt_query_response",
2020 Self::Collect(_) => "collect",
2021 Self::EntityTeleport(_) => "entity_teleport",
2022 Self::Advancements(_) => "advancements",
2023 Self::EntityUpdateAttributes(_) => "entity_update_attributes",
2024 Self::EntityEffect(_) => "entity_effect",
2025 Self::DeclareRecipes(_) => "declare_recipes",
2026 Self::Tags(_) => "tags",
2027 }
2028 }
2029 fn encode_body(&self, w: &mut BytesMut) -> EncodeResult {
2030 match *self {
2031 Self::SpawnEntity(ref p) => p.encode(w),
2032 Self::SpawnEntityExperienceOrb(ref p) => p.encode(w),
2033 Self::SpawnEntityLiving(ref p) => p.encode(w),
2034 Self::SpawnEntityPainting(ref p) => p.encode(w),
2035 Self::NamedEntitySpawn(ref p) => p.encode(w),
2036 Self::Animation(ref p) => p.encode(w),
2037 Self::Statistics(ref p) => p.encode(w),
2038 Self::AcknowledgePlayerDigging(ref p) => p.encode(w),
2039 Self::BlockBreakAnimation(ref p) => p.encode(w),
2040 Self::TileEntityData(ref p) => p.encode(w),
2041 Self::BlockAction(ref p) => p.encode(w),
2042 Self::BlockChange(ref p) => p.encode(w),
2043 Self::BossBar(ref p) => p.encode(w),
2044 Self::Difficulty(ref p) => p.encode(w),
2045 Self::Chat(ref p) => p.encode(w),
2046 Self::TabComplete(ref p) => p.encode(w),
2047 Self::DeclareCommands(ref p) => p.encode(w),
2048 Self::Transaction(ref p) => p.encode(w),
2049 Self::CloseWindow(ref p) => p.encode(w),
2050 Self::WindowItems(ref p) => p.encode(w),
2051 Self::CraftProgressBar(ref p) => p.encode(w),
2052 Self::SetSlot(ref p) => p.encode(w),
2053 Self::SetCooldown(ref p) => p.encode(w),
2054 Self::CustomPayload(ref p) => p.encode(w),
2055 Self::NamedSoundEffect(ref p) => p.encode(w),
2056 Self::KickDisconnect(ref p) => p.encode(w),
2057 Self::EntityStatus(ref p) => p.encode(w),
2058 Self::Explosion(ref p) => p.encode(w),
2059 Self::UnloadChunk(ref p) => p.encode(w),
2060 Self::GameStateChange(ref p) => p.encode(w),
2061 Self::OpenHorseWindow(ref p) => p.encode(w),
2062 Self::KeepAlive(ref p) => p.encode(w),
2063 Self::MapChunk(ref p) => p.encode(w),
2064 Self::WorldEvent(ref p) => p.encode(w),
2065 Self::WorldParticles(ref p) => p.encode(w),
2066 Self::UpdateLight(ref p) => p.encode(w),
2067 Self::Login(ref p) => p.encode(w),
2068 Self::Map(ref p) => p.encode(w),
2069 Self::TradeList(ref p) => p.encode(w),
2070 Self::RelEntityMove(ref p) => p.encode(w),
2071 Self::EntityMoveLook(ref p) => p.encode(w),
2072 Self::EntityLook(ref p) => p.encode(w),
2073 Self::Entity(ref p) => p.encode(w),
2074 Self::VehicleMove(ref p) => p.encode(w),
2075 Self::OpenBook(ref p) => p.encode(w),
2076 Self::OpenWindow(ref p) => p.encode(w),
2077 Self::OpenSignEntity(ref p) => p.encode(w),
2078 Self::CraftRecipeResponse(ref p) => p.encode(w),
2079 Self::Abilities(ref p) => p.encode(w),
2080 Self::CombatEvent(ref p) => p.encode(w),
2081 Self::PlayerInfo(ref p) => p.encode(w),
2082 Self::FacePlayer(ref p) => p.encode(w),
2083 Self::Position(ref p) => p.encode(w),
2084 Self::UnlockRecipes(ref p) => p.encode(w),
2085 Self::EntityDestroy(ref p) => p.encode(w),
2086 Self::RemoveEntityEffect(ref p) => p.encode(w),
2087 Self::ResourcePackSend(ref p) => p.encode(w),
2088 Self::Respawn(ref p) => p.encode(w),
2089 Self::EntityHeadRotation(ref p) => p.encode(w),
2090 Self::MultiBlockChange(ref p) => p.encode(w),
2091 Self::SelectAdvancementTab(ref p) => p.encode(w),
2092 Self::WorldBorder(ref p) => p.encode(w),
2093 Self::Camera(ref p) => p.encode(w),
2094 Self::HeldItemSlot(ref p) => p.encode(w),
2095 Self::UpdateViewPosition(ref p) => p.encode(w),
2096 Self::UpdateViewDistance(ref p) => p.encode(w),
2097 Self::SpawnPosition(ref p) => p.encode(w),
2098 Self::ScoreboardDisplayObjective(ref p) => p.encode(w),
2099 Self::EntityMetadata(ref p) => p.encode(w),
2100 Self::AttachEntity(ref p) => p.encode(w),
2101 Self::EntityVelocity(ref p) => p.encode(w),
2102 Self::EntityEquipment(ref p) => p.encode(w),
2103 Self::Experience(ref p) => p.encode(w),
2104 Self::UpdateHealth(ref p) => p.encode(w),
2105 Self::ScoreboardObjective(ref p) => p.encode(w),
2106 Self::SetPassengers(ref p) => p.encode(w),
2107 Self::Teams(ref p) => p.encode(w),
2108 Self::ScoreboardScore(ref p) => p.encode(w),
2109 Self::UpdateTime(ref p) => p.encode(w),
2110 Self::Title(ref p) => p.encode(w),
2111 Self::EntitySoundEffect(ref p) => p.encode(w),
2112 Self::SoundEffect(ref p) => p.encode(w),
2113 Self::StopSound(ref p) => p.encode(w),
2114 Self::PlayerlistHeader(ref p) => p.encode(w),
2115 Self::NbtQueryResponse(ref p) => p.encode(w),
2116 Self::Collect(ref p) => p.encode(w),
2117 Self::EntityTeleport(ref p) => p.encode(w),
2118 Self::Advancements(ref p) => p.encode(w),
2119 Self::EntityUpdateAttributes(ref p) => p.encode(w),
2120 Self::EntityEffect(ref p) => p.encode(w),
2121 Self::DeclareRecipes(ref p) => p.encode(w),
2122 Self::Tags(ref p) => p.encode(w),
2123 }
2124 }
2125 fn name_of(id: i32) -> Option<&'static str> {
2126 match id {
2127 id::SPAWN_ENTITY => Some("spawn_entity"),
2128 id::SPAWN_ENTITY_EXPERIENCE_ORB => Some("spawn_entity_experience_orb"),
2129 id::SPAWN_ENTITY_LIVING => Some("spawn_entity_living"),
2130 id::SPAWN_ENTITY_PAINTING => Some("spawn_entity_painting"),
2131 id::NAMED_ENTITY_SPAWN => Some("named_entity_spawn"),
2132 id::ANIMATION => Some("animation"),
2133 id::STATISTICS => Some("statistics"),
2134 id::ACKNOWLEDGE_PLAYER_DIGGING => Some("acknowledge_player_digging"),
2135 id::BLOCK_BREAK_ANIMATION => Some("block_break_animation"),
2136 id::TILE_ENTITY_DATA => Some("tile_entity_data"),
2137 id::BLOCK_ACTION => Some("block_action"),
2138 id::BLOCK_CHANGE => Some("block_change"),
2139 id::BOSS_BAR => Some("boss_bar"),
2140 id::DIFFICULTY => Some("difficulty"),
2141 id::CHAT => Some("chat"),
2142 id::TAB_COMPLETE => Some("tab_complete"),
2143 id::DECLARE_COMMANDS => Some("declare_commands"),
2144 id::TRANSACTION => Some("transaction"),
2145 id::CLOSE_WINDOW => Some("close_window"),
2146 id::WINDOW_ITEMS => Some("window_items"),
2147 id::CRAFT_PROGRESS_BAR => Some("craft_progress_bar"),
2148 id::SET_SLOT => Some("set_slot"),
2149 id::SET_COOLDOWN => Some("set_cooldown"),
2150 id::CUSTOM_PAYLOAD => Some("custom_payload"),
2151 id::NAMED_SOUND_EFFECT => Some("named_sound_effect"),
2152 id::KICK_DISCONNECT => Some("kick_disconnect"),
2153 id::ENTITY_STATUS => Some("entity_status"),
2154 id::EXPLOSION => Some("explosion"),
2155 id::UNLOAD_CHUNK => Some("unload_chunk"),
2156 id::GAME_STATE_CHANGE => Some("game_state_change"),
2157 id::OPEN_HORSE_WINDOW => Some("open_horse_window"),
2158 id::KEEP_ALIVE => Some("keep_alive"),
2159 id::MAP_CHUNK => Some("map_chunk"),
2160 id::WORLD_EVENT => Some("world_event"),
2161 id::WORLD_PARTICLES => Some("world_particles"),
2162 id::UPDATE_LIGHT => Some("update_light"),
2163 id::LOGIN => Some("login"),
2164 id::MAP => Some("map"),
2165 id::TRADE_LIST => Some("trade_list"),
2166 id::REL_ENTITY_MOVE => Some("rel_entity_move"),
2167 id::ENTITY_MOVE_LOOK => Some("entity_move_look"),
2168 id::ENTITY_LOOK => Some("entity_look"),
2169 id::ENTITY => Some("entity"),
2170 id::VEHICLE_MOVE => Some("vehicle_move"),
2171 id::OPEN_BOOK => Some("open_book"),
2172 id::OPEN_WINDOW => Some("open_window"),
2173 id::OPEN_SIGN_ENTITY => Some("open_sign_entity"),
2174 id::CRAFT_RECIPE_RESPONSE => Some("craft_recipe_response"),
2175 id::ABILITIES => Some("abilities"),
2176 id::COMBAT_EVENT => Some("combat_event"),
2177 id::PLAYER_INFO => Some("player_info"),
2178 id::FACE_PLAYER => Some("face_player"),
2179 id::POSITION => Some("position"),
2180 id::UNLOCK_RECIPES => Some("unlock_recipes"),
2181 id::ENTITY_DESTROY => Some("entity_destroy"),
2182 id::REMOVE_ENTITY_EFFECT => Some("remove_entity_effect"),
2183 id::RESOURCE_PACK_SEND => Some("resource_pack_send"),
2184 id::RESPAWN => Some("respawn"),
2185 id::ENTITY_HEAD_ROTATION => Some("entity_head_rotation"),
2186 id::MULTI_BLOCK_CHANGE => Some("multi_block_change"),
2187 id::SELECT_ADVANCEMENT_TAB => Some("select_advancement_tab"),
2188 id::WORLD_BORDER => Some("world_border"),
2189 id::CAMERA => Some("camera"),
2190 id::HELD_ITEM_SLOT => Some("held_item_slot"),
2191 id::UPDATE_VIEW_POSITION => Some("update_view_position"),
2192 id::UPDATE_VIEW_DISTANCE => Some("update_view_distance"),
2193 id::SPAWN_POSITION => Some("spawn_position"),
2194 id::SCOREBOARD_DISPLAY_OBJECTIVE => Some("scoreboard_display_objective"),
2195 id::ENTITY_METADATA => Some("entity_metadata"),
2196 id::ATTACH_ENTITY => Some("attach_entity"),
2197 id::ENTITY_VELOCITY => Some("entity_velocity"),
2198 id::ENTITY_EQUIPMENT => Some("entity_equipment"),
2199 id::EXPERIENCE => Some("experience"),
2200 id::UPDATE_HEALTH => Some("update_health"),
2201 id::SCOREBOARD_OBJECTIVE => Some("scoreboard_objective"),
2202 id::SET_PASSENGERS => Some("set_passengers"),
2203 id::TEAMS => Some("teams"),
2204 id::SCOREBOARD_SCORE => Some("scoreboard_score"),
2205 id::UPDATE_TIME => Some("update_time"),
2206 id::TITLE => Some("title"),
2207 id::ENTITY_SOUND_EFFECT => Some("entity_sound_effect"),
2208 id::SOUND_EFFECT => Some("sound_effect"),
2209 id::STOP_SOUND => Some("stop_sound"),
2210 id::PLAYERLIST_HEADER => Some("playerlist_header"),
2211 id::NBT_QUERY_RESPONSE => Some("nbt_query_response"),
2212 id::COLLECT => Some("collect"),
2213 id::ENTITY_TELEPORT => Some("entity_teleport"),
2214 id::ADVANCEMENTS => Some("advancements"),
2215 id::ENTITY_UPDATE_ATTRIBUTES => Some("entity_update_attributes"),
2216 id::ENTITY_EFFECT => Some("entity_effect"),
2217 id::DECLARE_RECIPES => Some("declare_recipes"),
2218 id::TAGS => Some("tags"),
2219 _ => None,
2220 }
2221 }
2222}
2223
2224impl ClientboundPlayPacket {
2225 pub const IDS: &'static [i32] = &[
2227 id::SPAWN_ENTITY,
2228 id::SPAWN_ENTITY_EXPERIENCE_ORB,
2229 id::SPAWN_ENTITY_LIVING,
2230 id::SPAWN_ENTITY_PAINTING,
2231 id::NAMED_ENTITY_SPAWN,
2232 id::ANIMATION,
2233 id::STATISTICS,
2234 id::ACKNOWLEDGE_PLAYER_DIGGING,
2235 id::BLOCK_BREAK_ANIMATION,
2236 id::TILE_ENTITY_DATA,
2237 id::BLOCK_ACTION,
2238 id::BLOCK_CHANGE,
2239 id::BOSS_BAR,
2240 id::DIFFICULTY,
2241 id::CHAT,
2242 id::TAB_COMPLETE,
2243 id::DECLARE_COMMANDS,
2244 id::TRANSACTION,
2245 id::CLOSE_WINDOW,
2246 id::WINDOW_ITEMS,
2247 id::CRAFT_PROGRESS_BAR,
2248 id::SET_SLOT,
2249 id::SET_COOLDOWN,
2250 id::CUSTOM_PAYLOAD,
2251 id::NAMED_SOUND_EFFECT,
2252 id::KICK_DISCONNECT,
2253 id::ENTITY_STATUS,
2254 id::EXPLOSION,
2255 id::UNLOAD_CHUNK,
2256 id::GAME_STATE_CHANGE,
2257 id::OPEN_HORSE_WINDOW,
2258 id::KEEP_ALIVE,
2259 id::MAP_CHUNK,
2260 id::WORLD_EVENT,
2261 id::WORLD_PARTICLES,
2262 id::UPDATE_LIGHT,
2263 id::LOGIN,
2264 id::MAP,
2265 id::TRADE_LIST,
2266 id::REL_ENTITY_MOVE,
2267 id::ENTITY_MOVE_LOOK,
2268 id::ENTITY_LOOK,
2269 id::ENTITY,
2270 id::VEHICLE_MOVE,
2271 id::OPEN_BOOK,
2272 id::OPEN_WINDOW,
2273 id::OPEN_SIGN_ENTITY,
2274 id::CRAFT_RECIPE_RESPONSE,
2275 id::ABILITIES,
2276 id::COMBAT_EVENT,
2277 id::PLAYER_INFO,
2278 id::FACE_PLAYER,
2279 id::POSITION,
2280 id::UNLOCK_RECIPES,
2281 id::ENTITY_DESTROY,
2282 id::REMOVE_ENTITY_EFFECT,
2283 id::RESOURCE_PACK_SEND,
2284 id::RESPAWN,
2285 id::ENTITY_HEAD_ROTATION,
2286 id::MULTI_BLOCK_CHANGE,
2287 id::SELECT_ADVANCEMENT_TAB,
2288 id::WORLD_BORDER,
2289 id::CAMERA,
2290 id::HELD_ITEM_SLOT,
2291 id::UPDATE_VIEW_POSITION,
2292 id::UPDATE_VIEW_DISTANCE,
2293 id::SPAWN_POSITION,
2294 id::SCOREBOARD_DISPLAY_OBJECTIVE,
2295 id::ENTITY_METADATA,
2296 id::ATTACH_ENTITY,
2297 id::ENTITY_VELOCITY,
2298 id::ENTITY_EQUIPMENT,
2299 id::EXPERIENCE,
2300 id::UPDATE_HEALTH,
2301 id::SCOREBOARD_OBJECTIVE,
2302 id::SET_PASSENGERS,
2303 id::TEAMS,
2304 id::SCOREBOARD_SCORE,
2305 id::UPDATE_TIME,
2306 id::TITLE,
2307 id::ENTITY_SOUND_EFFECT,
2308 id::SOUND_EFFECT,
2309 id::STOP_SOUND,
2310 id::PLAYERLIST_HEADER,
2311 id::NBT_QUERY_RESPONSE,
2312 id::COLLECT,
2313 id::ENTITY_TELEPORT,
2314 id::ADVANCEMENTS,
2315 id::ENTITY_UPDATE_ATTRIBUTES,
2316 id::ENTITY_EFFECT,
2317 id::DECLARE_RECIPES,
2318 id::TAGS,
2319 ];
2320 #[cfg(feature = "testgen")]
2322 pub fn generate_by_id(id: i32, g: &mut Gen) -> Option<Self> {
2323 match id {
2324 id::SPAWN_ENTITY => Some(Self::SpawnEntity(<SpawnEntity as Generate>::generate(g))),
2325 id::SPAWN_ENTITY_EXPERIENCE_ORB => Some(Self::SpawnEntityExperienceOrb(
2326 <SpawnEntityExperienceOrb as Generate>::generate(g),
2327 )),
2328 id::SPAWN_ENTITY_LIVING => Some(Self::SpawnEntityLiving(
2329 <SpawnEntityLiving as Generate>::generate(g),
2330 )),
2331 id::SPAWN_ENTITY_PAINTING => Some(Self::SpawnEntityPainting(
2332 <SpawnEntityPainting as Generate>::generate(g),
2333 )),
2334 id::NAMED_ENTITY_SPAWN => Some(Self::NamedEntitySpawn(
2335 <NamedEntitySpawn as Generate>::generate(g),
2336 )),
2337 id::ANIMATION => Some(Self::Animation(<Animation as Generate>::generate(g))),
2338 id::STATISTICS => Some(Self::Statistics(<Statistics as Generate>::generate(g))),
2339 id::ACKNOWLEDGE_PLAYER_DIGGING => Some(Self::AcknowledgePlayerDigging(
2340 <AcknowledgePlayerDigging as Generate>::generate(g),
2341 )),
2342 id::BLOCK_BREAK_ANIMATION => Some(Self::BlockBreakAnimation(
2343 <BlockBreakAnimation as Generate>::generate(g),
2344 )),
2345 id::TILE_ENTITY_DATA => Some(Self::TileEntityData(
2346 <TileEntityData as Generate>::generate(g),
2347 )),
2348 id::BLOCK_ACTION => Some(Self::BlockAction(<BlockAction as Generate>::generate(g))),
2349 id::BLOCK_CHANGE => Some(Self::BlockChange(<BlockChange as Generate>::generate(g))),
2350 id::BOSS_BAR => Some(Self::BossBar(<BossBar as Generate>::generate(g))),
2351 id::DIFFICULTY => Some(Self::Difficulty(<Difficulty as Generate>::generate(g))),
2352 id::CHAT => Some(Self::Chat(<Chat as Generate>::generate(g))),
2353 id::TAB_COMPLETE => Some(Self::TabComplete(<TabComplete as Generate>::generate(g))),
2354 id::DECLARE_COMMANDS => Some(Self::DeclareCommands(
2355 <DeclareCommands as Generate>::generate(g),
2356 )),
2357 id::TRANSACTION => Some(Self::Transaction(<Transaction as Generate>::generate(g))),
2358 id::CLOSE_WINDOW => Some(Self::CloseWindow(<CloseWindow as Generate>::generate(g))),
2359 id::WINDOW_ITEMS => Some(Self::WindowItems(<WindowItems as Generate>::generate(g))),
2360 id::CRAFT_PROGRESS_BAR => Some(Self::CraftProgressBar(
2361 <CraftProgressBar as Generate>::generate(g),
2362 )),
2363 id::SET_SLOT => Some(Self::SetSlot(<SetSlot as Generate>::generate(g))),
2364 id::SET_COOLDOWN => Some(Self::SetCooldown(<SetCooldown as Generate>::generate(g))),
2365 id::CUSTOM_PAYLOAD => Some(Self::CustomPayload(<CustomPayload as Generate>::generate(
2366 g,
2367 ))),
2368 id::NAMED_SOUND_EFFECT => Some(Self::NamedSoundEffect(
2369 <NamedSoundEffect as Generate>::generate(g),
2370 )),
2371 id::KICK_DISCONNECT => Some(Self::KickDisconnect(
2372 <KickDisconnect as Generate>::generate(g),
2373 )),
2374 id::ENTITY_STATUS => Some(Self::EntityStatus(<EntityStatus as Generate>::generate(g))),
2375 id::EXPLOSION => Some(Self::Explosion(<Explosion as Generate>::generate(g))),
2376 id::UNLOAD_CHUNK => Some(Self::UnloadChunk(<UnloadChunk as Generate>::generate(g))),
2377 id::GAME_STATE_CHANGE => Some(Self::GameStateChange(
2378 <GameStateChange as Generate>::generate(g),
2379 )),
2380 id::OPEN_HORSE_WINDOW => Some(Self::OpenHorseWindow(
2381 <OpenHorseWindow as Generate>::generate(g),
2382 )),
2383 id::KEEP_ALIVE => Some(Self::KeepAlive(<KeepAlive as Generate>::generate(g))),
2384 id::MAP_CHUNK => Some(Self::MapChunk(<MapChunk as Generate>::generate(g))),
2385 id::WORLD_EVENT => Some(Self::WorldEvent(<WorldEvent as Generate>::generate(g))),
2386 id::WORLD_PARTICLES => Some(Self::WorldParticles(
2387 <WorldParticles as Generate>::generate(g),
2388 )),
2389 id::UPDATE_LIGHT => Some(Self::UpdateLight(<UpdateLight as Generate>::generate(g))),
2390 id::LOGIN => Some(Self::Login(<Login as Generate>::generate(g))),
2391 id::MAP => Some(Self::Map(<Map as Generate>::generate(g))),
2392 id::TRADE_LIST => Some(Self::TradeList(<TradeList as Generate>::generate(g))),
2393 id::REL_ENTITY_MOVE => Some(Self::RelEntityMove(
2394 <RelEntityMove as Generate>::generate(g),
2395 )),
2396 id::ENTITY_MOVE_LOOK => Some(Self::EntityMoveLook(
2397 <EntityMoveLook as Generate>::generate(g),
2398 )),
2399 id::ENTITY_LOOK => Some(Self::EntityLook(<EntityLook as Generate>::generate(g))),
2400 id::ENTITY => Some(Self::Entity(<Entity as Generate>::generate(g))),
2401 id::VEHICLE_MOVE => Some(Self::VehicleMove(<VehicleMove as Generate>::generate(g))),
2402 id::OPEN_BOOK => Some(Self::OpenBook(<OpenBook as Generate>::generate(g))),
2403 id::OPEN_WINDOW => Some(Self::OpenWindow(<OpenWindow as Generate>::generate(g))),
2404 id::OPEN_SIGN_ENTITY => Some(Self::OpenSignEntity(
2405 <OpenSignEntity as Generate>::generate(g),
2406 )),
2407 id::CRAFT_RECIPE_RESPONSE => Some(Self::CraftRecipeResponse(
2408 <CraftRecipeResponse as Generate>::generate(g),
2409 )),
2410 id::ABILITIES => Some(Self::Abilities(<Abilities as Generate>::generate(g))),
2411 id::COMBAT_EVENT => Some(Self::CombatEvent(<CombatEvent as Generate>::generate(g))),
2412 id::PLAYER_INFO => Some(Self::PlayerInfo(<PlayerInfo as Generate>::generate(g))),
2413 id::FACE_PLAYER => Some(Self::FacePlayer(<FacePlayer as Generate>::generate(g))),
2414 id::POSITION => Some(Self::Position(<Position as Generate>::generate(g))),
2415 id::UNLOCK_RECIPES => Some(Self::UnlockRecipes(<UnlockRecipes as Generate>::generate(
2416 g,
2417 ))),
2418 id::ENTITY_DESTROY => Some(Self::EntityDestroy(<EntityDestroy as Generate>::generate(
2419 g,
2420 ))),
2421 id::REMOVE_ENTITY_EFFECT => Some(Self::RemoveEntityEffect(
2422 <RemoveEntityEffect as Generate>::generate(g),
2423 )),
2424 id::RESOURCE_PACK_SEND => Some(Self::ResourcePackSend(
2425 <ResourcePackSend as Generate>::generate(g),
2426 )),
2427 id::RESPAWN => Some(Self::Respawn(<Respawn as Generate>::generate(g))),
2428 id::ENTITY_HEAD_ROTATION => Some(Self::EntityHeadRotation(
2429 <EntityHeadRotation as Generate>::generate(g),
2430 )),
2431 id::MULTI_BLOCK_CHANGE => Some(Self::MultiBlockChange(
2432 <MultiBlockChange as Generate>::generate(g),
2433 )),
2434 id::SELECT_ADVANCEMENT_TAB => Some(Self::SelectAdvancementTab(
2435 <SelectAdvancementTab as Generate>::generate(g),
2436 )),
2437 id::WORLD_BORDER => Some(Self::WorldBorder(<WorldBorder as Generate>::generate(g))),
2438 id::CAMERA => Some(Self::Camera(<Camera as Generate>::generate(g))),
2439 id::HELD_ITEM_SLOT => Some(Self::HeldItemSlot(<HeldItemSlot as Generate>::generate(g))),
2440 id::UPDATE_VIEW_POSITION => Some(Self::UpdateViewPosition(
2441 <UpdateViewPosition as Generate>::generate(g),
2442 )),
2443 id::UPDATE_VIEW_DISTANCE => Some(Self::UpdateViewDistance(
2444 <UpdateViewDistance as Generate>::generate(g),
2445 )),
2446 id::SPAWN_POSITION => Some(Self::SpawnPosition(<SpawnPosition as Generate>::generate(
2447 g,
2448 ))),
2449 id::SCOREBOARD_DISPLAY_OBJECTIVE => Some(Self::ScoreboardDisplayObjective(
2450 <ScoreboardDisplayObjective as Generate>::generate(g),
2451 )),
2452 id::ENTITY_METADATA => Some(Self::EntityMetadata(
2453 <EntityMetadata as Generate>::generate(g),
2454 )),
2455 id::ATTACH_ENTITY => Some(Self::AttachEntity(<AttachEntity as Generate>::generate(g))),
2456 id::ENTITY_VELOCITY => Some(Self::EntityVelocity(
2457 <EntityVelocity as Generate>::generate(g),
2458 )),
2459 id::ENTITY_EQUIPMENT => Some(Self::EntityEquipment(
2460 <EntityEquipment as Generate>::generate(g),
2461 )),
2462 id::EXPERIENCE => Some(Self::Experience(<Experience as Generate>::generate(g))),
2463 id::UPDATE_HEALTH => Some(Self::UpdateHealth(<UpdateHealth as Generate>::generate(g))),
2464 id::SCOREBOARD_OBJECTIVE => Some(Self::ScoreboardObjective(
2465 <ScoreboardObjective as Generate>::generate(g),
2466 )),
2467 id::SET_PASSENGERS => Some(Self::SetPassengers(<SetPassengers as Generate>::generate(
2468 g,
2469 ))),
2470 id::TEAMS => Some(Self::Teams(<Teams as Generate>::generate(g))),
2471 id::SCOREBOARD_SCORE => Some(Self::ScoreboardScore(
2472 <ScoreboardScore as Generate>::generate(g),
2473 )),
2474 id::UPDATE_TIME => Some(Self::UpdateTime(<UpdateTime as Generate>::generate(g))),
2475 id::TITLE => Some(Self::Title(<Title as Generate>::generate(g))),
2476 id::ENTITY_SOUND_EFFECT => Some(Self::EntitySoundEffect(
2477 <EntitySoundEffect as Generate>::generate(g),
2478 )),
2479 id::SOUND_EFFECT => Some(Self::SoundEffect(<SoundEffect as Generate>::generate(g))),
2480 id::STOP_SOUND => Some(Self::StopSound(<StopSound as Generate>::generate(g))),
2481 id::PLAYERLIST_HEADER => Some(Self::PlayerlistHeader(
2482 <PlayerlistHeader as Generate>::generate(g),
2483 )),
2484 id::NBT_QUERY_RESPONSE => Some(Self::NbtQueryResponse(
2485 <NbtQueryResponse as Generate>::generate(g),
2486 )),
2487 id::COLLECT => Some(Self::Collect(<Collect as Generate>::generate(g))),
2488 id::ENTITY_TELEPORT => Some(Self::EntityTeleport(
2489 <EntityTeleport as Generate>::generate(g),
2490 )),
2491 id::ADVANCEMENTS => Some(Self::Advancements(<Advancements as Generate>::generate(g))),
2492 id::ENTITY_UPDATE_ATTRIBUTES => Some(Self::EntityUpdateAttributes(
2493 <EntityUpdateAttributes as Generate>::generate(g),
2494 )),
2495 id::ENTITY_EFFECT => Some(Self::EntityEffect(<EntityEffect as Generate>::generate(g))),
2496 id::DECLARE_RECIPES => Some(Self::DeclareRecipes(
2497 <DeclareRecipes as Generate>::generate(g),
2498 )),
2499 id::TAGS => Some(Self::Tags(<Tags as Generate>::generate(g))),
2500 _ => None,
2501 }
2502 }
2503}