Minior packet changes

This commit is contained in:
Alexander Medvedev 2025-02-23 13:35:22 +01:00
parent f71ec64e22
commit 26b69eae33
146 changed files with 413 additions and 419 deletions

View File

@ -154,26 +154,7 @@ pub fn send_cancellable(input: TokenStream) -> TokenStream {
} }
#[proc_macro_attribute] #[proc_macro_attribute]
pub fn client_packet(input: TokenStream, item: TokenStream) -> TokenStream { pub fn packet(input: TokenStream, item: TokenStream) -> TokenStream {
let ast: syn::DeriveInput = syn::parse(item.clone()).unwrap();
let name = &ast.ident;
let (impl_generics, ty_generics, _) = ast.generics.split_for_impl();
let input: proc_macro2::TokenStream = input.into();
let item: proc_macro2::TokenStream = item.into();
let code = quote! {
#item
impl #impl_generics crate::bytebuf::packet::Packet for #name #ty_generics {
const PACKET_ID: i32 = #input;
}
};
code.into()
}
#[proc_macro_attribute]
pub fn server_packet(input: TokenStream, item: TokenStream) -> TokenStream {
let ast: syn::DeriveInput = syn::parse(item.clone()).unwrap(); let ast: syn::DeriveInput = syn::parse(item.clone()).unwrap();
let name = &ast.ident; let name = &ast.ident;
let (impl_generics, ty_generics, _) = ast.generics.split_for_impl(); let (impl_generics, ty_generics, _) = ast.generics.split_for_impl();

View File

@ -207,7 +207,7 @@ impl<B: BufMut> ser::Serializer for &mut Serializer<B> {
unimplemented!() unimplemented!()
} }
fn serialize_unit_struct(self, _name: &'static str) -> Result<Self::Ok, Self::Error> { fn serialize_unit_struct(self, _name: &'static str) -> Result<Self::Ok, Self::Error> {
todo!() Ok(())
} }
fn serialize_unit_variant( fn serialize_unit_variant(
self, self,

View File

@ -1,12 +1,12 @@
use pumpkin_util::text::TextComponent; use pumpkin_util::text::TextComponent;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use pumpkin_data::packet::clientbound::CONFIG_RESOURCE_PACK_PUSH; use pumpkin_data::packet::clientbound::CONFIG_RESOURCE_PACK_PUSH;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(CONFIG_RESOURCE_PACK_PUSH)] #[packet(CONFIG_RESOURCE_PACK_PUSH)]
pub struct CConfigAddResourcePack<'a> { pub struct CConfigAddResourcePack<'a> {
uuid: uuid::Uuid, uuid: uuid::Uuid,
url: &'a str, url: &'a str,

View File

@ -1,9 +1,9 @@
use pumpkin_macros::client_packet;
use pumpkin_data::packet::clientbound::CONFIG_DISCONNECT; use pumpkin_data::packet::clientbound::CONFIG_DISCONNECT;
use pumpkin_macros::packet;
use serde::Deserialize;
#[derive(serde::Serialize)] #[derive(serde::Serialize, Deserialize)]
#[client_packet(CONFIG_DISCONNECT)] #[packet(CONFIG_DISCONNECT)]
pub struct CConfigDisconnect<'a> { pub struct CConfigDisconnect<'a> {
reason: &'a str, reason: &'a str,
} }

View File

@ -1,10 +1,10 @@
use pumpkin_data::packet::clientbound::CONFIG_COOKIE_REQUEST; use pumpkin_data::packet::clientbound::CONFIG_COOKIE_REQUEST;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use crate::codec::identifier::Identifier; use crate::codec::identifier::Identifier;
#[derive(serde::Serialize)] #[derive(serde::Serialize)]
#[client_packet(CONFIG_COOKIE_REQUEST)] #[packet(CONFIG_COOKIE_REQUEST)]
/// Requests a cookie that was previously stored. /// Requests a cookie that was previously stored.
pub struct CCookieRequest<'a> { pub struct CCookieRequest<'a> {
key: &'a Identifier, key: &'a Identifier,

View File

@ -1,18 +1,7 @@
use pumpkin_data::packet::clientbound::CONFIG_FINISH_CONFIGURATION; use pumpkin_data::packet::clientbound::CONFIG_FINISH_CONFIGURATION;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize;
#[derive(serde::Serialize)] #[derive(Serialize)]
#[client_packet(CONFIG_FINISH_CONFIGURATION)] #[packet(CONFIG_FINISH_CONFIGURATION)]
pub struct CFinishConfig {} pub struct CFinishConfig;
impl Default for CFinishConfig {
fn default() -> Self {
Self::new()
}
}
impl CFinishConfig {
pub fn new() -> Self {
Self {}
}
}

View File

@ -1,10 +1,10 @@
use bytes::BufMut; use bytes::BufMut;
use pumpkin_data::packet::clientbound::CONFIG_SELECT_KNOWN_PACKS; use pumpkin_data::packet::clientbound::CONFIG_SELECT_KNOWN_PACKS;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use crate::{ClientPacket, KnownPack, bytebuf::ByteBufMut}; use crate::{ClientPacket, KnownPack, bytebuf::ByteBufMut};
#[client_packet(CONFIG_SELECT_KNOWN_PACKS)] #[packet(CONFIG_SELECT_KNOWN_PACKS)]
pub struct CKnownPacks<'a> { pub struct CKnownPacks<'a> {
known_packs: &'a [KnownPack<'a>], known_packs: &'a [KnownPack<'a>],
} }

View File

@ -1,9 +1,9 @@
use pumpkin_data::packet::clientbound::CONFIG_CUSTOM_PAYLOAD; use pumpkin_data::packet::clientbound::CONFIG_CUSTOM_PAYLOAD;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(CONFIG_CUSTOM_PAYLOAD)] #[packet(CONFIG_CUSTOM_PAYLOAD)]
pub struct CPluginMessage<'a> { pub struct CPluginMessage<'a> {
channel: &'a str, channel: &'a str,
data: &'a [u8], data: &'a [u8],

View File

@ -1,11 +1,11 @@
use bytes::BufMut; use bytes::BufMut;
use pumpkin_data::packet::clientbound::CONFIG_REGISTRY_DATA; use pumpkin_data::packet::clientbound::CONFIG_REGISTRY_DATA;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::{ClientPacket, bytebuf::ByteBufMut, codec::identifier::Identifier}; use crate::{ClientPacket, bytebuf::ByteBufMut, codec::identifier::Identifier};
#[client_packet(CONFIG_REGISTRY_DATA)] #[packet(CONFIG_REGISTRY_DATA)]
pub struct CRegistryData<'a> { pub struct CRegistryData<'a> {
registry_id: &'a Identifier, registry_id: &'a Identifier,
entries: &'a [RegistryEntry], entries: &'a [RegistryEntry],

View File

@ -1,10 +1,10 @@
use crate::{Link, VarInt}; use crate::{Link, VarInt};
use pumpkin_data::packet::clientbound::CONFIG_SERVER_LINKS; use pumpkin_data::packet::clientbound::CONFIG_SERVER_LINKS;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(CONFIG_SERVER_LINKS)] #[packet(CONFIG_SERVER_LINKS)]
pub struct CConfigServerLinks<'a> { pub struct CConfigServerLinks<'a> {
links_count: &'a VarInt, links_count: &'a VarInt,
links: &'a [Link<'a>], links: &'a [Link<'a>],

View File

