diff --git a/README.md b/README.md index fd1e91b7a..53921141d 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ and customizable experience. It prioritizes performance and player enjoyment whi - [x] Chunk Loading - [x] Chunk Generation - [x] Scoreboard - - [ ] World Borders + - [x] World Borders - [ ] World Saving - Player - [x] Player Skins diff --git a/extractor/gradle.properties b/extractor/gradle.properties index 503603609..33f6f84f3 100644 --- a/extractor/gradle.properties +++ b/extractor/gradle.properties @@ -12,4 +12,4 @@ maven_group=de.snowii archives_base_name=extractor # Dependencies # check this on https://modmuss50.me/fabric.html -fabric_version=0.106.1+1.21.3 +fabric_version=0.107.0+1.21.3 diff --git a/pumpkin-macros/src/lib.rs b/pumpkin-macros/src/lib.rs index 326e96010..cc6e5e017 100644 --- a/pumpkin-macros/src/lib.rs +++ b/pumpkin-macros/src/lib.rs @@ -2,6 +2,8 @@ use proc_macro::TokenStream; use quote::quote; extern crate proc_macro; + +mod packet; #[proc_macro_attribute] pub fn client_packet(input: TokenStream, item: TokenStream) -> TokenStream { let ast: syn::DeriveInput = syn::parse(item.clone()).unwrap(); @@ -10,13 +12,13 @@ pub fn client_packet(input: TokenStream, item: TokenStream) -> TokenStream { let (impl_generics, ty_generics, _) = ast.generics.split_for_impl(); - let input: proc_macro2::TokenStream = input.into(); + let input: proc_macro2::TokenStream = packet::packet_clientbound(input); let item: proc_macro2::TokenStream = item.into(); let gen = quote! { #item impl #impl_generics crate::bytebuf::packet_id::ClientPacketID for #name #ty_generics { - const PACKET_ID: i32 = #input; + const PACKET_ID: i32 = #input as i32; } }; diff --git a/pumpkin-macros/src/packet.rs b/pumpkin-macros/src/packet.rs new file mode 100644 index 000000000..2b0b838e3 --- /dev/null +++ b/pumpkin-macros/src/packet.rs @@ -0,0 +1,42 @@ +use std::{collections::HashMap, sync::LazyLock}; + +use proc_macro::TokenStream; +use quote::quote; +use serde::Deserialize; + +#[derive(Deserialize)] +pub struct Packet { + name: String, + phase: String, + side: String, + id: u16, +} + +static PACKETS: LazyLock> = LazyLock::new(|| { + serde_json::from_str::>(include_str!("../../assets/packets.json")) + .expect("Could not parse packets.json registry.") + .into_iter() + .map(|val| (format!("{}:{}:{}", val.side, val.phase, val.name), val.id)) + .collect() +}); + +pub(crate) fn packet_clientbound(item: TokenStream) -> proc_macro2::TokenStream { + let input_string = item.to_string(); + let packet_name = input_string.trim_matches('"'); + + let id = PACKETS + .get(&format!("clientbound:{}", packet_name)) + .expect("Invalid Packet"); + quote! { #id } +} + +#[expect(dead_code)] +pub(crate) fn packet_serverbound(item: TokenStream) -> proc_macro2::TokenStream { + let input_string = item.to_string(); + let packet_name = input_string.trim_matches('"'); + + let id = PACKETS + .get(&format!("serverbound:{}", packet_name)) + .expect("Invalid Packet"); + quote! { #id } +} diff --git a/pumpkin-macros/src/particle.rs b/pumpkin-macros/src/particle.rs index 281cf6275..a31c1868c 100644 --- a/pumpkin-macros/src/particle.rs +++ b/pumpkin-macros/src/particle.rs @@ -7,10 +7,10 @@ use serde::Deserialize; #[derive(Deserialize)] pub struct Particle { name: String, - id: u32, + id: u16, } -static SOUNDS: LazyLock> = LazyLock::new(|| { +static SOUNDS: LazyLock> = LazyLock::new(|| { serde_json::from_str::>(include_str!("../../assets/particles.json")) .expect("Could not parse particles.json registry.") .into_iter() diff --git a/pumpkin-macros/src/sound.rs b/pumpkin-macros/src/sound.rs index b355b9404..2a9f63a57 100644 --- a/pumpkin-macros/src/sound.rs +++ b/pumpkin-macros/src/sound.rs @@ -7,10 +7,10 @@ use serde::Deserialize; #[derive(Deserialize)] pub struct Sound { name: String, - id: u32, + id: u16, } -static SOUNDS: LazyLock> = LazyLock::new(|| { +static SOUNDS: LazyLock> = LazyLock::new(|| { serde_json::from_str::>(include_str!("../../assets/sounds.json")) .expect("Could not parse sounds.json registry.") .into_iter() diff --git a/pumpkin-protocol/src/client/config/c_add_resource_pack.rs b/pumpkin-protocol/src/client/config/c_add_resource_pack.rs index 1d24359ef..8718ffbe8 100644 --- a/pumpkin-protocol/src/client/config/c_add_resource_pack.rs +++ b/pumpkin-protocol/src/client/config/c_add_resource_pack.rs @@ -3,10 +3,8 @@ use pumpkin_core::text::TextComponent; use pumpkin_macros::client_packet; use serde::Serialize; -use super::ClientboundConfigPackets; - #[derive(Serialize)] -#[client_packet(ClientboundConfigPackets::AddResourcePack as i32)] +#[client_packet("configuration:resource_pack_push")] pub struct CConfigAddResourcePack<'a> { uuid: uuid::Uuid, url: &'a str, diff --git a/pumpkin-protocol/src/client/config/c_config_disconnect.rs b/pumpkin-protocol/src/client/config/c_config_disconnect.rs index f16ad3293..8b21b6ff3 100644 --- a/pumpkin-protocol/src/client/config/c_config_disconnect.rs +++ b/pumpkin-protocol/src/client/config/c_config_disconnect.rs @@ -1,9 +1,7 @@ use pumpkin_macros::client_packet; -use super::ClientboundConfigPackets; - #[derive(serde::Serialize)] -#[client_packet(ClientboundConfigPackets::Disconnect as i32)] +#[client_packet("configuration:disconnect")] pub struct CConfigDisconnect<'a> { reason: &'a str, } diff --git a/pumpkin-protocol/src/client/config/c_cookie_request.rs b/pumpkin-protocol/src/client/config/c_cookie_request.rs index 63d1b40de..66a76c6a3 100644 --- a/pumpkin-protocol/src/client/config/c_cookie_request.rs +++ b/pumpkin-protocol/src/client/config/c_cookie_request.rs @@ -2,10 +2,8 @@ use pumpkin_macros::client_packet; use crate::Identifier; -use super::ClientboundConfigPackets; - #[derive(serde::Serialize)] -#[client_packet(ClientboundConfigPackets::CookieRequest as i32)] +#[client_packet("configuration:cookie_request")] pub struct CCookieRequest { key: Identifier, } diff --git a/pumpkin-protocol/src/client/config/c_finish_config.rs b/pumpkin-protocol/src/client/config/c_finish_config.rs index 9eb91fc53..18e6d1b3d 100644 --- a/pumpkin-protocol/src/client/config/c_finish_config.rs +++ b/pumpkin-protocol/src/client/config/c_finish_config.rs @@ -1,9 +1,7 @@ use pumpkin_macros::client_packet; -use super::ClientboundConfigPackets; - #[derive(serde::Serialize)] -#[client_packet(ClientboundConfigPackets::Finish as i32)] +#[client_packet("configuration:finish_configuration")] pub struct CFinishConfig {} impl Default for CFinishConfig { diff --git a/pumpkin-protocol/src/client/config/c_known_packs.rs b/pumpkin-protocol/src/client/config/c_known_packs.rs index 7237e3ee3..0ee3c317c 100644 --- a/pumpkin-protocol/src/client/config/c_known_packs.rs +++ b/pumpkin-protocol/src/client/config/c_known_packs.rs @@ -2,9 +2,7 @@ use pumpkin_macros::client_packet; use crate::{bytebuf::ByteBuffer, ClientPacket, KnownPack}; -use super::ClientboundConfigPackets; - -#[client_packet(ClientboundConfigPackets::KnownPacks as i32)] +#[client_packet("configuration:select_known_packs")] pub struct CKnownPacks<'a> { known_packs: &'a [KnownPack<'a>], } diff --git a/pumpkin-protocol/src/client/config/c_plugin_message.rs b/pumpkin-protocol/src/client/config/c_plugin_message.rs index 61d0f459a..92286fd4e 100644 --- a/pumpkin-protocol/src/client/config/c_plugin_message.rs +++ b/pumpkin-protocol/src/client/config/c_plugin_message.rs @@ -1,10 +1,8 @@ use pumpkin_macros::client_packet; use serde::Serialize; -use super::ClientboundConfigPackets; - #[derive(Serialize)] -#[client_packet(ClientboundConfigPackets::PluginMessage as i32)] +#[client_packet("configuration:custom_payload")] pub struct CPluginMessage<'a> { channel: &'a str, data: &'a [u8], diff --git a/pumpkin-protocol/src/client/config/c_registry_data.rs b/pumpkin-protocol/src/client/config/c_registry_data.rs index db9297813..7cb81455e 100644 --- a/pumpkin-protocol/src/client/config/c_registry_data.rs +++ b/pumpkin-protocol/src/client/config/c_registry_data.rs @@ -2,9 +2,7 @@ use pumpkin_macros::client_packet; use crate::{bytebuf::ByteBuffer, ClientPacket}; -use super::ClientboundConfigPackets; - -#[client_packet(ClientboundConfigPackets::RegistryData as i32)] +#[client_packet("configuration:registry_data")] pub struct CRegistryData<'a> { registry_id: &'a str, entries: &'a [RegistryEntry<'a>], diff --git a/pumpkin-protocol/src/client/config/mod.rs b/pumpkin-protocol/src/client/config/mod.rs index e71d1c392..1e53e20d5 100644 --- a/pumpkin-protocol/src/client/config/mod.rs +++ b/pumpkin-protocol/src/client/config/mod.rs @@ -13,26 +13,3 @@ pub use c_finish_config::*; pub use c_known_packs::*; pub use c_plugin_message::*; pub use c_registry_data::*; - -/// DO NOT CHANGE ORDER -/// This Enum has the exact order like vanilla, Vanilla parses their Packet IDs from the enum order. Its also way easier to port. -#[repr(i32)] -pub enum ClientboundConfigPackets { - CookieRequest, - PluginMessage, - Disconnect, - Finish, - KeepAlive, - Ping, - ResetChat, - RegistryData, - RemoveResourcePack, - AddResourcePack, - StoreCookie, - Transfer, - FeatureFlags, - UpdateTags, - KnownPacks, - CustomReportDetails, - ServerLinks, -} diff --git a/pumpkin-protocol/src/client/login/c_encryption_request.rs b/pumpkin-protocol/src/client/login/c_encryption_request.rs index 95fe2be70..7ff9eeb10 100644 --- a/pumpkin-protocol/src/client/login/c_encryption_request.rs +++ b/pumpkin-protocol/src/client/login/c_encryption_request.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundLoginPackets; - #[derive(Serialize)] -#[client_packet(ClientboundLoginPackets::EncryptionRequest as i32)] +#[client_packet("login:hello")] pub struct CEncryptionRequest<'a> { server_id: &'a str, // 20 public_key_length: VarInt, diff --git a/pumpkin-protocol/src/client/login/c_login_disconnect.rs b/pumpkin-protocol/src/client/login/c_login_disconnect.rs index 5e1d11f05..30806dd70 100644 --- a/pumpkin-protocol/src/client/login/c_login_disconnect.rs +++ b/pumpkin-protocol/src/client/login/c_login_disconnect.rs @@ -1,10 +1,8 @@ use pumpkin_macros::client_packet; use serde::Serialize; -use super::ClientboundLoginPackets; - #[derive(Serialize)] -#[client_packet(ClientboundLoginPackets::Disconnect as i32)] +#[client_packet("login:login_disconnect")] pub struct CLoginDisconnect<'a> { json_reason: &'a str, } diff --git a/pumpkin-protocol/src/client/login/c_login_success.rs b/pumpkin-protocol/src/client/login/c_login_success.rs index 883a5fb49..d92fdcf7c 100644 --- a/pumpkin-protocol/src/client/login/c_login_success.rs +++ b/pumpkin-protocol/src/client/login/c_login_success.rs @@ -2,9 +2,7 @@ use pumpkin_macros::client_packet; use crate::{bytebuf::ByteBuffer, ClientPacket, Property}; -use super::ClientboundLoginPackets; - -#[client_packet(ClientboundLoginPackets::LoginSuccess as i32)] +#[client_packet("login:login_finished")] pub struct CLoginSuccess<'a> { pub uuid: &'a uuid::Uuid, pub username: &'a str, // 16 diff --git a/pumpkin-protocol/src/client/login/c_plugin_request.rs b/pumpkin-protocol/src/client/login/c_plugin_request.rs index 187b98d5a..ab9edf558 100644 --- a/pumpkin-protocol/src/client/login/c_plugin_request.rs +++ b/pumpkin-protocol/src/client/login/c_plugin_request.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundLoginPackets; - #[derive(Serialize)] -#[client_packet(ClientboundLoginPackets::LoginPluginRequest as i32)] +#[client_packet("login:custom_query")] pub struct CLoginPluginRequest<'a> { message_id: VarInt, channel: &'a str, diff --git a/pumpkin-protocol/src/client/login/c_set_compression.rs b/pumpkin-protocol/src/client/login/c_set_compression.rs index 670dd7b37..8033737a7 100644 --- a/pumpkin-protocol/src/client/login/c_set_compression.rs +++ b/pumpkin-protocol/src/client/login/c_set_compression.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundLoginPackets; - #[derive(Serialize)] -#[client_packet(ClientboundLoginPackets::SetCompression as i32)] +#[client_packet("login:login_compression")] pub struct CSetCompression { threshold: VarInt, } diff --git a/pumpkin-protocol/src/client/login/mod.rs b/pumpkin-protocol/src/client/login/mod.rs index 2a40cc705..6824b2012 100644 --- a/pumpkin-protocol/src/client/login/mod.rs +++ b/pumpkin-protocol/src/client/login/mod.rs @@ -9,15 +9,3 @@ pub use c_login_disconnect::*; pub use c_login_success::*; pub use c_plugin_request::*; pub use c_set_compression::*; - -/// DO NOT CHANGE ORDER -/// This Enum has the exact order like vanilla, Vanilla parses their Packet IDs from the enum order. Its also way easier to port. -#[repr(i32)] -pub enum ClientboundLoginPackets { - Disconnect, - EncryptionRequest, - LoginSuccess, - SetCompression, - LoginPluginRequest, - CookieRequest, -} diff --git a/pumpkin-protocol/src/client/play/c_acknowledge_block.rs b/pumpkin-protocol/src/client/play/c_acknowledge_block.rs index 175263943..7cde985d6 100644 --- a/pumpkin-protocol/src/client/play/c_acknowledge_block.rs +++ b/pumpkin-protocol/src/client/play/c_acknowledge_block.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::AcknowledgeBlockChanges as i32)] +#[client_packet("play:block_changed_ack")] pub struct CAcknowledgeBlockChange { sequence_id: VarInt, } diff --git a/pumpkin-protocol/src/client/play/c_actionbar.rs b/pumpkin-protocol/src/client/play/c_actionbar.rs index bbd423033..c74f0778e 100644 --- a/pumpkin-protocol/src/client/play/c_actionbar.rs +++ b/pumpkin-protocol/src/client/play/c_actionbar.rs @@ -3,10 +3,8 @@ use pumpkin_core::text::TextComponent; use pumpkin_macros::client_packet; use serde::Serialize; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::ActionBar as i32)] +#[client_packet("play:set_action_bar_text")] pub struct CActionBar<'a> { action_bar: TextComponent<'a>, } diff --git a/pumpkin-protocol/src/client/play/c_block_destroy_stage.rs b/pumpkin-protocol/src/client/play/c_block_destroy_stage.rs index 82cae98e0..3c3a6f79e 100644 --- a/pumpkin-protocol/src/client/play/c_block_destroy_stage.rs +++ b/pumpkin-protocol/src/client/play/c_block_destroy_stage.rs @@ -5,10 +5,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::BlockBreakAnimation as i32)] +#[client_packet("play:block_destruction")] pub struct CSetBlockDestroyStage { entity_id: VarInt, location: WorldPosition, diff --git a/pumpkin-protocol/src/client/play/c_block_update.rs b/pumpkin-protocol/src/client/play/c_block_update.rs index 47829d51a..408116393 100644 --- a/pumpkin-protocol/src/client/play/c_block_update.rs +++ b/pumpkin-protocol/src/client/play/c_block_update.rs @@ -5,10 +5,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::BlockChange as i32)] +#[client_packet("play:block_update")] pub struct CBlockUpdate<'a> { location: &'a WorldPosition, block_id: VarInt, diff --git a/pumpkin-protocol/src/client/play/c_center_chunk.rs b/pumpkin-protocol/src/client/play/c_center_chunk.rs index d955685e3..b64e8ad4a 100644 --- a/pumpkin-protocol/src/client/play/c_center_chunk.rs +++ b/pumpkin-protocol/src/client/play/c_center_chunk.rs @@ -2,10 +2,8 @@ use pumpkin_macros::client_packet; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(serde::Serialize)] -#[client_packet(ClientboundPlayPackets::UpdateViewPosition as i32)] +#[client_packet("play:set_chunk_cache_center")] pub struct CCenterChunk { pub chunk_x: VarInt, pub chunk_z: VarInt, diff --git a/pumpkin-protocol/src/client/play/c_change_difficulty.rs b/pumpkin-protocol/src/client/play/c_change_difficulty.rs index 1fd51a944..e4cee5f88 100644 --- a/pumpkin-protocol/src/client/play/c_change_difficulty.rs +++ b/pumpkin-protocol/src/client/play/c_change_difficulty.rs @@ -1,10 +1,8 @@ use pumpkin_macros::client_packet; use serde::Serialize; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::ServerDifficulty as i32)] +#[client_packet("play:change_difficulty")] pub struct CChangeDifficulty { difficulty: u8, locked: bool, diff --git a/pumpkin-protocol/src/client/play/c_chunk_data.rs b/pumpkin-protocol/src/client/play/c_chunk_data.rs index a3b8098bb..b1e373e01 100644 --- a/pumpkin-protocol/src/client/play/c_chunk_data.rs +++ b/pumpkin-protocol/src/client/play/c_chunk_data.rs @@ -6,9 +6,7 @@ use itertools::Itertools; use pumpkin_macros::client_packet; use pumpkin_world::{chunk::ChunkData, DIRECT_PALETTE_BITS}; -use super::ClientboundPlayPackets; - -#[client_packet(ClientboundPlayPackets::ChunkData as i32)] +#[client_packet("play:level_chunk_with_light")] pub struct CChunkData<'a>(pub &'a ChunkData); impl<'a> ClientPacket for CChunkData<'a> { diff --git a/pumpkin-protocol/src/client/play/c_close_container.rs b/pumpkin-protocol/src/client/play/c_close_container.rs index 1753e7609..b2346166a 100644 --- a/pumpkin-protocol/src/client/play/c_close_container.rs +++ b/pumpkin-protocol/src/client/play/c_close_container.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::CloseWindow as i32)] +#[client_packet("play:container_close")] pub struct CCloseContainer { window_id: VarInt, } diff --git a/pumpkin-protocol/src/client/play/c_disguised_chat_message.rs b/pumpkin-protocol/src/client/play/c_disguised_chat_message.rs index 6d2facfa7..5f79292b5 100644 --- a/pumpkin-protocol/src/client/play/c_disguised_chat_message.rs +++ b/pumpkin-protocol/src/client/play/c_disguised_chat_message.rs @@ -5,10 +5,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::DisguisedChat as i32)] +#[client_packet("play:disguised_chat")] pub struct CDisguisedChatMessage<'a> { message: TextComponent<'a>, chat_type: VarInt, diff --git a/pumpkin-protocol/src/client/play/c_display_objective.rs b/pumpkin-protocol/src/client/play/c_display_objective.rs index bf48536e9..1bc39ac33 100644 --- a/pumpkin-protocol/src/client/play/c_display_objective.rs +++ b/pumpkin-protocol/src/client/play/c_display_objective.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::DisplayScoreboard as i32)] +#[client_packet("play:set_display_objective")] pub struct CDisplayObjective<'a> { position: VarInt, score_name: &'a str, diff --git a/pumpkin-protocol/src/client/play/c_entity_animation.rs b/pumpkin-protocol/src/client/play/c_entity_animation.rs index 58448db2b..f6a08e407 100644 --- a/pumpkin-protocol/src/client/play/c_entity_animation.rs +++ b/pumpkin-protocol/src/client/play/c_entity_animation.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::EntityAnimation as i32)] +#[client_packet("play:animate")] pub struct CEntityAnimation { entity_id: VarInt, /// See `Animation` diff --git a/pumpkin-protocol/src/client/play/c_entity_metadata.rs b/pumpkin-protocol/src/client/play/c_entity_metadata.rs index b99a2d1f7..67b35e834 100644 --- a/pumpkin-protocol/src/client/play/c_entity_metadata.rs +++ b/pumpkin-protocol/src/client/play/c_entity_metadata.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::EntityMetadata as i32)] +#[client_packet("play:set_entity_data")] pub struct CSetEntityMetadata { entity_id: VarInt, metadata: Metadata, diff --git a/pumpkin-protocol/src/client/play/c_entity_sound_effect.rs b/pumpkin-protocol/src/client/play/c_entity_sound_effect.rs index 255c01c05..c819f0316 100644 --- a/pumpkin-protocol/src/client/play/c_entity_sound_effect.rs +++ b/pumpkin-protocol/src/client/play/c_entity_sound_effect.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::{SoundCategory, VarInt}; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::EntitySoundEffect as i32)] +#[client_packet("play:sound_entity")] pub struct CEntitySoundEffect { sound_id: VarInt, // TODO: add sound from name diff --git a/pumpkin-protocol/src/client/play/c_entity_status.rs b/pumpkin-protocol/src/client/play/c_entity_status.rs index 118de8e70..9c7247aff 100644 --- a/pumpkin-protocol/src/client/play/c_entity_status.rs +++ b/pumpkin-protocol/src/client/play/c_entity_status.rs @@ -1,10 +1,8 @@ use pumpkin_macros::client_packet; use serde::Serialize; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::EntityStatus as i32)] +#[client_packet("play:entity_event")] pub struct CEntityStatus { entity_id: i32, entity_status: i8, diff --git a/pumpkin-protocol/src/client/play/c_entity_velocity.rs b/pumpkin-protocol/src/client/play/c_entity_velocity.rs index 962f561ec..e73989b6c 100644 --- a/pumpkin-protocol/src/client/play/c_entity_velocity.rs +++ b/pumpkin-protocol/src/client/play/c_entity_velocity.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::EntityVelocity as i32)] +#[client_packet("play:set_entity_motion")] pub struct CEntityVelocity<'a> { entity_id: &'a VarInt, velocity_x: i16, diff --git a/pumpkin-protocol/src/client/play/c_game_event.rs b/pumpkin-protocol/src/client/play/c_game_event.rs index 294f41fb1..606e6f3d2 100644 --- a/pumpkin-protocol/src/client/play/c_game_event.rs +++ b/pumpkin-protocol/src/client/play/c_game_event.rs @@ -1,10 +1,8 @@ use pumpkin_macros::client_packet; use serde::Serialize; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::ChangeGameState as i32)] +#[client_packet("play:game_event")] pub struct CGameEvent { event: u8, value: f32, diff --git a/pumpkin-protocol/src/client/play/c_head_rot.rs b/pumpkin-protocol/src/client/play/c_head_rot.rs index f96be4cda..f38733957 100644 --- a/pumpkin-protocol/src/client/play/c_head_rot.rs +++ b/pumpkin-protocol/src/client/play/c_head_rot.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::EntityHeadLook as i32)] +#[client_packet("play:rotate_head")] pub struct CHeadRot { entity_id: VarInt, head_yaw: u8, diff --git a/pumpkin-protocol/src/client/play/c_hurt_animation.rs b/pumpkin-protocol/src/client/play/c_hurt_animation.rs index 61466d72c..196c3e0f3 100644 --- a/pumpkin-protocol/src/client/play/c_hurt_animation.rs +++ b/pumpkin-protocol/src/client/play/c_hurt_animation.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::HurtAnimation as i32)] +#[client_packet("play:hurt_animation")] pub struct CHurtAnimation<'a> { entity_id: &'a VarInt, yaw: f32, diff --git a/pumpkin-protocol/src/client/play/c_initialize_world_border.rs b/pumpkin-protocol/src/client/play/c_initialize_world_border.rs index f8518552c..f4d6663a7 100644 --- a/pumpkin-protocol/src/client/play/c_initialize_world_border.rs +++ b/pumpkin-protocol/src/client/play/c_initialize_world_border.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::{VarInt, VarLong}; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::InitializeWorldBorder as i32)] +#[client_packet("play:initialize_border")] pub struct CInitializeWorldBorder { x: f64, z: f64, diff --git a/pumpkin-protocol/src/client/play/c_keep_alive.rs b/pumpkin-protocol/src/client/play/c_keep_alive.rs index aa90b8d52..5d962ae88 100644 --- a/pumpkin-protocol/src/client/play/c_keep_alive.rs +++ b/pumpkin-protocol/src/client/play/c_keep_alive.rs @@ -1,10 +1,8 @@ use pumpkin_macros::client_packet; use serde::Serialize; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::KeepAlive as i32)] +#[client_packet("play:keep_alive")] pub struct CKeepAlive { keep_alive_id: i64, } diff --git a/pumpkin-protocol/src/client/play/c_login.rs b/pumpkin-protocol/src/client/play/c_login.rs index 3e3142bb7..f0e02b631 100644 --- a/pumpkin-protocol/src/client/play/c_login.rs +++ b/pumpkin-protocol/src/client/play/c_login.rs @@ -5,10 +5,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::JoinGame as i32)] +#[client_packet("play:login")] pub struct CLogin<'a> { entity_id: i32, is_hardcore: bool, diff --git a/pumpkin-protocol/src/client/play/c_open_screen.rs b/pumpkin-protocol/src/client/play/c_open_screen.rs index cc0150096..90a9d959b 100644 --- a/pumpkin-protocol/src/client/play/c_open_screen.rs +++ b/pumpkin-protocol/src/client/play/c_open_screen.rs @@ -5,10 +5,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::OpenWindow as i32)] +#[client_packet("play:open_screen")] pub struct COpenScreen<'a> { window_id: VarInt, window_type: VarInt, diff --git a/pumpkin-protocol/src/client/play/c_particle.rs b/pumpkin-protocol/src/client/play/c_particle.rs index 982874e3e..0110df8c2 100644 --- a/pumpkin-protocol/src/client/play/c_particle.rs +++ b/pumpkin-protocol/src/client/play/c_particle.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::Particle as i32)] +#[client_packet("play:level_particles")] pub struct CParticle<'a> { /// If true, particle distance increases from 256 to 65536. long_distance: bool, diff --git a/pumpkin-protocol/src/client/play/c_ping_response.rs b/pumpkin-protocol/src/client/play/c_ping_response.rs index c1c54ed5a..ad3b86038 100644 --- a/pumpkin-protocol/src/client/play/c_ping_response.rs +++ b/pumpkin-protocol/src/client/play/c_ping_response.rs @@ -1,10 +1,8 @@ use pumpkin_macros::client_packet; use serde::Serialize; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::Ping as i32)] +#[client_packet("play:pong_response")] pub struct CPingResponse { payload: i64, } diff --git a/pumpkin-protocol/src/client/play/c_play_disconnect.rs b/pumpkin-protocol/src/client/play/c_play_disconnect.rs index cf656d0d5..ae8dd3f56 100644 --- a/pumpkin-protocol/src/client/play/c_play_disconnect.rs +++ b/pumpkin-protocol/src/client/play/c_play_disconnect.rs @@ -3,10 +3,8 @@ use pumpkin_core::text::TextComponent; use pumpkin_macros::client_packet; use serde::Serialize; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::Disconnect as i32)] +#[client_packet("play:disconnect")] pub struct CPlayDisconnect<'a> { reason: &'a TextComponent<'a>, } diff --git a/pumpkin-protocol/src/client/play/c_player_abilities.rs b/pumpkin-protocol/src/client/play/c_player_abilities.rs index 54a8472d8..096824a8f 100644 --- a/pumpkin-protocol/src/client/play/c_player_abilities.rs +++ b/pumpkin-protocol/src/client/play/c_player_abilities.rs @@ -1,10 +1,8 @@ use pumpkin_macros::client_packet; use serde::Serialize; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::PlayerAbilities as i32)] +#[client_packet("play:player_abilities")] pub struct CPlayerAbilities { flags: i8, flying_speed: f32, diff --git a/pumpkin-protocol/src/client/play/c_player_chat_message.rs b/pumpkin-protocol/src/client/play/c_player_chat_message.rs index 45cd6dab5..b774a2f28 100644 --- a/pumpkin-protocol/src/client/play/c_player_chat_message.rs +++ b/pumpkin-protocol/src/client/play/c_player_chat_message.rs @@ -5,9 +5,8 @@ use serde::Serialize; use crate::{BitSet, VarInt}; -use super::ClientboundPlayPackets; #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::ChatMessage as i32)] +#[client_packet("play:player_chat")] pub struct CPlayerChatMessage<'a> { #[serde(with = "uuid::serde::compact")] sender: uuid::Uuid, diff --git a/pumpkin-protocol/src/client/play/c_player_info_update.rs b/pumpkin-protocol/src/client/play/c_player_info_update.rs index 8a0258758..e13c4c886 100644 --- a/pumpkin-protocol/src/client/play/c_player_info_update.rs +++ b/pumpkin-protocol/src/client/play/c_player_info_update.rs @@ -2,9 +2,9 @@ use pumpkin_macros::client_packet; use crate::{bytebuf::ByteBuffer, ClientPacket, Property}; -use super::{ClientboundPlayPackets, PlayerAction}; +use super::PlayerAction; -#[client_packet(ClientboundPlayPackets::PlayerInfoUpdate as i32)] +#[client_packet("play:player_info_update")] pub struct CPlayerInfoUpdate<'a> { pub actions: i8, pub players: &'a [Player<'a>], diff --git a/pumpkin-protocol/src/client/play/c_player_remove.rs b/pumpkin-protocol/src/client/play/c_player_remove.rs index f35fd0d03..d92d6dbf3 100644 --- a/pumpkin-protocol/src/client/play/c_player_remove.rs +++ b/pumpkin-protocol/src/client/play/c_player_remove.rs @@ -3,10 +3,8 @@ use serde::{ser::SerializeSeq, Serialize}; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::PlayerInfoRemove as i32)] +#[client_packet("play:player_info_remove")] pub struct CRemovePlayerInfo<'a> { players_count: VarInt, #[serde(serialize_with = "serialize_slice_uuids")] diff --git a/pumpkin-protocol/src/client/play/c_remove_entities.rs b/pumpkin-protocol/src/client/play/c_remove_entities.rs index de9e1bc18..50ed65736 100644 --- a/pumpkin-protocol/src/client/play/c_remove_entities.rs +++ b/pumpkin-protocol/src/client/play/c_remove_entities.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::DestroyEntities as i32)] +#[client_packet("play:remove_entities")] pub struct CRemoveEntities<'a> { count: VarInt, entity_ids: &'a [VarInt], diff --git a/pumpkin-protocol/src/client/play/c_reset_score.rs b/pumpkin-protocol/src/client/play/c_reset_score.rs index 5fda70a01..a5b5c3d05 100644 --- a/pumpkin-protocol/src/client/play/c_reset_score.rs +++ b/pumpkin-protocol/src/client/play/c_reset_score.rs @@ -1,10 +1,8 @@ use pumpkin_macros::client_packet; use serde::Serialize; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::ResetScore as i32)] +#[client_packet("play:reset_score")] pub struct CResetScore { entity_name: String, objective_name: Option, diff --git a/pumpkin-protocol/src/client/play/c_set_border_center.rs b/pumpkin-protocol/src/client/play/c_set_border_center.rs index 12a6d9604..dfb10d203 100644 --- a/pumpkin-protocol/src/client/play/c_set_border_center.rs +++ b/pumpkin-protocol/src/client/play/c_set_border_center.rs @@ -1,10 +1,8 @@ use pumpkin_macros::client_packet; use serde::Serialize; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::WorldBorderCenter as i32)] +#[client_packet("play:set_border_center")] pub struct CSetBorderCenter { x: f64, z: f64, diff --git a/pumpkin-protocol/src/client/play/c_set_border_lerp_size.rs b/pumpkin-protocol/src/client/play/c_set_border_lerp_size.rs index 222618c6e..0d15ab9bc 100644 --- a/pumpkin-protocol/src/client/play/c_set_border_lerp_size.rs +++ b/pumpkin-protocol/src/client/play/c_set_border_lerp_size.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::VarLong; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::WorldBorderLerpSize as i32)] +#[client_packet("play:set_border_lerp_size")] pub struct CSetBorderLerpSize { old_diameter: f64, new_diameter: f64, diff --git a/pumpkin-protocol/src/client/play/c_set_border_size.rs b/pumpkin-protocol/src/client/play/c_set_border_size.rs index d4733ce01..725830f00 100644 --- a/pumpkin-protocol/src/client/play/c_set_border_size.rs +++ b/pumpkin-protocol/src/client/play/c_set_border_size.rs @@ -1,10 +1,8 @@ use pumpkin_macros::client_packet; use serde::Serialize; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::WorldBorderSize as i32)] +#[client_packet("play:set_border_size")] pub struct CSetBorderSize { diameter: f64, } diff --git a/pumpkin-protocol/src/client/play/c_set_border_warning_delay.rs b/pumpkin-protocol/src/client/play/c_set_border_warning_delay.rs index bc3073570..20c05766f 100644 --- a/pumpkin-protocol/src/client/play/c_set_border_warning_delay.rs +++ b/pumpkin-protocol/src/client/play/c_set_border_warning_delay.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::WorldBorderWarningDelay as i32)] +#[client_packet("play:set_border_warning_delay")] pub struct CSetBorderWarningDelay { warning_time: VarInt, } diff --git a/pumpkin-protocol/src/client/play/c_set_border_warning_distance.rs b/pumpkin-protocol/src/client/play/c_set_border_warning_distance.rs index 2f265e2d0..be569478f 100644 --- a/pumpkin-protocol/src/client/play/c_set_border_warning_distance.rs +++ b/pumpkin-protocol/src/client/play/c_set_border_warning_distance.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::WorldBorderWarningReach as i32)] +#[client_packet("play:set_border_warning_distance")] pub struct CSetBorderWarningDistance { warning_blocks: VarInt, } diff --git a/pumpkin-protocol/src/client/play/c_set_container_content.rs b/pumpkin-protocol/src/client/play/c_set_container_content.rs index cf6499a6e..38e6b39ac 100644 --- a/pumpkin-protocol/src/client/play/c_set_container_content.rs +++ b/pumpkin-protocol/src/client/play/c_set_container_content.rs @@ -4,10 +4,8 @@ use crate::VarInt; use pumpkin_macros::client_packet; use serde::Serialize; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::WindowItems as i32)] +#[client_packet("play:container_set_content")] pub struct CSetContainerContent<'a> { window_id: VarInt, state_id: VarInt, diff --git a/pumpkin-protocol/src/client/play/c_set_container_property.rs b/pumpkin-protocol/src/client/play/c_set_container_property.rs index b8efc742f..fdd231b81 100644 --- a/pumpkin-protocol/src/client/play/c_set_container_property.rs +++ b/pumpkin-protocol/src/client/play/c_set_container_property.rs @@ -3,9 +3,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundPlayPackets; #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::WindowProperty as i32)] +#[client_packet("play:container_set_data")] pub struct CSetContainerProperty { window_id: VarInt, property: i16, diff --git a/pumpkin-protocol/src/client/play/c_set_container_slot.rs b/pumpkin-protocol/src/client/play/c_set_container_slot.rs index 57f19b343..19e6b484a 100644 --- a/pumpkin-protocol/src/client/play/c_set_container_slot.rs +++ b/pumpkin-protocol/src/client/play/c_set_container_slot.rs @@ -4,9 +4,8 @@ use crate::VarInt; use pumpkin_macros::client_packet; use serde::Serialize; -use super::ClientboundPlayPackets; #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::SetSlot as i32)] +#[client_packet("play:container_set_slot")] pub struct CSetContainerSlot<'a> { window_id: i8, state_id: VarInt, diff --git a/pumpkin-protocol/src/client/play/c_set_health.rs b/pumpkin-protocol/src/client/play/c_set_health.rs index f07bb6ba3..0d1b3e165 100644 --- a/pumpkin-protocol/src/client/play/c_set_health.rs +++ b/pumpkin-protocol/src/client/play/c_set_health.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::UpdateHealth as i32)] +#[client_packet("play:set_health")] pub struct CSetHealth { health: f32, food: VarInt, diff --git a/pumpkin-protocol/src/client/play/c_set_held_item.rs b/pumpkin-protocol/src/client/play/c_set_held_item.rs index 2b307316d..1bbc0c403 100644 --- a/pumpkin-protocol/src/client/play/c_set_held_item.rs +++ b/pumpkin-protocol/src/client/play/c_set_held_item.rs @@ -1,10 +1,8 @@ use pumpkin_macros::client_packet; use serde::Serialize; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::HeldItemChange as i32)] +#[client_packet("play:set_held_slot")] pub struct CSetHeldItem { slot: i8, } diff --git a/pumpkin-protocol/src/client/play/c_set_title.rs b/pumpkin-protocol/src/client/play/c_set_title.rs index 75c45a89d..2253f4202 100644 --- a/pumpkin-protocol/src/client/play/c_set_title.rs +++ b/pumpkin-protocol/src/client/play/c_set_title.rs @@ -3,10 +3,8 @@ use pumpkin_core::text::TextComponent; use pumpkin_macros::client_packet; use serde::Serialize; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::SetTitleText as i32)] +#[client_packet("play:set_title_text")] pub struct CTitleText<'a> { title: TextComponent<'a>, } diff --git a/pumpkin-protocol/src/client/play/c_sound_effect.rs b/pumpkin-protocol/src/client/play/c_sound_effect.rs index e9405e20b..03dd326d6 100644 --- a/pumpkin-protocol/src/client/play/c_sound_effect.rs +++ b/pumpkin-protocol/src/client/play/c_sound_effect.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::{SoundCategory, VarInt}; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::SoundEffect as i32)] +#[client_packet("play:sound")] pub struct CSoundEffect { sound_id: VarInt, // TODO: add sound from name diff --git a/pumpkin-protocol/src/client/play/c_spawn_entity.rs b/pumpkin-protocol/src/client/play/c_spawn_entity.rs index 031f5c7aa..258101049 100644 --- a/pumpkin-protocol/src/client/play/c_spawn_entity.rs +++ b/pumpkin-protocol/src/client/play/c_spawn_entity.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::SpawnEntity as i32)] +#[client_packet("play:add_entity")] pub struct CSpawnEntity { entity_id: VarInt, #[serde(with = "uuid::serde::compact")] diff --git a/pumpkin-protocol/src/client/play/c_subtitle.rs b/pumpkin-protocol/src/client/play/c_subtitle.rs index 214cac187..52c0db090 100644 --- a/pumpkin-protocol/src/client/play/c_subtitle.rs +++ b/pumpkin-protocol/src/client/play/c_subtitle.rs @@ -3,10 +3,8 @@ use pumpkin_core::text::TextComponent; use pumpkin_macros::client_packet; use serde::Serialize; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::SetTitleSubtitle as i32)] +#[client_packet("play:set_subtitle_text")] pub struct CSubtitle<'a> { subtitle: TextComponent<'a>, } diff --git a/pumpkin-protocol/src/client/play/c_sync_player_position.rs b/pumpkin-protocol/src/client/play/c_sync_player_position.rs index cb012ed41..df136a438 100644 --- a/pumpkin-protocol/src/client/play/c_sync_player_position.rs +++ b/pumpkin-protocol/src/client/play/c_sync_player_position.rs @@ -3,9 +3,7 @@ use pumpkin_macros::client_packet; use crate::{ClientPacket, PositionFlag, VarInt}; -use super::ClientboundPlayPackets; - -#[client_packet(ClientboundPlayPackets::PlayerPositionAndLook as i32)] +#[client_packet("play:player_position")] pub struct CSyncPlayerPosition<'a> { teleport_id: VarInt, x: f64, diff --git a/pumpkin-protocol/src/client/play/c_system_chat_message.rs b/pumpkin-protocol/src/client/play/c_system_chat_message.rs index b5f4b89b1..98d7b275e 100644 --- a/pumpkin-protocol/src/client/play/c_system_chat_message.rs +++ b/pumpkin-protocol/src/client/play/c_system_chat_message.rs @@ -3,10 +3,8 @@ use pumpkin_core::text::TextComponent; use pumpkin_macros::client_packet; use serde::Serialize; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::SystemChatMessage as i32)] +#[client_packet("play:system_chat")] pub struct CSystemChatMessage<'a> { content: &'a TextComponent<'a>, overlay: bool, diff --git a/pumpkin-protocol/src/client/play/c_teleport_entity.rs b/pumpkin-protocol/src/client/play/c_teleport_entity.rs index 24ab9fc24..10d90c5c0 100644 --- a/pumpkin-protocol/src/client/play/c_teleport_entity.rs +++ b/pumpkin-protocol/src/client/play/c_teleport_entity.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::EntityTeleport as i32)] +#[client_packet("play:teleport_entity")] pub struct CTeleportEntitiy { entity_id: VarInt, x: f64, diff --git a/pumpkin-protocol/src/client/play/c_unload_chunk.rs b/pumpkin-protocol/src/client/play/c_unload_chunk.rs index 5235bcb59..5c8343c0e 100644 --- a/pumpkin-protocol/src/client/play/c_unload_chunk.rs +++ b/pumpkin-protocol/src/client/play/c_unload_chunk.rs @@ -1,10 +1,8 @@ use pumpkin_macros::client_packet; use serde::Serialize; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::UnloadChunk as i32)] +#[client_packet("play:forget_level_chunk")] pub struct CUnloadChunk { z: i32, x: i32, diff --git a/pumpkin-protocol/src/client/play/c_update_entity_pos.rs b/pumpkin-protocol/src/client/play/c_update_entity_pos.rs index ae29f2ef3..bb0eab806 100644 --- a/pumpkin-protocol/src/client/play/c_update_entity_pos.rs +++ b/pumpkin-protocol/src/client/play/c_update_entity_pos.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::EntityRelativeMove as i32)] +#[client_packet("play:move_entity_pos")] pub struct CUpdateEntityPos { entity_id: VarInt, delta_x: i16, diff --git a/pumpkin-protocol/src/client/play/c_update_entity_pos_rot.rs b/pumpkin-protocol/src/client/play/c_update_entity_pos_rot.rs index 8bdabf901..ecc14b681 100644 --- a/pumpkin-protocol/src/client/play/c_update_entity_pos_rot.rs +++ b/pumpkin-protocol/src/client/play/c_update_entity_pos_rot.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::EntityRelativeMoveAndRotation as i32)] +#[client_packet("play:move_entity_pos_rot")] pub struct CUpdateEntityPosRot { entity_id: VarInt, delta_x: i16, diff --git a/pumpkin-protocol/src/client/play/c_update_entity_rot.rs b/pumpkin-protocol/src/client/play/c_update_entity_rot.rs index bd45d9313..8cd95a942 100644 --- a/pumpkin-protocol/src/client/play/c_update_entity_rot.rs +++ b/pumpkin-protocol/src/client/play/c_update_entity_rot.rs @@ -3,10 +3,8 @@ use serde::Serialize; use crate::VarInt; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::EntityRotation as i32)] +#[client_packet("play:move_entity_rot")] pub struct CUpdateEntityRot { entity_id: VarInt, yaw: u8, diff --git a/pumpkin-protocol/src/client/play/c_update_objectives.rs b/pumpkin-protocol/src/client/play/c_update_objectives.rs index f4b93dbc2..4fa4ac191 100644 --- a/pumpkin-protocol/src/client/play/c_update_objectives.rs +++ b/pumpkin-protocol/src/client/play/c_update_objectives.rs @@ -3,9 +3,7 @@ use pumpkin_macros::client_packet; use crate::{ClientPacket, NumberFormat, VarInt}; -use super::ClientboundPlayPackets; - -#[client_packet(ClientboundPlayPackets::ScoreboardObjective as i32)] +#[client_packet("play:set_objective")] pub struct CUpdateObjectives<'a> { objective_name: &'a str, mode: u8, diff --git a/pumpkin-protocol/src/client/play/c_update_score.rs b/pumpkin-protocol/src/client/play/c_update_score.rs index 5fa38780f..33abebe69 100644 --- a/pumpkin-protocol/src/client/play/c_update_score.rs +++ b/pumpkin-protocol/src/client/play/c_update_score.rs @@ -5,10 +5,8 @@ use serde::Serialize; use crate::{NumberFormat, VarInt}; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::UpdateScore as i32)] +#[client_packet("play:set_score")] pub struct CUpdateScore<'a> { entity_name: &'a str, objective_name: &'a str, diff --git a/pumpkin-protocol/src/client/play/c_worldevent.rs b/pumpkin-protocol/src/client/play/c_worldevent.rs index 3b23cac6e..8a168d39c 100644 --- a/pumpkin-protocol/src/client/play/c_worldevent.rs +++ b/pumpkin-protocol/src/client/play/c_worldevent.rs @@ -3,10 +3,8 @@ use pumpkin_core::math::position::WorldPosition; use pumpkin_macros::client_packet; use serde::Serialize; -use super::ClientboundPlayPackets; - #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::Effect as i32)] +#[client_packet("play:level_event")] pub struct CWorldEvent<'a> { event: i32, location: &'a WorldPosition, diff --git a/pumpkin-protocol/src/client/play/mod.rs b/pumpkin-protocol/src/client/play/mod.rs index 6091ce4d7..fd980bd47 100644 --- a/pumpkin-protocol/src/client/play/mod.rs +++ b/pumpkin-protocol/src/client/play/mod.rs @@ -111,142 +111,3 @@ pub use c_update_objectives::*; pub use c_update_score::*; pub use c_worldevent::*; pub use player_action::*; - -/// DO NOT CHANGE ORDER -/// This Enum has the exact order like vanilla, Vanilla parses their Packet IDs from the enum order. Its also way easier to port. -#[repr(i32)] -pub enum ClientboundPlayPackets { - Bundle, - SpawnEntity, - SpawnExperienceOrb, - EntityAnimation, - Statistics, - AcknowledgeBlockChanges, - BlockBreakAnimation, - BlockEntityData, - BlockAction, - BlockChange, - BossBar, - ServerDifficulty, - ChunkBatchEnd, - ChunkBatchBegin, - ChunkBiomes, - ClearTitles, - TabComplete, - DeclareCommands, - CloseWindow, - WindowItems, - WindowProperty, - SetSlot, - CookieRequest, - SetCooldown, - CustomChatCompletions, - PluginMessage, - DamageEvent, - DebugSample, - DeleteChat, - Disconnect, - DisguisedChat, - EntityStatus, - EntityPositionSync, - Explosion, - UnloadChunk, - ChangeGameState, - OpenHorseWindow, - HurtAnimation, - InitializeWorldBorder, - KeepAlive, - ChunkData, - Effect, - Particle, - UpdateLight, - JoinGame, - MapData, - MerchantOffers, - EntityRelativeMove, - EntityRelativeMoveAndRotation, - MoveMinecart, - EntityRotation, - VehicleMove, - OpenBook, - OpenWindow, - OpenSignEditor, - Ping, - DebugPong, - CraftRecipeResponse, - PlayerAbilities, - ChatMessage, - EndCombatEvent, - EnterCombatEvent, - DeathCombatEvent, - PlayerInfoRemove, - PlayerInfoUpdate, - FacePlayer, - PlayerPositionAndLook, - PlayerRotation, - RecipeBookAdd, - RecipeBookRemove, - RecipeBookSettings, - DestroyEntities, - RemoveEntityEffect, - ResetScore, - ResourcePackRemove, - ResourcePackSend, - Respawn, - EntityHeadLook, - MultiBlockChange, - SelectAdvancementsTab, - ServerData, - ActionBar, - WorldBorderCenter, - WorldBorderLerpSize, - WorldBorderSize, - WorldBorderWarningDelay, - WorldBorderWarningReach, - - Camera, - UpdateViewPosition, - UpdateViewDistance, - SetCursorItem, - SpawnPosition, - DisplayScoreboard, - EntityMetadata, - AttachEntity, - EntityVelocity, - EntityEquipment, - SetExperience, - UpdateHealth, - HeldItemChange, - ScoreboardObjective, - SetPassengers, - SetPlayerInventory, - Teams, - UpdateScore, - UpdateSimulationDistance, - SetTitleSubtitle, - TimeUpdate, - SetTitleText, - SetTitleTimes, - EntitySoundEffect, - SoundEffect, - - ConfigurationStart, - StopSound, - StoreCookie, - SystemChatMessage, - PlayerListHeaderAndFooter, - NBTQueryResponse, - CollectItem, - EntityTeleport, - TickingState, - TickingStep, - Transfer, - UpdateAdvancements, - UpdateAttributes, - EntityEffect, - DeclareRecipes, - Tags, - ProjectilePower, - CustomReportDetails, - ServerLinks, -} diff --git a/pumpkin-protocol/src/client/status/c_ping_response.rs b/pumpkin-protocol/src/client/status/c_ping_response.rs index 746dd1f51..ffe4a480c 100644 --- a/pumpkin-protocol/src/client/status/c_ping_response.rs +++ b/pumpkin-protocol/src/client/status/c_ping_response.rs @@ -1,10 +1,8 @@ use pumpkin_macros::client_packet; use serde::Serialize; -use super::ClientboundStatusPackets; - #[derive(Serialize)] -#[client_packet(ClientboundStatusPackets::PingRequest as i32)] +#[client_packet("status:pong_response")] pub struct CPingResponse { payload: i64, // must responde with the same as in `SPingRequest` } diff --git a/pumpkin-protocol/src/client/status/c_status_response.rs b/pumpkin-protocol/src/client/status/c_status_response.rs index 197ee152c..bfed7dae3 100644 --- a/pumpkin-protocol/src/client/status/c_status_response.rs +++ b/pumpkin-protocol/src/client/status/c_status_response.rs @@ -1,10 +1,8 @@ use pumpkin_macros::client_packet; use serde::Serialize; -use super::ClientboundStatusPackets; - #[derive(Serialize)] -#[client_packet(ClientboundStatusPackets::StatusResponse as i32)] +#[client_packet("status:status_response")] pub struct CStatusResponse<'a> { json_response: &'a str, // 32767 } diff --git a/pumpkin-protocol/src/client/status/mod.rs b/pumpkin-protocol/src/client/status/mod.rs index 3774f3c93..2d96cd61b 100644 --- a/pumpkin-protocol/src/client/status/mod.rs +++ b/pumpkin-protocol/src/client/status/mod.rs @@ -3,11 +3,3 @@ mod c_status_response; pub use c_ping_response::*; pub use c_status_response::*; - -/// DO NOT CHANGE ORDER -/// This Enum has the exact order like vanilla, Vanilla parses their Packet IDs from the enum order. Its also way easier to port. -#[repr(i32)] -pub enum ClientboundStatusPackets { - StatusResponse, - PingRequest, -} diff --git a/pumpkin/src/client/combat.rs b/pumpkin/src/client/combat.rs index 695716e34..ab025cd71 100644 --- a/pumpkin/src/client/combat.rs +++ b/pumpkin/src/client/combat.rs @@ -117,7 +117,7 @@ pub(super) async fn spawn_sweep_particle( 0.0, 0.0, 0, - VarInt(particle!("minecraft:sweep_attack") as i32), // sweep + VarInt(i32::from(particle!("minecraft:sweep_attack"))), // sweep &[], )) .await; diff --git a/pumpkin/src/world/mod.rs b/pumpkin/src/world/mod.rs index 74fd7ab0a..e43ea4054 100644 --- a/pumpkin/src/world/mod.rs +++ b/pumpkin/src/world/mod.rs @@ -108,13 +108,13 @@ impl World { pub async fn play_sound( &self, - sound_id: u32, + sound_id: u16, category: SoundCategory, posistion: &Vector3, ) { let seed = thread_rng().gen::(); self.broadcast_packet_all(&CSoundEffect::new( - sound_id.into(), + VarInt(i32::from(sound_id)), category, posistion.x, posistion.y,