mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 06:16:04 +00:00
add derive McBuf to every packet
This commit is contained in:
parent
93730a550a
commit
f0792f25bb
55 changed files with 99 additions and 103 deletions
|
@ -182,8 +182,8 @@ fn as_packet_derive(input: TokenStream, state: proc_macro2::TokenStream) -> Toke
|
||||||
_ => panic!("#[derive(*Packet)] can only be used on structs with named fields"),
|
_ => panic!("#[derive(*Packet)] can only be used on structs with named fields"),
|
||||||
};
|
};
|
||||||
|
|
||||||
let mcbufreadable_impl = create_impl_mcbufreadable(&ident, &data);
|
let _mcbufreadable_impl = create_impl_mcbufreadable(&ident, &data);
|
||||||
let mcbufwritable_impl = create_impl_mcbufwritable(&ident, &data);
|
let _mcbufwritable_impl = create_impl_mcbufwritable(&ident, &data);
|
||||||
|
|
||||||
let contents = quote! {
|
let contents = quote! {
|
||||||
impl #ident {
|
impl #ident {
|
||||||
|
@ -202,10 +202,6 @@ fn as_packet_derive(input: TokenStream, state: proc_macro2::TokenStream) -> Toke
|
||||||
Ok(Self::read_into(buf)?.get())
|
Ok(Self::read_into(buf)?.get())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#mcbufreadable_impl
|
|
||||||
|
|
||||||
#mcbufwritable_impl
|
|
||||||
};
|
};
|
||||||
|
|
||||||
contents.into()
|
contents.into()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundAddEntityPacket {
|
pub struct ClientboundAddEntityPacket {
|
||||||
#[var]
|
#[var]
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundAddMobPacket {
|
pub struct ClientboundAddMobPacket {
|
||||||
#[var]
|
#[var]
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundAddPlayerPacket {
|
pub struct ClientboundAddPlayerPacket {
|
||||||
#[var]
|
#[var]
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use packet_macros::{GamePacket, McBuf};
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundAnimatePacket {
|
pub struct ClientboundAnimatePacket {
|
||||||
#[var]
|
#[var]
|
||||||
pub id: u32,
|
pub id: u32,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use azalea_core::BlockPos;
|
use azalea_core::BlockPos;
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundBlockUpdatePacket {
|
pub struct ClientboundBlockUpdatePacket {
|
||||||
pub pos: BlockPos,
|
pub pos: BlockPos,
|
||||||
// TODO: in vanilla this is a BlockState, but here we just have it as a number.
|
// TODO: in vanilla this is a BlockState, but here we just have it as a number.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use azalea_core::difficulty::Difficulty;
|
use azalea_core::difficulty::Difficulty;
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundChangeDifficultyPacket {
|
pub struct ClientboundChangeDifficultyPacket {
|
||||||
pub difficulty: Difficulty,
|
pub difficulty: Difficulty,
|
||||||
pub locked: bool,
|
pub locked: bool,
|
||||||
|
|
|
@ -2,7 +2,7 @@ use azalea_chat::component::Component;
|
||||||
use packet_macros::{GamePacket, McBuf};
|
use packet_macros::{GamePacket, McBuf};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundChatPacket {
|
pub struct ClientboundChatPacket {
|
||||||
pub message: Component,
|
pub message: Component,
|
||||||
pub type_: ChatType,
|
pub type_: ChatType,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use azalea_core::Slot;
|
use azalea_core::Slot;
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundContainerSetContentPacket {
|
pub struct ClientboundContainerSetContentPacket {
|
||||||
pub container_id: u8,
|
pub container_id: u8,
|
||||||
#[var]
|
#[var]
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use crate::mc_buf::UnsizedByteArray;
|
use crate::mc_buf::UnsizedByteArray;
|
||||||
use azalea_core::resource_location::ResourceLocation;
|
use azalea_core::resource_location::ResourceLocation;
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundCustomPayloadPacket {
|
pub struct ClientboundCustomPayloadPacket {
|
||||||
pub identifier: ResourceLocation,
|
pub identifier: ResourceLocation,
|
||||||
pub data: UnsizedByteArray,
|
pub data: UnsizedByteArray,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use azalea_chat::component::Component;
|
use azalea_chat::component::Component;
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundDisconnectPacket {
|
pub struct ClientboundDisconnectPacket {
|
||||||
pub reason: Component,
|
pub reason: Component,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
// we can't identify the status in azalea-protocol since they vary depending on the entity
|
// we can't identify the status in azalea-protocol since they vary depending on the entity
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundEntityEventPacket {
|
pub struct ClientboundEntityEventPacket {
|
||||||
pub entity_id: i32,
|
pub entity_id: i32,
|
||||||
pub entity_status: i8,
|
pub entity_status: i8,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundEntityVelocityPacket {
|
pub struct ClientboundEntityVelocityPacket {
|
||||||
#[var]
|
#[var]
|
||||||
pub entity_id: u32,
|
pub entity_id: u32,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use packet_macros::{GamePacket, McBuf};
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundGameEventPacket {
|
pub struct ClientboundGameEventPacket {
|
||||||
pub event: EventType,
|
pub event: EventType,
|
||||||
pub param: f32,
|
pub param: f32,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundInitializeBorderPacket {
|
pub struct ClientboundInitializeBorderPacket {
|
||||||
pub new_center_x: f64,
|
pub new_center_x: f64,
|
||||||
pub new_center_z: f64,
|
pub new_center_z: f64,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundKeepAlivePacket {
|
pub struct ClientboundKeepAlivePacket {
|
||||||
pub id: u64,
|
pub id: u64,
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
use super::clientbound_light_update_packet::ClientboundLightUpdatePacketData;
|
use super::clientbound_light_update_packet::ClientboundLightUpdatePacketData;
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundLevelChunkWithLightPacket {
|
pub struct ClientboundLevelChunkWithLightPacket {
|
||||||
pub x: i32,
|
pub x: i32,
|
||||||
pub z: i32,
|
pub z: i32,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use azalea_core::BlockPos;
|
use azalea_core::BlockPos;
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundLevelEventPacket {
|
pub struct ClientboundLevelEventPacket {
|
||||||
pub type_: i32,
|
pub type_: i32,
|
||||||
pub pos: BlockPos,
|
pub pos: BlockPos,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::mc_buf::ParticleData;
|
use crate::mc_buf::ParticleData;
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundLevelParticlesPacket {
|
pub struct ClientboundLevelParticlesPacket {
|
||||||
pub particle_id: u32,
|
pub particle_id: u32,
|
||||||
pub override_limiter: bool,
|
pub override_limiter: bool,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::mc_buf::BitSet;
|
use crate::mc_buf::BitSet;
|
||||||
use packet_macros::{GamePacket, McBuf};
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundLightUpdatePacket {
|
pub struct ClientboundLightUpdatePacket {
|
||||||
pub x: i32,
|
pub x: i32,
|
||||||
pub z: i32,
|
pub z: i32,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use azalea_core::{game_type::GameType, resource_location::ResourceLocation};
|
use azalea_core::{game_type::GameType, resource_location::ResourceLocation};
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundLoginPacket {
|
pub struct ClientboundLoginPacket {
|
||||||
pub player_id: u32,
|
pub player_id: u32,
|
||||||
pub hardcore: bool,
|
pub hardcore: bool,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundMoveEntityPosPacket {
|
pub struct ClientboundMoveEntityPosPacket {
|
||||||
#[var]
|
#[var]
|
||||||
pub entity_id: i32,
|
pub entity_id: i32,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundMoveEntityPosRotPacket {
|
pub struct ClientboundMoveEntityPosRotPacket {
|
||||||
#[var]
|
#[var]
|
||||||
pub entity_id: i32,
|
pub entity_id: i32,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundMoveEntityRotPacket {
|
pub struct ClientboundMoveEntityRotPacket {
|
||||||
#[var]
|
#[var]
|
||||||
pub entity_id: i32,
|
pub entity_id: i32,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use crate::mc_buf::{McBufReadable, McBufWritable, Readable};
|
use crate::mc_buf::{McBufReadable, McBufWritable, Readable};
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundPlayerAbilitiesPacket {
|
pub struct ClientboundPlayerAbilitiesPacket {
|
||||||
pub flags: PlayerAbilitiesFlags,
|
pub flags: PlayerAbilitiesFlags,
|
||||||
pub flying_speed: f32,
|
pub flying_speed: f32,
|
||||||
|
|
|
@ -4,7 +4,7 @@ use packet_macros::{GamePacket, McBuf};
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundPlayerInfoPacket {
|
pub struct ClientboundPlayerInfoPacket {
|
||||||
pub action: Action,
|
pub action: Action,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use crate::mc_buf::{McBufReadable, McBufWritable, Readable};
|
use crate::mc_buf::{McBufReadable, McBufWritable, Readable};
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundPlayerPositionPacket {
|
pub struct ClientboundPlayerPositionPacket {
|
||||||
pub x: f64,
|
pub x: f64,
|
||||||
pub y: f64,
|
pub y: f64,
|
||||||
|
|
|
@ -3,7 +3,7 @@ use azalea_core::resource_location::ResourceLocation;
|
||||||
use packet_macros::{GamePacket, McBuf};
|
use packet_macros::{GamePacket, McBuf};
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundRecipePacket {
|
pub struct ClientboundRecipePacket {
|
||||||
pub action: State,
|
pub action: State,
|
||||||
pub settings: RecipeBookSettings,
|
pub settings: RecipeBookSettings,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundRemoveEntitiesPacket {
|
pub struct ClientboundRemoveEntitiesPacket {
|
||||||
#[var]
|
#[var]
|
||||||
pub entity_ids: Vec<u32>,
|
pub entity_ids: Vec<u32>,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundRotateHeadPacket {
|
pub struct ClientboundRotateHeadPacket {
|
||||||
#[var]
|
#[var]
|
||||||
pub entity_id: u32,
|
pub entity_id: u32,
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
use crate::mc_buf::{McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable};
|
use crate::mc_buf::{McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable};
|
||||||
use azalea_core::{ChunkSectionBlockPos, ChunkSectionPos};
|
use azalea_core::{ChunkSectionBlockPos, ChunkSectionPos};
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundSectionBlocksUpdatePacket {
|
pub struct ClientboundSectionBlocksUpdatePacket {
|
||||||
pub section_pos: ChunkSectionPos,
|
pub section_pos: ChunkSectionPos,
|
||||||
pub suppress_light_updates: bool,
|
pub suppress_light_updates: bool,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
/// Sent to change the player's slot selection.
|
/// Sent to change the player's slot selection.
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundSetCarriedItemPacket {
|
pub struct ClientboundSetCarriedItemPacket {
|
||||||
pub slot: u8,
|
pub slot: u8,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundSetChunkCacheCenterPacket {
|
pub struct ClientboundSetChunkCacheCenterPacket {
|
||||||
#[var]
|
#[var]
|
||||||
pub x: i32,
|
pub x: i32,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use azalea_core::BlockPos;
|
use azalea_core::BlockPos;
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundSetDefaultSpawnPositionPacket {
|
pub struct ClientboundSetDefaultSpawnPositionPacket {
|
||||||
pub pos: BlockPos,
|
pub pos: BlockPos,
|
||||||
pub angle: f32,
|
pub angle: f32,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::mc_buf::EntityMetadata;
|
use crate::mc_buf::EntityMetadata;
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundSetEntityDataPacket {
|
pub struct ClientboundSetEntityDataPacket {
|
||||||
#[var]
|
#[var]
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundSetEntityLinkPacket {
|
pub struct ClientboundSetEntityLinkPacket {
|
||||||
pub source_id: u32,
|
pub source_id: u32,
|
||||||
pub dest_id: u32,
|
pub dest_id: u32,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundSetExperiencePacket {
|
pub struct ClientboundSetExperiencePacket {
|
||||||
pub experience_progress: f32,
|
pub experience_progress: f32,
|
||||||
#[var]
|
#[var]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundSetHealthPacket {
|
pub struct ClientboundSetHealthPacket {
|
||||||
pub health: f32,
|
pub health: f32,
|
||||||
#[var]
|
#[var]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundSetTimePacket {
|
pub struct ClientboundSetTimePacket {
|
||||||
pub game_time: u64,
|
pub game_time: u64,
|
||||||
pub day_time: u64,
|
pub day_time: u64,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use packet_macros::{GamePacket, McBuf};
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundSoundPacket {
|
pub struct ClientboundSoundPacket {
|
||||||
#[var]
|
#[var]
|
||||||
/// TODO: use the sound registry instead of just being a u32
|
/// TODO: use the sound registry instead of just being a u32
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundTeleportEntityPacket {
|
pub struct ClientboundTeleportEntityPacket {
|
||||||
#[var]
|
#[var]
|
||||||
pub id: u32,
|
pub id: u32,
|
||||||
|
|
|
@ -7,7 +7,7 @@ use std::{
|
||||||
io::{Read, Write},
|
io::{Read, Write},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundUpdateAdvancementsPacket {
|
pub struct ClientboundUpdateAdvancementsPacket {
|
||||||
pub reset: bool,
|
pub reset: bool,
|
||||||
pub added: HashMap<ResourceLocation, Advancement>,
|
pub added: HashMap<ResourceLocation, Advancement>,
|
||||||
|
|
|
@ -4,7 +4,7 @@ use packet_macros::{GamePacket, McBuf};
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundUpdateAttributesPacket {
|
pub struct ClientboundUpdateAttributesPacket {
|
||||||
#[var]
|
#[var]
|
||||||
pub entity_id: u32,
|
pub entity_id: u32,
|
||||||
|
|
|
@ -5,7 +5,7 @@ use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
use crate::mc_buf::{McBufReadable, McBufWritable, Readable, Writable};
|
use crate::mc_buf::{McBufReadable, McBufWritable, Readable, Writable};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundUpdateRecipesPacket {
|
pub struct ClientboundUpdateRecipesPacket {
|
||||||
pub recipes: Vec<Recipe>,
|
pub recipes: Vec<Recipe>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
use crate::mc_buf::{McBufReadable, McBufWritable, Readable, Writable};
|
use crate::mc_buf::{McBufReadable, McBufWritable, Readable, Writable};
|
||||||
use azalea_core::resource_location::ResourceLocation;
|
use azalea_core::resource_location::ResourceLocation;
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
io::{Read, Write},
|
io::{Read, Write},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundUpdateTagsPacket {
|
pub struct ClientboundUpdateTagsPacket {
|
||||||
pub tags: HashMap<ResourceLocation, Vec<Tags>>,
|
pub tags: HashMap<ResourceLocation, Vec<Tags>>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ClientboundUpdateViewDistancePacket {
|
pub struct ClientboundUpdateViewDistancePacket {
|
||||||
#[var]
|
#[var]
|
||||||
pub view_distance: i32,
|
pub view_distance: i32,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use crate::mc_buf::UnsizedByteArray;
|
use crate::mc_buf::UnsizedByteArray;
|
||||||
use azalea_core::resource_location::ResourceLocation;
|
use azalea_core::resource_location::ResourceLocation;
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ServerboundCustomPayloadPacket {
|
pub struct ServerboundCustomPayloadPacket {
|
||||||
pub identifier: ResourceLocation,
|
pub identifier: ResourceLocation,
|
||||||
pub data: UnsizedByteArray,
|
pub data: UnsizedByteArray,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use packet_macros::GamePacket;
|
use packet_macros::{GamePacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, GamePacket)]
|
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||||
pub struct ServerboundKeepAlivePacket {
|
pub struct ServerboundKeepAlivePacket {
|
||||||
pub id: u64,
|
pub id: u64,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use crate::packets::ConnectionProtocol;
|
use crate::packets::ConnectionProtocol;
|
||||||
use packet_macros::HandshakePacket;
|
use packet_macros::{HandshakePacket, McBuf};
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
|
|
||||||
#[derive(Hash, Clone, Debug, HandshakePacket)]
|
#[derive(Hash, Clone, Debug, McBuf, HandshakePacket)]
|
||||||
pub struct ClientIntentionPacket {
|
pub struct ClientIntentionPacket {
|
||||||
#[var]
|
#[var]
|
||||||
pub protocol_version: u32,
|
pub protocol_version: u32,
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
use crate::mc_buf::UnsizedByteArray;
|
use crate::mc_buf::UnsizedByteArray;
|
||||||
use azalea_core::resource_location::ResourceLocation;
|
use azalea_core::resource_location::ResourceLocation;
|
||||||
use packet_macros::LoginPacket;
|
use packet_macros::{LoginPacket, McBuf};
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
|
|
||||||
#[derive(Hash, Clone, Debug, LoginPacket)]
|
#[derive(Hash, Clone, Debug, McBuf, LoginPacket)]
|
||||||
pub struct ClientboundCustomQueryPacket {
|
pub struct ClientboundCustomQueryPacket {
|
||||||
#[var]
|
#[var]
|
||||||
pub transaction_id: u32,
|
pub transaction_id: u32,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use azalea_chat::component::Component;
|
use azalea_chat::component::Component;
|
||||||
use packet_macros::LoginPacket;
|
use packet_macros::{LoginPacket, McBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, LoginPacket)]
|
#[derive(Clone, Debug, McBuf, LoginPacket)]
|
||||||
pub struct ClientboundLoginDisconnectPacket {
|
pub struct ClientboundLoginDisconnectPacket {
|
||||||
pub reason: Component,
|
pub reason: Component,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use packet_macros::LoginPacket;
|
use packet_macros::{LoginPacket, McBuf};
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
|
|
||||||
#[derive(Hash, Clone, Debug, LoginPacket)]
|
#[derive(Hash, Clone, Debug, McBuf, LoginPacket)]
|
||||||
pub struct ServerboundHelloPacket {
|
pub struct ServerboundHelloPacket {
|
||||||
pub username: String,
|
pub username: String,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use packet_macros::LoginPacket;
|
use packet_macros::{LoginPacket, McBuf};
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
|
|
||||||
#[derive(Hash, Clone, Debug, LoginPacket)]
|
#[derive(Hash, Clone, Debug, McBuf, LoginPacket)]
|
||||||
pub struct ServerboundKeyPacket {
|
pub struct ServerboundKeyPacket {
|
||||||
pub shared_secret: Vec<u8>,
|
pub shared_secret: Vec<u8>,
|
||||||
pub nonce: Vec<u8>,
|
pub nonce: Vec<u8>,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use packet_macros::StatusPacket;
|
use packet_macros::{McBuf, StatusPacket};
|
||||||
|
|
||||||
#[derive(Clone, Debug, StatusPacket)]
|
#[derive(Clone, Debug, McBuf, StatusPacket)]
|
||||||
pub struct ServerboundStatusRequestPacket {}
|
pub struct ServerboundStatusRequestPacket {}
|
||||||
|
|
|
@ -84,8 +84,8 @@ def generate(burger_packets, mappings: Mappings, target_packet_id, target_packet
|
||||||
generated_packet_code = []
|
generated_packet_code = []
|
||||||
uses = set()
|
uses = set()
|
||||||
generated_packet_code.append(
|
generated_packet_code.append(
|
||||||
f'#[derive(Clone, Debug, {to_camel_case(state)}Packet)]')
|
f'#[derive(Clone, Debug, McBuf, {to_camel_case(state)}Packet)]')
|
||||||
uses.add(f'packet_macros::{to_camel_case(state)}Packet')
|
uses.add(f'packet_macros::{{to_camel_case(state)}Packet, McBuf}')
|
||||||
|
|
||||||
obfuscated_class_name = packet['class'].split('.')[0].split('$')[0]
|
obfuscated_class_name = packet['class'].split('.')[0].split('$')[0]
|
||||||
class_name = mappings.get_class(
|
class_name = mappings.get_class(
|
||||||
|
|
Loading…
Add table
Reference in a new issue