@ -1,9 +1,9 @@
use crate::{VarInt, codec::identifier::Identifier}; use crate::{VarInt, codec::identifier::Identifier};
use pumpkin_data::packet::clientbound::CONFIG_STORE_COOKIE; use pumpkin_data::packet::clientbound::CONFIG_STORE_COOKIE;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
#[derive(serde::Serialize)] #[derive(serde::Serialize)]
#[client_packet(CONFIG_STORE_COOKIE)] #[packet(CONFIG_STORE_COOKIE)]
/// Stores some arbitrary data on the client, which persists between server transfers. /// Stores some arbitrary data on the client, which persists between server transfers.
/// The Notchian (vanilla) client only accepts cookies of up to 5 kiB in size. /// The Notchian (vanilla) client only accepts cookies of up to 5 kiB in size.
pub struct CStoreCookie<'a> { pub struct CStoreCookie<'a> {

View File

@ -1,10 +1,10 @@
use crate::VarInt; use crate::VarInt;
use pumpkin_data::packet::clientbound::CONFIG_TRANSFER; use pumpkin_data::packet::clientbound::CONFIG_TRANSFER;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(CONFIG_TRANSFER)] #[packet(CONFIG_TRANSFER)]
pub struct CTransfer<'a> { pub struct CTransfer<'a> {
host: &'a str, host: &'a str,
port: &'a VarInt, port: &'a VarInt,

View File

@ -4,7 +4,7 @@ use pumpkin_data::{
packet::clientbound::CONFIG_UPDATE_TAGS, packet::clientbound::CONFIG_UPDATE_TAGS,
tag::{RegistryKey, TAGS}, tag::{RegistryKey, TAGS},
}; };
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use pumpkin_world::block::registry; use pumpkin_world::block::registry;
use crate::{ use crate::{
@ -13,7 +13,7 @@ use crate::{
codec::{identifier::Identifier, var_int::VarInt}, codec::{identifier::Identifier, var_int::VarInt},
}; };
#[client_packet(CONFIG_UPDATE_TAGS)] #[packet(CONFIG_UPDATE_TAGS)]
pub struct CUpdateTags<'a> { pub struct CUpdateTags<'a> {
tags: &'a [pumpkin_data::tag::RegistryKey], tags: &'a [pumpkin_data::tag::RegistryKey],
} }

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::LOGIN_COOKIE_REQUEST; use pumpkin_data::packet::clientbound::LOGIN_COOKIE_REQUEST;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::codec::identifier::Identifier; use crate::codec::identifier::Identifier;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(LOGIN_COOKIE_REQUEST)] #[packet(LOGIN_COOKIE_REQUEST)]
/// Requests a cookie that was previously stored. /// Requests a cookie that was previously stored.
pub struct CLoginCookieRequest<'a> { pub struct CLoginCookieRequest<'a> {
key: &'a Identifier, key: &'a Identifier,

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::LOGIN_HELLO; use pumpkin_data::packet::clientbound::LOGIN_HELLO;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::{Deserialize, Serialize};
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize, Deserialize)]
#[client_packet(LOGIN_HELLO)] #[packet(LOGIN_HELLO)]
pub struct CEncryptionRequest<'a> { pub struct CEncryptionRequest<'a> {
server_id: &'a str, // 20 server_id: &'a str, // 20
public_key_length: VarInt, public_key_length: VarInt,

View File

@ -1,9 +1,9 @@
use pumpkin_data::packet::clientbound::LOGIN_LOGIN_DISCONNECT; use pumpkin_data::packet::clientbound::LOGIN_LOGIN_DISCONNECT;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::{Deserialize, Serialize};
#[derive(Serialize)] #[derive(Serialize, Deserialize)]
#[client_packet(LOGIN_LOGIN_DISCONNECT)] #[packet(LOGIN_LOGIN_DISCONNECT)]
pub struct CLoginDisconnect<'a> { pub struct CLoginDisconnect<'a> {
json_reason: &'a str, json_reason: &'a str,
} }

View File

@ -1,10 +1,10 @@
use bytes::BufMut; use bytes::BufMut;
use pumpkin_data::packet::clientbound::LOGIN_LOGIN_FINISHED; use pumpkin_data::packet::clientbound::LOGIN_LOGIN_FINISHED;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use crate::{ClientPacket, Property, bytebuf::ByteBufMut}; use crate::{ClientPacket, Property, bytebuf::ByteBufMut};
#[client_packet(LOGIN_LOGIN_FINISHED)] #[packet(LOGIN_LOGIN_FINISHED)]
pub struct CLoginSuccess<'a> { pub struct CLoginSuccess<'a> {
pub uuid: &'a uuid::Uuid, pub uuid: &'a uuid::Uuid,
pub username: &'a str, // 16 pub username: &'a str, // 16

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::LOGIN_CUSTOM_QUERY; use pumpkin_data::packet::clientbound::LOGIN_CUSTOM_QUERY;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(LOGIN_CUSTOM_QUERY)] #[packet(LOGIN_CUSTOM_QUERY)]
pub struct CLoginPluginRequest<'a> { pub struct CLoginPluginRequest<'a> {
message_id: VarInt, message_id: VarInt,
channel: &'a str, channel: &'a str,

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::LOGIN_LOGIN_COMPRESSION; use pumpkin_data::packet::clientbound::LOGIN_LOGIN_COMPRESSION;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::{Deserialize, Serialize};
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize, Deserialize)]
#[client_packet(LOGIN_LOGIN_COMPRESSION)] #[packet(LOGIN_LOGIN_COMPRESSION)]
pub struct CSetCompression { pub struct CSetCompression {
threshold: VarInt, threshold: VarInt,
} }

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::PLAY_BLOCK_CHANGED_ACK; use pumpkin_data::packet::clientbound::PLAY_BLOCK_CHANGED_ACK;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::{Deserialize, Serialize};
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize, Deserialize)]
#[client_packet(PLAY_BLOCK_CHANGED_ACK)] #[packet(PLAY_BLOCK_CHANGED_ACK)]
pub struct CAcknowledgeBlockChange { pub struct CAcknowledgeBlockChange {
sequence_id: VarInt, sequence_id: VarInt,
} }

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::PLAY_SET_ACTION_BAR_TEXT; use pumpkin_data::packet::clientbound::PLAY_SET_ACTION_BAR_TEXT;
use pumpkin_util::text::TextComponent; use pumpkin_util::text::TextComponent;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_SET_ACTION_BAR_TEXT)] #[packet(PLAY_SET_ACTION_BAR_TEXT)]
pub struct CActionBar<'a> { pub struct CActionBar<'a> {
action_bar: &'a TextComponent, action_bar: &'a TextComponent,
} }

View File

