1pub mod chat;
7pub mod entity;
8pub mod inventory;
9pub mod misc;
10pub mod player;
11pub mod types;
12pub mod world;
13
14pub use types::Particle;
15pub use types::RecipeDisplay;
16pub use types::SlotDisplay;
17
18pub use chat::ClientboundPlayActionBar;
19pub use chat::ClientboundPlayBossBar;
20pub use chat::ClientboundPlayBossBarAction;
21pub use chat::ClientboundPlayChatSuggestions;
22pub use chat::ClientboundPlayClearTitles;
23pub use chat::ClientboundPlayDeclareCommands;
24pub use chat::ClientboundPlayDeclareCommandsCommandNode;
25pub use chat::ClientboundPlayHideMessage;
26pub use chat::ClientboundPlayHideMessageId;
27pub use chat::ClientboundPlayPlayerlistHeader;
28pub use chat::ClientboundPlayProfilelessChat;
29pub use chat::ClientboundPlayResetScore;
30pub use chat::ClientboundPlayScoreboardDisplayObjective;
31pub use chat::ClientboundPlayScoreboardObjective;
32pub use chat::ClientboundPlayScoreboardObjectiveAction;
33pub use chat::ClientboundPlayScoreboardScore;
34pub use chat::ClientboundPlayScoreboardScoreNumberFormat;
35pub use chat::ClientboundPlaySetTitleSubtitle;
36pub use chat::ClientboundPlaySetTitleText;
37pub use chat::ClientboundPlaySetTitleTime;
38pub use chat::ClientboundPlaySystemChat;
39pub use chat::ClientboundPlayTabComplete;
40pub use chat::ClientboundPlayTabCompleteMatches;
41pub use chat::ClientboundPlayTeams;
42pub use chat::ClientboundPlayTeamsMode;
43pub use chat::ServerboundPlayChatCommand;
44pub use chat::ServerboundPlayChatCommandSigned;
45pub use chat::ServerboundPlayChatCommandSignedArgumentsignatures;
46pub use chat::ServerboundPlayChatMessage;
47pub use chat::ServerboundPlayChatSessionUpdate;
48pub use chat::ServerboundPlayMessageAcknowledgement;
49pub use chat::ServerboundPlayTabComplete;
50pub use entity::ClientboundPlayAnimation;
51pub use entity::ClientboundPlayAttachEntity;
52pub use entity::ClientboundPlayBlockBreakAnimation;
53pub use entity::ClientboundPlayCollect;
54pub use entity::ClientboundPlayDamageEvent;
55pub use entity::ClientboundPlayEntityDestroy;
56pub use entity::ClientboundPlayEntityEffect;
57pub use entity::ClientboundPlayEntityEquipment;
58pub use entity::ClientboundPlayEntityHeadRotation;
59pub use entity::ClientboundPlayEntityLook;
60pub use entity::ClientboundPlayEntityMetadata;
61pub use entity::ClientboundPlayEntityMoveLook;
62pub use entity::ClientboundPlayEntitySoundEffect;
63pub use entity::ClientboundPlayEntityStatus;
64pub use entity::ClientboundPlayEntityTeleport;
65pub use entity::ClientboundPlayEntityUpdateAttributes;
66pub use entity::ClientboundPlayEntityUpdateAttributesProperties;
67pub use entity::ClientboundPlayEntityUpdateAttributesPropertiesModifiers;
68pub use entity::ClientboundPlayEntityVelocity;
69pub use entity::ClientboundPlayHurtAnimation;
70pub use entity::ClientboundPlayMoveMinecart;
71pub use entity::ClientboundPlayMoveMinecartSteps;
72pub use entity::ClientboundPlayRelEntityMove;
73pub use entity::ClientboundPlayRemoveEntityEffect;
74pub use entity::ClientboundPlaySetPassengers;
75pub use entity::ClientboundPlaySetProjectilePower;
76pub use entity::ClientboundPlaySpawnEntity;
77pub use entity::ClientboundPlaySpawnEntityExperienceOrb;
78pub use entity::ClientboundPlaySyncEntityPosition;
79pub use entity::ServerboundPlayArmAnimation;
80pub use entity::ServerboundPlayEntityAction;
81pub use entity::ServerboundPlayQueryEntityNbt;
82pub use entity::ServerboundPlayUseEntity;
83pub use entity::ServerboundPlayUseEntityMouse;
84pub use inventory::ClientboundPlayCloseWindow;
85pub use inventory::ClientboundPlayCraftProgressBar;
86pub use inventory::ClientboundPlayCraftRecipeResponse;
87pub use inventory::ClientboundPlayHeldItemSlot;
88pub use inventory::ClientboundPlayOpenBook;
89pub use inventory::ClientboundPlayOpenHorseWindow;
90pub use inventory::ClientboundPlayOpenSignEntity;
91pub use inventory::ClientboundPlayOpenWindow;
92pub use inventory::ClientboundPlaySetCooldown;
93pub use inventory::ClientboundPlaySetCursorItem;
94pub use inventory::ClientboundPlaySetPlayerInventory;
95pub use inventory::ClientboundPlaySetSlot;
96pub use inventory::ClientboundPlayTradeList;
97pub use inventory::ClientboundPlayTradeListTrades;
98pub use inventory::ClientboundPlayTradeListTradesInputitem1;
99pub use inventory::ClientboundPlayTradeListTradesInputitem1Slotcomponent;
100pub use inventory::ClientboundPlayWindowItems;
101pub use inventory::ServerboundPlayCloseWindow;
102pub use inventory::ServerboundPlayCraftRecipeRequest;
103pub use inventory::ServerboundPlayEnchantItem;
104pub use inventory::ServerboundPlayHeldItemSlot;
105pub use inventory::ServerboundPlayNameItem;
106pub use inventory::ServerboundPlayPickItemFromBlock;
107pub use inventory::ServerboundPlayPickItemFromEntity;
108pub use inventory::ServerboundPlaySelectBundleItem;
109pub use inventory::ServerboundPlaySelectTrade;
110pub use inventory::ServerboundPlaySetBeaconEffect;
111pub use inventory::ServerboundPlaySetCreativeSlot;
112pub use inventory::ServerboundPlaySetSlotState;
113pub use inventory::ServerboundPlayWindowClick;
114pub use inventory::ServerboundPlayWindowClickChangedslots;
115pub use misc::ClientboundPlayAdvancements;
116pub use misc::ClientboundPlayAdvancementsAdvancementmapping;
117pub use misc::ClientboundPlayAdvancementsAdvancementmappingValue;
118pub use misc::ClientboundPlayAdvancementsProgressmapping;
119pub use misc::ClientboundPlayAdvancementsProgressmappingValue;
120pub use misc::ClientboundPlayCustomPayload;
121pub use misc::ClientboundPlayDebugSample;
122pub use misc::ClientboundPlayDeclareRecipes;
123pub use misc::ClientboundPlayDeclareRecipesRecipes;
124pub use misc::ClientboundPlayDeclareRecipesStonecutterrecipes;
125pub use misc::ClientboundPlayKeepAlive;
126pub use misc::ClientboundPlayKickDisconnect;
127pub use misc::ClientboundPlayPing;
128pub use misc::ClientboundPlayPingResponse;
129pub use misc::ClientboundPlayRecipeBookAdd;
130pub use misc::ClientboundPlayRecipeBookAddEntries;
131pub use misc::ClientboundPlayRecipeBookAddEntriesRecipe;
132pub use misc::ClientboundPlayRecipeBookRemove;
133pub use misc::ClientboundPlayRecipeBookSettings;
134pub use misc::ClientboundPlaySelectAdvancementTab;
135pub use misc::ClientboundPlayServerData;
136pub use misc::ClientboundPlaySetTickingState;
137pub use misc::ClientboundPlaySoundEffect;
138pub use misc::ClientboundPlayStartConfiguration;
139pub use misc::ClientboundPlayStatistics;
140pub use misc::ClientboundPlayStatisticsEntries;
141pub use misc::ClientboundPlayStepTick;
142pub use misc::ClientboundPlayStopSound;
143pub use misc::ClientboundPlayStopSoundFlags;
144pub use misc::ClientboundPlayTags;
145pub use misc::ClientboundPlayTagsTags;
146pub use misc::ClientboundPlayTagsTagsTags;
147pub use misc::ServerboundPlayAdvancementTab;
148pub use misc::ServerboundPlayAdvancementTabAction;
149pub use misc::ServerboundPlayConfigurationAcknowledged;
150pub use misc::ServerboundPlayCustomPayload;
151pub use misc::ServerboundPlayDebugSampleSubscription;
152pub use misc::ServerboundPlayDisplayedRecipe;
153pub use misc::ServerboundPlayEditBook;
154pub use misc::ServerboundPlayKeepAlive;
155pub use misc::ServerboundPlayPingRequest;
156pub use misc::ServerboundPlayPong;
157pub use misc::ServerboundPlayRecipeBook;
158pub use misc::ServerboundPlayResourcePackReceive;
159pub use misc::ServerboundPlayTickEnd;
160pub use misc::ServerboundPlayUpdateCommandBlock;
161pub use misc::ServerboundPlayUpdateCommandBlockMinecart;
162pub use misc::ServerboundPlayUpdateJigsawBlock;
163pub use misc::ServerboundPlayUpdateStructureBlock;
164pub use misc::ServerboundPlayUseItem;
165pub use player::ClientboundPlayAbilities;
166pub use player::ClientboundPlayCamera;
167pub use player::ClientboundPlayDeathCombatEvent;
168pub use player::ClientboundPlayDifficulty;
169pub use player::ClientboundPlayEndCombatEvent;
170pub use player::ClientboundPlayEnterCombatEvent;
171pub use player::ClientboundPlayExperience;
172pub use player::ClientboundPlayFacePlayer;
173pub use player::ClientboundPlayGameStateChange;
174pub use player::ClientboundPlayLogin;
175pub use player::ClientboundPlayLoginSpawninfo;
176pub use player::ClientboundPlayPlayerChat;
177pub use player::ClientboundPlayPlayerChatFiltertype;
178pub use player::ClientboundPlayPlayerChatPreviousmessages;
179pub use player::ClientboundPlayPlayerInfo;
180pub use player::ClientboundPlayPlayerInfoData;
181pub use player::ClientboundPlayPlayerRemove;
182pub use player::ClientboundPlayPlayerRotation;
183pub use player::ClientboundPlayPosition;
184pub use player::ClientboundPlayRespawn;
185pub use player::ClientboundPlayRespawnSpawninfo;
186pub use player::ClientboundPlaySimulationDistance;
187pub use player::ClientboundPlayUpdateHealth;
188pub use player::ClientboundPlayVehicleMove;
189pub use player::ServerboundPlayAbilities;
190pub use player::ServerboundPlayClientCommand;
191pub use player::ServerboundPlayFlying;
192pub use player::ServerboundPlayLockDifficulty;
193pub use player::ServerboundPlayLook;
194pub use player::ServerboundPlayPlayerInput;
195pub use player::ServerboundPlayPlayerLoaded;
196pub use player::ServerboundPlayPosition;
197pub use player::ServerboundPlayPositionLook;
198pub use player::ServerboundPlaySetDifficulty;
199pub use player::ServerboundPlaySpectate;
200pub use player::ServerboundPlaySteerBoat;
201pub use player::ServerboundPlayTeleportConfirm;
202pub use player::ServerboundPlayVehicleMove;
203pub use world::ClientboundPlayAcknowledgePlayerDigging;
204pub use world::ClientboundPlayBlockAction;
205pub use world::ClientboundPlayBlockChange;
206pub use world::ClientboundPlayChunkBatchFinished;
207pub use world::ClientboundPlayChunkBatchStart;
208pub use world::ClientboundPlayChunkBiomes;
209pub use world::ClientboundPlayChunkBiomesBiomes;
210pub use world::ClientboundPlayExplosion;
211pub use world::ClientboundPlayInitializeWorldBorder;
212pub use world::ClientboundPlayMap;
213pub use world::ClientboundPlayMapChunk;
214pub use world::ClientboundPlayMapChunkChunkblockentity;
215pub use world::ClientboundPlayMapIcons;
216pub use world::ClientboundPlayMultiBlockChange;
217pub use world::ClientboundPlayNbtQueryResponse;
218pub use world::ClientboundPlaySpawnPosition;
219pub use world::ClientboundPlayTileEntityData;
220pub use world::ClientboundPlayUnloadChunk;
221pub use world::ClientboundPlayUpdateLight;
222pub use world::ClientboundPlayUpdateTime;
223pub use world::ClientboundPlayUpdateViewDistance;
224pub use world::ClientboundPlayUpdateViewPosition;
225pub use world::ClientboundPlayWorldBorderCenter;
226pub use world::ClientboundPlayWorldBorderLerpSize;
227pub use world::ClientboundPlayWorldBorderSize;
228pub use world::ClientboundPlayWorldBorderWarningDelay;
229pub use world::ClientboundPlayWorldBorderWarningReach;
230pub use world::ClientboundPlayWorldEvent;
231pub use world::ClientboundPlayWorldParticles;
232pub use world::ServerboundPlayBlockDig;
233pub use world::ServerboundPlayBlockPlace;
234pub use world::ServerboundPlayChunkBatchReceived;
235pub use world::ServerboundPlayGenerateStructure;
236pub use world::ServerboundPlayQueryBlockNbt;
237pub use world::ServerboundPlayUpdateSign;
238
239use crate::error::{Error, Result};
240use basalt_types::Decode as _;
241
242#[derive(Debug, Clone, PartialEq)]
244pub enum ServerboundPlayPacket {
245 Abilities(ServerboundPlayAbilities),
246 AdvancementTab(ServerboundPlayAdvancementTab),
247 ArmAnimation(ServerboundPlayArmAnimation),
248 BlockDig(ServerboundPlayBlockDig),
249 BlockPlace(ServerboundPlayBlockPlace),
250 ChatCommand(ServerboundPlayChatCommand),
251 ChatCommandSigned(ServerboundPlayChatCommandSigned),
252 ChatMessage(ServerboundPlayChatMessage),
253 ChatSessionUpdate(ServerboundPlayChatSessionUpdate),
254 ChunkBatchReceived(ServerboundPlayChunkBatchReceived),
255 ClientCommand(ServerboundPlayClientCommand),
256 CloseWindow(ServerboundPlayCloseWindow),
257 ConfigurationAcknowledged(ServerboundPlayConfigurationAcknowledged),
258 CraftRecipeRequest(ServerboundPlayCraftRecipeRequest),
259 CustomPayload(ServerboundPlayCustomPayload),
260 DebugSampleSubscription(ServerboundPlayDebugSampleSubscription),
261 DisplayedRecipe(ServerboundPlayDisplayedRecipe),
262 EditBook(ServerboundPlayEditBook),
263 EnchantItem(ServerboundPlayEnchantItem),
264 EntityAction(ServerboundPlayEntityAction),
265 Flying(ServerboundPlayFlying),
266 GenerateStructure(ServerboundPlayGenerateStructure),
267 HeldItemSlot(ServerboundPlayHeldItemSlot),
268 KeepAlive(ServerboundPlayKeepAlive),
269 LockDifficulty(ServerboundPlayLockDifficulty),
270 Look(ServerboundPlayLook),
271 MessageAcknowledgement(ServerboundPlayMessageAcknowledgement),
272 NameItem(ServerboundPlayNameItem),
273 PickItemFromBlock(ServerboundPlayPickItemFromBlock),
274 PickItemFromEntity(ServerboundPlayPickItemFromEntity),
275 PingRequest(ServerboundPlayPingRequest),
276 PlayerInput(ServerboundPlayPlayerInput),
277 PlayerLoaded(ServerboundPlayPlayerLoaded),
278 Pong(ServerboundPlayPong),
279 Position(ServerboundPlayPosition),
280 PositionLook(ServerboundPlayPositionLook),
281 QueryBlockNbt(ServerboundPlayQueryBlockNbt),
282 QueryEntityNbt(ServerboundPlayQueryEntityNbt),
283 RecipeBook(ServerboundPlayRecipeBook),
284 ResourcePackReceive(ServerboundPlayResourcePackReceive),
285 SelectBundleItem(ServerboundPlaySelectBundleItem),
286 SelectTrade(ServerboundPlaySelectTrade),
287 SetBeaconEffect(ServerboundPlaySetBeaconEffect),
288 SetCreativeSlot(ServerboundPlaySetCreativeSlot),
289 SetDifficulty(ServerboundPlaySetDifficulty),
290 SetSlotState(ServerboundPlaySetSlotState),
291 Spectate(ServerboundPlaySpectate),
292 SteerBoat(ServerboundPlaySteerBoat),
293 TabComplete(ServerboundPlayTabComplete),
294 TeleportConfirm(ServerboundPlayTeleportConfirm),
295 TickEnd(ServerboundPlayTickEnd),
296 UpdateCommandBlock(ServerboundPlayUpdateCommandBlock),
297 UpdateCommandBlockMinecart(ServerboundPlayUpdateCommandBlockMinecart),
298 UpdateJigsawBlock(ServerboundPlayUpdateJigsawBlock),
299 UpdateSign(ServerboundPlayUpdateSign),
300 UpdateStructureBlock(ServerboundPlayUpdateStructureBlock),
301 UseEntity(ServerboundPlayUseEntity),
302 UseItem(ServerboundPlayUseItem),
303 VehicleMove(ServerboundPlayVehicleMove),
304 WindowClick(ServerboundPlayWindowClick),
305}
306
307impl ServerboundPlayPacket {
308 pub fn decode_by_id(id: i32, buf: &mut &[u8]) -> Result<Self> {
310 match id {
311 ServerboundPlayAbilities::PACKET_ID => {
312 Ok(Self::Abilities(ServerboundPlayAbilities::decode(buf)?))
313 }
314 ServerboundPlayAdvancementTab::PACKET_ID => Ok(Self::AdvancementTab(
315 ServerboundPlayAdvancementTab::decode(buf)?,
316 )),
317 ServerboundPlayArmAnimation::PACKET_ID => Ok(Self::ArmAnimation(
318 ServerboundPlayArmAnimation::decode(buf)?,
319 )),
320 ServerboundPlayBlockDig::PACKET_ID => {
321 Ok(Self::BlockDig(ServerboundPlayBlockDig::decode(buf)?))
322 }
323 ServerboundPlayBlockPlace::PACKET_ID => {
324 Ok(Self::BlockPlace(ServerboundPlayBlockPlace::decode(buf)?))
325 }
326 ServerboundPlayChatCommand::PACKET_ID => {
327 Ok(Self::ChatCommand(ServerboundPlayChatCommand::decode(buf)?))
328 }
329 ServerboundPlayChatCommandSigned::PACKET_ID => Ok(Self::ChatCommandSigned(
330 ServerboundPlayChatCommandSigned::decode(buf)?,
331 )),
332 ServerboundPlayChatMessage::PACKET_ID => {
333 Ok(Self::ChatMessage(ServerboundPlayChatMessage::decode(buf)?))
334 }
335 ServerboundPlayChatSessionUpdate::PACKET_ID => Ok(Self::ChatSessionUpdate(
336 ServerboundPlayChatSessionUpdate::decode(buf)?,
337 )),
338 ServerboundPlayChunkBatchReceived::PACKET_ID => Ok(Self::ChunkBatchReceived(
339 ServerboundPlayChunkBatchReceived::decode(buf)?,
340 )),
341 ServerboundPlayClientCommand::PACKET_ID => Ok(Self::ClientCommand(
342 ServerboundPlayClientCommand::decode(buf)?,
343 )),
344 ServerboundPlayCloseWindow::PACKET_ID => {
345 Ok(Self::CloseWindow(ServerboundPlayCloseWindow::decode(buf)?))
346 }
347 ServerboundPlayConfigurationAcknowledged::PACKET_ID => {
348 Ok(Self::ConfigurationAcknowledged(
349 ServerboundPlayConfigurationAcknowledged::decode(buf)?,
350 ))
351 }
352 ServerboundPlayCraftRecipeRequest::PACKET_ID => Ok(Self::CraftRecipeRequest(
353 ServerboundPlayCraftRecipeRequest::decode(buf)?,
354 )),
355 ServerboundPlayCustomPayload::PACKET_ID => Ok(Self::CustomPayload(
356 ServerboundPlayCustomPayload::decode(buf)?,
357 )),
358 ServerboundPlayDebugSampleSubscription::PACKET_ID => Ok(Self::DebugSampleSubscription(
359 ServerboundPlayDebugSampleSubscription::decode(buf)?,
360 )),
361 ServerboundPlayDisplayedRecipe::PACKET_ID => Ok(Self::DisplayedRecipe(
362 ServerboundPlayDisplayedRecipe::decode(buf)?,
363 )),
364 ServerboundPlayEditBook::PACKET_ID => {
365 Ok(Self::EditBook(ServerboundPlayEditBook::decode(buf)?))
366 }
367 ServerboundPlayEnchantItem::PACKET_ID => {
368 Ok(Self::EnchantItem(ServerboundPlayEnchantItem::decode(buf)?))
369 }
370 ServerboundPlayEntityAction::PACKET_ID => Ok(Self::EntityAction(
371 ServerboundPlayEntityAction::decode(buf)?,
372 )),
373 ServerboundPlayFlying::PACKET_ID => {
374 Ok(Self::Flying(ServerboundPlayFlying::decode(buf)?))
375 }
376 ServerboundPlayGenerateStructure::PACKET_ID => Ok(Self::GenerateStructure(
377 ServerboundPlayGenerateStructure::decode(buf)?,
378 )),
379 ServerboundPlayHeldItemSlot::PACKET_ID => Ok(Self::HeldItemSlot(
380 ServerboundPlayHeldItemSlot::decode(buf)?,
381 )),
382 ServerboundPlayKeepAlive::PACKET_ID => {
383 Ok(Self::KeepAlive(ServerboundPlayKeepAlive::decode(buf)?))
384 }
385 ServerboundPlayLockDifficulty::PACKET_ID => Ok(Self::LockDifficulty(
386 ServerboundPlayLockDifficulty::decode(buf)?,
387 )),
388 ServerboundPlayLook::PACKET_ID => Ok(Self::Look(ServerboundPlayLook::decode(buf)?)),
389 ServerboundPlayMessageAcknowledgement::PACKET_ID => Ok(Self::MessageAcknowledgement(
390 ServerboundPlayMessageAcknowledgement::decode(buf)?,
391 )),
392 ServerboundPlayNameItem::PACKET_ID => {
393 Ok(Self::NameItem(ServerboundPlayNameItem::decode(buf)?))
394 }
395 ServerboundPlayPickItemFromBlock::PACKET_ID => Ok(Self::PickItemFromBlock(
396 ServerboundPlayPickItemFromBlock::decode(buf)?,
397 )),
398 ServerboundPlayPickItemFromEntity::PACKET_ID => Ok(Self::PickItemFromEntity(
399 ServerboundPlayPickItemFromEntity::decode(buf)?,
400 )),
401 ServerboundPlayPingRequest::PACKET_ID => {
402 Ok(Self::PingRequest(ServerboundPlayPingRequest::decode(buf)?))
403 }
404 ServerboundPlayPlayerInput::PACKET_ID => {
405 Ok(Self::PlayerInput(ServerboundPlayPlayerInput::decode(buf)?))
406 }
407 ServerboundPlayPlayerLoaded::PACKET_ID => Ok(Self::PlayerLoaded(
408 ServerboundPlayPlayerLoaded::decode(buf)?,
409 )),
410 ServerboundPlayPong::PACKET_ID => Ok(Self::Pong(ServerboundPlayPong::decode(buf)?)),
411 ServerboundPlayPosition::PACKET_ID => {
412 Ok(Self::Position(ServerboundPlayPosition::decode(buf)?))
413 }
414 ServerboundPlayPositionLook::PACKET_ID => Ok(Self::PositionLook(
415 ServerboundPlayPositionLook::decode(buf)?,
416 )),
417 ServerboundPlayQueryBlockNbt::PACKET_ID => Ok(Self::QueryBlockNbt(
418 ServerboundPlayQueryBlockNbt::decode(buf)?,
419 )),
420 ServerboundPlayQueryEntityNbt::PACKET_ID => Ok(Self::QueryEntityNbt(
421 ServerboundPlayQueryEntityNbt::decode(buf)?,
422 )),
423 ServerboundPlayRecipeBook::PACKET_ID => {
424 Ok(Self::RecipeBook(ServerboundPlayRecipeBook::decode(buf)?))
425 }
426 ServerboundPlayResourcePackReceive::PACKET_ID => Ok(Self::ResourcePackReceive(
427 ServerboundPlayResourcePackReceive::decode(buf)?,
428 )),
429 ServerboundPlaySelectBundleItem::PACKET_ID => Ok(Self::SelectBundleItem(
430 ServerboundPlaySelectBundleItem::decode(buf)?,
431 )),
432 ServerboundPlaySelectTrade::PACKET_ID => {
433 Ok(Self::SelectTrade(ServerboundPlaySelectTrade::decode(buf)?))
434 }
435 ServerboundPlaySetBeaconEffect::PACKET_ID => Ok(Self::SetBeaconEffect(
436 ServerboundPlaySetBeaconEffect::decode(buf)?,
437 )),
438 ServerboundPlaySetCreativeSlot::PACKET_ID => Ok(Self::SetCreativeSlot(
439 ServerboundPlaySetCreativeSlot::decode(buf)?,
440 )),
441 ServerboundPlaySetDifficulty::PACKET_ID => Ok(Self::SetDifficulty(
442 ServerboundPlaySetDifficulty::decode(buf)?,
443 )),
444 ServerboundPlaySetSlotState::PACKET_ID => Ok(Self::SetSlotState(
445 ServerboundPlaySetSlotState::decode(buf)?,
446 )),
447 ServerboundPlaySpectate::PACKET_ID => {
448 Ok(Self::Spectate(ServerboundPlaySpectate::decode(buf)?))
449 }
450 ServerboundPlaySteerBoat::PACKET_ID => {
451 Ok(Self::SteerBoat(ServerboundPlaySteerBoat::decode(buf)?))
452 }
453 ServerboundPlayTabComplete::PACKET_ID => {
454 Ok(Self::TabComplete(ServerboundPlayTabComplete::decode(buf)?))
455 }
456 ServerboundPlayTeleportConfirm::PACKET_ID => Ok(Self::TeleportConfirm(
457 ServerboundPlayTeleportConfirm::decode(buf)?,
458 )),
459 ServerboundPlayTickEnd::PACKET_ID => {
460 Ok(Self::TickEnd(ServerboundPlayTickEnd::decode(buf)?))
461 }
462 ServerboundPlayUpdateCommandBlock::PACKET_ID => Ok(Self::UpdateCommandBlock(
463 ServerboundPlayUpdateCommandBlock::decode(buf)?,
464 )),
465 ServerboundPlayUpdateCommandBlockMinecart::PACKET_ID => {
466 Ok(Self::UpdateCommandBlockMinecart(
467 ServerboundPlayUpdateCommandBlockMinecart::decode(buf)?,
468 ))
469 }
470 ServerboundPlayUpdateJigsawBlock::PACKET_ID => Ok(Self::UpdateJigsawBlock(
471 ServerboundPlayUpdateJigsawBlock::decode(buf)?,
472 )),
473 ServerboundPlayUpdateSign::PACKET_ID => {
474 Ok(Self::UpdateSign(ServerboundPlayUpdateSign::decode(buf)?))
475 }
476 ServerboundPlayUpdateStructureBlock::PACKET_ID => Ok(Self::UpdateStructureBlock(
477 ServerboundPlayUpdateStructureBlock::decode(buf)?,
478 )),
479 ServerboundPlayUseEntity::PACKET_ID => {
480 Ok(Self::UseEntity(ServerboundPlayUseEntity::decode(buf)?))
481 }
482 ServerboundPlayUseItem::PACKET_ID => {
483 Ok(Self::UseItem(ServerboundPlayUseItem::decode(buf)?))
484 }
485 ServerboundPlayVehicleMove::PACKET_ID => {
486 Ok(Self::VehicleMove(ServerboundPlayVehicleMove::decode(buf)?))
487 }
488 ServerboundPlayWindowClick::PACKET_ID => {
489 Ok(Self::WindowClick(ServerboundPlayWindowClick::decode(buf)?))
490 }
491 _ => Err(Error::UnknownPacket { id, state: "play" }),
492 }
493 }
494}
495
496#[derive(Debug, Clone, PartialEq)]
498pub enum ClientboundPlayPacket {
499 Abilities(ClientboundPlayAbilities),
500 AcknowledgePlayerDigging(ClientboundPlayAcknowledgePlayerDigging),
501 ActionBar(ClientboundPlayActionBar),
502 Advancements(ClientboundPlayAdvancements),
503 Animation(ClientboundPlayAnimation),
504 AttachEntity(ClientboundPlayAttachEntity),
505 BlockAction(ClientboundPlayBlockAction),
506 BlockBreakAnimation(ClientboundPlayBlockBreakAnimation),
507 BlockChange(ClientboundPlayBlockChange),
508 BossBar(ClientboundPlayBossBar),
509 Camera(ClientboundPlayCamera),
510 ChatSuggestions(ClientboundPlayChatSuggestions),
511 ChunkBatchFinished(ClientboundPlayChunkBatchFinished),
512 ChunkBatchStart(ClientboundPlayChunkBatchStart),
513 ChunkBiomes(ClientboundPlayChunkBiomes),
514 ClearTitles(ClientboundPlayClearTitles),
515 CloseWindow(ClientboundPlayCloseWindow),
516 Collect(ClientboundPlayCollect),
517 CraftProgressBar(ClientboundPlayCraftProgressBar),
518 CraftRecipeResponse(ClientboundPlayCraftRecipeResponse),
519 CustomPayload(ClientboundPlayCustomPayload),
520 DamageEvent(ClientboundPlayDamageEvent),
521 DeathCombatEvent(ClientboundPlayDeathCombatEvent),
522 DebugSample(ClientboundPlayDebugSample),
523 DeclareCommands(ClientboundPlayDeclareCommands),
524 DeclareRecipes(ClientboundPlayDeclareRecipes),
525 Difficulty(ClientboundPlayDifficulty),
526 EndCombatEvent(ClientboundPlayEndCombatEvent),
527 EnterCombatEvent(ClientboundPlayEnterCombatEvent),
528 EntityDestroy(ClientboundPlayEntityDestroy),
529 EntityEffect(ClientboundPlayEntityEffect),
530 EntityEquipment(ClientboundPlayEntityEquipment),
531 EntityHeadRotation(ClientboundPlayEntityHeadRotation),
532 EntityLook(ClientboundPlayEntityLook),
533 EntityMetadata(ClientboundPlayEntityMetadata),
534 EntityMoveLook(ClientboundPlayEntityMoveLook),
535 EntitySoundEffect(ClientboundPlayEntitySoundEffect),
536 EntityStatus(ClientboundPlayEntityStatus),
537 EntityTeleport(ClientboundPlayEntityTeleport),
538 EntityUpdateAttributes(ClientboundPlayEntityUpdateAttributes),
539 EntityVelocity(ClientboundPlayEntityVelocity),
540 Experience(ClientboundPlayExperience),
541 Explosion(ClientboundPlayExplosion),
542 FacePlayer(ClientboundPlayFacePlayer),
543 GameStateChange(ClientboundPlayGameStateChange),
544 HeldItemSlot(ClientboundPlayHeldItemSlot),
545 HideMessage(ClientboundPlayHideMessage),
546 HurtAnimation(ClientboundPlayHurtAnimation),
547 InitializeWorldBorder(ClientboundPlayInitializeWorldBorder),
548 KeepAlive(ClientboundPlayKeepAlive),
549 KickDisconnect(ClientboundPlayKickDisconnect),
550 Login(ClientboundPlayLogin),
551 Map(ClientboundPlayMap),
552 MapChunk(ClientboundPlayMapChunk),
553 MoveMinecart(ClientboundPlayMoveMinecart),
554 MultiBlockChange(ClientboundPlayMultiBlockChange),
555 NbtQueryResponse(ClientboundPlayNbtQueryResponse),
556 OpenBook(ClientboundPlayOpenBook),
557 OpenHorseWindow(ClientboundPlayOpenHorseWindow),
558 OpenSignEntity(ClientboundPlayOpenSignEntity),
559 OpenWindow(ClientboundPlayOpenWindow),
560 Ping(ClientboundPlayPing),
561 PingResponse(ClientboundPlayPingResponse),
562 PlayerChat(ClientboundPlayPlayerChat),
563 PlayerInfo(ClientboundPlayPlayerInfo),
564 PlayerRemove(ClientboundPlayPlayerRemove),
565 PlayerRotation(ClientboundPlayPlayerRotation),
566 PlayerlistHeader(ClientboundPlayPlayerlistHeader),
567 Position(ClientboundPlayPosition),
568 ProfilelessChat(ClientboundPlayProfilelessChat),
569 RecipeBookAdd(ClientboundPlayRecipeBookAdd),
570 RecipeBookRemove(ClientboundPlayRecipeBookRemove),
571 RecipeBookSettings(ClientboundPlayRecipeBookSettings),
572 RelEntityMove(ClientboundPlayRelEntityMove),
573 RemoveEntityEffect(ClientboundPlayRemoveEntityEffect),
574 ResetScore(ClientboundPlayResetScore),
575 Respawn(ClientboundPlayRespawn),
576 ScoreboardDisplayObjective(ClientboundPlayScoreboardDisplayObjective),
577 ScoreboardObjective(ClientboundPlayScoreboardObjective),
578 ScoreboardScore(ClientboundPlayScoreboardScore),
579 SelectAdvancementTab(ClientboundPlaySelectAdvancementTab),
580 ServerData(ClientboundPlayServerData),
581 SetCooldown(ClientboundPlaySetCooldown),
582 SetCursorItem(ClientboundPlaySetCursorItem),
583 SetPassengers(ClientboundPlaySetPassengers),
584 SetPlayerInventory(ClientboundPlaySetPlayerInventory),
585 SetProjectilePower(ClientboundPlaySetProjectilePower),
586 SetSlot(ClientboundPlaySetSlot),
587 SetTickingState(ClientboundPlaySetTickingState),
588 SetTitleSubtitle(ClientboundPlaySetTitleSubtitle),
589 SetTitleText(ClientboundPlaySetTitleText),
590 SetTitleTime(ClientboundPlaySetTitleTime),
591 SimulationDistance(ClientboundPlaySimulationDistance),
592 SoundEffect(ClientboundPlaySoundEffect),
593 SpawnEntity(ClientboundPlaySpawnEntity),
594 SpawnEntityExperienceOrb(ClientboundPlaySpawnEntityExperienceOrb),
595 SpawnPosition(ClientboundPlaySpawnPosition),
596 StartConfiguration(ClientboundPlayStartConfiguration),
597 Statistics(ClientboundPlayStatistics),
598 StepTick(ClientboundPlayStepTick),
599 StopSound(ClientboundPlayStopSound),
600 SyncEntityPosition(ClientboundPlaySyncEntityPosition),
601 SystemChat(ClientboundPlaySystemChat),
602 TabComplete(ClientboundPlayTabComplete),
603 Tags(ClientboundPlayTags),
604 Teams(ClientboundPlayTeams),
605 TileEntityData(ClientboundPlayTileEntityData),
606 TradeList(ClientboundPlayTradeList),
607 UnloadChunk(ClientboundPlayUnloadChunk),
608 UpdateHealth(ClientboundPlayUpdateHealth),
609 UpdateLight(ClientboundPlayUpdateLight),
610 UpdateTime(ClientboundPlayUpdateTime),
611 UpdateViewDistance(ClientboundPlayUpdateViewDistance),
612 UpdateViewPosition(ClientboundPlayUpdateViewPosition),
613 VehicleMove(ClientboundPlayVehicleMove),
614 WindowItems(ClientboundPlayWindowItems),
615 WorldBorderCenter(ClientboundPlayWorldBorderCenter),
616 WorldBorderLerpSize(ClientboundPlayWorldBorderLerpSize),
617 WorldBorderSize(ClientboundPlayWorldBorderSize),
618 WorldBorderWarningDelay(ClientboundPlayWorldBorderWarningDelay),
619 WorldBorderWarningReach(ClientboundPlayWorldBorderWarningReach),
620 WorldEvent(ClientboundPlayWorldEvent),
621 WorldParticles(ClientboundPlayWorldParticles),
622}
623
624impl ClientboundPlayPacket {
625 pub fn decode_by_id(id: i32, buf: &mut &[u8]) -> Result<Self> {
627 match id {
628 ClientboundPlayAbilities::PACKET_ID => {
629 Ok(Self::Abilities(ClientboundPlayAbilities::decode(buf)?))
630 }
631 ClientboundPlayAcknowledgePlayerDigging::PACKET_ID => {
632 Ok(Self::AcknowledgePlayerDigging(
633 ClientboundPlayAcknowledgePlayerDigging::decode(buf)?,
634 ))
635 }
636 ClientboundPlayActionBar::PACKET_ID => {
637 Ok(Self::ActionBar(ClientboundPlayActionBar::decode(buf)?))
638 }
639 ClientboundPlayAdvancements::PACKET_ID => Ok(Self::Advancements(
640 ClientboundPlayAdvancements::decode(buf)?,
641 )),
642 ClientboundPlayAnimation::PACKET_ID => {
643 Ok(Self::Animation(ClientboundPlayAnimation::decode(buf)?))
644 }
645 ClientboundPlayAttachEntity::PACKET_ID => Ok(Self::AttachEntity(
646 ClientboundPlayAttachEntity::decode(buf)?,
647 )),
648 ClientboundPlayBlockAction::PACKET_ID => {
649 Ok(Self::BlockAction(ClientboundPlayBlockAction::decode(buf)?))
650 }
651 ClientboundPlayBlockBreakAnimation::PACKET_ID => Ok(Self::BlockBreakAnimation(
652 ClientboundPlayBlockBreakAnimation::decode(buf)?,
653 )),
654 ClientboundPlayBlockChange::PACKET_ID => {
655 Ok(Self::BlockChange(ClientboundPlayBlockChange::decode(buf)?))
656 }
657 ClientboundPlayBossBar::PACKET_ID => {
658 Ok(Self::BossBar(ClientboundPlayBossBar::decode(buf)?))
659 }
660 ClientboundPlayCamera::PACKET_ID => {
661 Ok(Self::Camera(ClientboundPlayCamera::decode(buf)?))
662 }
663 ClientboundPlayChatSuggestions::PACKET_ID => Ok(Self::ChatSuggestions(
664 ClientboundPlayChatSuggestions::decode(buf)?,
665 )),
666 ClientboundPlayChunkBatchFinished::PACKET_ID => Ok(Self::ChunkBatchFinished(
667 ClientboundPlayChunkBatchFinished::decode(buf)?,
668 )),
669 ClientboundPlayChunkBatchStart::PACKET_ID => Ok(Self::ChunkBatchStart(
670 ClientboundPlayChunkBatchStart::decode(buf)?,
671 )),
672 ClientboundPlayChunkBiomes::PACKET_ID => {
673 Ok(Self::ChunkBiomes(ClientboundPlayChunkBiomes::decode(buf)?))
674 }
675 ClientboundPlayClearTitles::PACKET_ID => {
676 Ok(Self::ClearTitles(ClientboundPlayClearTitles::decode(buf)?))
677 }
678 ClientboundPlayCloseWindow::PACKET_ID => {
679 Ok(Self::CloseWindow(ClientboundPlayCloseWindow::decode(buf)?))
680 }
681 ClientboundPlayCollect::PACKET_ID => {
682 Ok(Self::Collect(ClientboundPlayCollect::decode(buf)?))
683 }
684 ClientboundPlayCraftProgressBar::PACKET_ID => Ok(Self::CraftProgressBar(
685 ClientboundPlayCraftProgressBar::decode(buf)?,
686 )),
687 ClientboundPlayCraftRecipeResponse::PACKET_ID => Ok(Self::CraftRecipeResponse(
688 ClientboundPlayCraftRecipeResponse::decode(buf)?,
689 )),
690 ClientboundPlayCustomPayload::PACKET_ID => Ok(Self::CustomPayload(
691 ClientboundPlayCustomPayload::decode(buf)?,
692 )),
693 ClientboundPlayDamageEvent::PACKET_ID => {
694 Ok(Self::DamageEvent(ClientboundPlayDamageEvent::decode(buf)?))
695 }
696 ClientboundPlayDeathCombatEvent::PACKET_ID => Ok(Self::DeathCombatEvent(
697 ClientboundPlayDeathCombatEvent::decode(buf)?,
698 )),
699 ClientboundPlayDebugSample::PACKET_ID => {
700 Ok(Self::DebugSample(ClientboundPlayDebugSample::decode(buf)?))
701 }
702 ClientboundPlayDeclareCommands::PACKET_ID => Ok(Self::DeclareCommands(
703 ClientboundPlayDeclareCommands::decode(buf)?,
704 )),
705 ClientboundPlayDeclareRecipes::PACKET_ID => Ok(Self::DeclareRecipes(
706 ClientboundPlayDeclareRecipes::decode(buf)?,
707 )),
708 ClientboundPlayDifficulty::PACKET_ID => {
709 Ok(Self::Difficulty(ClientboundPlayDifficulty::decode(buf)?))
710 }
711 ClientboundPlayEndCombatEvent::PACKET_ID => Ok(Self::EndCombatEvent(
712 ClientboundPlayEndCombatEvent::decode(buf)?,
713 )),
714 ClientboundPlayEnterCombatEvent::PACKET_ID => Ok(Self::EnterCombatEvent(
715 ClientboundPlayEnterCombatEvent::decode(buf)?,
716 )),
717 ClientboundPlayEntityDestroy::PACKET_ID => Ok(Self::EntityDestroy(
718 ClientboundPlayEntityDestroy::decode(buf)?,
719 )),
720 ClientboundPlayEntityEffect::PACKET_ID => Ok(Self::EntityEffect(
721 ClientboundPlayEntityEffect::decode(buf)?,
722 )),
723 ClientboundPlayEntityEquipment::PACKET_ID => Ok(Self::EntityEquipment(
724 ClientboundPlayEntityEquipment::decode(buf)?,
725 )),
726 ClientboundPlayEntityHeadRotation::PACKET_ID => Ok(Self::EntityHeadRotation(
727 ClientboundPlayEntityHeadRotation::decode(buf)?,
728 )),
729 ClientboundPlayEntityLook::PACKET_ID => {
730 Ok(Self::EntityLook(ClientboundPlayEntityLook::decode(buf)?))
731 }
732 ClientboundPlayEntityMetadata::PACKET_ID => Ok(Self::EntityMetadata(
733 ClientboundPlayEntityMetadata::decode(buf)?,
734 )),
735 ClientboundPlayEntityMoveLook::PACKET_ID => Ok(Self::EntityMoveLook(
736 ClientboundPlayEntityMoveLook::decode(buf)?,
737 )),
738 ClientboundPlayEntitySoundEffect::PACKET_ID => Ok(Self::EntitySoundEffect(
739 ClientboundPlayEntitySoundEffect::decode(buf)?,
740 )),
741 ClientboundPlayEntityStatus::PACKET_ID => Ok(Self::EntityStatus(
742 ClientboundPlayEntityStatus::decode(buf)?,
743 )),
744 ClientboundPlayEntityTeleport::PACKET_ID => Ok(Self::EntityTeleport(
745 ClientboundPlayEntityTeleport::decode(buf)?,
746 )),
747 ClientboundPlayEntityUpdateAttributes::PACKET_ID => Ok(Self::EntityUpdateAttributes(
748 ClientboundPlayEntityUpdateAttributes::decode(buf)?,
749 )),
750 ClientboundPlayEntityVelocity::PACKET_ID => Ok(Self::EntityVelocity(
751 ClientboundPlayEntityVelocity::decode(buf)?,
752 )),
753 ClientboundPlayExperience::PACKET_ID => {
754 Ok(Self::Experience(ClientboundPlayExperience::decode(buf)?))
755 }
756 ClientboundPlayExplosion::PACKET_ID => {
757 Ok(Self::Explosion(ClientboundPlayExplosion::decode(buf)?))
758 }
759 ClientboundPlayFacePlayer::PACKET_ID => {
760 Ok(Self::FacePlayer(ClientboundPlayFacePlayer::decode(buf)?))
761 }
762 ClientboundPlayGameStateChange::PACKET_ID => Ok(Self::GameStateChange(
763 ClientboundPlayGameStateChange::decode(buf)?,
764 )),
765 ClientboundPlayHeldItemSlot::PACKET_ID => Ok(Self::HeldItemSlot(
766 ClientboundPlayHeldItemSlot::decode(buf)?,
767 )),
768 ClientboundPlayHideMessage::PACKET_ID => {
769 Ok(Self::HideMessage(ClientboundPlayHideMessage::decode(buf)?))
770 }
771 ClientboundPlayHurtAnimation::PACKET_ID => Ok(Self::HurtAnimation(
772 ClientboundPlayHurtAnimation::decode(buf)?,
773 )),
774 ClientboundPlayInitializeWorldBorder::PACKET_ID => Ok(Self::InitializeWorldBorder(
775 ClientboundPlayInitializeWorldBorder::decode(buf)?,
776 )),
777 ClientboundPlayKeepAlive::PACKET_ID => {
778 Ok(Self::KeepAlive(ClientboundPlayKeepAlive::decode(buf)?))
779 }
780 ClientboundPlayKickDisconnect::PACKET_ID => Ok(Self::KickDisconnect(
781 ClientboundPlayKickDisconnect::decode(buf)?,
782 )),
783 ClientboundPlayLogin::PACKET_ID => Ok(Self::Login(ClientboundPlayLogin::decode(buf)?)),
784 ClientboundPlayMap::PACKET_ID => Ok(Self::Map(ClientboundPlayMap::decode(buf)?)),
785 ClientboundPlayMapChunk::PACKET_ID => {
786 Ok(Self::MapChunk(ClientboundPlayMapChunk::decode(buf)?))
787 }
788 ClientboundPlayMoveMinecart::PACKET_ID => Ok(Self::MoveMinecart(
789 ClientboundPlayMoveMinecart::decode(buf)?,
790 )),
791 ClientboundPlayMultiBlockChange::PACKET_ID => Ok(Self::MultiBlockChange(
792 ClientboundPlayMultiBlockChange::decode(buf)?,
793 )),
794 ClientboundPlayNbtQueryResponse::PACKET_ID => Ok(Self::NbtQueryResponse(
795 ClientboundPlayNbtQueryResponse::decode(buf)?,
796 )),
797 ClientboundPlayOpenBook::PACKET_ID => {
798 Ok(Self::OpenBook(ClientboundPlayOpenBook::decode(buf)?))
799 }
800 ClientboundPlayOpenHorseWindow::PACKET_ID => Ok(Self::OpenHorseWindow(
801 ClientboundPlayOpenHorseWindow::decode(buf)?,
802 )),
803 ClientboundPlayOpenSignEntity::PACKET_ID => Ok(Self::OpenSignEntity(
804 ClientboundPlayOpenSignEntity::decode(buf)?,
805 )),
806 ClientboundPlayOpenWindow::PACKET_ID => {
807 Ok(Self::OpenWindow(ClientboundPlayOpenWindow::decode(buf)?))
808 }
809 ClientboundPlayPing::PACKET_ID => Ok(Self::Ping(ClientboundPlayPing::decode(buf)?)),
810 ClientboundPlayPingResponse::PACKET_ID => Ok(Self::PingResponse(
811 ClientboundPlayPingResponse::decode(buf)?,
812 )),
813 ClientboundPlayPlayerChat::PACKET_ID => {
814 Ok(Self::PlayerChat(ClientboundPlayPlayerChat::decode(buf)?))
815 }
816 ClientboundPlayPlayerInfo::PACKET_ID => {
817 Ok(Self::PlayerInfo(ClientboundPlayPlayerInfo::decode(buf)?))
818 }
819 ClientboundPlayPlayerRemove::PACKET_ID => Ok(Self::PlayerRemove(
820 ClientboundPlayPlayerRemove::decode(buf)?,
821 )),
822 ClientboundPlayPlayerRotation::PACKET_ID => Ok(Self::PlayerRotation(
823 ClientboundPlayPlayerRotation::decode(buf)?,
824 )),
825 ClientboundPlayPlayerlistHeader::PACKET_ID => Ok(Self::PlayerlistHeader(
826 ClientboundPlayPlayerlistHeader::decode(buf)?,
827 )),
828 ClientboundPlayPosition::PACKET_ID => {
829 Ok(Self::Position(ClientboundPlayPosition::decode(buf)?))
830 }
831 ClientboundPlayProfilelessChat::PACKET_ID => Ok(Self::ProfilelessChat(
832 ClientboundPlayProfilelessChat::decode(buf)?,
833 )),
834 ClientboundPlayRecipeBookAdd::PACKET_ID => Ok(Self::RecipeBookAdd(
835 ClientboundPlayRecipeBookAdd::decode(buf)?,
836 )),
837 ClientboundPlayRecipeBookRemove::PACKET_ID => Ok(Self::RecipeBookRemove(
838 ClientboundPlayRecipeBookRemove::decode(buf)?,
839 )),
840 ClientboundPlayRecipeBookSettings::PACKET_ID => Ok(Self::RecipeBookSettings(
841 ClientboundPlayRecipeBookSettings::decode(buf)?,
842 )),
843 ClientboundPlayRelEntityMove::PACKET_ID => Ok(Self::RelEntityMove(
844 ClientboundPlayRelEntityMove::decode(buf)?,
845 )),
846 ClientboundPlayRemoveEntityEffect::PACKET_ID => Ok(Self::RemoveEntityEffect(
847 ClientboundPlayRemoveEntityEffect::decode(buf)?,
848 )),
849 ClientboundPlayResetScore::PACKET_ID => {
850 Ok(Self::ResetScore(ClientboundPlayResetScore::decode(buf)?))
851 }
852 ClientboundPlayRespawn::PACKET_ID => {
853 Ok(Self::Respawn(ClientboundPlayRespawn::decode(buf)?))
854 }
855 ClientboundPlayScoreboardDisplayObjective::PACKET_ID => {
856 Ok(Self::ScoreboardDisplayObjective(
857 ClientboundPlayScoreboardDisplayObjective::decode(buf)?,
858 ))
859 }
860 ClientboundPlayScoreboardObjective::PACKET_ID => Ok(Self::ScoreboardObjective(
861 ClientboundPlayScoreboardObjective::decode(buf)?,
862 )),
863 ClientboundPlayScoreboardScore::PACKET_ID => Ok(Self::ScoreboardScore(
864 ClientboundPlayScoreboardScore::decode(buf)?,
865 )),
866 ClientboundPlaySelectAdvancementTab::PACKET_ID => Ok(Self::SelectAdvancementTab(
867 ClientboundPlaySelectAdvancementTab::decode(buf)?,
868 )),
869 ClientboundPlayServerData::PACKET_ID => {
870 Ok(Self::ServerData(ClientboundPlayServerData::decode(buf)?))
871 }
872 ClientboundPlaySetCooldown::PACKET_ID => {
873 Ok(Self::SetCooldown(ClientboundPlaySetCooldown::decode(buf)?))
874 }
875 ClientboundPlaySetCursorItem::PACKET_ID => Ok(Self::SetCursorItem(
876 ClientboundPlaySetCursorItem::decode(buf)?,
877 )),
878 ClientboundPlaySetPassengers::PACKET_ID => Ok(Self::SetPassengers(
879 ClientboundPlaySetPassengers::decode(buf)?,
880 )),
881 ClientboundPlaySetPlayerInventory::PACKET_ID => Ok(Self::SetPlayerInventory(
882 ClientboundPlaySetPlayerInventory::decode(buf)?,
883 )),
884 ClientboundPlaySetProjectilePower::PACKET_ID => Ok(Self::SetProjectilePower(
885 ClientboundPlaySetProjectilePower::decode(buf)?,
886 )),
887 ClientboundPlaySetSlot::PACKET_ID => {
888 Ok(Self::SetSlot(ClientboundPlaySetSlot::decode(buf)?))
889 }
890 ClientboundPlaySetTickingState::PACKET_ID => Ok(Self::SetTickingState(
891 ClientboundPlaySetTickingState::decode(buf)?,
892 )),
893 ClientboundPlaySetTitleSubtitle::PACKET_ID => Ok(Self::SetTitleSubtitle(
894 ClientboundPlaySetTitleSubtitle::decode(buf)?,
895 )),
896 ClientboundPlaySetTitleText::PACKET_ID => Ok(Self::SetTitleText(
897 ClientboundPlaySetTitleText::decode(buf)?,
898 )),
899 ClientboundPlaySetTitleTime::PACKET_ID => Ok(Self::SetTitleTime(
900 ClientboundPlaySetTitleTime::decode(buf)?,
901 )),
902 ClientboundPlaySimulationDistance::PACKET_ID => Ok(Self::SimulationDistance(
903 ClientboundPlaySimulationDistance::decode(buf)?,
904 )),
905 ClientboundPlaySoundEffect::PACKET_ID => {
906 Ok(Self::SoundEffect(ClientboundPlaySoundEffect::decode(buf)?))
907 }
908 ClientboundPlaySpawnEntity::PACKET_ID => {
909 Ok(Self::SpawnEntity(ClientboundPlaySpawnEntity::decode(buf)?))
910 }
911 ClientboundPlaySpawnEntityExperienceOrb::PACKET_ID => {
912 Ok(Self::SpawnEntityExperienceOrb(
913 ClientboundPlaySpawnEntityExperienceOrb::decode(buf)?,
914 ))
915 }
916 ClientboundPlaySpawnPosition::PACKET_ID => Ok(Self::SpawnPosition(
917 ClientboundPlaySpawnPosition::decode(buf)?,
918 )),
919 ClientboundPlayStartConfiguration::PACKET_ID => Ok(Self::StartConfiguration(
920 ClientboundPlayStartConfiguration::decode(buf)?,
921 )),
922 ClientboundPlayStatistics::PACKET_ID => {
923 Ok(Self::Statistics(ClientboundPlayStatistics::decode(buf)?))
924 }
925 ClientboundPlayStepTick::PACKET_ID => {
926 Ok(Self::StepTick(ClientboundPlayStepTick::decode(buf)?))
927 }
928 ClientboundPlayStopSound::PACKET_ID => {
929 Ok(Self::StopSound(ClientboundPlayStopSound::decode(buf)?))
930 }
931 ClientboundPlaySyncEntityPosition::PACKET_ID => Ok(Self::SyncEntityPosition(
932 ClientboundPlaySyncEntityPosition::decode(buf)?,
933 )),
934 ClientboundPlaySystemChat::PACKET_ID => {
935 Ok(Self::SystemChat(ClientboundPlaySystemChat::decode(buf)?))
936 }
937 ClientboundPlayTabComplete::PACKET_ID => {
938 Ok(Self::TabComplete(ClientboundPlayTabComplete::decode(buf)?))
939 }
940 ClientboundPlayTags::PACKET_ID => Ok(Self::Tags(ClientboundPlayTags::decode(buf)?)),
941 ClientboundPlayTeams::PACKET_ID => Ok(Self::Teams(ClientboundPlayTeams::decode(buf)?)),
942 ClientboundPlayTileEntityData::PACKET_ID => Ok(Self::TileEntityData(
943 ClientboundPlayTileEntityData::decode(buf)?,
944 )),
945 ClientboundPlayTradeList::PACKET_ID => {
946 Ok(Self::TradeList(ClientboundPlayTradeList::decode(buf)?))
947 }
948 ClientboundPlayUnloadChunk::PACKET_ID => {
949 Ok(Self::UnloadChunk(ClientboundPlayUnloadChunk::decode(buf)?))
950 }
951 ClientboundPlayUpdateHealth::PACKET_ID => Ok(Self::UpdateHealth(
952 ClientboundPlayUpdateHealth::decode(buf)?,
953 )),
954 ClientboundPlayUpdateLight::PACKET_ID => {
955 Ok(Self::UpdateLight(ClientboundPlayUpdateLight::decode(buf)?))
956 }
957 ClientboundPlayUpdateTime::PACKET_ID => {
958 Ok(Self::UpdateTime(ClientboundPlayUpdateTime::decode(buf)?))
959 }
960 ClientboundPlayUpdateViewDistance::PACKET_ID => Ok(Self::UpdateViewDistance(
961 ClientboundPlayUpdateViewDistance::decode(buf)?,
962 )),
963 ClientboundPlayUpdateViewPosition::PACKET_ID => Ok(Self::UpdateViewPosition(
964 ClientboundPlayUpdateViewPosition::decode(buf)?,
965 )),
966 ClientboundPlayVehicleMove::PACKET_ID => {
967 Ok(Self::VehicleMove(ClientboundPlayVehicleMove::decode(buf)?))
968 }
969 ClientboundPlayWindowItems::PACKET_ID => {
970 Ok(Self::WindowItems(ClientboundPlayWindowItems::decode(buf)?))
971 }
972 ClientboundPlayWorldBorderCenter::PACKET_ID => Ok(Self::WorldBorderCenter(
973 ClientboundPlayWorldBorderCenter::decode(buf)?,
974 )),
975 ClientboundPlayWorldBorderLerpSize::PACKET_ID => Ok(Self::WorldBorderLerpSize(
976 ClientboundPlayWorldBorderLerpSize::decode(buf)?,
977 )),
978 ClientboundPlayWorldBorderSize::PACKET_ID => Ok(Self::WorldBorderSize(
979 ClientboundPlayWorldBorderSize::decode(buf)?,
980 )),
981 ClientboundPlayWorldBorderWarningDelay::PACKET_ID => Ok(Self::WorldBorderWarningDelay(
982 ClientboundPlayWorldBorderWarningDelay::decode(buf)?,
983 )),
984 ClientboundPlayWorldBorderWarningReach::PACKET_ID => Ok(Self::WorldBorderWarningReach(
985 ClientboundPlayWorldBorderWarningReach::decode(buf)?,
986 )),
987 ClientboundPlayWorldEvent::PACKET_ID => {
988 Ok(Self::WorldEvent(ClientboundPlayWorldEvent::decode(buf)?))
989 }
990 ClientboundPlayWorldParticles::PACKET_ID => Ok(Self::WorldParticles(
991 ClientboundPlayWorldParticles::decode(buf)?,
992 )),
993 _ => Err(Error::UnknownPacket { id, state: "play" }),
994 }
995 }
996}