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 KEEP_ALIVE: i32 = 0x00;
32 pub const LOGIN: i32 = 0x01;
34 pub const CHAT: i32 = 0x02;
36 pub const UPDATE_TIME: i32 = 0x03;
38 pub const ENTITY_EQUIPMENT: i32 = 0x04;
40 pub const SPAWN_POSITION: i32 = 0x05;
42 pub const UPDATE_HEALTH: i32 = 0x06;
44 pub const RESPAWN: i32 = 0x07;
46 pub const POSITION: i32 = 0x08;
48 pub const HELD_ITEM_SLOT: i32 = 0x09;
50 pub const BED: i32 = 0x0a;
52 pub const ANIMATION: i32 = 0x0b;
54 pub const NAMED_ENTITY_SPAWN: i32 = 0x0c;
56 pub const COLLECT: i32 = 0x0d;
58 pub const SPAWN_ENTITY: i32 = 0x0e;
60 pub const SPAWN_ENTITY_LIVING: i32 = 0x0f;
62 pub const SPAWN_ENTITY_PAINTING: i32 = 0x10;
64 pub const SPAWN_ENTITY_EXPERIENCE_ORB: i32 = 0x11;
66 pub const ENTITY_VELOCITY: i32 = 0x12;
68 pub const ENTITY_DESTROY: i32 = 0x13;
70 pub const ENTITY: i32 = 0x14;
72 pub const REL_ENTITY_MOVE: i32 = 0x15;
74 pub const ENTITY_LOOK: i32 = 0x16;
76 pub const ENTITY_MOVE_LOOK: i32 = 0x17;
78 pub const ENTITY_TELEPORT: i32 = 0x18;
80 pub const ENTITY_HEAD_ROTATION: i32 = 0x19;
82 pub const ENTITY_STATUS: i32 = 0x1a;
84 pub const ATTACH_ENTITY: i32 = 0x1b;
86 pub const ENTITY_METADATA: i32 = 0x1c;
88 pub const ENTITY_EFFECT: i32 = 0x1d;
90 pub const REMOVE_ENTITY_EFFECT: i32 = 0x1e;
92 pub const EXPERIENCE: i32 = 0x1f;
94 pub const UPDATE_ATTRIBUTES: i32 = 0x20;
96 pub const MAP_CHUNK: i32 = 0x21;
98 pub const MULTI_BLOCK_CHANGE: i32 = 0x22;
100 pub const BLOCK_CHANGE: i32 = 0x23;
102 pub const BLOCK_ACTION: i32 = 0x24;
104 pub const BLOCK_BREAK_ANIMATION: i32 = 0x25;
106 pub const MAP_CHUNK_BULK: i32 = 0x26;
108 pub const EXPLOSION: i32 = 0x27;
110 pub const WORLD_EVENT: i32 = 0x28;
112 pub const NAMED_SOUND_EFFECT: i32 = 0x29;
114 pub const WORLD_PARTICLES: i32 = 0x2a;
116 pub const GAME_STATE_CHANGE: i32 = 0x2b;
118 pub const SPAWN_ENTITY_WEATHER: i32 = 0x2c;
120 pub const OPEN_WINDOW: i32 = 0x2d;
122 pub const CLOSE_WINDOW: i32 = 0x2e;
124 pub const SET_SLOT: i32 = 0x2f;
126 pub const WINDOW_ITEMS: i32 = 0x30;
128 pub const CRAFT_PROGRESS_BAR: i32 = 0x31;
130 pub const TRANSACTION: i32 = 0x32;
132 pub const UPDATE_SIGN: i32 = 0x33;
134 pub const MAP: i32 = 0x34;
136 pub const TILE_ENTITY_DATA: i32 = 0x35;
138 pub const OPEN_SIGN_ENTITY: i32 = 0x36;
140 pub const STATISTICS: i32 = 0x37;
142 pub const PLAYER_INFO: i32 = 0x38;
144 pub const ABILITIES: i32 = 0x39;
146 pub const TAB_COMPLETE: i32 = 0x3a;
148 pub const SCOREBOARD_OBJECTIVE: i32 = 0x3b;
150 pub const SCOREBOARD_SCORE: i32 = 0x3c;
152 pub const SCOREBOARD_DISPLAY_OBJECTIVE: i32 = 0x3d;
154 pub const SCOREBOARD_TEAM: i32 = 0x3e;
156 pub const CUSTOM_PAYLOAD: i32 = 0x3f;
158 pub const KICK_DISCONNECT: i32 = 0x40;
160 pub const DIFFICULTY: i32 = 0x41;
162 pub const COMBAT_EVENT: i32 = 0x42;
164 pub const CAMERA: i32 = 0x43;
166 pub const WORLD_BORDER: i32 = 0x44;
168 pub const TITLE: i32 = 0x45;
170 pub const SET_COMPRESSION: i32 = 0x46;
172 pub const PLAYERLIST_HEADER: i32 = 0x47;
174 pub const RESOURCE_PACK_SEND: i32 = 0x48;
176 pub const UPDATE_ENTITY_NBT: i32 = 0x49;
178}
179
180pub use crate::defs::p47::play::clientbound::DifficultyDifficulty;
181pub use crate::defs::p47::play::clientbound::ExplosionAffectedBlockOffsets;
182pub use crate::defs::p47::play::clientbound::GameStateChangeReason;
183pub use crate::defs::p47::play::clientbound::MapChunkBulkMeta;
184pub use crate::defs::p47::play::clientbound::MapIcons;
185pub use crate::defs::p47::play::clientbound::MultiBlockChangeRecords;
186pub use crate::defs::p47::play::clientbound::PlayerInfoAction;
187pub use crate::defs::p47::play::clientbound::PlayerInfoData;
188pub use crate::defs::p47::play::clientbound::PlayerInfoDataBody;
189pub use crate::defs::p47::play::clientbound::PlayerInfoDataBodyAddPlayer;
190pub use crate::defs::p47::play::clientbound::PlayerInfoDataBodyAddPlayerProperties;
191pub use crate::defs::p47::play::clientbound::PlayerInfoDataBodyUpdateDisplayName;
192pub use crate::defs::p47::play::clientbound::PlayerInfoDataBodyUpdateGameMode;
193pub use crate::defs::p47::play::clientbound::PlayerInfoDataBodyUpdateLatency;
194pub use crate::defs::p47::play::clientbound::StatisticsEntries;
195pub use crate::defs::p47::play::clientbound::UpdateAttributesProperties;
196pub use crate::defs::p47::play::clientbound::UpdateAttributesPropertiesModifiers;
197pub use crate::defs::p47::play::clientbound::WorldParticlesData;
198
199pub type KeepAlive = crate::defs::p47::play::clientbound::KeepAlive<47>;
201impl crate::packet::Packet for KeepAlive {
202 const ID: i32 = id::KEEP_ALIVE;
203 const NAME: &'static str = "keep_alive";
204 const STATE: State = State::Play;
205 const DIRECTION: Direction = Direction::Clientbound;
206}
207impl From<KeepAlive> for ClientboundPlayPacket {
208 fn from(p: KeepAlive) -> Self {
209 Self::KeepAlive(p)
210 }
211}
212
213pub type Login = crate::defs::p47::play::clientbound::Login<47>;
215impl crate::packet::Packet for Login {
216 const ID: i32 = id::LOGIN;
217 const NAME: &'static str = "login";
218 const STATE: State = State::Play;
219 const DIRECTION: Direction = Direction::Clientbound;
220}
221impl From<Login> for ClientboundPlayPacket {
222 fn from(p: Login) -> Self {
223 Self::Login(p)
224 }
225}
226
227pub type Chat = crate::defs::p47::play::clientbound::Chat<47>;
229impl crate::packet::Packet for Chat {
230 const ID: i32 = id::CHAT;
231 const NAME: &'static str = "chat";
232 const STATE: State = State::Play;
233 const DIRECTION: Direction = Direction::Clientbound;
234}
235impl From<Chat> for ClientboundPlayPacket {
236 fn from(p: Chat) -> Self {
237 Self::Chat(p)
238 }
239}
240
241pub type UpdateTime = crate::defs::p47::play::clientbound::UpdateTime<47>;
243impl crate::packet::Packet for UpdateTime {
244 const ID: i32 = id::UPDATE_TIME;
245 const NAME: &'static str = "update_time";
246 const STATE: State = State::Play;
247 const DIRECTION: Direction = Direction::Clientbound;
248}
249impl From<UpdateTime> for ClientboundPlayPacket {
250 fn from(p: UpdateTime) -> Self {
251 Self::UpdateTime(p)
252 }
253}
254
255pub type EntityEquipment = crate::defs::p47::play::clientbound::EntityEquipment<47>;
257impl crate::packet::Packet for EntityEquipment {
258 const ID: i32 = id::ENTITY_EQUIPMENT;
259 const NAME: &'static str = "entity_equipment";
260 const STATE: State = State::Play;
261 const DIRECTION: Direction = Direction::Clientbound;
262}
263impl From<EntityEquipment> for ClientboundPlayPacket {
264 fn from(p: EntityEquipment) -> Self {
265 Self::EntityEquipment(p)
266 }
267}
268
269pub type SpawnPosition = crate::defs::p47::play::clientbound::SpawnPosition<47>;
271impl crate::packet::Packet for SpawnPosition {
272 const ID: i32 = id::SPAWN_POSITION;
273 const NAME: &'static str = "spawn_position";
274 const STATE: State = State::Play;
275 const DIRECTION: Direction = Direction::Clientbound;
276}
277impl From<SpawnPosition> for ClientboundPlayPacket {
278 fn from(p: SpawnPosition) -> Self {
279 Self::SpawnPosition(p)
280 }
281}
282
283pub type UpdateHealth = crate::defs::p47::play::clientbound::UpdateHealth<47>;
285impl crate::packet::Packet for UpdateHealth {
286 const ID: i32 = id::UPDATE_HEALTH;
287 const NAME: &'static str = "update_health";
288 const STATE: State = State::Play;
289 const DIRECTION: Direction = Direction::Clientbound;
290}
291impl From<UpdateHealth> for ClientboundPlayPacket {
292 fn from(p: UpdateHealth) -> Self {
293 Self::UpdateHealth(p)
294 }
295}
296
297pub type Respawn = crate::defs::p47::play::clientbound::Respawn<47>;
299impl crate::packet::Packet for Respawn {
300 const ID: i32 = id::RESPAWN;
301 const NAME: &'static str = "respawn";
302 const STATE: State = State::Play;
303 const DIRECTION: Direction = Direction::Clientbound;
304}
305impl From<Respawn> for ClientboundPlayPacket {
306 fn from(p: Respawn) -> Self {
307 Self::Respawn(p)
308 }
309}
310
311pub type Position = crate::defs::p47::play::clientbound::Position<47>;
313impl crate::packet::Packet for Position {
314 const ID: i32 = id::POSITION;
315 const NAME: &'static str = "position";
316 const STATE: State = State::Play;
317 const DIRECTION: Direction = Direction::Clientbound;
318}
319impl From<Position> for ClientboundPlayPacket {
320 fn from(p: Position) -> Self {
321 Self::Position(p)
322 }
323}
324
325pub type HeldItemSlot = crate::defs::p47::play::clientbound::HeldItemSlot<47>;
327impl crate::packet::Packet for HeldItemSlot {
328 const ID: i32 = id::HELD_ITEM_SLOT;
329 const NAME: &'static str = "held_item_slot";
330 const STATE: State = State::Play;
331 const DIRECTION: Direction = Direction::Clientbound;
332}
333impl From<HeldItemSlot> for ClientboundPlayPacket {
334 fn from(p: HeldItemSlot) -> Self {
335 Self::HeldItemSlot(p)
336 }
337}
338
339pub type Bed = crate::defs::p47::play::clientbound::Bed<47>;
341impl crate::packet::Packet for Bed {
342 const ID: i32 = id::BED;
343 const NAME: &'static str = "bed";
344 const STATE: State = State::Play;
345 const DIRECTION: Direction = Direction::Clientbound;
346}
347impl From<Bed> for ClientboundPlayPacket {
348 fn from(p: Bed) -> Self {
349 Self::Bed(p)
350 }
351}
352
353pub type Animation = crate::defs::p47::play::clientbound::Animation<47>;
355impl crate::packet::Packet for Animation {
356 const ID: i32 = id::ANIMATION;
357 const NAME: &'static str = "animation";
358 const STATE: State = State::Play;
359 const DIRECTION: Direction = Direction::Clientbound;
360}
361impl From<Animation> for ClientboundPlayPacket {
362 fn from(p: Animation) -> Self {
363 Self::Animation(p)
364 }
365}
366
367pub type NamedEntitySpawn = crate::defs::p47::play::clientbound::NamedEntitySpawn<47>;
369impl crate::packet::Packet for NamedEntitySpawn {
370 const ID: i32 = id::NAMED_ENTITY_SPAWN;
371 const NAME: &'static str = "named_entity_spawn";
372 const STATE: State = State::Play;
373 const DIRECTION: Direction = Direction::Clientbound;
374}
375impl From<NamedEntitySpawn> for ClientboundPlayPacket {
376 fn from(p: NamedEntitySpawn) -> Self {
377 Self::NamedEntitySpawn(p)
378 }
379}
380
381pub type Collect = crate::defs::p47::play::clientbound::Collect<47>;
383impl crate::packet::Packet for Collect {
384 const ID: i32 = id::COLLECT;
385 const NAME: &'static str = "collect";
386 const STATE: State = State::Play;
387 const DIRECTION: Direction = Direction::Clientbound;
388}
389impl From<Collect> for ClientboundPlayPacket {
390 fn from(p: Collect) -> Self {
391 Self::Collect(p)
392 }
393}
394
395pub type SpawnEntity = crate::defs::p47::play::clientbound::SpawnEntity<47>;
397impl crate::packet::Packet for SpawnEntity {
398 const ID: i32 = id::SPAWN_ENTITY;
399 const NAME: &'static str = "spawn_entity";
400 const STATE: State = State::Play;
401 const DIRECTION: Direction = Direction::Clientbound;
402}
403impl From<SpawnEntity> for ClientboundPlayPacket {
404 fn from(p: SpawnEntity) -> Self {
405 Self::SpawnEntity(p)
406 }
407}
408
409pub type SpawnEntityLiving = crate::defs::p47::play::clientbound::SpawnEntityLiving<47>;
411impl crate::packet::Packet for SpawnEntityLiving {
412 const ID: i32 = id::SPAWN_ENTITY_LIVING;
413 const NAME: &'static str = "spawn_entity_living";
414 const STATE: State = State::Play;
415 const DIRECTION: Direction = Direction::Clientbound;
416}
417impl From<SpawnEntityLiving> for ClientboundPlayPacket {
418 fn from(p: SpawnEntityLiving) -> Self {
419 Self::SpawnEntityLiving(p)
420 }
421}
422
423pub type SpawnEntityPainting = crate::defs::p47::play::clientbound::SpawnEntityPainting<47>;
425impl crate::packet::Packet for SpawnEntityPainting {
426 const ID: i32 = id::SPAWN_ENTITY_PAINTING;
427 const NAME: &'static str = "spawn_entity_painting";
428 const STATE: State = State::Play;
429 const DIRECTION: Direction = Direction::Clientbound;
430}
431impl From<SpawnEntityPainting> for ClientboundPlayPacket {
432 fn from(p: SpawnEntityPainting) -> Self {
433 Self::SpawnEntityPainting(p)
434 }
435}
436
437pub type SpawnEntityExperienceOrb =
439 crate::defs::p47::play::clientbound::SpawnEntityExperienceOrb<47>;
440impl crate::packet::Packet for SpawnEntityExperienceOrb {
441 const ID: i32 = id::SPAWN_ENTITY_EXPERIENCE_ORB;
442 const NAME: &'static str = "spawn_entity_experience_orb";
443 const STATE: State = State::Play;
444 const DIRECTION: Direction = Direction::Clientbound;
445}
446impl From<SpawnEntityExperienceOrb> for ClientboundPlayPacket {
447 fn from(p: SpawnEntityExperienceOrb) -> Self {
448 Self::SpawnEntityExperienceOrb(p)
449 }
450}
451
452pub type EntityVelocity = crate::defs::p47::play::clientbound::EntityVelocity<47>;
454impl crate::packet::Packet for EntityVelocity {
455 const ID: i32 = id::ENTITY_VELOCITY;
456 const NAME: &'static str = "entity_velocity";
457 const STATE: State = State::Play;
458 const DIRECTION: Direction = Direction::Clientbound;
459}
460impl From<EntityVelocity> for ClientboundPlayPacket {
461 fn from(p: EntityVelocity) -> Self {
462 Self::EntityVelocity(p)
463 }
464}
465
466pub type EntityDestroy = crate::defs::p47::play::clientbound::EntityDestroy<47>;
468impl crate::packet::Packet for EntityDestroy {
469 const ID: i32 = id::ENTITY_DESTROY;
470 const NAME: &'static str = "entity_destroy";
471 const STATE: State = State::Play;
472 const DIRECTION: Direction = Direction::Clientbound;
473}
474impl From<EntityDestroy> for ClientboundPlayPacket {
475 fn from(p: EntityDestroy) -> Self {
476 Self::EntityDestroy(p)
477 }
478}
479
480pub type Entity = crate::defs::p47::play::clientbound::Entity<47>;
482impl crate::packet::Packet for Entity {
483 const ID: i32 = id::ENTITY;
484 const NAME: &'static str = "entity";
485 const STATE: State = State::Play;
486 const DIRECTION: Direction = Direction::Clientbound;
487}
488impl From<Entity> for ClientboundPlayPacket {
489 fn from(p: Entity) -> Self {
490 Self::Entity(p)
491 }
492}
493
494pub type RelEntityMove = crate::defs::p47::play::clientbound::RelEntityMove<47>;
496impl crate::packet::Packet for RelEntityMove {
497 const ID: i32 = id::REL_ENTITY_MOVE;
498 const NAME: &'static str = "rel_entity_move";
499 const STATE: State = State::Play;
500 const DIRECTION: Direction = Direction::Clientbound;
501}
502impl From<RelEntityMove> for ClientboundPlayPacket {
503 fn from(p: RelEntityMove) -> Self {
504 Self::RelEntityMove(p)
505 }
506}
507
508pub type EntityLook = crate::defs::p47::play::clientbound::EntityLook<47>;
510impl crate::packet::Packet for EntityLook {
511 const ID: i32 = id::ENTITY_LOOK;
512 const NAME: &'static str = "entity_look";
513 const STATE: State = State::Play;
514 const DIRECTION: Direction = Direction::Clientbound;
515}
516impl From<EntityLook> for ClientboundPlayPacket {
517 fn from(p: EntityLook) -> Self {
518 Self::EntityLook(p)
519 }
520}
521
522pub type EntityMoveLook = crate::defs::p47::play::clientbound::EntityMoveLook<47>;
524impl crate::packet::Packet for EntityMoveLook {
525 const ID: i32 = id::ENTITY_MOVE_LOOK;
526 const NAME: &'static str = "entity_move_look";
527 const STATE: State = State::Play;
528 const DIRECTION: Direction = Direction::Clientbound;
529}
530impl From<EntityMoveLook> for ClientboundPlayPacket {
531 fn from(p: EntityMoveLook) -> Self {
532 Self::EntityMoveLook(p)
533 }
534}
535
536pub type EntityTeleport = crate::defs::p47::play::clientbound::EntityTeleport<47>;
538impl crate::packet::Packet for EntityTeleport {
539 const ID: i32 = id::ENTITY_TELEPORT;
540 const NAME: &'static str = "entity_teleport";
541 const STATE: State = State::Play;
542 const DIRECTION: Direction = Direction::Clientbound;
543}
544impl From<EntityTeleport> for ClientboundPlayPacket {
545 fn from(p: EntityTeleport) -> Self {
546 Self::EntityTeleport(p)
547 }
548}
549
550pub type EntityHeadRotation = crate::defs::p47::play::clientbound::EntityHeadRotation<47>;
552impl crate::packet::Packet for EntityHeadRotation {
553 const ID: i32 = id::ENTITY_HEAD_ROTATION;
554 const NAME: &'static str = "entity_head_rotation";
555 const STATE: State = State::Play;
556 const DIRECTION: Direction = Direction::Clientbound;
557}
558impl From<EntityHeadRotation> for ClientboundPlayPacket {
559 fn from(p: EntityHeadRotation) -> Self {
560 Self::EntityHeadRotation(p)
561 }
562}
563
564pub type EntityStatus = crate::defs::p47::play::clientbound::EntityStatus<47>;
566impl crate::packet::Packet for EntityStatus {
567 const ID: i32 = id::ENTITY_STATUS;
568 const NAME: &'static str = "entity_status";
569 const STATE: State = State::Play;
570 const DIRECTION: Direction = Direction::Clientbound;
571}
572impl From<EntityStatus> for ClientboundPlayPacket {
573 fn from(p: EntityStatus) -> Self {
574 Self::EntityStatus(p)
575 }
576}
577
578pub type AttachEntity = crate::defs::p47::play::clientbound::AttachEntity<47>;
580impl crate::packet::Packet for AttachEntity {
581 const ID: i32 = id::ATTACH_ENTITY;
582 const NAME: &'static str = "attach_entity";
583 const STATE: State = State::Play;
584 const DIRECTION: Direction = Direction::Clientbound;
585}
586impl From<AttachEntity> for ClientboundPlayPacket {
587 fn from(p: AttachEntity) -> Self {
588 Self::AttachEntity(p)
589 }
590}
591
592pub type EntityMetadata = crate::defs::p47::play::clientbound::EntityMetadata<47>;
594impl crate::packet::Packet for EntityMetadata {
595 const ID: i32 = id::ENTITY_METADATA;
596 const NAME: &'static str = "entity_metadata";
597 const STATE: State = State::Play;
598 const DIRECTION: Direction = Direction::Clientbound;
599}
600impl From<EntityMetadata> for ClientboundPlayPacket {
601 fn from(p: EntityMetadata) -> Self {
602 Self::EntityMetadata(p)
603 }
604}
605
606pub type EntityEffect = crate::defs::p47::play::clientbound::EntityEffect<47>;
608impl crate::packet::Packet for EntityEffect {
609 const ID: i32 = id::ENTITY_EFFECT;
610 const NAME: &'static str = "entity_effect";
611 const STATE: State = State::Play;
612 const DIRECTION: Direction = Direction::Clientbound;
613}
614impl From<EntityEffect> for ClientboundPlayPacket {
615 fn from(p: EntityEffect) -> Self {
616 Self::EntityEffect(p)
617 }
618}
619
620pub type RemoveEntityEffect = crate::defs::p47::play::clientbound::RemoveEntityEffect<47>;
622impl crate::packet::Packet for RemoveEntityEffect {
623 const ID: i32 = id::REMOVE_ENTITY_EFFECT;
624 const NAME: &'static str = "remove_entity_effect";
625 const STATE: State = State::Play;
626 const DIRECTION: Direction = Direction::Clientbound;
627}
628impl From<RemoveEntityEffect> for ClientboundPlayPacket {
629 fn from(p: RemoveEntityEffect) -> Self {
630 Self::RemoveEntityEffect(p)
631 }
632}
633
634pub type Experience = crate::defs::p47::play::clientbound::Experience<47>;
636impl crate::packet::Packet for Experience {
637 const ID: i32 = id::EXPERIENCE;
638 const NAME: &'static str = "experience";
639 const STATE: State = State::Play;
640 const DIRECTION: Direction = Direction::Clientbound;
641}
642impl From<Experience> for ClientboundPlayPacket {
643 fn from(p: Experience) -> Self {
644 Self::Experience(p)
645 }
646}
647
648pub type UpdateAttributes = crate::defs::p47::play::clientbound::UpdateAttributes<47>;
650impl crate::packet::Packet for UpdateAttributes {
651 const ID: i32 = id::UPDATE_ATTRIBUTES;
652 const NAME: &'static str = "update_attributes";
653 const STATE: State = State::Play;
654 const DIRECTION: Direction = Direction::Clientbound;
655}
656impl From<UpdateAttributes> for ClientboundPlayPacket {
657 fn from(p: UpdateAttributes) -> Self {
658 Self::UpdateAttributes(p)
659 }
660}
661
662pub type MapChunk = crate::defs::p47::play::clientbound::MapChunk<47>;
664impl crate::packet::Packet for MapChunk {
665 const ID: i32 = id::MAP_CHUNK;
666 const NAME: &'static str = "map_chunk";
667 const STATE: State = State::Play;
668 const DIRECTION: Direction = Direction::Clientbound;
669}
670impl From<MapChunk> for ClientboundPlayPacket {
671 fn from(p: MapChunk) -> Self {
672 Self::MapChunk(p)
673 }
674}
675
676pub type MultiBlockChange = crate::defs::p47::play::clientbound::MultiBlockChange<47>;
678impl crate::packet::Packet for MultiBlockChange {
679 const ID: i32 = id::MULTI_BLOCK_CHANGE;
680 const NAME: &'static str = "multi_block_change";
681 const STATE: State = State::Play;
682 const DIRECTION: Direction = Direction::Clientbound;
683}
684impl From<MultiBlockChange> for ClientboundPlayPacket {
685 fn from(p: MultiBlockChange) -> Self {
686 Self::MultiBlockChange(p)
687 }
688}
689
690pub type BlockChange = crate::defs::p47::play::clientbound::BlockChange<47>;
692impl crate::packet::Packet for BlockChange {
693 const ID: i32 = id::BLOCK_CHANGE;
694 const NAME: &'static str = "block_change";
695 const STATE: State = State::Play;
696 const DIRECTION: Direction = Direction::Clientbound;
697}
698impl From<BlockChange> for ClientboundPlayPacket {
699 fn from(p: BlockChange) -> Self {
700 Self::BlockChange(p)
701 }
702}
703
704pub type BlockAction = crate::defs::p47::play::clientbound::BlockAction<47>;
706impl crate::packet::Packet for BlockAction {
707 const ID: i32 = id::BLOCK_ACTION;
708 const NAME: &'static str = "block_action";
709 const STATE: State = State::Play;
710 const DIRECTION: Direction = Direction::Clientbound;
711}
712impl From<BlockAction> for ClientboundPlayPacket {
713 fn from(p: BlockAction) -> Self {
714 Self::BlockAction(p)
715 }
716}
717
718pub type BlockBreakAnimation = crate::defs::p47::play::clientbound::BlockBreakAnimation<47>;
720impl crate::packet::Packet for BlockBreakAnimation {
721 const ID: i32 = id::BLOCK_BREAK_ANIMATION;
722 const NAME: &'static str = "block_break_animation";
723 const STATE: State = State::Play;
724 const DIRECTION: Direction = Direction::Clientbound;
725}
726impl From<BlockBreakAnimation> for ClientboundPlayPacket {
727 fn from(p: BlockBreakAnimation) -> Self {
728 Self::BlockBreakAnimation(p)
729 }
730}
731
732pub type MapChunkBulk = crate::defs::p47::play::clientbound::MapChunkBulk<47>;
734impl crate::packet::Packet for MapChunkBulk {
735 const ID: i32 = id::MAP_CHUNK_BULK;
736 const NAME: &'static str = "map_chunk_bulk";
737 const STATE: State = State::Play;
738 const DIRECTION: Direction = Direction::Clientbound;
739}
740impl From<MapChunkBulk> for ClientboundPlayPacket {
741 fn from(p: MapChunkBulk) -> Self {
742 Self::MapChunkBulk(p)
743 }
744}
745
746pub type Explosion = crate::defs::p47::play::clientbound::Explosion<47>;
748impl crate::packet::Packet for Explosion {
749 const ID: i32 = id::EXPLOSION;
750 const NAME: &'static str = "explosion";
751 const STATE: State = State::Play;
752 const DIRECTION: Direction = Direction::Clientbound;
753}
754impl From<Explosion> for ClientboundPlayPacket {
755 fn from(p: Explosion) -> Self {
756 Self::Explosion(p)
757 }
758}
759
760pub type WorldEvent = crate::defs::p47::play::clientbound::WorldEvent<47>;
762impl crate::packet::Packet for WorldEvent {
763 const ID: i32 = id::WORLD_EVENT;
764 const NAME: &'static str = "world_event";
765 const STATE: State = State::Play;
766 const DIRECTION: Direction = Direction::Clientbound;
767}
768impl From<WorldEvent> for ClientboundPlayPacket {
769 fn from(p: WorldEvent) -> Self {
770 Self::WorldEvent(p)
771 }
772}
773
774pub type NamedSoundEffect = crate::defs::p47::play::clientbound::NamedSoundEffect<47>;
776impl crate::packet::Packet for NamedSoundEffect {
777 const ID: i32 = id::NAMED_SOUND_EFFECT;
778 const NAME: &'static str = "named_sound_effect";
779 const STATE: State = State::Play;
780 const DIRECTION: Direction = Direction::Clientbound;
781}
782impl From<NamedSoundEffect> for ClientboundPlayPacket {
783 fn from(p: NamedSoundEffect) -> Self {
784 Self::NamedSoundEffect(p)
785 }
786}
787
788pub type WorldParticles = crate::defs::p47::play::clientbound::WorldParticles<47>;
790impl crate::packet::Packet for WorldParticles {
791 const ID: i32 = id::WORLD_PARTICLES;
792 const NAME: &'static str = "world_particles";
793 const STATE: State = State::Play;
794 const DIRECTION: Direction = Direction::Clientbound;
795}
796impl From<WorldParticles> for ClientboundPlayPacket {
797 fn from(p: WorldParticles) -> Self {
798 Self::WorldParticles(p)
799 }
800}
801
802pub type GameStateChange = crate::defs::p47::play::clientbound::GameStateChange<47>;
804impl crate::packet::Packet for GameStateChange {
805 const ID: i32 = id::GAME_STATE_CHANGE;
806 const NAME: &'static str = "game_state_change";
807 const STATE: State = State::Play;
808 const DIRECTION: Direction = Direction::Clientbound;
809}
810impl From<GameStateChange> for ClientboundPlayPacket {
811 fn from(p: GameStateChange) -> Self {
812 Self::GameStateChange(p)
813 }
814}
815
816pub type SpawnEntityWeather = crate::defs::p47::play::clientbound::SpawnEntityWeather<47>;
818impl crate::packet::Packet for SpawnEntityWeather {
819 const ID: i32 = id::SPAWN_ENTITY_WEATHER;
820 const NAME: &'static str = "spawn_entity_weather";
821 const STATE: State = State::Play;
822 const DIRECTION: Direction = Direction::Clientbound;
823}
824impl From<SpawnEntityWeather> for ClientboundPlayPacket {
825 fn from(p: SpawnEntityWeather) -> Self {
826 Self::SpawnEntityWeather(p)
827 }
828}
829
830pub type OpenWindow = crate::defs::p47::play::clientbound::OpenWindow<47>;
832impl crate::packet::Packet for OpenWindow {
833 const ID: i32 = id::OPEN_WINDOW;
834 const NAME: &'static str = "open_window";
835 const STATE: State = State::Play;
836 const DIRECTION: Direction = Direction::Clientbound;
837}
838impl From<OpenWindow> for ClientboundPlayPacket {
839 fn from(p: OpenWindow) -> Self {
840 Self::OpenWindow(p)
841 }
842}
843
844pub type CloseWindow = crate::defs::p47::play::clientbound::CloseWindow<47>;
846impl crate::packet::Packet for CloseWindow {
847 const ID: i32 = id::CLOSE_WINDOW;
848 const NAME: &'static str = "close_window";
849 const STATE: State = State::Play;
850 const DIRECTION: Direction = Direction::Clientbound;
851}
852impl From<CloseWindow> for ClientboundPlayPacket {
853 fn from(p: CloseWindow) -> Self {
854 Self::CloseWindow(p)
855 }
856}
857
858pub type SetSlot = crate::defs::p47::play::clientbound::SetSlot<47>;
860impl crate::packet::Packet for SetSlot {
861 const ID: i32 = id::SET_SLOT;
862 const NAME: &'static str = "set_slot";
863 const STATE: State = State::Play;
864 const DIRECTION: Direction = Direction::Clientbound;
865}
866impl From<SetSlot> for ClientboundPlayPacket {
867 fn from(p: SetSlot) -> Self {
868 Self::SetSlot(p)
869 }
870}
871
872pub type WindowItems = crate::defs::p47::play::clientbound::WindowItems<47>;
874impl crate::packet::Packet for WindowItems {
875 const ID: i32 = id::WINDOW_ITEMS;
876 const NAME: &'static str = "window_items";
877 const STATE: State = State::Play;
878 const DIRECTION: Direction = Direction::Clientbound;
879}
880impl From<WindowItems> for ClientboundPlayPacket {
881 fn from(p: WindowItems) -> Self {
882 Self::WindowItems(p)
883 }
884}
885
886pub type CraftProgressBar = crate::defs::p47::play::clientbound::CraftProgressBar<47>;
888impl crate::packet::Packet for CraftProgressBar {
889 const ID: i32 = id::CRAFT_PROGRESS_BAR;
890 const NAME: &'static str = "craft_progress_bar";
891 const STATE: State = State::Play;
892 const DIRECTION: Direction = Direction::Clientbound;
893}
894impl From<CraftProgressBar> for ClientboundPlayPacket {
895 fn from(p: CraftProgressBar) -> Self {
896 Self::CraftProgressBar(p)
897 }
898}
899
900pub type Transaction = crate::defs::p47::play::clientbound::Transaction<47>;
902impl crate::packet::Packet for Transaction {
903 const ID: i32 = id::TRANSACTION;
904 const NAME: &'static str = "transaction";
905 const STATE: State = State::Play;
906 const DIRECTION: Direction = Direction::Clientbound;
907}
908impl From<Transaction> for ClientboundPlayPacket {
909 fn from(p: Transaction) -> Self {
910 Self::Transaction(p)
911 }
912}
913
914pub type UpdateSign = crate::defs::p47::play::clientbound::UpdateSign<47>;
916impl crate::packet::Packet for UpdateSign {
917 const ID: i32 = id::UPDATE_SIGN;
918 const NAME: &'static str = "update_sign";
919 const STATE: State = State::Play;
920 const DIRECTION: Direction = Direction::Clientbound;
921}
922impl From<UpdateSign> for ClientboundPlayPacket {
923 fn from(p: UpdateSign) -> Self {
924 Self::UpdateSign(p)
925 }
926}
927
928pub type Map = crate::defs::p47::play::clientbound::Map<47>;
930impl crate::packet::Packet for Map {
931 const ID: i32 = id::MAP;
932 const NAME: &'static str = "map";
933 const STATE: State = State::Play;
934 const DIRECTION: Direction = Direction::Clientbound;
935}
936impl From<Map> for ClientboundPlayPacket {
937 fn from(p: Map) -> Self {
938 Self::Map(p)
939 }
940}
941
942pub type TileEntityData = crate::defs::p47::play::clientbound::TileEntityData<47>;
944impl crate::packet::Packet for TileEntityData {
945 const ID: i32 = id::TILE_ENTITY_DATA;
946 const NAME: &'static str = "tile_entity_data";
947 const STATE: State = State::Play;
948 const DIRECTION: Direction = Direction::Clientbound;
949}
950impl From<TileEntityData> for ClientboundPlayPacket {
951 fn from(p: TileEntityData) -> Self {
952 Self::TileEntityData(p)
953 }
954}
955
956pub type OpenSignEntity = crate::defs::p47::play::clientbound::OpenSignEntity<47>;
958impl crate::packet::Packet for OpenSignEntity {
959 const ID: i32 = id::OPEN_SIGN_ENTITY;
960 const NAME: &'static str = "open_sign_entity";
961 const STATE: State = State::Play;
962 const DIRECTION: Direction = Direction::Clientbound;
963}
964impl From<OpenSignEntity> for ClientboundPlayPacket {
965 fn from(p: OpenSignEntity) -> Self {
966 Self::OpenSignEntity(p)
967 }
968}
969
970pub type Statistics = crate::defs::p47::play::clientbound::Statistics<47>;
972impl crate::packet::Packet for Statistics {
973 const ID: i32 = id::STATISTICS;
974 const NAME: &'static str = "statistics";
975 const STATE: State = State::Play;
976 const DIRECTION: Direction = Direction::Clientbound;
977}
978impl From<Statistics> for ClientboundPlayPacket {
979 fn from(p: Statistics) -> Self {
980 Self::Statistics(p)
981 }
982}
983
984pub type PlayerInfo = crate::defs::p47::play::clientbound::PlayerInfo<47>;
986impl crate::packet::Packet for PlayerInfo {
987 const ID: i32 = id::PLAYER_INFO;
988 const NAME: &'static str = "player_info";
989 const STATE: State = State::Play;
990 const DIRECTION: Direction = Direction::Clientbound;
991}
992impl From<PlayerInfo> for ClientboundPlayPacket {
993 fn from(p: PlayerInfo) -> Self {
994 Self::PlayerInfo(p)
995 }
996}
997
998pub type Abilities = crate::defs::p47::play::clientbound::Abilities<47>;
1000impl crate::packet::Packet for Abilities {
1001 const ID: i32 = id::ABILITIES;
1002 const NAME: &'static str = "abilities";
1003 const STATE: State = State::Play;
1004 const DIRECTION: Direction = Direction::Clientbound;
1005}
1006impl From<Abilities> for ClientboundPlayPacket {
1007 fn from(p: Abilities) -> Self {
1008 Self::Abilities(p)
1009 }
1010}
1011
1012pub type TabComplete = crate::defs::p47::play::clientbound::TabComplete<47>;
1014impl crate::packet::Packet for TabComplete {
1015 const ID: i32 = id::TAB_COMPLETE;
1016 const NAME: &'static str = "tab_complete";
1017 const STATE: State = State::Play;
1018 const DIRECTION: Direction = Direction::Clientbound;
1019}
1020impl From<TabComplete> for ClientboundPlayPacket {
1021 fn from(p: TabComplete) -> Self {
1022 Self::TabComplete(p)
1023 }
1024}
1025
1026pub type ScoreboardObjective = crate::defs::p47::play::clientbound::ScoreboardObjective<47>;
1028impl crate::packet::Packet for ScoreboardObjective {
1029 const ID: i32 = id::SCOREBOARD_OBJECTIVE;
1030 const NAME: &'static str = "scoreboard_objective";
1031 const STATE: State = State::Play;
1032 const DIRECTION: Direction = Direction::Clientbound;
1033}
1034impl From<ScoreboardObjective> for ClientboundPlayPacket {
1035 fn from(p: ScoreboardObjective) -> Self {
1036 Self::ScoreboardObjective(p)
1037 }
1038}
1039
1040pub type ScoreboardScore = crate::defs::p47::play::clientbound::ScoreboardScore<47>;
1042impl crate::packet::Packet for ScoreboardScore {
1043 const ID: i32 = id::SCOREBOARD_SCORE;
1044 const NAME: &'static str = "scoreboard_score";
1045 const STATE: State = State::Play;
1046 const DIRECTION: Direction = Direction::Clientbound;
1047}
1048impl From<ScoreboardScore> for ClientboundPlayPacket {
1049 fn from(p: ScoreboardScore) -> Self {
1050 Self::ScoreboardScore(p)
1051 }
1052}
1053
1054pub type ScoreboardDisplayObjective =
1056 crate::defs::p47::play::clientbound::ScoreboardDisplayObjective<47>;
1057impl crate::packet::Packet for ScoreboardDisplayObjective {
1058 const ID: i32 = id::SCOREBOARD_DISPLAY_OBJECTIVE;
1059 const NAME: &'static str = "scoreboard_display_objective";
1060 const STATE: State = State::Play;
1061 const DIRECTION: Direction = Direction::Clientbound;
1062}
1063impl From<ScoreboardDisplayObjective> for ClientboundPlayPacket {
1064 fn from(p: ScoreboardDisplayObjective) -> Self {
1065 Self::ScoreboardDisplayObjective(p)
1066 }
1067}
1068
1069pub type ScoreboardTeam = crate::defs::p47::play::clientbound::ScoreboardTeam<47>;
1071impl crate::packet::Packet for ScoreboardTeam {
1072 const ID: i32 = id::SCOREBOARD_TEAM;
1073 const NAME: &'static str = "scoreboard_team";
1074 const STATE: State = State::Play;
1075 const DIRECTION: Direction = Direction::Clientbound;
1076}
1077impl From<ScoreboardTeam> for ClientboundPlayPacket {
1078 fn from(p: ScoreboardTeam) -> Self {
1079 Self::ScoreboardTeam(p)
1080 }
1081}
1082
1083pub type CustomPayload = crate::defs::p47::play::clientbound::CustomPayload<47>;
1085impl crate::packet::Packet for CustomPayload {
1086 const ID: i32 = id::CUSTOM_PAYLOAD;
1087 const NAME: &'static str = "custom_payload";
1088 const STATE: State = State::Play;
1089 const DIRECTION: Direction = Direction::Clientbound;
1090}
1091impl From<CustomPayload> for ClientboundPlayPacket {
1092 fn from(p: CustomPayload) -> Self {
1093 Self::CustomPayload(p)
1094 }
1095}
1096
1097pub type KickDisconnect = crate::defs::p47::play::clientbound::KickDisconnect<47>;
1099impl crate::packet::Packet for KickDisconnect {
1100 const ID: i32 = id::KICK_DISCONNECT;
1101 const NAME: &'static str = "kick_disconnect";
1102 const STATE: State = State::Play;
1103 const DIRECTION: Direction = Direction::Clientbound;
1104}
1105impl From<KickDisconnect> for ClientboundPlayPacket {
1106 fn from(p: KickDisconnect) -> Self {
1107 Self::KickDisconnect(p)
1108 }
1109}
1110
1111pub type Difficulty = crate::defs::p47::play::clientbound::Difficulty<47>;
1113impl crate::packet::Packet for Difficulty {
1114 const ID: i32 = id::DIFFICULTY;
1115 const NAME: &'static str = "difficulty";
1116 const STATE: State = State::Play;
1117 const DIRECTION: Direction = Direction::Clientbound;
1118}
1119impl From<Difficulty> for ClientboundPlayPacket {
1120 fn from(p: Difficulty) -> Self {
1121 Self::Difficulty(p)
1122 }
1123}
1124
1125pub type CombatEvent = crate::defs::p47::play::clientbound::CombatEvent<47>;
1127impl crate::packet::Packet for CombatEvent {
1128 const ID: i32 = id::COMBAT_EVENT;
1129 const NAME: &'static str = "combat_event";
1130 const STATE: State = State::Play;
1131 const DIRECTION: Direction = Direction::Clientbound;
1132}
1133impl From<CombatEvent> for ClientboundPlayPacket {
1134 fn from(p: CombatEvent) -> Self {
1135 Self::CombatEvent(p)
1136 }
1137}
1138
1139pub type Camera = crate::defs::p47::play::clientbound::Camera<47>;
1141impl crate::packet::Packet for Camera {
1142 const ID: i32 = id::CAMERA;
1143 const NAME: &'static str = "camera";
1144 const STATE: State = State::Play;
1145 const DIRECTION: Direction = Direction::Clientbound;
1146}
1147impl From<Camera> for ClientboundPlayPacket {
1148 fn from(p: Camera) -> Self {
1149 Self::Camera(p)
1150 }
1151}
1152
1153pub type WorldBorder = crate::defs::p47::play::clientbound::WorldBorder<47>;
1155impl crate::packet::Packet for WorldBorder {
1156 const ID: i32 = id::WORLD_BORDER;
1157 const NAME: &'static str = "world_border";
1158 const STATE: State = State::Play;
1159 const DIRECTION: Direction = Direction::Clientbound;
1160}
1161impl From<WorldBorder> for ClientboundPlayPacket {
1162 fn from(p: WorldBorder) -> Self {
1163 Self::WorldBorder(p)
1164 }
1165}
1166
1167pub type Title = crate::defs::p47::play::clientbound::Title<47>;
1169impl crate::packet::Packet for Title {
1170 const ID: i32 = id::TITLE;
1171 const NAME: &'static str = "title";
1172 const STATE: State = State::Play;
1173 const DIRECTION: Direction = Direction::Clientbound;
1174}
1175impl From<Title> for ClientboundPlayPacket {
1176 fn from(p: Title) -> Self {
1177 Self::Title(p)
1178 }
1179}
1180
1181pub type SetCompression = crate::defs::p47::play::clientbound::SetCompression<47>;
1183impl crate::packet::Packet for SetCompression {
1184 const ID: i32 = id::SET_COMPRESSION;
1185 const NAME: &'static str = "set_compression";
1186 const STATE: State = State::Play;
1187 const DIRECTION: Direction = Direction::Clientbound;
1188}
1189impl From<SetCompression> for ClientboundPlayPacket {
1190 fn from(p: SetCompression) -> Self {
1191 Self::SetCompression(p)
1192 }
1193}
1194
1195pub type PlayerlistHeader = crate::defs::p47::play::clientbound::PlayerlistHeader<47>;
1197impl crate::packet::Packet for PlayerlistHeader {
1198 const ID: i32 = id::PLAYERLIST_HEADER;
1199 const NAME: &'static str = "playerlist_header";
1200 const STATE: State = State::Play;
1201 const DIRECTION: Direction = Direction::Clientbound;
1202}
1203impl From<PlayerlistHeader> for ClientboundPlayPacket {
1204 fn from(p: PlayerlistHeader) -> Self {
1205 Self::PlayerlistHeader(p)
1206 }
1207}
1208
1209pub type ResourcePackSend = crate::defs::p47::play::clientbound::ResourcePackSend<47>;
1211impl crate::packet::Packet for ResourcePackSend {
1212 const ID: i32 = id::RESOURCE_PACK_SEND;
1213 const NAME: &'static str = "resource_pack_send";
1214 const STATE: State = State::Play;
1215 const DIRECTION: Direction = Direction::Clientbound;
1216}
1217impl From<ResourcePackSend> for ClientboundPlayPacket {
1218 fn from(p: ResourcePackSend) -> Self {
1219 Self::ResourcePackSend(p)
1220 }
1221}
1222
1223pub type UpdateEntityNbt = crate::defs::p47::play::clientbound::UpdateEntityNbt<47>;
1225impl crate::packet::Packet for UpdateEntityNbt {
1226 const ID: i32 = id::UPDATE_ENTITY_NBT;
1227 const NAME: &'static str = "update_entity_nbt";
1228 const STATE: State = State::Play;
1229 const DIRECTION: Direction = Direction::Clientbound;
1230}
1231impl From<UpdateEntityNbt> for ClientboundPlayPacket {
1232 fn from(p: UpdateEntityNbt) -> Self {
1233 Self::UpdateEntityNbt(p)
1234 }
1235}
1236
1237#[derive(Debug, Clone, PartialEq)]
1239pub enum ClientboundPlayPacket {
1240 KeepAlive(KeepAlive),
1242 Login(Login),
1244 Chat(Chat),
1246 UpdateTime(UpdateTime),
1248 EntityEquipment(EntityEquipment),
1250 SpawnPosition(SpawnPosition),
1252 UpdateHealth(UpdateHealth),
1254 Respawn(Respawn),
1256 Position(Position),
1258 HeldItemSlot(HeldItemSlot),
1260 Bed(Bed),
1262 Animation(Animation),
1264 NamedEntitySpawn(NamedEntitySpawn),
1266 Collect(Collect),
1268 SpawnEntity(SpawnEntity),
1270 SpawnEntityLiving(SpawnEntityLiving),
1272 SpawnEntityPainting(SpawnEntityPainting),
1274 SpawnEntityExperienceOrb(SpawnEntityExperienceOrb),
1276 EntityVelocity(EntityVelocity),
1278 EntityDestroy(EntityDestroy),
1280 Entity(Entity),
1282 RelEntityMove(RelEntityMove),
1284 EntityLook(EntityLook),
1286 EntityMoveLook(EntityMoveLook),
1288 EntityTeleport(EntityTeleport),
1290 EntityHeadRotation(EntityHeadRotation),
1292 EntityStatus(EntityStatus),
1294 AttachEntity(AttachEntity),
1296 EntityMetadata(EntityMetadata),
1298 EntityEffect(EntityEffect),
1300 RemoveEntityEffect(RemoveEntityEffect),
1302 Experience(Experience),
1304 UpdateAttributes(UpdateAttributes),
1306 MapChunk(MapChunk),
1308 MultiBlockChange(MultiBlockChange),
1310 BlockChange(BlockChange),
1312 BlockAction(BlockAction),
1314 BlockBreakAnimation(BlockBreakAnimation),
1316 MapChunkBulk(MapChunkBulk),
1318 Explosion(Explosion),
1320 WorldEvent(WorldEvent),
1322 NamedSoundEffect(NamedSoundEffect),
1324 WorldParticles(WorldParticles),
1326 GameStateChange(GameStateChange),
1328 SpawnEntityWeather(SpawnEntityWeather),
1330 OpenWindow(OpenWindow),
1332 CloseWindow(CloseWindow),
1334 SetSlot(SetSlot),
1336 WindowItems(WindowItems),
1338 CraftProgressBar(CraftProgressBar),
1340 Transaction(Transaction),
1342 UpdateSign(UpdateSign),
1344 Map(Map),
1346 TileEntityData(TileEntityData),
1348 OpenSignEntity(OpenSignEntity),
1350 Statistics(Statistics),
1352 PlayerInfo(PlayerInfo),
1354 Abilities(Abilities),
1356 TabComplete(TabComplete),
1358 ScoreboardObjective(ScoreboardObjective),
1360 ScoreboardScore(ScoreboardScore),
1362 ScoreboardDisplayObjective(ScoreboardDisplayObjective),
1364 ScoreboardTeam(ScoreboardTeam),
1366 CustomPayload(CustomPayload),
1368 KickDisconnect(KickDisconnect),
1370 Difficulty(Difficulty),
1372 CombatEvent(CombatEvent),
1374 Camera(Camera),
1376 WorldBorder(WorldBorder),
1378 Title(Title),
1380 SetCompression(SetCompression),
1382 PlayerlistHeader(PlayerlistHeader),
1384 ResourcePackSend(ResourcePackSend),
1386 UpdateEntityNbt(UpdateEntityNbt),
1388}
1389
1390impl PacketSet for ClientboundPlayPacket {
1391 const STATE: State = State::Play;
1392 const DIRECTION: Direction = Direction::Clientbound;
1393 fn decode_raw(raw: &RawPacket) -> DecodeResult<Self> {
1394 match raw.id {
1395 id::KEEP_ALIVE => decode_exact(&raw.body).map(Self::KeepAlive),
1396 id::LOGIN => decode_exact(&raw.body).map(Self::Login),
1397 id::CHAT => decode_exact(&raw.body).map(Self::Chat),
1398 id::UPDATE_TIME => decode_exact(&raw.body).map(Self::UpdateTime),
1399 id::ENTITY_EQUIPMENT => decode_exact(&raw.body).map(Self::EntityEquipment),
1400 id::SPAWN_POSITION => decode_exact(&raw.body).map(Self::SpawnPosition),
1401 id::UPDATE_HEALTH => decode_exact(&raw.body).map(Self::UpdateHealth),
1402 id::RESPAWN => decode_exact(&raw.body).map(Self::Respawn),
1403 id::POSITION => decode_exact(&raw.body).map(Self::Position),
1404 id::HELD_ITEM_SLOT => decode_exact(&raw.body).map(Self::HeldItemSlot),
1405 id::BED => decode_exact(&raw.body).map(Self::Bed),
1406 id::ANIMATION => decode_exact(&raw.body).map(Self::Animation),
1407 id::NAMED_ENTITY_SPAWN => decode_exact(&raw.body).map(Self::NamedEntitySpawn),
1408 id::COLLECT => decode_exact(&raw.body).map(Self::Collect),
1409 id::SPAWN_ENTITY => decode_exact(&raw.body).map(Self::SpawnEntity),
1410 id::SPAWN_ENTITY_LIVING => decode_exact(&raw.body).map(Self::SpawnEntityLiving),
1411 id::SPAWN_ENTITY_PAINTING => decode_exact(&raw.body).map(Self::SpawnEntityPainting),
1412 id::SPAWN_ENTITY_EXPERIENCE_ORB => {
1413 decode_exact(&raw.body).map(Self::SpawnEntityExperienceOrb)
1414 }
1415 id::ENTITY_VELOCITY => decode_exact(&raw.body).map(Self::EntityVelocity),
1416 id::ENTITY_DESTROY => decode_exact(&raw.body).map(Self::EntityDestroy),
1417 id::ENTITY => decode_exact(&raw.body).map(Self::Entity),
1418 id::REL_ENTITY_MOVE => decode_exact(&raw.body).map(Self::RelEntityMove),
1419 id::ENTITY_LOOK => decode_exact(&raw.body).map(Self::EntityLook),
1420 id::ENTITY_MOVE_LOOK => decode_exact(&raw.body).map(Self::EntityMoveLook),
1421 id::ENTITY_TELEPORT => decode_exact(&raw.body).map(Self::EntityTeleport),
1422 id::ENTITY_HEAD_ROTATION => decode_exact(&raw.body).map(Self::EntityHeadRotation),
1423 id::ENTITY_STATUS => decode_exact(&raw.body).map(Self::EntityStatus),
1424 id::ATTACH_ENTITY => decode_exact(&raw.body).map(Self::AttachEntity),
1425 id::ENTITY_METADATA => decode_exact(&raw.body).map(Self::EntityMetadata),
1426 id::ENTITY_EFFECT => decode_exact(&raw.body).map(Self::EntityEffect),
1427 id::REMOVE_ENTITY_EFFECT => decode_exact(&raw.body).map(Self::RemoveEntityEffect),
1428 id::EXPERIENCE => decode_exact(&raw.body).map(Self::Experience),
1429 id::UPDATE_ATTRIBUTES => decode_exact(&raw.body).map(Self::UpdateAttributes),
1430 id::MAP_CHUNK => decode_exact(&raw.body).map(Self::MapChunk),
1431 id::MULTI_BLOCK_CHANGE => decode_exact(&raw.body).map(Self::MultiBlockChange),
1432 id::BLOCK_CHANGE => decode_exact(&raw.body).map(Self::BlockChange),
1433 id::BLOCK_ACTION => decode_exact(&raw.body).map(Self::BlockAction),
1434 id::BLOCK_BREAK_ANIMATION => decode_exact(&raw.body).map(Self::BlockBreakAnimation),
1435 id::MAP_CHUNK_BULK => decode_exact(&raw.body).map(Self::MapChunkBulk),
1436 id::EXPLOSION => decode_exact(&raw.body).map(Self::Explosion),
1437 id::WORLD_EVENT => decode_exact(&raw.body).map(Self::WorldEvent),
1438 id::NAMED_SOUND_EFFECT => decode_exact(&raw.body).map(Self::NamedSoundEffect),
1439 id::WORLD_PARTICLES => decode_exact(&raw.body).map(Self::WorldParticles),
1440 id::GAME_STATE_CHANGE => decode_exact(&raw.body).map(Self::GameStateChange),
1441 id::SPAWN_ENTITY_WEATHER => decode_exact(&raw.body).map(Self::SpawnEntityWeather),
1442 id::OPEN_WINDOW => decode_exact(&raw.body).map(Self::OpenWindow),
1443 id::CLOSE_WINDOW => decode_exact(&raw.body).map(Self::CloseWindow),
1444 id::SET_SLOT => decode_exact(&raw.body).map(Self::SetSlot),
1445 id::WINDOW_ITEMS => decode_exact(&raw.body).map(Self::WindowItems),
1446 id::CRAFT_PROGRESS_BAR => decode_exact(&raw.body).map(Self::CraftProgressBar),
1447 id::TRANSACTION => decode_exact(&raw.body).map(Self::Transaction),
1448 id::UPDATE_SIGN => decode_exact(&raw.body).map(Self::UpdateSign),
1449 id::MAP => decode_exact(&raw.body).map(Self::Map),
1450 id::TILE_ENTITY_DATA => decode_exact(&raw.body).map(Self::TileEntityData),
1451 id::OPEN_SIGN_ENTITY => decode_exact(&raw.body).map(Self::OpenSignEntity),
1452 id::STATISTICS => decode_exact(&raw.body).map(Self::Statistics),
1453 id::PLAYER_INFO => decode_exact(&raw.body).map(Self::PlayerInfo),
1454 id::ABILITIES => decode_exact(&raw.body).map(Self::Abilities),
1455 id::TAB_COMPLETE => decode_exact(&raw.body).map(Self::TabComplete),
1456 id::SCOREBOARD_OBJECTIVE => decode_exact(&raw.body).map(Self::ScoreboardObjective),
1457 id::SCOREBOARD_SCORE => decode_exact(&raw.body).map(Self::ScoreboardScore),
1458 id::SCOREBOARD_DISPLAY_OBJECTIVE => {
1459 decode_exact(&raw.body).map(Self::ScoreboardDisplayObjective)
1460 }
1461 id::SCOREBOARD_TEAM => decode_exact(&raw.body).map(Self::ScoreboardTeam),
1462 id::CUSTOM_PAYLOAD => decode_exact(&raw.body).map(Self::CustomPayload),
1463 id::KICK_DISCONNECT => decode_exact(&raw.body).map(Self::KickDisconnect),
1464 id::DIFFICULTY => decode_exact(&raw.body).map(Self::Difficulty),
1465 id::COMBAT_EVENT => decode_exact(&raw.body).map(Self::CombatEvent),
1466 id::CAMERA => decode_exact(&raw.body).map(Self::Camera),
1467 id::WORLD_BORDER => decode_exact(&raw.body).map(Self::WorldBorder),
1468 id::TITLE => decode_exact(&raw.body).map(Self::Title),
1469 id::SET_COMPRESSION => decode_exact(&raw.body).map(Self::SetCompression),
1470 id::PLAYERLIST_HEADER => decode_exact(&raw.body).map(Self::PlayerlistHeader),
1471 id::RESOURCE_PACK_SEND => decode_exact(&raw.body).map(Self::ResourcePackSend),
1472 id::UPDATE_ENTITY_NBT => decode_exact(&raw.body).map(Self::UpdateEntityNbt),
1473 other => Err(DecodeError::UnknownPacketId(other)),
1474 }
1475 }
1476 fn id(&self) -> i32 {
1477 match *self {
1478 Self::KeepAlive(_) => id::KEEP_ALIVE,
1479 Self::Login(_) => id::LOGIN,
1480 Self::Chat(_) => id::CHAT,
1481 Self::UpdateTime(_) => id::UPDATE_TIME,
1482 Self::EntityEquipment(_) => id::ENTITY_EQUIPMENT,
1483 Self::SpawnPosition(_) => id::SPAWN_POSITION,
1484 Self::UpdateHealth(_) => id::UPDATE_HEALTH,
1485 Self::Respawn(_) => id::RESPAWN,
1486 Self::Position(_) => id::POSITION,
1487 Self::HeldItemSlot(_) => id::HELD_ITEM_SLOT,
1488 Self::Bed(_) => id::BED,
1489 Self::Animation(_) => id::ANIMATION,
1490 Self::NamedEntitySpawn(_) => id::NAMED_ENTITY_SPAWN,
1491 Self::Collect(_) => id::COLLECT,
1492 Self::SpawnEntity(_) => id::SPAWN_ENTITY,
1493 Self::SpawnEntityLiving(_) => id::SPAWN_ENTITY_LIVING,
1494 Self::SpawnEntityPainting(_) => id::SPAWN_ENTITY_PAINTING,
1495 Self::SpawnEntityExperienceOrb(_) => id::SPAWN_ENTITY_EXPERIENCE_ORB,
1496 Self::EntityVelocity(_) => id::ENTITY_VELOCITY,
1497 Self::EntityDestroy(_) => id::ENTITY_DESTROY,
1498 Self::Entity(_) => id::ENTITY,
1499 Self::RelEntityMove(_) => id::REL_ENTITY_MOVE,
1500 Self::EntityLook(_) => id::ENTITY_LOOK,
1501 Self::EntityMoveLook(_) => id::ENTITY_MOVE_LOOK,
1502 Self::EntityTeleport(_) => id::ENTITY_TELEPORT,
1503 Self::EntityHeadRotation(_) => id::ENTITY_HEAD_ROTATION,
1504 Self::EntityStatus(_) => id::ENTITY_STATUS,
1505 Self::AttachEntity(_) => id::ATTACH_ENTITY,
1506 Self::EntityMetadata(_) => id::ENTITY_METADATA,
1507 Self::EntityEffect(_) => id::ENTITY_EFFECT,
1508 Self::RemoveEntityEffect(_) => id::REMOVE_ENTITY_EFFECT,
1509 Self::Experience(_) => id::EXPERIENCE,
1510 Self::UpdateAttributes(_) => id::UPDATE_ATTRIBUTES,
1511 Self::MapChunk(_) => id::MAP_CHUNK,
1512 Self::MultiBlockChange(_) => id::MULTI_BLOCK_CHANGE,
1513 Self::BlockChange(_) => id::BLOCK_CHANGE,
1514 Self::BlockAction(_) => id::BLOCK_ACTION,
1515 Self::BlockBreakAnimation(_) => id::BLOCK_BREAK_ANIMATION,
1516 Self::MapChunkBulk(_) => id::MAP_CHUNK_BULK,
1517 Self::Explosion(_) => id::EXPLOSION,
1518 Self::WorldEvent(_) => id::WORLD_EVENT,
1519 Self::NamedSoundEffect(_) => id::NAMED_SOUND_EFFECT,
1520 Self::WorldParticles(_) => id::WORLD_PARTICLES,
1521 Self::GameStateChange(_) => id::GAME_STATE_CHANGE,
1522 Self::SpawnEntityWeather(_) => id::SPAWN_ENTITY_WEATHER,
1523 Self::OpenWindow(_) => id::OPEN_WINDOW,
1524 Self::CloseWindow(_) => id::CLOSE_WINDOW,
1525 Self::SetSlot(_) => id::SET_SLOT,
1526 Self::WindowItems(_) => id::WINDOW_ITEMS,
1527 Self::CraftProgressBar(_) => id::CRAFT_PROGRESS_BAR,
1528 Self::Transaction(_) => id::TRANSACTION,
1529 Self::UpdateSign(_) => id::UPDATE_SIGN,
1530 Self::Map(_) => id::MAP,
1531 Self::TileEntityData(_) => id::TILE_ENTITY_DATA,
1532 Self::OpenSignEntity(_) => id::OPEN_SIGN_ENTITY,
1533 Self::Statistics(_) => id::STATISTICS,
1534 Self::PlayerInfo(_) => id::PLAYER_INFO,
1535 Self::Abilities(_) => id::ABILITIES,
1536 Self::TabComplete(_) => id::TAB_COMPLETE,
1537 Self::ScoreboardObjective(_) => id::SCOREBOARD_OBJECTIVE,
1538 Self::ScoreboardScore(_) => id::SCOREBOARD_SCORE,
1539 Self::ScoreboardDisplayObjective(_) => id::SCOREBOARD_DISPLAY_OBJECTIVE,
1540 Self::ScoreboardTeam(_) => id::SCOREBOARD_TEAM,
1541 Self::CustomPayload(_) => id::CUSTOM_PAYLOAD,
1542 Self::KickDisconnect(_) => id::KICK_DISCONNECT,
1543 Self::Difficulty(_) => id::DIFFICULTY,
1544 Self::CombatEvent(_) => id::COMBAT_EVENT,
1545 Self::Camera(_) => id::CAMERA,
1546 Self::WorldBorder(_) => id::WORLD_BORDER,
1547 Self::Title(_) => id::TITLE,
1548 Self::SetCompression(_) => id::SET_COMPRESSION,
1549 Self::PlayerlistHeader(_) => id::PLAYERLIST_HEADER,
1550 Self::ResourcePackSend(_) => id::RESOURCE_PACK_SEND,
1551 Self::UpdateEntityNbt(_) => id::UPDATE_ENTITY_NBT,
1552 }
1553 }
1554 fn name(&self) -> &'static str {
1555 match *self {
1556 Self::KeepAlive(_) => "keep_alive",
1557 Self::Login(_) => "login",
1558 Self::Chat(_) => "chat",
1559 Self::UpdateTime(_) => "update_time",
1560 Self::EntityEquipment(_) => "entity_equipment",
1561 Self::SpawnPosition(_) => "spawn_position",
1562 Self::UpdateHealth(_) => "update_health",
1563 Self::Respawn(_) => "respawn",
1564 Self::Position(_) => "position",
1565 Self::HeldItemSlot(_) => "held_item_slot",
1566 Self::Bed(_) => "bed",
1567 Self::Animation(_) => "animation",
1568 Self::NamedEntitySpawn(_) => "named_entity_spawn",
1569 Self::Collect(_) => "collect",
1570 Self::SpawnEntity(_) => "spawn_entity",
1571 Self::SpawnEntityLiving(_) => "spawn_entity_living",
1572 Self::SpawnEntityPainting(_) => "spawn_entity_painting",
1573 Self::SpawnEntityExperienceOrb(_) => "spawn_entity_experience_orb",
1574 Self::EntityVelocity(_) => "entity_velocity",
1575 Self::EntityDestroy(_) => "entity_destroy",
1576 Self::Entity(_) => "entity",
1577 Self::RelEntityMove(_) => "rel_entity_move",
1578 Self::EntityLook(_) => "entity_look",
1579 Self::EntityMoveLook(_) => "entity_move_look",
1580 Self::EntityTeleport(_) => "entity_teleport",
1581 Self::EntityHeadRotation(_) => "entity_head_rotation",
1582 Self::EntityStatus(_) => "entity_status",
1583 Self::AttachEntity(_) => "attach_entity",
1584 Self::EntityMetadata(_) => "entity_metadata",
1585 Self::EntityEffect(_) => "entity_effect",
1586 Self::RemoveEntityEffect(_) => "remove_entity_effect",
1587 Self::Experience(_) => "experience",
1588 Self::UpdateAttributes(_) => "update_attributes",
1589 Self::MapChunk(_) => "map_chunk",
1590 Self::MultiBlockChange(_) => "multi_block_change",
1591 Self::BlockChange(_) => "block_change",
1592 Self::BlockAction(_) => "block_action",
1593 Self::BlockBreakAnimation(_) => "block_break_animation",
1594 Self::MapChunkBulk(_) => "map_chunk_bulk",
1595 Self::Explosion(_) => "explosion",
1596 Self::WorldEvent(_) => "world_event",
1597 Self::NamedSoundEffect(_) => "named_sound_effect",
1598 Self::WorldParticles(_) => "world_particles",
1599 Self::GameStateChange(_) => "game_state_change",
1600 Self::SpawnEntityWeather(_) => "spawn_entity_weather",
1601 Self::OpenWindow(_) => "open_window",
1602 Self::CloseWindow(_) => "close_window",
1603 Self::SetSlot(_) => "set_slot",
1604 Self::WindowItems(_) => "window_items",
1605 Self::CraftProgressBar(_) => "craft_progress_bar",
1606 Self::Transaction(_) => "transaction",
1607 Self::UpdateSign(_) => "update_sign",
1608 Self::Map(_) => "map",
1609 Self::TileEntityData(_) => "tile_entity_data",
1610 Self::OpenSignEntity(_) => "open_sign_entity",
1611 Self::Statistics(_) => "statistics",
1612 Self::PlayerInfo(_) => "player_info",
1613 Self::Abilities(_) => "abilities",
1614 Self::TabComplete(_) => "tab_complete",
1615 Self::ScoreboardObjective(_) => "scoreboard_objective",
1616 Self::ScoreboardScore(_) => "scoreboard_score",
1617 Self::ScoreboardDisplayObjective(_) => "scoreboard_display_objective",
1618 Self::ScoreboardTeam(_) => "scoreboard_team",
1619 Self::CustomPayload(_) => "custom_payload",
1620 Self::KickDisconnect(_) => "kick_disconnect",
1621 Self::Difficulty(_) => "difficulty",
1622 Self::CombatEvent(_) => "combat_event",
1623 Self::Camera(_) => "camera",
1624 Self::WorldBorder(_) => "world_border",
1625 Self::Title(_) => "title",
1626 Self::SetCompression(_) => "set_compression",
1627 Self::PlayerlistHeader(_) => "playerlist_header",
1628 Self::ResourcePackSend(_) => "resource_pack_send",
1629 Self::UpdateEntityNbt(_) => "update_entity_nbt",
1630 }
1631 }
1632 fn encode_body(&self, w: &mut BytesMut) -> EncodeResult {
1633 match *self {
1634 Self::KeepAlive(ref p) => p.encode(w),
1635 Self::Login(ref p) => p.encode(w),
1636 Self::Chat(ref p) => p.encode(w),
1637 Self::UpdateTime(ref p) => p.encode(w),
1638 Self::EntityEquipment(ref p) => p.encode(w),
1639 Self::SpawnPosition(ref p) => p.encode(w),
1640 Self::UpdateHealth(ref p) => p.encode(w),
1641 Self::Respawn(ref p) => p.encode(w),
1642 Self::Position(ref p) => p.encode(w),
1643 Self::HeldItemSlot(ref p) => p.encode(w),
1644 Self::Bed(ref p) => p.encode(w),
1645 Self::Animation(ref p) => p.encode(w),
1646 Self::NamedEntitySpawn(ref p) => p.encode(w),
1647 Self::Collect(ref p) => p.encode(w),
1648 Self::SpawnEntity(ref p) => p.encode(w),
1649 Self::SpawnEntityLiving(ref p) => p.encode(w),
1650 Self::SpawnEntityPainting(ref p) => p.encode(w),
1651 Self::SpawnEntityExperienceOrb(ref p) => p.encode(w),
1652 Self::EntityVelocity(ref p) => p.encode(w),
1653 Self::EntityDestroy(ref p) => p.encode(w),
1654 Self::Entity(ref p) => p.encode(w),
1655 Self::RelEntityMove(ref p) => p.encode(w),
1656 Self::EntityLook(ref p) => p.encode(w),
1657 Self::EntityMoveLook(ref p) => p.encode(w),
1658 Self::EntityTeleport(ref p) => p.encode(w),
1659 Self::EntityHeadRotation(ref p) => p.encode(w),
1660 Self::EntityStatus(ref p) => p.encode(w),
1661 Self::AttachEntity(ref p) => p.encode(w),
1662 Self::EntityMetadata(ref p) => p.encode(w),
1663 Self::EntityEffect(ref p) => p.encode(w),
1664 Self::RemoveEntityEffect(ref p) => p.encode(w),
1665 Self::Experience(ref p) => p.encode(w),
1666 Self::UpdateAttributes(ref p) => p.encode(w),
1667 Self::MapChunk(ref p) => p.encode(w),
1668 Self::MultiBlockChange(ref p) => p.encode(w),
1669 Self::BlockChange(ref p) => p.encode(w),
1670 Self::BlockAction(ref p) => p.encode(w),
1671 Self::BlockBreakAnimation(ref p) => p.encode(w),
1672 Self::MapChunkBulk(ref p) => p.encode(w),
1673 Self::Explosion(ref p) => p.encode(w),
1674 Self::WorldEvent(ref p) => p.encode(w),
1675 Self::NamedSoundEffect(ref p) => p.encode(w),
1676 Self::WorldParticles(ref p) => p.encode(w),
1677 Self::GameStateChange(ref p) => p.encode(w),
1678 Self::SpawnEntityWeather(ref p) => p.encode(w),
1679 Self::OpenWindow(ref p) => p.encode(w),
1680 Self::CloseWindow(ref p) => p.encode(w),
1681 Self::SetSlot(ref p) => p.encode(w),
1682 Self::WindowItems(ref p) => p.encode(w),
1683 Self::CraftProgressBar(ref p) => p.encode(w),
1684 Self::Transaction(ref p) => p.encode(w),
1685 Self::UpdateSign(ref p) => p.encode(w),
1686 Self::Map(ref p) => p.encode(w),
1687 Self::TileEntityData(ref p) => p.encode(w),
1688 Self::OpenSignEntity(ref p) => p.encode(w),
1689 Self::Statistics(ref p) => p.encode(w),
1690 Self::PlayerInfo(ref p) => p.encode(w),
1691 Self::Abilities(ref p) => p.encode(w),
1692 Self::TabComplete(ref p) => p.encode(w),
1693 Self::ScoreboardObjective(ref p) => p.encode(w),
1694 Self::ScoreboardScore(ref p) => p.encode(w),
1695 Self::ScoreboardDisplayObjective(ref p) => p.encode(w),
1696 Self::ScoreboardTeam(ref p) => p.encode(w),
1697 Self::CustomPayload(ref p) => p.encode(w),
1698 Self::KickDisconnect(ref p) => p.encode(w),
1699 Self::Difficulty(ref p) => p.encode(w),
1700 Self::CombatEvent(ref p) => p.encode(w),
1701 Self::Camera(ref p) => p.encode(w),
1702 Self::WorldBorder(ref p) => p.encode(w),
1703 Self::Title(ref p) => p.encode(w),
1704 Self::SetCompression(ref p) => p.encode(w),
1705 Self::PlayerlistHeader(ref p) => p.encode(w),
1706 Self::ResourcePackSend(ref p) => p.encode(w),
1707 Self::UpdateEntityNbt(ref p) => p.encode(w),
1708 }
1709 }
1710 fn name_of(id: i32) -> Option<&'static str> {
1711 match id {
1712 id::KEEP_ALIVE => Some("keep_alive"),
1713 id::LOGIN => Some("login"),
1714 id::CHAT => Some("chat"),
1715 id::UPDATE_TIME => Some("update_time"),
1716 id::ENTITY_EQUIPMENT => Some("entity_equipment"),
1717 id::SPAWN_POSITION => Some("spawn_position"),
1718 id::UPDATE_HEALTH => Some("update_health"),
1719 id::RESPAWN => Some("respawn"),
1720 id::POSITION => Some("position"),
1721 id::HELD_ITEM_SLOT => Some("held_item_slot"),
1722 id::BED => Some("bed"),
1723 id::ANIMATION => Some("animation"),
1724 id::NAMED_ENTITY_SPAWN => Some("named_entity_spawn"),
1725 id::COLLECT => Some("collect"),
1726 id::SPAWN_ENTITY => Some("spawn_entity"),
1727 id::SPAWN_ENTITY_LIVING => Some("spawn_entity_living"),
1728 id::SPAWN_ENTITY_PAINTING => Some("spawn_entity_painting"),
1729 id::SPAWN_ENTITY_EXPERIENCE_ORB => Some("spawn_entity_experience_orb"),
1730 id::ENTITY_VELOCITY => Some("entity_velocity"),
1731 id::ENTITY_DESTROY => Some("entity_destroy"),
1732 id::ENTITY => Some("entity"),
1733 id::REL_ENTITY_MOVE => Some("rel_entity_move"),
1734 id::ENTITY_LOOK => Some("entity_look"),
1735 id::ENTITY_MOVE_LOOK => Some("entity_move_look"),
1736 id::ENTITY_TELEPORT => Some("entity_teleport"),
1737 id::ENTITY_HEAD_ROTATION => Some("entity_head_rotation"),
1738 id::ENTITY_STATUS => Some("entity_status"),
1739 id::ATTACH_ENTITY => Some("attach_entity"),
1740 id::ENTITY_METADATA => Some("entity_metadata"),
1741 id::ENTITY_EFFECT => Some("entity_effect"),
1742 id::REMOVE_ENTITY_EFFECT => Some("remove_entity_effect"),
1743 id::EXPERIENCE => Some("experience"),
1744 id::UPDATE_ATTRIBUTES => Some("update_attributes"),
1745 id::MAP_CHUNK => Some("map_chunk"),
1746 id::MULTI_BLOCK_CHANGE => Some("multi_block_change"),
1747 id::BLOCK_CHANGE => Some("block_change"),
1748 id::BLOCK_ACTION => Some("block_action"),
1749 id::BLOCK_BREAK_ANIMATION => Some("block_break_animation"),
1750 id::MAP_CHUNK_BULK => Some("map_chunk_bulk"),
1751 id::EXPLOSION => Some("explosion"),
1752 id::WORLD_EVENT => Some("world_event"),
1753 id::NAMED_SOUND_EFFECT => Some("named_sound_effect"),
1754 id::WORLD_PARTICLES => Some("world_particles"),
1755 id::GAME_STATE_CHANGE => Some("game_state_change"),
1756 id::SPAWN_ENTITY_WEATHER => Some("spawn_entity_weather"),
1757 id::OPEN_WINDOW => Some("open_window"),
1758 id::CLOSE_WINDOW => Some("close_window"),
1759 id::SET_SLOT => Some("set_slot"),
1760 id::WINDOW_ITEMS => Some("window_items"),
1761 id::CRAFT_PROGRESS_BAR => Some("craft_progress_bar"),
1762 id::TRANSACTION => Some("transaction"),
1763 id::UPDATE_SIGN => Some("update_sign"),
1764 id::MAP => Some("map"),
1765 id::TILE_ENTITY_DATA => Some("tile_entity_data"),
1766 id::OPEN_SIGN_ENTITY => Some("open_sign_entity"),
1767 id::STATISTICS => Some("statistics"),
1768 id::PLAYER_INFO => Some("player_info"),
1769 id::ABILITIES => Some("abilities"),
1770 id::TAB_COMPLETE => Some("tab_complete"),
1771 id::SCOREBOARD_OBJECTIVE => Some("scoreboard_objective"),
1772 id::SCOREBOARD_SCORE => Some("scoreboard_score"),
1773 id::SCOREBOARD_DISPLAY_OBJECTIVE => Some("scoreboard_display_objective"),
1774 id::SCOREBOARD_TEAM => Some("scoreboard_team"),
1775 id::CUSTOM_PAYLOAD => Some("custom_payload"),
1776 id::KICK_DISCONNECT => Some("kick_disconnect"),
1777 id::DIFFICULTY => Some("difficulty"),
1778 id::COMBAT_EVENT => Some("combat_event"),
1779 id::CAMERA => Some("camera"),
1780 id::WORLD_BORDER => Some("world_border"),
1781 id::TITLE => Some("title"),
1782 id::SET_COMPRESSION => Some("set_compression"),
1783 id::PLAYERLIST_HEADER => Some("playerlist_header"),
1784 id::RESOURCE_PACK_SEND => Some("resource_pack_send"),
1785 id::UPDATE_ENTITY_NBT => Some("update_entity_nbt"),
1786 _ => None,
1787 }
1788 }
1789}
1790
1791impl ClientboundPlayPacket {
1792 pub const IDS: &'static [i32] = &[
1794 id::KEEP_ALIVE,
1795 id::LOGIN,
1796 id::CHAT,
1797 id::UPDATE_TIME,
1798 id::ENTITY_EQUIPMENT,
1799 id::SPAWN_POSITION,
1800 id::UPDATE_HEALTH,
1801 id::RESPAWN,
1802 id::POSITION,
1803 id::HELD_ITEM_SLOT,
1804 id::BED,
1805 id::ANIMATION,
1806 id::NAMED_ENTITY_SPAWN,
1807 id::COLLECT,
1808 id::SPAWN_ENTITY,
1809 id::SPAWN_ENTITY_LIVING,
1810 id::SPAWN_ENTITY_PAINTING,
1811 id::SPAWN_ENTITY_EXPERIENCE_ORB,
1812 id::ENTITY_VELOCITY,
1813 id::ENTITY_DESTROY,
1814 id::ENTITY,
1815 id::REL_ENTITY_MOVE,
1816 id::ENTITY_LOOK,
1817 id::ENTITY_MOVE_LOOK,
1818 id::ENTITY_TELEPORT,
1819 id::ENTITY_HEAD_ROTATION,
1820 id::ENTITY_STATUS,
1821 id::ATTACH_ENTITY,
1822 id::ENTITY_METADATA,
1823 id::ENTITY_EFFECT,
1824 id::REMOVE_ENTITY_EFFECT,
1825 id::EXPERIENCE,
1826 id::UPDATE_ATTRIBUTES,
1827 id::MAP_CHUNK,
1828 id::MULTI_BLOCK_CHANGE,
1829 id::BLOCK_CHANGE,
1830 id::BLOCK_ACTION,
1831 id::BLOCK_BREAK_ANIMATION,
1832 id::MAP_CHUNK_BULK,
1833 id::EXPLOSION,
1834 id::WORLD_EVENT,
1835 id::NAMED_SOUND_EFFECT,
1836 id::WORLD_PARTICLES,
1837 id::GAME_STATE_CHANGE,
1838 id::SPAWN_ENTITY_WEATHER,
1839 id::OPEN_WINDOW,
1840 id::CLOSE_WINDOW,
1841 id::SET_SLOT,
1842 id::WINDOW_ITEMS,
1843 id::CRAFT_PROGRESS_BAR,
1844 id::TRANSACTION,
1845 id::UPDATE_SIGN,
1846 id::MAP,
1847 id::TILE_ENTITY_DATA,
1848 id::OPEN_SIGN_ENTITY,
1849 id::STATISTICS,
1850 id::PLAYER_INFO,
1851 id::ABILITIES,
1852 id::TAB_COMPLETE,
1853 id::SCOREBOARD_OBJECTIVE,
1854 id::SCOREBOARD_SCORE,
1855 id::SCOREBOARD_DISPLAY_OBJECTIVE,
1856 id::SCOREBOARD_TEAM,
1857 id::CUSTOM_PAYLOAD,
1858 id::KICK_DISCONNECT,
1859 id::DIFFICULTY,
1860 id::COMBAT_EVENT,
1861 id::CAMERA,
1862 id::WORLD_BORDER,
1863 id::TITLE,
1864 id::SET_COMPRESSION,
1865 id::PLAYERLIST_HEADER,
1866 id::RESOURCE_PACK_SEND,
1867 id::UPDATE_ENTITY_NBT,
1868 ];
1869 #[cfg(feature = "testgen")]
1871 pub fn generate_by_id(id: i32, g: &mut Gen) -> Option<Self> {
1872 match id {
1873 id::KEEP_ALIVE => Some(Self::KeepAlive(<KeepAlive as Generate>::generate(g))),
1874 id::LOGIN => Some(Self::Login(<Login as Generate>::generate(g))),
1875 id::CHAT => Some(Self::Chat(<Chat as Generate>::generate(g))),
1876 id::UPDATE_TIME => Some(Self::UpdateTime(<UpdateTime as Generate>::generate(g))),
1877 id::ENTITY_EQUIPMENT => Some(Self::EntityEquipment(
1878 <EntityEquipment as Generate>::generate(g),
1879 )),
1880 id::SPAWN_POSITION => Some(Self::SpawnPosition(<SpawnPosition as Generate>::generate(
1881 g,
1882 ))),
1883 id::UPDATE_HEALTH => Some(Self::UpdateHealth(<UpdateHealth as Generate>::generate(g))),
1884 id::RESPAWN => Some(Self::Respawn(<Respawn as Generate>::generate(g))),
1885 id::POSITION => Some(Self::Position(<Position as Generate>::generate(g))),
1886 id::HELD_ITEM_SLOT => Some(Self::HeldItemSlot(<HeldItemSlot as Generate>::generate(g))),
1887 id::BED => Some(Self::Bed(<Bed as Generate>::generate(g))),
1888 id::ANIMATION => Some(Self::Animation(<Animation as Generate>::generate(g))),
1889 id::NAMED_ENTITY_SPAWN => Some(Self::NamedEntitySpawn(
1890 <NamedEntitySpawn as Generate>::generate(g),
1891 )),
1892 id::COLLECT => Some(Self::Collect(<Collect as Generate>::generate(g))),
1893 id::SPAWN_ENTITY => Some(Self::SpawnEntity(<SpawnEntity as Generate>::generate(g))),
1894 id::SPAWN_ENTITY_LIVING => Some(Self::SpawnEntityLiving(
1895 <SpawnEntityLiving as Generate>::generate(g),
1896 )),
1897 id::SPAWN_ENTITY_PAINTING => Some(Self::SpawnEntityPainting(
1898 <SpawnEntityPainting as Generate>::generate(g),
1899 )),
1900 id::SPAWN_ENTITY_EXPERIENCE_ORB => Some(Self::SpawnEntityExperienceOrb(
1901 <SpawnEntityExperienceOrb as Generate>::generate(g),
1902 )),
1903 id::ENTITY_VELOCITY => Some(Self::EntityVelocity(
1904 <EntityVelocity as Generate>::generate(g),
1905 )),
1906 id::ENTITY_DESTROY => Some(Self::EntityDestroy(<EntityDestroy as Generate>::generate(
1907 g,
1908 ))),
1909 id::ENTITY => Some(Self::Entity(<Entity as Generate>::generate(g))),
1910 id::REL_ENTITY_MOVE => Some(Self::RelEntityMove(
1911 <RelEntityMove as Generate>::generate(g),
1912 )),
1913 id::ENTITY_LOOK => Some(Self::EntityLook(<EntityLook as Generate>::generate(g))),
1914 id::ENTITY_MOVE_LOOK => Some(Self::EntityMoveLook(
1915 <EntityMoveLook as Generate>::generate(g),
1916 )),
1917 id::ENTITY_TELEPORT => Some(Self::EntityTeleport(
1918 <EntityTeleport as Generate>::generate(g),
1919 )),
1920 id::ENTITY_HEAD_ROTATION => Some(Self::EntityHeadRotation(
1921 <EntityHeadRotation as Generate>::generate(g),
1922 )),
1923 id::ENTITY_STATUS => Some(Self::EntityStatus(<EntityStatus as Generate>::generate(g))),
1924 id::ATTACH_ENTITY => Some(Self::AttachEntity(<AttachEntity as Generate>::generate(g))),
1925 id::ENTITY_METADATA => Some(Self::EntityMetadata(
1926 <EntityMetadata as Generate>::generate(g),
1927 )),
1928 id::ENTITY_EFFECT => Some(Self::EntityEffect(<EntityEffect as Generate>::generate(g))),
1929 id::REMOVE_ENTITY_EFFECT => Some(Self::RemoveEntityEffect(
1930 <RemoveEntityEffect as Generate>::generate(g),
1931 )),
1932 id::EXPERIENCE => Some(Self::Experience(<Experience as Generate>::generate(g))),
1933 id::UPDATE_ATTRIBUTES => Some(Self::UpdateAttributes(
1934 <UpdateAttributes as Generate>::generate(g),
1935 )),
1936 id::MAP_CHUNK => Some(Self::MapChunk(<MapChunk as Generate>::generate(g))),
1937 id::MULTI_BLOCK_CHANGE => Some(Self::MultiBlockChange(
1938 <MultiBlockChange as Generate>::generate(g),
1939 )),
1940 id::BLOCK_CHANGE => Some(Self::BlockChange(<BlockChange as Generate>::generate(g))),
1941 id::BLOCK_ACTION => Some(Self::BlockAction(<BlockAction as Generate>::generate(g))),
1942 id::BLOCK_BREAK_ANIMATION => Some(Self::BlockBreakAnimation(
1943 <BlockBreakAnimation as Generate>::generate(g),
1944 )),
1945 id::MAP_CHUNK_BULK => Some(Self::MapChunkBulk(<MapChunkBulk as Generate>::generate(g))),
1946 id::EXPLOSION => Some(Self::Explosion(<Explosion as Generate>::generate(g))),
1947 id::WORLD_EVENT => Some(Self::WorldEvent(<WorldEvent as Generate>::generate(g))),
1948 id::NAMED_SOUND_EFFECT => Some(Self::NamedSoundEffect(
1949 <NamedSoundEffect as Generate>::generate(g),
1950 )),
1951 id::WORLD_PARTICLES => Some(Self::WorldParticles(
1952 <WorldParticles as Generate>::generate(g),
1953 )),
1954 id::GAME_STATE_CHANGE => Some(Self::GameStateChange(
1955 <GameStateChange as Generate>::generate(g),
1956 )),
1957 id::SPAWN_ENTITY_WEATHER => Some(Self::SpawnEntityWeather(
1958 <SpawnEntityWeather as Generate>::generate(g),
1959 )),
1960 id::OPEN_WINDOW => Some(Self::OpenWindow(<OpenWindow as Generate>::generate(g))),
1961 id::CLOSE_WINDOW => Some(Self::CloseWindow(<CloseWindow as Generate>::generate(g))),
1962 id::SET_SLOT => Some(Self::SetSlot(<SetSlot as Generate>::generate(g))),
1963 id::WINDOW_ITEMS => Some(Self::WindowItems(<WindowItems as Generate>::generate(g))),
1964 id::CRAFT_PROGRESS_BAR => Some(Self::CraftProgressBar(
1965 <CraftProgressBar as Generate>::generate(g),
1966 )),
1967 id::TRANSACTION => Some(Self::Transaction(<Transaction as Generate>::generate(g))),
1968 id::UPDATE_SIGN => Some(Self::UpdateSign(<UpdateSign as Generate>::generate(g))),
1969 id::MAP => Some(Self::Map(<Map as Generate>::generate(g))),
1970 id::TILE_ENTITY_DATA => Some(Self::TileEntityData(
1971 <TileEntityData as Generate>::generate(g),
1972 )),
1973 id::OPEN_SIGN_ENTITY => Some(Self::OpenSignEntity(
1974 <OpenSignEntity as Generate>::generate(g),
1975 )),
1976 id::STATISTICS => Some(Self::Statistics(<Statistics as Generate>::generate(g))),
1977 id::PLAYER_INFO => Some(Self::PlayerInfo(<PlayerInfo as Generate>::generate(g))),
1978 id::ABILITIES => Some(Self::Abilities(<Abilities as Generate>::generate(g))),
1979 id::TAB_COMPLETE => Some(Self::TabComplete(<TabComplete as Generate>::generate(g))),
1980 id::SCOREBOARD_OBJECTIVE => Some(Self::ScoreboardObjective(
1981 <ScoreboardObjective as Generate>::generate(g),
1982 )),
1983 id::SCOREBOARD_SCORE => Some(Self::ScoreboardScore(
1984 <ScoreboardScore as Generate>::generate(g),
1985 )),
1986 id::SCOREBOARD_DISPLAY_OBJECTIVE => Some(Self::ScoreboardDisplayObjective(
1987 <ScoreboardDisplayObjective as Generate>::generate(g),
1988 )),
1989 id::SCOREBOARD_TEAM => Some(Self::ScoreboardTeam(
1990 <ScoreboardTeam as Generate>::generate(g),
1991 )),
1992 id::CUSTOM_PAYLOAD => Some(Self::CustomPayload(<CustomPayload as Generate>::generate(
1993 g,
1994 ))),
1995 id::KICK_DISCONNECT => Some(Self::KickDisconnect(
1996 <KickDisconnect as Generate>::generate(g),
1997 )),
1998 id::DIFFICULTY => Some(Self::Difficulty(<Difficulty as Generate>::generate(g))),
1999 id::COMBAT_EVENT => Some(Self::CombatEvent(<CombatEvent as Generate>::generate(g))),
2000 id::CAMERA => Some(Self::Camera(<Camera as Generate>::generate(g))),
2001 id::WORLD_BORDER => Some(Self::WorldBorder(<WorldBorder as Generate>::generate(g))),
2002 id::TITLE => Some(Self::Title(<Title as Generate>::generate(g))),
2003 id::SET_COMPRESSION => Some(Self::SetCompression(
2004 <SetCompression as Generate>::generate(g),
2005 )),
2006 id::PLAYERLIST_HEADER => Some(Self::PlayerlistHeader(
2007 <PlayerlistHeader as Generate>::generate(g),
2008 )),
2009 id::RESOURCE_PACK_SEND => Some(Self::ResourcePackSend(
2010 <ResourcePackSend as Generate>::generate(g),
2011 )),
2012 id::UPDATE_ENTITY_NBT => Some(Self::UpdateEntityNbt(
2013 <UpdateEntityNbt as Generate>::generate(g),
2014 )),
2015 _ => None,
2016 }
2017 }
2018}