@ -1,13 +1,13 @@
use pumpkin_data::packet::clientbound::PLAY_BLOCK_DESTRUCTION; use pumpkin_data::packet::clientbound::PLAY_BLOCK_DESTRUCTION;
use pumpkin_util::math::position::BlockPos; use pumpkin_util::math::position::BlockPos;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_BLOCK_DESTRUCTION)] #[packet(PLAY_BLOCK_DESTRUCTION)]
pub struct CSetBlockDestroyStage { pub struct CSetBlockDestroyStage {
entity_id: VarInt, entity_id: VarInt,
location: BlockPos, location: BlockPos,

View File

@ -1,12 +1,12 @@
use pumpkin_data::packet::clientbound::PLAY_BLOCK_ENTITY_DATA; use pumpkin_data::packet::clientbound::PLAY_BLOCK_ENTITY_DATA;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use pumpkin_util::math::position::BlockPos; use pumpkin_util::math::position::BlockPos;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_BLOCK_ENTITY_DATA)] #[packet(PLAY_BLOCK_ENTITY_DATA)]
pub struct CBlockEntityData { pub struct CBlockEntityData {
location: BlockPos, location: BlockPos,
r#type: VarInt, r#type: VarInt,

View File

@ -1,13 +1,13 @@
use pumpkin_data::packet::clientbound::PLAY_BLOCK_EVENT; use pumpkin_data::packet::clientbound::PLAY_BLOCK_EVENT;
use pumpkin_util::math::position::BlockPos; use pumpkin_util::math::position::BlockPos;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_BLOCK_EVENT)] #[packet(PLAY_BLOCK_EVENT)]
pub struct CBlockAction<'a> { pub struct CBlockAction<'a> {
location: &'a BlockPos, location: &'a BlockPos,
action_id: u8, action_id: u8,

View File

@ -1,13 +1,13 @@
use pumpkin_data::packet::clientbound::PLAY_BLOCK_UPDATE; use pumpkin_data::packet::clientbound::PLAY_BLOCK_UPDATE;
use pumpkin_util::math::position::BlockPos; use pumpkin_util::math::position::BlockPos;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_BLOCK_UPDATE)] #[packet(PLAY_BLOCK_UPDATE)]
pub struct CBlockUpdate<'a> { pub struct CBlockUpdate<'a> {
location: &'a BlockPos, location: &'a BlockPos,
block_id: VarInt, block_id: VarInt,

View File

@ -3,9 +3,9 @@ use crate::client::play::bossevent_action::BosseventAction;
use crate::{ClientPacket, VarInt}; use crate::{ClientPacket, VarInt};
use bytes::BufMut; use bytes::BufMut;
use pumpkin_data::packet::clientbound::PLAY_BOSS_EVENT; use pumpkin_data::packet::clientbound::PLAY_BOSS_EVENT;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
#[client_packet(PLAY_BOSS_EVENT)] #[packet(PLAY_BOSS_EVENT)]
pub struct CBossEvent<'a> { pub struct CBossEvent<'a> {
pub uuid: &'a uuid::Uuid, pub uuid: &'a uuid::Uuid,
pub action: BosseventAction, pub action: BosseventAction,

View File

@ -1,10 +1,10 @@
use pumpkin_data::packet::clientbound::PLAY_SET_CHUNK_CACHE_CENTER; use pumpkin_data::packet::clientbound::PLAY_SET_CHUNK_CACHE_CENTER;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use crate::VarInt; use crate::VarInt;
#[derive(serde::Serialize)] #[derive(serde::Serialize)]
#[client_packet(PLAY_SET_CHUNK_CACHE_CENTER)] #[packet(PLAY_SET_CHUNK_CACHE_CENTER)]
pub struct CCenterChunk { pub struct CCenterChunk {
pub chunk_x: VarInt, pub chunk_x: VarInt,
pub chunk_z: VarInt, pub chunk_z: VarInt,

View File

@ -1,9 +1,9 @@
use pumpkin_data::packet::clientbound::PLAY_CHANGE_DIFFICULTY; use pumpkin_data::packet::clientbound::PLAY_CHANGE_DIFFICULTY;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_CHANGE_DIFFICULTY)] #[packet(PLAY_CHANGE_DIFFICULTY)]
pub struct CChangeDifficulty { pub struct CChangeDifficulty {
difficulty: u8, difficulty: u8,
locked: bool, locked: bool,

View File

@ -2,13 +2,13 @@ use crate::{ClientPacket, VarInt, bytebuf::ByteBufMut, codec::bit_set::BitSet};
use bytes::{BufMut, BytesMut}; use bytes::{BufMut, BytesMut};
use pumpkin_data::packet::clientbound::PLAY_LEVEL_CHUNK_WITH_LIGHT; use pumpkin_data::packet::clientbound::PLAY_LEVEL_CHUNK_WITH_LIGHT;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use pumpkin_world::{ use pumpkin_world::{
DIRECT_PALETTE_BITS, DIRECT_PALETTE_BITS,
chunk::{ChunkData, SUBCHUNKS_COUNT}, chunk::{ChunkData, SUBCHUNKS_COUNT},
}; };
#[client_packet(PLAY_LEVEL_CHUNK_WITH_LIGHT)] #[packet(PLAY_LEVEL_CHUNK_WITH_LIGHT)]
pub struct CChunkData<'a>(pub &'a ChunkData); pub struct CChunkData<'a>(pub &'a ChunkData);
impl ClientPacket for CChunkData<'_> { impl ClientPacket for CChunkData<'_> {

View File

@ -1,9 +1,9 @@
use pumpkin_data::packet::clientbound::PLAY_CLEAR_TITLES; use pumpkin_data::packet::clientbound::PLAY_CLEAR_TITLES;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_CLEAR_TITLES)] #[packet(PLAY_CLEAR_TITLES)]
pub struct CClearTtitle { pub struct CClearTtitle {
reset: bool, reset: bool,
} }

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::PLAY_CONTAINER_CLOSE; use pumpkin_data::packet::clientbound::PLAY_CONTAINER_CLOSE;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_CONTAINER_CLOSE)] #[packet(PLAY_CONTAINER_CLOSE)]
pub struct CCloseContainer { pub struct CCloseContainer {
window_id: VarInt, window_id: VarInt,
} }

View File

@ -1,12 +1,12 @@
use pumpkin_data::packet::clientbound::PLAY_PLAYER_COMBAT_KILL; use pumpkin_data::packet::clientbound::PLAY_PLAYER_COMBAT_KILL;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use pumpkin_util::text::TextComponent; use pumpkin_util::text::TextComponent;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_PLAYER_COMBAT_KILL)] #[packet(PLAY_PLAYER_COMBAT_KILL)]
pub struct CCombatDeath<'a> { pub struct CCombatDeath<'a> {
player_id: VarInt, player_id: VarInt,
message: &'a TextComponent, message: &'a TextComponent,

View File

@ -1,11 +1,11 @@
use bytes::BufMut; use bytes::BufMut;
use pumpkin_data::packet::clientbound::PLAY_COMMAND_SUGGESTIONS; use pumpkin_data::packet::clientbound::PLAY_COMMAND_SUGGESTIONS;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use pumpkin_util::text::TextComponent; use pumpkin_util::text::TextComponent;
use crate::{ClientPacket, VarInt, bytebuf::ByteBufMut}; use crate::{ClientPacket, VarInt, bytebuf::ByteBufMut};
#[client_packet(PLAY_COMMAND_SUGGESTIONS)] #[packet(PLAY_COMMAND_SUGGESTIONS)]
pub struct CCommandSuggestions { pub struct CCommandSuggestions {
id: VarInt, id: VarInt,
start: VarInt, start: VarInt,

View File

@ -1,10 +1,10 @@
use bytes::BufMut; use bytes::BufMut;
use pumpkin_data::packet::clientbound::PLAY_COMMANDS; use pumpkin_data::packet::clientbound::PLAY_COMMANDS;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use crate::{ClientPacket, VarInt, bytebuf::ByteBufMut}; use crate::{ClientPacket, VarInt, bytebuf::ByteBufMut};
#[client_packet(PLAY_COMMANDS)] #[packet(PLAY_COMMANDS)]
pub struct CCommands<'a> { pub struct CCommands<'a> {
pub nodes: Vec<ProtoNode<'a>>, pub nodes: Vec<ProtoNode<'a>>,
pub root_node_index: VarInt, pub root_node_index: VarInt,

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::PLAY_COOKIE_REQUEST; use pumpkin_data::packet::clientbound::PLAY_COOKIE_REQUEST;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::codec::identifier::Identifier; use crate::codec::identifier::Identifier;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_COOKIE_REQUEST)] #[packet(PLAY_COOKIE_REQUEST)]
/// Requests a cookie that was previously stored. /// Requests a cookie that was previously stored.
pub struct CPlayCookieRequest<'a> { pub struct CPlayCookieRequest<'a> {
key: &'a Identifier, key: &'a Identifier,

View File

@ -1,12 +1,12 @@
use pumpkin_data::packet::clientbound::PLAY_DAMAGE_EVENT; use pumpkin_data::packet::clientbound::PLAY_DAMAGE_EVENT;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use pumpkin_util::math::vector3::Vector3; use pumpkin_util::math::vector3::Vector3;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_DAMAGE_EVENT)] #[packet(PLAY_DAMAGE_EVENT)]
pub struct CDamageEvent { pub struct CDamageEvent {
entity_id: VarInt, entity_id: VarInt,
source_type_id: VarInt, source_type_id: VarInt,

View File

@ -1,17 +1,17 @@
use pumpkin_data::packet::clientbound::PLAY_DISCONNECT; use pumpkin_data::packet::clientbound::PLAY_DISCONNECT;
use pumpkin_util::text::TextComponent; use pumpkin_util::text::TextComponent;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::{Deserialize, Serialize};
#[derive(Serialize)] #[derive(Serialize, Deserialize)]
#[client_packet(PLAY_DISCONNECT)] #[packet(PLAY_DISCONNECT)]
pub struct CPlayDisconnect<'a> { pub struct CPlayDisconnect {
reason: &'a TextComponent, reason: TextComponent,
} }
impl<'a> CPlayDisconnect<'a> { impl CPlayDisconnect {
pub fn new(reason: &'a TextComponent) -> Self { pub fn new(reason: TextComponent) -> Self {
Self { reason } Self { reason }
} }
} }

View File

@ -1,13 +1,13 @@
use pumpkin_data::packet::clientbound::PLAY_DISGUISED_CHAT; use pumpkin_data::packet::clientbound::PLAY_DISGUISED_CHAT;
use pumpkin_util::text::TextComponent; use pumpkin_util::text::TextComponent;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_DISGUISED_CHAT)] #[packet(PLAY_DISGUISED_CHAT)]
pub struct CDisguisedChatMessage<'a> { pub struct CDisguisedChatMessage<'a> {
message: &'a TextComponent, message: &'a TextComponent,
chat_type: VarInt, chat_type: VarInt,

View File

@ -1,13 +1,13 @@
use pumpkin_data::{ use pumpkin_data::{
packet::clientbound::PLAY_SET_DISPLAY_OBJECTIVE, scoreboard::ScoreboardDisplaySlot, packet::clientbound::PLAY_SET_DISPLAY_OBJECTIVE, scoreboard::ScoreboardDisplaySlot,
}; };
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_SET_DISPLAY_OBJECTIVE)] #[packet(PLAY_SET_DISPLAY_OBJECTIVE)]
pub struct CDisplayObjective<'a> { pub struct CDisplayObjective<'a> {
position: VarInt, position: VarInt,
score_name: &'a str, score_name: &'a str,

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::PLAY_ANIMATE; use pumpkin_data::packet::clientbound::PLAY_ANIMATE;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_ANIMATE)] #[packet(PLAY_ANIMATE)]
pub struct CEntityAnimation { pub struct CEntityAnimation {
entity_id: VarInt, entity_id: VarInt,
/// See `Animation` /// See `Animation`

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::PLAY_SET_ENTITY_DATA; use pumpkin_data::packet::clientbound::PLAY_SET_ENTITY_DATA;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_SET_ENTITY_DATA)] #[packet(PLAY_SET_ENTITY_DATA)]
pub struct CSetEntityMetadata<T> { pub struct CSetEntityMetadata<T> {
entity_id: VarInt, entity_id: VarInt,
metadata: Metadata<T>, metadata: Metadata<T>,

View File

@ -1,10 +1,10 @@
use bytes::BufMut; use bytes::BufMut;
use pumpkin_data::{packet::clientbound::PLAY_SOUND_ENTITY, sound::SoundCategory}; use pumpkin_data::{packet::clientbound::PLAY_SOUND_ENTITY, sound::SoundCategory};
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use crate::{ClientPacket, IDOrSoundEvent, SoundEvent, VarInt, bytebuf::ByteBufMut}; use crate::{ClientPacket, IDOrSoundEvent, SoundEvent, VarInt, bytebuf::ByteBufMut};
#[client_packet(PLAY_SOUND_ENTITY)] #[packet(PLAY_SOUND_ENTITY)]
pub struct CEntitySoundEffect { pub struct CEntitySoundEffect {
sound_event: IDOrSoundEvent, sound_event: IDOrSoundEvent,
sound_category: VarInt, sound_category: VarInt,

View File

@ -1,9 +1,9 @@
use pumpkin_data::packet::clientbound::PLAY_ENTITY_EVENT; use pumpkin_data::packet::clientbound::PLAY_ENTITY_EVENT;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::{Deserialize, Serialize};
#[derive(Serialize)] #[derive(Serialize, Deserialize)]
#[client_packet(PLAY_ENTITY_EVENT)] #[packet(PLAY_ENTITY_EVENT)]
pub struct CEntityStatus { pub struct CEntityStatus {
entity_id: i32, entity_id: i32,
entity_status: i8, entity_status: i8,

View File

@ -1,19 +1,19 @@
use pumpkin_data::packet::clientbound::PLAY_SET_ENTITY_MOTION; use pumpkin_data::packet::clientbound::PLAY_SET_ENTITY_MOTION;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use pumpkin_util::math::vector3::Vector3; use pumpkin_util::math::vector3::Vector3;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_SET_ENTITY_MOTION)] #[packet(PLAY_SET_ENTITY_MOTION)]
pub struct CEntityVelocity<'a> { pub struct CEntityVelocity {
entity_id: &'a VarInt, entity_id: VarInt,
velocity: Vector3<i16>, velocity: Vector3<i16>,
} }
impl<'a> CEntityVelocity<'a> { impl CEntityVelocity {
pub fn new(entity_id: &'a VarInt, velocity_x: f64, velocity_y: f64, velocity_z: f64) -> Self { pub fn new(entity_id: VarInt, velocity_x: f64, velocity_y: f64, velocity_z: f64) -> Self {
Self { Self {
entity_id, entity_id,
velocity: Vector3::new( velocity: Vector3::new(

View File

@ -1,9 +1,9 @@
use pumpkin_data::packet::clientbound::PLAY_GAME_EVENT; use pumpkin_data::packet::clientbound::PLAY_GAME_EVENT;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::{Deserialize, Serialize};
#[derive(Serialize)] #[derive(Serialize, Deserialize)]
#[client_packet(PLAY_GAME_EVENT)] #[packet(PLAY_GAME_EVENT)]
pub struct CGameEvent { pub struct CGameEvent {
event: u8, event: u8,
value: f32, value: f32,

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::PLAY_ROTATE_HEAD; use pumpkin_data::packet::clientbound::PLAY_ROTATE_HEAD;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::{Deserialize, Serialize};
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize, Deserialize)]
#[client_packet(PLAY_ROTATE_HEAD)] #[packet(PLAY_ROTATE_HEAD)]
pub struct CHeadRot { pub struct CHeadRot {
entity_id: VarInt, entity_id: VarInt,
head_yaw: u8, head_yaw: u8,

View File

@ -1,18 +1,18 @@
use pumpkin_data::packet::clientbound::PLAY_HURT_ANIMATION; use pumpkin_data::packet::clientbound::PLAY_HURT_ANIMATION;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::{Deserialize, Serialize};
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize, Deserialize)]
#[client_packet(PLAY_HURT_ANIMATION)] #[packet(PLAY_HURT_ANIMATION)]
pub struct CHurtAnimation<'a> { pub struct CHurtAnimation {
entity_id: &'a VarInt, entity_id: VarInt,
yaw: f32, yaw: f32,
} }
impl<'a> CHurtAnimation<'a> { impl CHurtAnimation {
pub fn new(entity_id: &'a VarInt, yaw: f32) -> Self { pub fn new(entity_id: VarInt, yaw: f32) -> Self {
Self { entity_id, yaw } Self { entity_id, yaw }
} }
} }

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::PLAY_INITIALIZE_BORDER; use pumpkin_data::packet::clientbound::PLAY_INITIALIZE_BORDER;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::{VarInt, codec::var_long::VarLong}; use crate::{VarInt, codec::var_long::VarLong};
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_INITIALIZE_BORDER)] #[packet(PLAY_INITIALIZE_BORDER)]
pub struct CInitializeWorldBorder { pub struct CInitializeWorldBorder {
x: f64, x: f64,
z: f64, z: f64,

View File

@ -1,9 +1,9 @@
use pumpkin_data::packet::clientbound::PLAY_KEEP_ALIVE; use pumpkin_data::packet::clientbound::PLAY_KEEP_ALIVE;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::{Deserialize, Serialize};
#[derive(Serialize)] #[derive(Serialize, Deserialize)]
#[client_packet(PLAY_KEEP_ALIVE)] #[packet(PLAY_KEEP_ALIVE)]
pub struct CKeepAlive { pub struct CKeepAlive {
keep_alive_id: i64, keep_alive_id: i64,
} }

View File

@ -1,10 +1,10 @@
use pumpkin_data::packet::clientbound::PLAY_LEVEL_EVENT; use pumpkin_data::packet::clientbound::PLAY_LEVEL_EVENT;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use pumpkin_util::math::position::BlockPos; use pumpkin_util::math::position::BlockPos;
use serde::Serialize; use serde::{Deserialize, Serialize};
#[derive(Serialize)] #[derive(Serialize, Deserialize)]
#[client_packet(PLAY_LEVEL_EVENT)] #[packet(PLAY_LEVEL_EVENT)]
pub struct CLevelEvent { pub struct CLevelEvent {
event: i32, event: i32,
location: BlockPos, location: BlockPos,

View File

@ -1,13 +1,13 @@
use pumpkin_data::packet::clientbound::PLAY_LOGIN; use pumpkin_data::packet::clientbound::PLAY_LOGIN;
use pumpkin_util::math::position::BlockPos; use pumpkin_util::math::position::BlockPos;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::{VarInt, codec::identifier::Identifier}; use crate::{VarInt, codec::identifier::Identifier};
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_LOGIN)] #[packet(PLAY_LOGIN)]
pub struct CLogin<'a> { pub struct CLogin<'a> {
entity_id: i32, entity_id: i32,
is_hardcore: bool, is_hardcore: bool,

View File

@ -1,13 +1,13 @@
use pumpkin_data::packet::clientbound::PLAY_OPEN_SCREEN; use pumpkin_data::packet::clientbound::PLAY_OPEN_SCREEN;
use pumpkin_util::text::TextComponent; use pumpkin_util::text::TextComponent;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_OPEN_SCREEN)] #[packet(PLAY_OPEN_SCREEN)]
pub struct COpenScreen<'a> { pub struct COpenScreen<'a> {
window_id: VarInt, window_id: VarInt,
window_type: VarInt, window_type: VarInt,

View File

@ -1,10 +1,10 @@
use pumpkin_data::packet::clientbound::PLAY_OPEN_SIGN_EDITOR; use pumpkin_data::packet::clientbound::PLAY_OPEN_SIGN_EDITOR;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use pumpkin_util::math::position::BlockPos; use pumpkin_util::math::position::BlockPos;
use serde::Serialize; use serde::Serialize;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_OPEN_SIGN_EDITOR)] #[packet(PLAY_OPEN_SIGN_EDITOR)]
pub struct COpenSignEditor { pub struct COpenSignEditor {
location: BlockPos, location: BlockPos,
is_front_text: bool, is_front_text: bool,

View File

@ -1,12 +1,12 @@
use pumpkin_data::packet::clientbound::PLAY_LEVEL_PARTICLES; use pumpkin_data::packet::clientbound::PLAY_LEVEL_PARTICLES;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use pumpkin_util::math::vector3::Vector3; use pumpkin_util::math::vector3::Vector3;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_LEVEL_PARTICLES)] #[packet(PLAY_LEVEL_PARTICLES)]
pub struct CParticle<'a> { pub struct CParticle<'a> {
force_spawn: bool, force_spawn: bool,
/// If true, particle distance increases from 256 to 65536. /// If true, particle distance increases from 256 to 65536.

View File

@ -1,9 +1,9 @@
use pumpkin_data::packet::clientbound::PLAY_PONG_RESPONSE; use pumpkin_data::packet::clientbound::PLAY_PONG_RESPONSE;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::{Deserialize, Serialize};
#[derive(Serialize)] #[derive(Serialize, Deserialize)]
#[client_packet(PLAY_PONG_RESPONSE)] #[packet(PLAY_PONG_RESPONSE)]
pub struct CPingResponse { pub struct CPingResponse {
payload: i64, payload: i64,
} }

View File

@ -1,9 +1,9 @@
use pumpkin_data::packet::clientbound::PLAY_PLAYER_ABILITIES; use pumpkin_data::packet::clientbound::PLAY_PLAYER_ABILITIES;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_PLAYER_ABILITIES)] #[packet(PLAY_PLAYER_ABILITIES)]
pub struct CPlayerAbilities { pub struct CPlayerAbilities {
flags: i8, flags: i8,
flying_speed: f32, flying_speed: f32,

View File

@ -1,13 +1,13 @@
use pumpkin_data::packet::clientbound::PLAY_PLAYER_CHAT; use pumpkin_data::packet::clientbound::PLAY_PLAYER_CHAT;
use pumpkin_util::text::TextComponent; use pumpkin_util::text::TextComponent;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::{VarInt, codec::bit_set::BitSet}; use crate::{VarInt, codec::bit_set::BitSet};
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_PLAYER_CHAT)] #[packet(PLAY_PLAYER_CHAT)]
pub struct CPlayerChatMessage<'a> { pub struct CPlayerChatMessage<'a> {
#[serde(with = "uuid::serde::compact")] #[serde(with = "uuid::serde::compact")]
sender: uuid::Uuid, sender: uuid::Uuid,

View File

@ -1,12 +1,12 @@
use bytes::BufMut; use bytes::BufMut;
use pumpkin_data::packet::clientbound::PLAY_PLAYER_INFO_UPDATE; use pumpkin_data::packet::clientbound::PLAY_PLAYER_INFO_UPDATE;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use crate::{ClientPacket, Property, bytebuf::ByteBufMut}; use crate::{ClientPacket, Property, bytebuf::ByteBufMut};
use super::PlayerAction; use super::PlayerAction;
#[client_packet(PLAY_PLAYER_INFO_UPDATE)] #[packet(PLAY_PLAYER_INFO_UPDATE)]
pub struct CPlayerInfoUpdate<'a> { pub struct CPlayerInfoUpdate<'a> {
pub actions: i8, pub actions: i8,
pub players: &'a [Player<'a>], pub players: &'a [Player<'a>],

View File

@ -1,11 +1,11 @@
use bytes::BufMut; use bytes::BufMut;
use pumpkin_data::packet::clientbound::PLAY_PLAYER_POSITION; use pumpkin_data::packet::clientbound::PLAY_PLAYER_POSITION;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use pumpkin_util::math::vector3::Vector3; use pumpkin_util::math::vector3::Vector3;
use crate::{ClientPacket, PositionFlag, VarInt, bytebuf::ByteBufMut}; use crate::{ClientPacket, PositionFlag, VarInt, bytebuf::ByteBufMut};
#[client_packet(PLAY_PLAYER_POSITION)] #[packet(PLAY_PLAYER_POSITION)]
pub struct CPlayerPosition<'a> { pub struct CPlayerPosition<'a> {
teleport_id: VarInt, teleport_id: VarInt,
position: Vector3<f64>, position: Vector3<f64>,

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::PLAY_PLAYER_INFO_REMOVE; use pumpkin_data::packet::clientbound::PLAY_PLAYER_INFO_REMOVE;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::{Serialize, ser::SerializeSeq}; use serde::{Serialize, ser::SerializeSeq};
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_PLAYER_INFO_REMOVE)] #[packet(PLAY_PLAYER_INFO_REMOVE)]
pub struct CRemovePlayerInfo<'a> { pub struct CRemovePlayerInfo<'a> {
players_count: VarInt, players_count: VarInt,
#[serde(serialize_with = "serialize_slice_uuids")] #[serde(serialize_with = "serialize_slice_uuids")]

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::PLAY_REMOVE_ENTITIES; use pumpkin_data::packet::clientbound::PLAY_REMOVE_ENTITIES;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_REMOVE_ENTITIES)] #[packet(PLAY_REMOVE_ENTITIES)]
pub struct CRemoveEntities<'a> { pub struct CRemoveEntities<'a> {
count: VarInt, count: VarInt,
entity_ids: &'a [VarInt], entity_ids: &'a [VarInt],

View File

@ -1,9 +1,9 @@
use pumpkin_data::packet::clientbound::PLAY_RESET_SCORE; use pumpkin_data::packet::clientbound::PLAY_RESET_SCORE;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_RESET_SCORE)] #[packet(PLAY_RESET_SCORE)]
pub struct CResetScore { pub struct CResetScore {
entity_name: String, entity_name: String,
objective_name: Option<String>, objective_name: Option<String>,

View File

@ -1,12 +1,12 @@
use pumpkin_data::packet::clientbound::PLAY_RESPAWN; use pumpkin_data::packet::clientbound::PLAY_RESPAWN;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use pumpkin_util::math::position::BlockPos; use pumpkin_util::math::position::BlockPos;
use serde::Serialize; use serde::{Deserialize, Serialize};
use crate::{VarInt, codec::identifier::Identifier}; use crate::{VarInt, codec::identifier::Identifier};
#[derive(Serialize)] #[derive(Serialize, Deserialize)]
#[client_packet(PLAY_RESPAWN)] #[packet(PLAY_RESPAWN)]
pub struct CRespawn { pub struct CRespawn {
dimension_type: VarInt, dimension_type: VarInt,
dimension_name: Identifier, dimension_name: Identifier,

View File

@ -1,10 +1,10 @@
use crate::{Link, VarInt}; use crate::{Link, VarInt};
use pumpkin_data::packet::clientbound::PLAY_SERVER_LINKS; use pumpkin_data::packet::clientbound::PLAY_SERVER_LINKS;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_SERVER_LINKS)] #[packet(PLAY_SERVER_LINKS)]
pub struct CPlayServerLinks<'a> { pub struct CPlayServerLinks<'a> {
links_count: &'a VarInt, links_count: &'a VarInt,
links: &'a [Link<'a>], links: &'a [Link<'a>],

View File

@ -1,9 +1,9 @@
use pumpkin_data::packet::clientbound::PLAY_SET_BORDER_CENTER; use pumpkin_data::packet::clientbound::PLAY_SET_BORDER_CENTER;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_SET_BORDER_CENTER)] #[packet(PLAY_SET_BORDER_CENTER)]
pub struct CSetBorderCenter { pub struct CSetBorderCenter {
x: f64, x: f64,
z: f64, z: f64,

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::PLAY_SET_BORDER_LERP_SIZE; use pumpkin_data::packet::clientbound::PLAY_SET_BORDER_LERP_SIZE;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::codec::var_long::VarLong; use crate::codec::var_long::VarLong;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_SET_BORDER_LERP_SIZE)] #[packet(PLAY_SET_BORDER_LERP_SIZE)]
pub struct CSetBorderLerpSize { pub struct CSetBorderLerpSize {
old_diameter: f64, old_diameter: f64,
new_diameter: f64, new_diameter: f64,

View File

@ -1,9 +1,9 @@
use pumpkin_data::packet::clientbound::PLAY_SET_BORDER_SIZE; use pumpkin_data::packet::clientbound::PLAY_SET_BORDER_SIZE;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_SET_BORDER_SIZE)] #[packet(PLAY_SET_BORDER_SIZE)]
pub struct CSetBorderSize { pub struct CSetBorderSize {
diameter: f64, diameter: f64,
} }

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::PLAY_SET_BORDER_WARNING_DELAY; use pumpkin_data::packet::clientbound::PLAY_SET_BORDER_WARNING_DELAY;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_SET_BORDER_WARNING_DELAY)] #[packet(PLAY_SET_BORDER_WARNING_DELAY)]
pub struct CSetBorderWarningDelay { pub struct CSetBorderWarningDelay {
warning_time: VarInt, warning_time: VarInt,
} }

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::PLAY_SET_BORDER_WARNING_DISTANCE; use pumpkin_data::packet::clientbound::PLAY_SET_BORDER_WARNING_DISTANCE;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_SET_BORDER_WARNING_DISTANCE)] #[packet(PLAY_SET_BORDER_WARNING_DISTANCE)]
pub struct CSetBorderWarningDistance { pub struct CSetBorderWarningDistance {
warning_blocks: VarInt, warning_blocks: VarInt,
} }

View File

@ -2,11 +2,11 @@ use crate::VarInt;
use crate::codec::slot::Slot; use crate::codec::slot::Slot;
use pumpkin_data::packet::clientbound::PLAY_CONTAINER_SET_CONTENT; use pumpkin_data::packet::clientbound::PLAY_CONTAINER_SET_CONTENT;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_CONTAINER_SET_CONTENT)] #[packet(PLAY_CONTAINER_SET_CONTENT)]
pub struct CSetContainerContent<'a> { pub struct CSetContainerContent<'a> {
window_id: VarInt, window_id: VarInt,
state_id: VarInt, state_id: VarInt,

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::PLAY_CONTAINER_SET_DATA; use pumpkin_data::packet::clientbound::PLAY_CONTAINER_SET_DATA;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_CONTAINER_SET_DATA)] #[packet(PLAY_CONTAINER_SET_DATA)]
pub struct CSetContainerProperty { pub struct CSetContainerProperty {
window_id: VarInt, window_id: VarInt,
property: i16, property: i16,

View File

@ -2,11 +2,11 @@ use crate::VarInt;
use crate::codec::slot::Slot; use crate::codec::slot::Slot;
use pumpkin_data::packet::clientbound::PLAY_CONTAINER_SET_SLOT; use pumpkin_data::packet::clientbound::PLAY_CONTAINER_SET_SLOT;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_CONTAINER_SET_SLOT)] #[packet(PLAY_CONTAINER_SET_SLOT)]
pub struct CSetContainerSlot<'a> { pub struct CSetContainerSlot<'a> {
window_id: i8, window_id: i8,
state_id: VarInt, state_id: VarInt,

View File

@ -1,7 +1,7 @@
use crate::bytebuf::{ByteBufMut, serializer::Serializer}; use crate::bytebuf::{ByteBufMut, serializer::Serializer};
use bytes::BytesMut; use bytes::BytesMut;
use pumpkin_data::packet::clientbound::PLAY_SET_EQUIPMENT; use pumpkin_data::packet::clientbound::PLAY_SET_EQUIPMENT;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::{ use crate::{
@ -9,7 +9,7 @@ use crate::{
codec::{slot::Slot, var_int::VarInt}, codec::{slot::Slot, var_int::VarInt},
}; };
#[client_packet(PLAY_SET_EQUIPMENT)] #[packet(PLAY_SET_EQUIPMENT)]
pub struct CSetEquipment { pub struct CSetEquipment {
entity_id: VarInt, entity_id: VarInt,
equipment: Vec<(EquipmentSlot, Slot)>, equipment: Vec<(EquipmentSlot, Slot)>,

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::PLAY_SET_EXPERIENCE; use pumpkin_data::packet::clientbound::PLAY_SET_EXPERIENCE;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_SET_EXPERIENCE)] #[packet(PLAY_SET_EXPERIENCE)]
pub struct CSetExperience { pub struct CSetExperience {
progress: f32, progress: f32,
level: VarInt, level: VarInt,

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::PLAY_SET_HEALTH; use pumpkin_data::packet::clientbound::PLAY_SET_HEALTH;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_SET_HEALTH)] #[packet(PLAY_SET_HEALTH)]
pub struct CSetHealth { pub struct CSetHealth {
health: f32, health: f32,
food: VarInt, food: VarInt,

View File

@ -1,9 +1,9 @@
use pumpkin_data::packet::clientbound::PLAY_SET_HELD_SLOT; use pumpkin_data::packet::clientbound::PLAY_SET_HELD_SLOT;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_SET_HELD_SLOT)] #[packet(PLAY_SET_HELD_SLOT)]
pub struct CSetHeldItem { pub struct CSetHeldItem {
slot: i8, slot: i8,
} }

View File

@ -1,9 +1,9 @@
use pumpkin_data::packet::clientbound::PLAY_SET_TIME; use pumpkin_data::packet::clientbound::PLAY_SET_TIME;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_SET_TIME)] #[packet(PLAY_SET_TIME)]
pub struct CUpdateTime { pub struct CUpdateTime {
world_age: i64, world_age: i64,
time_of_day: i64, time_of_day: i64,

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::PLAY_SET_TITLE_TEXT; use pumpkin_data::packet::clientbound::PLAY_SET_TITLE_TEXT;
use pumpkin_util::text::TextComponent; use pumpkin_util::text::TextComponent;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_SET_TITLE_TEXT)] #[packet(PLAY_SET_TITLE_TEXT)]
pub struct CTitleText<'a> { pub struct CTitleText<'a> {
title: &'a TextComponent, title: &'a TextComponent,
} }

View File

@ -1,11 +1,11 @@
use bytes::BufMut; use bytes::BufMut;
use pumpkin_data::{packet::clientbound::PLAY_SOUND, sound::SoundCategory}; use pumpkin_data::{packet::clientbound::PLAY_SOUND, sound::SoundCategory};
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use pumpkin_util::math::vector3::Vector3; use pumpkin_util::math::vector3::Vector3;
use crate::{ClientPacket, IDOrSoundEvent, SoundEvent, VarInt, bytebuf::ByteBufMut}; use crate::{ClientPacket, IDOrSoundEvent, SoundEvent, VarInt, bytebuf::ByteBufMut};
#[client_packet(PLAY_SOUND)] #[packet(PLAY_SOUND)]
pub struct CSoundEffect { pub struct CSoundEffect {
sound_event: IDOrSoundEvent, sound_event: IDOrSoundEvent,
sound_category: VarInt, sound_category: VarInt,

View File

@ -1,12 +1,12 @@
use pumpkin_data::packet::clientbound::PLAY_ADD_ENTITY; use pumpkin_data::packet::clientbound::PLAY_ADD_ENTITY;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use pumpkin_util::math::vector3::Vector3; use pumpkin_util::math::vector3::Vector3;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_ADD_ENTITY)] #[packet(PLAY_ADD_ENTITY)]
pub struct CSpawnEntity { pub struct CSpawnEntity {
entity_id: VarInt, entity_id: VarInt,
#[serde(with = "uuid::serde::compact")] #[serde(with = "uuid::serde::compact")]

View File

@ -1,12 +1,12 @@
use crate::{VarInt, codec::identifier::Identifier}; use crate::{VarInt, codec::identifier::Identifier};
use pumpkin_data::packet::clientbound::PLAY_STORE_COOKIE; use pumpkin_data::packet::clientbound::PLAY_STORE_COOKIE;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
/// Stores some arbitrary data on the client, which persists between server transfers. /// Stores some arbitrary data on the client, which persists between server transfers.
/// The Notchian client only accepts cookies of up to 5 kiB in size. /// The Notchian client only accepts cookies of up to 5 kiB in size.
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_STORE_COOKIE)] #[packet(PLAY_STORE_COOKIE)]
pub struct CStoreCookie<'a> { pub struct CStoreCookie<'a> {
key: &'a Identifier, key: &'a Identifier,
payload_length: VarInt, payload_length: VarInt,

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::PLAY_SET_SUBTITLE_TEXT; use pumpkin_data::packet::clientbound::PLAY_SET_SUBTITLE_TEXT;
use pumpkin_util::text::TextComponent; use pumpkin_util::text::TextComponent;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_SET_SUBTITLE_TEXT)] #[packet(PLAY_SET_SUBTITLE_TEXT)]
pub struct CSubtitle<'a> { pub struct CSubtitle<'a> {
subtitle: &'a TextComponent, subtitle: &'a TextComponent,
} }

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::PLAY_SYSTEM_CHAT; use pumpkin_data::packet::clientbound::PLAY_SYSTEM_CHAT;
use pumpkin_util::text::TextComponent; use pumpkin_util::text::TextComponent;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_SYSTEM_CHAT)] #[packet(PLAY_SYSTEM_CHAT)]
pub struct CSystemChatMessage<'a> { pub struct CSystemChatMessage<'a> {
content: &'a TextComponent, content: &'a TextComponent,
overlay: bool, overlay: bool,

View File

@ -1,10 +1,10 @@
use crate::VarInt; use crate::VarInt;
use pumpkin_data::packet::clientbound::PLAY_TAKE_ITEM_ENTITY; use pumpkin_data::packet::clientbound::PLAY_TAKE_ITEM_ENTITY;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_TAKE_ITEM_ENTITY)] #[packet(PLAY_TAKE_ITEM_ENTITY)]
pub struct CTakeItemEntity { pub struct CTakeItemEntity {
/// The Entity ID of the Item Entity /// The Entity ID of the Item Entity
entity_id: VarInt, entity_id: VarInt,

View File

@ -1,11 +1,11 @@
use bytes::BufMut; use bytes::BufMut;
use pumpkin_data::packet::clientbound::PLAY_TELEPORT_ENTITY; use pumpkin_data::packet::clientbound::PLAY_TELEPORT_ENTITY;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use pumpkin_util::math::vector3::Vector3; use pumpkin_util::math::vector3::Vector3;
use crate::{ClientPacket, PositionFlag, VarInt, bytebuf::ByteBufMut}; use crate::{ClientPacket, PositionFlag, VarInt, bytebuf::ByteBufMut};
#[client_packet(PLAY_TELEPORT_ENTITY)] #[packet(PLAY_TELEPORT_ENTITY)]
pub struct CTeleportEntity<'a> { pub struct CTeleportEntity<'a> {
entity_id: VarInt, entity_id: VarInt,
position: Vector3<f64>, position: Vector3<f64>,

View File

@ -1,17 +1,17 @@
use crate::VarInt; use crate::VarInt;
use pumpkin_data::packet::clientbound::PLAY_TRANSFER; use pumpkin_data::packet::clientbound::PLAY_TRANSFER;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::{Deserialize, Serialize};
#[derive(Serialize)] #[derive(Serialize, Deserialize)]
#[client_packet(PLAY_TRANSFER)] #[packet(PLAY_TRANSFER)]
pub struct CTransfer<'a> { pub struct CTransfer<'a> {
host: &'a str, host: &'a str,
port: &'a VarInt, port: VarInt,
} }
impl<'a> CTransfer<'a> { impl<'a> CTransfer<'a> {
pub fn new(host: &'a str, port: &'a VarInt) -> Self { pub fn new(host: &'a str, port: VarInt) -> Self {
Self { host, port } Self { host, port }
} }
} }

View File

@ -1,9 +1,9 @@
use pumpkin_data::packet::clientbound::PLAY_FORGET_LEVEL_CHUNK; use pumpkin_data::packet::clientbound::PLAY_FORGET_LEVEL_CHUNK;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_FORGET_LEVEL_CHUNK)] #[packet(PLAY_FORGET_LEVEL_CHUNK)]
pub struct CUnloadChunk { pub struct CUnloadChunk {
z: i32, z: i32,
x: i32, x: i32,

View File

@ -1,12 +1,12 @@
use pumpkin_data::packet::clientbound::PLAY_MOVE_ENTITY_POS; use pumpkin_data::packet::clientbound::PLAY_MOVE_ENTITY_POS;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use pumpkin_util::math::vector3::Vector3; use pumpkin_util::math::vector3::Vector3;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_MOVE_ENTITY_POS)] #[packet(PLAY_MOVE_ENTITY_POS)]
pub struct CUpdateEntityPos { pub struct CUpdateEntityPos {
entity_id: VarInt, entity_id: VarInt,
delta: Vector3<i16>, delta: Vector3<i16>,

View File

@ -1,12 +1,12 @@
use pumpkin_data::packet::clientbound::PLAY_MOVE_ENTITY_POS_ROT; use pumpkin_data::packet::clientbound::PLAY_MOVE_ENTITY_POS_ROT;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use pumpkin_util::math::vector3::Vector3; use pumpkin_util::math::vector3::Vector3;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_MOVE_ENTITY_POS_ROT)] #[packet(PLAY_MOVE_ENTITY_POS_ROT)]
pub struct CUpdateEntityPosRot { pub struct CUpdateEntityPosRot {
entity_id: VarInt, entity_id: VarInt,
delta: Vector3<i16>, delta: Vector3<i16>,

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::PLAY_MOVE_ENTITY_ROT; use pumpkin_data::packet::clientbound::PLAY_MOVE_ENTITY_ROT;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_MOVE_ENTITY_ROT)] #[packet(PLAY_MOVE_ENTITY_ROT)]
pub struct CUpdateEntityRot { pub struct CUpdateEntityRot {
entity_id: VarInt, entity_id: VarInt,
yaw: u8, yaw: u8,

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::PLAY_UPDATE_MOB_EFFECT; use pumpkin_data::packet::clientbound::PLAY_UPDATE_MOB_EFFECT;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::codec::var_int::VarInt; use crate::codec::var_int::VarInt;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_UPDATE_MOB_EFFECT)] #[packet(PLAY_UPDATE_MOB_EFFECT)]
pub struct CUpdateMobEffect { pub struct CUpdateMobEffect {
entity_id: VarInt, entity_id: VarInt,
effect_id: VarInt, effect_id: VarInt,

View File

@ -1,11 +1,11 @@
use bytes::BufMut; use bytes::BufMut;
use pumpkin_data::packet::clientbound::PLAY_SET_OBJECTIVE; use pumpkin_data::packet::clientbound::PLAY_SET_OBJECTIVE;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use pumpkin_util::text::TextComponent; use pumpkin_util::text::TextComponent;
use crate::{ClientPacket, NumberFormat, VarInt, bytebuf::ByteBufMut}; use crate::{ClientPacket, NumberFormat, VarInt, bytebuf::ByteBufMut};
#[client_packet(PLAY_SET_OBJECTIVE)] #[packet(PLAY_SET_OBJECTIVE)]
pub struct CUpdateObjectives<'a> { pub struct CUpdateObjectives<'a> {
objective_name: &'a str, objective_name: &'a str,
mode: u8, mode: u8,

View File

@ -1,13 +1,13 @@
use pumpkin_data::packet::clientbound::PLAY_SET_SCORE; use pumpkin_data::packet::clientbound::PLAY_SET_SCORE;
use pumpkin_util::text::TextComponent; use pumpkin_util::text::TextComponent;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
use crate::{NumberFormat, VarInt}; use crate::{NumberFormat, VarInt};
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_SET_SCORE)] #[packet(PLAY_SET_SCORE)]
pub struct CUpdateScore<'a> { pub struct CUpdateScore<'a> {
entity_name: &'a str, entity_name: &'a str,
objective_name: &'a str, objective_name: &'a str,

View File

@ -1,11 +1,11 @@
use pumpkin_data::packet::clientbound::PLAY_LEVEL_EVENT; use pumpkin_data::packet::clientbound::PLAY_LEVEL_EVENT;
use pumpkin_util::math::position::BlockPos; use pumpkin_util::math::position::BlockPos;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(PLAY_LEVEL_EVENT)] #[packet(PLAY_LEVEL_EVENT)]
pub struct CWorldEvent<'a> { pub struct CWorldEvent<'a> {
event: i32, event: i32,
location: &'a BlockPos, location: &'a BlockPos,

View File

@ -1,9 +1,9 @@
use pumpkin_data::packet::clientbound::STATUS_PONG_RESPONSE; use pumpkin_data::packet::clientbound::STATUS_PONG_RESPONSE;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::{Deserialize, Serialize};
#[derive(Serialize)] #[derive(Serialize, Deserialize)]
#[client_packet(STATUS_PONG_RESPONSE)] #[packet(STATUS_PONG_RESPONSE)]
pub struct CPingResponse { pub struct CPingResponse {
payload: i64, // must respond with the same as in `SPingRequest` payload: i64, // must respond with the same as in `SPingRequest`
} }

View File

@ -1,9 +1,9 @@
use pumpkin_data::packet::clientbound::STATUS_STATUS_RESPONSE; use pumpkin_data::packet::clientbound::STATUS_STATUS_RESPONSE;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::{Deserialize, Serialize};
#[derive(Serialize)] #[derive(Serialize, Deserialize)]
#[client_packet(STATUS_STATUS_RESPONSE)] #[packet(STATUS_STATUS_RESPONSE)]
pub struct CStatusResponse<'a> { pub struct CStatusResponse<'a> {
json_response: &'a str, // 32767 json_response: &'a str, // 32767
} }

View File

@ -222,12 +222,12 @@ mod tests {
use cfb8::cipher::AsyncStreamCipher; use cfb8::cipher::AsyncStreamCipher;
use libdeflater::{DecompressionError, Decompressor}; use libdeflater::{DecompressionError, Decompressor};
use pumpkin_data::packet::clientbound::STATUS_STATUS_RESPONSE; use pumpkin_data::packet::clientbound::STATUS_STATUS_RESPONSE;
use pumpkin_macros::client_packet; use pumpkin_macros::packet;
use serde::Serialize; use serde::Serialize;
/// Define a custom packet for testing maximum packet size /// Define a custom packet for testing maximum packet size
#[derive(Serialize)] #[derive(Serialize)]
#[client_packet(STATUS_STATUS_RESPONSE)] #[packet(STATUS_STATUS_RESPONSE)]
pub struct MaxSizePacket { pub struct MaxSizePacket {
data: Vec<u8>, data: Vec<u8>,
} }

View File

@ -1,6 +1,7 @@
use pumpkin_data::packet::serverbound::CONFIG_FINISH_CONFIGURATION; use pumpkin_data::packet::serverbound::CONFIG_FINISH_CONFIGURATION;
use pumpkin_macros::server_packet; use pumpkin_macros::packet;
use serde::Serialize;
#[derive(serde::Deserialize)] #[derive(Serialize)]
#[server_packet(CONFIG_FINISH_CONFIGURATION)] #[packet(CONFIG_FINISH_CONFIGURATION)]
pub struct SAcknowledgeFinishConfig {} pub struct SAcknowledgeFinishConfig;

View File

@ -1,10 +1,11 @@
use pumpkin_data::packet::serverbound::CONFIG_CLIENT_INFORMATION; use pumpkin_data::packet::serverbound::CONFIG_CLIENT_INFORMATION;
use pumpkin_macros::server_packet; use pumpkin_macros::packet;
use serde::Serialize;
use crate::VarInt; use crate::VarInt;
#[derive(serde::Deserialize)] #[derive(serde::Deserialize, Serialize)]
#[server_packet(CONFIG_CLIENT_INFORMATION)] #[packet(CONFIG_CLIENT_INFORMATION)]
pub struct SClientInformationConfig { pub struct SClientInformationConfig {
pub locale: String, // 16 pub locale: String, // 16
pub view_distance: i8, pub view_distance: i8,

View File

@ -1,6 +1,6 @@
use bytes::Buf; use bytes::Buf;
use pumpkin_data::packet::serverbound::CONFIG_COOKIE_RESPONSE; use pumpkin_data::packet::serverbound::CONFIG_COOKIE_RESPONSE;
use pumpkin_macros::server_packet; use pumpkin_macros::packet;
use crate::{ use crate::{
ServerPacket, VarInt, ServerPacket, VarInt,
@ -8,7 +8,7 @@ use crate::{
codec::identifier::Identifier, codec::identifier::Identifier,
}; };
#[server_packet(CONFIG_COOKIE_RESPONSE)] #[packet(CONFIG_COOKIE_RESPONSE)]
/// Response to a Cookie Request (configuration) from the server. /// Response to a Cookie Request (configuration) from the server.
/// The Notchian (vanilla) server only accepts responses of up to 5 kiB in size. /// The Notchian (vanilla) server only accepts responses of up to 5 kiB in size.
pub struct SConfigCookieResponse { pub struct SConfigCookieResponse {

Some files were not shown because too many files have changed in this diff Show More