1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 14:26:04 +00:00

McBuf -> AzBuf

This commit is contained in:
mat 2024-11-27 02:10:14 +00:00
parent 22bdc50130
commit 35441c33fa
267 changed files with 748 additions and 760 deletions

View file

@ -1,10 +1,10 @@
use std::collections::HashMap; use std::collections::HashMap;
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use uuid::Uuid; use uuid::Uuid;
#[derive(McBuf, Debug, Clone, Default, Eq, PartialEq)] #[derive(AzBuf, Debug, Clone, Default, Eq, PartialEq)]
pub struct GameProfile { pub struct GameProfile {
/// The UUID of the player. /// The UUID of the player.
pub uuid: Uuid, pub uuid: Uuid,
@ -43,7 +43,7 @@ impl From<SerializableGameProfile> for GameProfile {
} }
} }
#[derive(McBuf, Debug, Clone, Eq, PartialEq)] #[derive(AzBuf, Debug, Clone, Eq, PartialEq)]
pub struct ProfilePropertyValue { pub struct ProfilePropertyValue {
pub value: String, pub value: String,
pub signature: Option<String>, pub signature: Option<String>,

View file

@ -4,7 +4,7 @@ use std::{collections::HashSet, hash::Hash};
#[cfg(feature = "azalea-buf")] #[cfg(feature = "azalea-buf")]
use azalea_buf::{ use azalea_buf::{
BufReadError, McBuf, AzaleaRead, AzaleaReadVar, AzaleaWriteVar, AzaleaWrite, BufReadError, AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWriteVar, AzaleaWrite,
}; };
#[cfg(feature = "azalea-buf")] #[cfg(feature = "azalea-buf")]
use azalea_chat::FormattedText; use azalea_chat::FormattedText;
@ -81,7 +81,7 @@ impl Suggestions {
#[cfg(feature = "azalea-buf")] #[cfg(feature = "azalea-buf")]
impl AzaleaRead for Suggestions { impl AzaleaRead for Suggestions {
fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
#[derive(McBuf)] #[derive(AzBuf)]
struct StandaloneSuggestion { struct StandaloneSuggestion {
pub text: String, pub text: String,
pub tooltip: Option<FormattedText>, pub tooltip: Option<FormattedText>,

View file

@ -1,5 +1,5 @@
[package] [package]
description = "#[derive(McBuf)]" description = "#[derive(AzBuf)]"
edition = "2021" edition = "2021"
license = "MIT" license = "MIT"
name = "azalea-buf-macros" name = "azalea-buf-macros"

View file

@ -19,8 +19,8 @@ pub fn derive_azaleawrite(input: TokenStream) -> TokenStream {
write::create_impl_azaleawrite(&ident, &data).into() write::create_impl_azaleawrite(&ident, &data).into()
} }
#[proc_macro_derive(McBuf, attributes(var))] #[proc_macro_derive(AzBuf, attributes(var))]
pub fn derive_mcbuf(input: TokenStream) -> TokenStream { pub fn derive_azbuf(input: TokenStream) -> TokenStream {
let DeriveInput { ident, data, .. } = parse_macro_input!(input); let DeriveInput { ident, data, .. } = parse_macro_input!(input);
let writable = write::create_impl_azaleawrite(&ident, &data); let writable = write::create_impl_azaleawrite(&ident, &data);

View file

@ -63,7 +63,7 @@ pub fn create_impl_azalearead(ident: &Ident, data: &Data) -> proc_macro2::TokenS
} }
} }
_ => { _ => {
panic!("#[derive(McBuf)] can only be used on structs with named fields") panic!("#[derive(AzBuf)] can only be used on structs with named fields")
} }
}, },
syn::Data::Enum(syn::DataEnum { variants, .. }) => { syn::Data::Enum(syn::DataEnum { variants, .. }) => {
@ -157,6 +157,6 @@ pub fn create_impl_azalearead(ident: &Ident, data: &Data) -> proc_macro2::TokenS
} }
} }
} }
_ => panic!("#[derive(McBuf)] can only be used on structs"), _ => panic!("#[derive(AzBuf)] can only be used on structs"),
} }
} }

View file

@ -63,7 +63,7 @@ pub fn create_impl_azaleawrite(ident: &Ident, data: &Data) -> proc_macro2::Token
} }
} }
_ => { _ => {
panic!("#[derive(McBuf)] can only be used on structs with named fields") panic!("#[derive(AzBuf)] can only be used on structs with named fields")
} }
}, },
syn::Data::Enum(syn::DataEnum { variants, .. }) => { syn::Data::Enum(syn::DataEnum { variants, .. }) => {
@ -197,6 +197,6 @@ pub fn create_impl_azaleawrite(ident: &Ident, data: &Data) -> proc_macro2::Token
} }
} }
} }
_ => panic!("#[derive(McBuf)] can only be used on structs"), _ => panic!("#[derive(AzBuf)] can only be used on structs"),
} }
} }

View file

@ -1,7 +1,7 @@
use std::{collections::HashMap, fmt}; use std::{collections::HashMap, fmt};
#[cfg(feature = "azalea-buf")] #[cfg(feature = "azalea-buf")]
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use serde::{ser::SerializeStruct, Serialize, Serializer}; use serde::{ser::SerializeStruct, Serialize, Serializer};
use serde_json::Value; use serde_json::Value;
@ -101,7 +101,7 @@ impl Ansi {
} }
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
#[cfg_attr(feature = "azalea-buf", derive(McBuf))] #[cfg_attr(feature = "azalea-buf", derive(AzBuf))]
pub enum ChatFormatting { pub enum ChatFormatting {
Black, Black,
DarkBlue, DarkBlue,

View file

@ -29,7 +29,7 @@ use crate::{
/// A chat packet, either a system message or a chat message. /// A chat packet, either a system message or a chat message.
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum Chat { pub enum ChatPacket {
System(Arc<ClientboundSystemChat>), System(Arc<ClientboundSystemChat>),
Player(Arc<ClientboundPlayerChat>), Player(Arc<ClientboundPlayerChat>),
Disguised(Arc<ClientboundDisguisedChat>), Disguised(Arc<ClientboundDisguisedChat>),
@ -42,13 +42,13 @@ macro_rules! regex {
}}; }};
} }
impl Chat { impl ChatPacket {
/// Get the message shown in chat for this packet. /// Get the message shown in chat for this packet.
pub fn message(&self) -> FormattedText { pub fn message(&self) -> FormattedText {
match self { match self {
Chat::System(p) => p.content.clone(), ChatPacket::System(p) => p.content.clone(),
Chat::Player(p) => p.message(), ChatPacket::Player(p) => p.message(),
Chat::Disguised(p) => p.message(), ChatPacket::Disguised(p) => p.message(),
} }
} }
@ -58,7 +58,7 @@ impl Chat {
/// None. /// None.
pub fn split_sender_and_content(&self) -> (Option<String>, String) { pub fn split_sender_and_content(&self) -> (Option<String>, String) {
match self { match self {
Chat::System(p) => { ChatPacket::System(p) => {
let message = p.content.to_string(); let message = p.content.to_string();
// Overlay messages aren't in chat // Overlay messages aren't in chat
if p.overlay { if p.overlay {
@ -72,13 +72,13 @@ impl Chat {
(None, message) (None, message)
} }
Chat::Player(p) => ( ChatPacket::Player(p) => (
// If it's a player chat packet, then the sender and content // If it's a player chat packet, then the sender and content
// are already split for us. // are already split for us.
Some(p.chat_type.name.to_string()), Some(p.chat_type.name.to_string()),
p.body.content.clone(), p.body.content.clone(),
), ),
Chat::Disguised(p) => ( ChatPacket::Disguised(p) => (
// disguised chat packets are basically the same as player chat packets but without // disguised chat packets are basically the same as player chat packets but without
// the chat signing things // the chat signing things
Some(p.chat_type.name.to_string()), Some(p.chat_type.name.to_string()),
@ -99,9 +99,9 @@ impl Chat {
/// when a server uses a plugin to modify chat messages). /// when a server uses a plugin to modify chat messages).
pub fn uuid(&self) -> Option<Uuid> { pub fn uuid(&self) -> Option<Uuid> {
match self { match self {
Chat::System(_) => None, ChatPacket::System(_) => None,
Chat::Player(m) => Some(m.sender), ChatPacket::Player(m) => Some(m.sender),
Chat::Disguised(_) => None, ChatPacket::Disguised(_) => None,
} }
} }
@ -115,7 +115,7 @@ impl Chat {
/// Create a new Chat from a string. This is meant to be used as a /// Create a new Chat from a string. This is meant to be used as a
/// convenience function for testing. /// convenience function for testing.
pub fn new(message: &str) -> Self { pub fn new(message: &str) -> Self {
Chat::System(Arc::new(ClientboundSystemChat { ChatPacket::System(Arc::new(ClientboundSystemChat {
content: FormattedText::from(message), content: FormattedText::from(message),
overlay: false, overlay: false,
})) }))
@ -197,7 +197,7 @@ impl Plugin for ChatPlugin {
#[derive(Event, Debug, Clone)] #[derive(Event, Debug, Clone)]
pub struct ChatReceivedEvent { pub struct ChatReceivedEvent {
pub entity: Entity, pub entity: Entity,
pub packet: Chat, pub packet: ChatPacket,
} }
/// Send a chat message (or command, if it starts with a slash) to the server. /// Send a chat message (or command, if it starts with a slash) to the server.

View file

@ -21,7 +21,7 @@ use derive_more::{Deref, DerefMut};
use tokio::sync::mpsc; use tokio::sync::mpsc;
use crate::{ use crate::{
chat::{Chat, ChatReceivedEvent}, chat::{ChatPacket, ChatReceivedEvent},
disconnect::DisconnectEvent, disconnect::DisconnectEvent,
packet_handling::game::{ packet_handling::game::{
AddPlayerEvent, DeathEvent, KeepAliveEvent, PacketEvent, RemovePlayerEvent, AddPlayerEvent, DeathEvent, KeepAliveEvent, PacketEvent, RemovePlayerEvent,
@ -62,7 +62,7 @@ pub enum Event {
/// The client is now in the world. Fired when we receive a login packet. /// The client is now in the world. Fired when we receive a login packet.
Login, Login,
/// A chat message was sent in the game chat. /// A chat message was sent in the game chat.
Chat(Chat), Chat(ChatPacket),
/// Happens 20 times per second, but only when the world is loaded. /// Happens 20 times per second, but only when the world is loaded.
Tick, Tick,
/// We received a packet from the server. /// We received a packet from the server.

View file

@ -33,7 +33,7 @@ use tracing::{debug, error, trace, warn};
use uuid::Uuid; use uuid::Uuid;
use crate::{ use crate::{
chat::{Chat, ChatReceivedEvent}, chat::{ChatPacket, ChatReceivedEvent},
chunks, chunks,
disconnect::DisconnectEvent, disconnect::DisconnectEvent,
inventory::{ inventory::{
@ -1030,7 +1030,7 @@ pub fn process_packet_events(ecs: &mut World) {
chat_events.send(ChatReceivedEvent { chat_events.send(ChatReceivedEvent {
entity: player_entity, entity: player_entity,
packet: Chat::Player(Arc::new(p.clone())), packet: ChatPacket::Player(Arc::new(p.clone())),
}); });
} }
ClientboundGamePacket::SystemChat(p) => { ClientboundGamePacket::SystemChat(p) => {
@ -1042,7 +1042,7 @@ pub fn process_packet_events(ecs: &mut World) {
chat_events.send(ChatReceivedEvent { chat_events.send(ChatReceivedEvent {
entity: player_entity, entity: player_entity,
packet: Chat::System(Arc::new(p.clone())), packet: ChatPacket::System(Arc::new(p.clone())),
}); });
} }
ClientboundGamePacket::DisguisedChat(p) => { ClientboundGamePacket::DisguisedChat(p) => {
@ -1054,7 +1054,7 @@ pub fn process_packet_events(ecs: &mut World) {
chat_events.send(ChatReceivedEvent { chat_events.send(ChatReceivedEvent {
entity: player_entity, entity: player_entity,
packet: Chat::Disguised(Arc::new(p.clone())), packet: ChatPacket::Disguised(Arc::new(p.clone())),
}); });
} }
ClientboundGamePacket::Sound(_p) => { ClientboundGamePacket::Sound(_p) => {

View file

@ -1,9 +1,9 @@
use std::io::{Cursor, Write}; use std::io::{Cursor, Write};
use azalea_buf::{BufReadError, McBuf, AzaleaRead, AzaleaWrite}; use azalea_buf::{BufReadError, AzBuf, AzaleaRead, AzaleaWrite};
/// Represents Java's BitSet, a list of bits. /// Represents Java's BitSet, a list of bits.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, McBuf)] #[derive(Debug, Clone, PartialEq, Eq, Hash, Default, AzBuf)]
pub struct BitSet { pub struct BitSet {
data: Vec<u64>, data: Vec<u64>,
} }

View file

@ -1,4 +1,4 @@
pub use azalea_buf::McBuf; pub use azalea_buf::AzBuf;
use crate::position::Vec3; use crate::position::Vec3;
@ -9,7 +9,7 @@ pub trait PositionDeltaTrait {
} }
/// Only works for up to 8 blocks /// Only works for up to 8 blocks
#[derive(Clone, Debug, McBuf, Default)] #[derive(Clone, Debug, AzBuf, Default)]
pub struct PositionDelta8 { pub struct PositionDelta8 {
pub xa: i16, pub xa: i16,
pub ya: i16, pub ya: i16,

View file

@ -1,8 +1,8 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use crate::position::Vec3; use crate::position::Vec3;
#[derive(Clone, Copy, Debug, McBuf, Default, Eq, PartialEq)] #[derive(Clone, Copy, Debug, AzBuf, Default, Eq, PartialEq)]
pub enum Direction { pub enum Direction {
#[default] #[default]
Down = 0, Down = 0,
@ -62,7 +62,7 @@ impl Direction {
} }
// TODO: make azalea_block use this instead of FacingCardinal // TODO: make azalea_block use this instead of FacingCardinal
#[derive(Clone, Copy, Debug, McBuf, PartialEq, Eq, Hash)] #[derive(Clone, Copy, Debug, AzBuf, PartialEq, Eq, Hash)]
pub enum CardinalDirection { pub enum CardinalDirection {
North, North,
South, South,

View file

@ -3,9 +3,9 @@ use std::{
str::FromStr, str::FromStr,
}; };
use azalea_buf::McBuf; use azalea_buf::AzBuf;
#[derive(Clone, Copy, Debug, McBuf)] #[derive(Clone, Copy, Debug, AzBuf)]
pub enum ObjectiveCriteria { pub enum ObjectiveCriteria {
Integer, Integer,
Hearts, Hearts,

View file

@ -11,7 +11,7 @@ use std::{
str::FromStr, str::FromStr,
}; };
use azalea_buf::{BufReadError, McBuf, AzaleaRead, AzaleaWrite}; use azalea_buf::{BufReadError, AzBuf, AzaleaRead, AzaleaWrite};
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -214,7 +214,7 @@ macro_rules! vec3_impl {
/// Used to represent an exact position in the world where an entity could be. /// Used to represent an exact position in the world where an entity could be.
/// For blocks, [`BlockPos`] is used instead. /// For blocks, [`BlockPos`] is used instead.
#[derive(Clone, Copy, Debug, Default, PartialEq, McBuf)] #[derive(Clone, Copy, Debug, Default, PartialEq, AzBuf)]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))] #[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
pub struct Vec3 { pub struct Vec3 {
pub x: f64, pub x: f64,

View file

@ -6,7 +6,7 @@ use std::{
str::FromStr, str::FromStr,
}; };
use azalea_buf::{BufReadError, AzaleaRead, AzaleaWrite}; use azalea_buf::{AzaleaRead, AzaleaWrite, BufReadError};
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
use simdnbt::{owned::NbtTag, FromNbtTag, ToNbtTag}; use simdnbt::{owned::NbtTag, FromNbtTag, ToNbtTag};
@ -142,7 +142,7 @@ mod tests {
} }
#[test] #[test]
fn mcbuf_resource_location() { fn azbuf_resource_location() {
let mut buf = Vec::new(); let mut buf = Vec::new();
ResourceLocation::new("minecraft:dirt") ResourceLocation::new("minecraft:dirt")
.azalea_write(&mut buf) .azalea_write(&mut buf)

View file

@ -1,6 +1,6 @@
use std::time::{SystemTime, UNIX_EPOCH}; use std::time::{SystemTime, UNIX_EPOCH};
use azalea_buf::{McBuf, AzaleaWrite}; use azalea_buf::{AzBuf, AzaleaWrite};
use rsa::{ use rsa::{
signature::{RandomizedSigner, SignatureEncoding}, signature::{RandomizedSigner, SignatureEncoding},
RsaPrivateKey, RsaPrivateKey,
@ -8,18 +8,18 @@ use rsa::{
use sha2::Sha256; use sha2::Sha256;
use uuid::Uuid; use uuid::Uuid;
#[derive(Debug, Clone, McBuf)] #[derive(Debug, Clone, AzBuf)]
pub struct SaltSignaturePair { pub struct SaltSignaturePair {
pub salt: u64, pub salt: u64,
pub signature: Vec<u8>, pub signature: Vec<u8>,
} }
#[derive(Clone, Debug, PartialEq, McBuf)] #[derive(Clone, Debug, PartialEq, AzBuf)]
pub struct MessageSignature { pub struct MessageSignature {
pub bytes: [u8; 256], pub bytes: [u8; 256],
} }
#[derive(Clone, Debug, McBuf, PartialEq)] #[derive(Clone, Debug, AzBuf, PartialEq)]
pub struct SignedMessageHeader { pub struct SignedMessageHeader {
pub previous_signature: Option<MessageSignature>, pub previous_signature: Option<MessageSignature>,
pub sender: Uuid, pub sender: Uuid,

View file

@ -2,7 +2,7 @@
use std::collections::{hash_map, HashMap}; use std::collections::{hash_map, HashMap};
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_core::resource_location::ResourceLocation; use azalea_core::resource_location::ResourceLocation;
use bevy_ecs::component::Component; use bevy_ecs::component::Component;
use thiserror::Error; use thiserror::Error;
@ -71,14 +71,14 @@ impl AttributeInstance {
} }
} }
#[derive(Clone, Debug, McBuf)] #[derive(Clone, Debug, AzBuf)]
pub struct AttributeModifier { pub struct AttributeModifier {
pub id: ResourceLocation, pub id: ResourceLocation,
pub amount: f64, pub amount: f64,
pub operation: AttributeModifierOperation, pub operation: AttributeModifierOperation,
} }
#[derive(Clone, Debug, Copy, McBuf)] #[derive(Clone, Debug, Copy, AzBuf)]
pub enum AttributeModifierOperation { pub enum AttributeModifierOperation {
Addition, Addition,
MultiplyBase, MultiplyBase,

View file

@ -2,7 +2,7 @@
use std::io::{Cursor, Write}; use std::io::{Cursor, Write};
use azalea_buf::{AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError, McBuf}; use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError};
use azalea_chat::FormattedText; use azalea_chat::FormattedText;
use azalea_core::{ use azalea_core::{
direction::Direction, direction::Direction,
@ -62,7 +62,7 @@ impl AzaleaWrite for EntityMetadataItems {
// Note: This enum is partially generated and parsed by // Note: This enum is partially generated and parsed by
// codegen/lib/code/entity.py // codegen/lib/code/entity.py
#[derive(Clone, Debug, EnumAsInner, McBuf)] #[derive(Clone, Debug, EnumAsInner, AzBuf)]
pub enum EntityDataValue { pub enum EntityDataValue {
Byte(u8), Byte(u8),
Int(#[var] i32), Int(#[var] i32),
@ -102,7 +102,7 @@ pub enum EntityDataValue {
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct OptionalUnsignedInt(pub Option<u32>); pub struct OptionalUnsignedInt(pub Option<u32>);
#[derive(Clone, Debug, McBuf)] #[derive(Clone, Debug, AzBuf)]
pub struct Quaternion { pub struct Quaternion {
pub x: f32, pub x: f32,
pub y: f32, pub y: f32,
@ -112,7 +112,7 @@ pub struct Quaternion {
// mojang just calls this ArmadilloState but i added "Kind" since otherwise it // mojang just calls this ArmadilloState but i added "Kind" since otherwise it
// collides with a name in metadata.rs // collides with a name in metadata.rs
#[derive(Clone, Debug, Copy, Default, McBuf)] #[derive(Clone, Debug, Copy, Default, AzBuf)]
pub enum ArmadilloStateKind { pub enum ArmadilloStateKind {
#[default] #[default]
Idle, Idle,
@ -140,14 +140,14 @@ impl AzaleaWrite for OptionalUnsignedInt {
} }
/// A set of x, y, and z rotations. This is used for armor stands. /// A set of x, y, and z rotations. This is used for armor stands.
#[derive(Clone, Debug, McBuf, Default)] #[derive(Clone, Debug, AzBuf, Default)]
pub struct Rotations { pub struct Rotations {
pub x: f32, pub x: f32,
pub y: f32, pub y: f32,
pub z: f32, pub z: f32,
} }
#[derive(Clone, Debug, Copy, McBuf, Default, Component, Eq, PartialEq)] #[derive(Clone, Debug, Copy, AzBuf, Default, Component, Eq, PartialEq)]
pub enum Pose { pub enum Pose {
#[default] #[default]
Standing = 0, Standing = 0,
@ -160,7 +160,7 @@ pub enum Pose {
Dying, Dying,
} }
#[derive(Debug, Clone, McBuf)] #[derive(Debug, Clone, AzBuf)]
pub struct VillagerData { pub struct VillagerData {
pub kind: azalea_registry::VillagerKind, pub kind: azalea_registry::VillagerKind,
pub profession: azalea_registry::VillagerProfession, pub profession: azalea_registry::VillagerProfession,
@ -197,7 +197,7 @@ impl TryFrom<EntityMetadataItems> for Vec<EntityDataValue> {
} }
} }
#[derive(Debug, Copy, Clone, McBuf, Default)] #[derive(Debug, Copy, Clone, AzBuf, Default)]
pub enum SnifferState { pub enum SnifferState {
#[default] #[default]
Idling, Idling,

View file

@ -1,4 +1,4 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_core::position::BlockPos; use azalea_core::position::BlockPos;
use azalea_inventory::ItemStack; use azalea_inventory::ItemStack;
use azalea_registry::ParticleKind; use azalea_registry::ParticleKind;
@ -7,7 +7,7 @@ use bevy_ecs::component::Component;
// the order of this enum must be kept in sync with ParticleKind, otherwise // the order of this enum must be kept in sync with ParticleKind, otherwise
// we get errors parsing particles. // we get errors parsing particles.
/// A [`ParticleKind`] with data potentially attached to it. /// A [`ParticleKind`] with data potentially attached to it.
#[derive(Component, Clone, Debug, McBuf, Default)] #[derive(Component, Clone, Debug, AzBuf, Default)]
pub enum Particle { pub enum Particle {
AngryVillager, AngryVillager,
Block(BlockParticle), Block(BlockParticle),
@ -249,12 +249,12 @@ impl From<ParticleKind> for Particle {
} }
} }
#[derive(Debug, Clone, McBuf, Default)] #[derive(Debug, Clone, AzBuf, Default)]
pub struct BlockParticle { pub struct BlockParticle {
#[var] #[var]
pub block_state: i32, pub block_state: i32,
} }
#[derive(Debug, Clone, McBuf, Default)] #[derive(Debug, Clone, AzBuf, Default)]
pub struct DustParticle { pub struct DustParticle {
/// Red value, 0-1 /// Red value, 0-1
pub red: f32, pub red: f32,
@ -266,7 +266,7 @@ pub struct DustParticle {
pub scale: f32, pub scale: f32,
} }
#[derive(Debug, Clone, McBuf, Default)] #[derive(Debug, Clone, AzBuf, Default)]
pub struct DustColorTransitionParticle { pub struct DustColorTransitionParticle {
/// Red value, 0-1 /// Red value, 0-1
pub from_red: f32, pub from_red: f32,
@ -284,12 +284,12 @@ pub struct DustColorTransitionParticle {
pub to_blue: f32, pub to_blue: f32,
} }
#[derive(Debug, Clone, McBuf, Default)] #[derive(Debug, Clone, AzBuf, Default)]
pub struct ItemParticle { pub struct ItemParticle {
pub item: ItemStack, pub item: ItemStack,
} }
#[derive(Debug, Clone, McBuf, Default)] #[derive(Debug, Clone, AzBuf, Default)]
pub struct VibrationParticle { pub struct VibrationParticle {
pub origin: BlockPos, pub origin: BlockPos,
pub position_type: String, pub position_type: String,
@ -300,12 +300,12 @@ pub struct VibrationParticle {
pub ticks: u32, pub ticks: u32,
} }
#[derive(Debug, Clone, McBuf, Default)] #[derive(Debug, Clone, AzBuf, Default)]
pub struct SculkChargeParticle { pub struct SculkChargeParticle {
pub roll: f32, pub roll: f32,
} }
#[derive(Debug, Clone, McBuf, Default)] #[derive(Debug, Clone, AzBuf, Default)]
pub struct ShriekParticle { pub struct ShriekParticle {
#[var] #[var]
pub delay: i32, // The time in ticks before the particle is displayed pub delay: i32, // The time in ticks before the particle is displayed

View file

@ -1,7 +1,7 @@
use core::f64; use core::f64;
use std::{any::Any, collections::HashMap, io::Cursor}; use std::{any::Any, collections::HashMap, io::Cursor};
use azalea_buf::{BufReadError, McBuf, AzaleaRead, AzaleaWrite}; use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite, BufReadError};
use azalea_chat::FormattedText; use azalea_chat::FormattedText;
use azalea_core::{position::GlobalPos, resource_location::ResourceLocation}; use azalea_core::{position::GlobalPos, resource_location::ResourceLocation};
use azalea_registry::{ use azalea_registry::{
@ -134,27 +134,27 @@ pub fn from_kind(
}) })
} }
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct CustomData { pub struct CustomData {
pub nbt: Nbt, pub nbt: Nbt,
} }
impl DataComponent for CustomData {} impl DataComponent for CustomData {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct MaxStackSize { pub struct MaxStackSize {
#[var] #[var]
pub count: i32, pub count: i32,
} }
impl DataComponent for MaxStackSize {} impl DataComponent for MaxStackSize {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct MaxDamage { pub struct MaxDamage {
#[var] #[var]
pub amount: i32, pub amount: i32,
} }
impl DataComponent for MaxDamage {} impl DataComponent for MaxDamage {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct Damage { pub struct Damage {
#[var] #[var]
pub amount: i32, pub amount: i32,
@ -162,7 +162,7 @@ pub struct Damage {
impl DataComponent for Damage {} impl DataComponent for Damage {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct Unbreakable { pub struct Unbreakable {
pub show_in_tooltip: bool, pub show_in_tooltip: bool,
} }
@ -175,26 +175,26 @@ impl Default for Unbreakable {
} }
} }
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct CustomName { pub struct CustomName {
pub name: FormattedText, pub name: FormattedText,
} }
impl DataComponent for CustomName {} impl DataComponent for CustomName {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct ItemName { pub struct ItemName {
pub name: FormattedText, pub name: FormattedText,
} }
impl DataComponent for ItemName {} impl DataComponent for ItemName {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct Lore { pub struct Lore {
pub lines: Vec<FormattedText>, pub lines: Vec<FormattedText>,
// vanilla also has styled_lines here but it doesn't appear to be used for the protocol // vanilla also has styled_lines here but it doesn't appear to be used for the protocol
} }
impl DataComponent for Lore {} impl DataComponent for Lore {}
#[derive(Clone, PartialEq, Copy, McBuf)] #[derive(Clone, PartialEq, Copy, AzBuf)]
pub enum Rarity { pub enum Rarity {
Common, Common,
Uncommon, Uncommon,
@ -203,7 +203,7 @@ pub enum Rarity {
} }
impl DataComponent for Rarity {} impl DataComponent for Rarity {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct Enchantments { pub struct Enchantments {
#[var] #[var]
pub levels: HashMap<Enchantment, u32>, pub levels: HashMap<Enchantment, u32>,
@ -211,7 +211,7 @@ pub struct Enchantments {
} }
impl DataComponent for Enchantments {} impl DataComponent for Enchantments {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub enum BlockStateValueMatcher { pub enum BlockStateValueMatcher {
Exact { Exact {
value: String, value: String,
@ -222,38 +222,38 @@ pub enum BlockStateValueMatcher {
}, },
} }
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct BlockStatePropertyMatcher { pub struct BlockStatePropertyMatcher {
pub name: String, pub name: String,
pub value_matcher: BlockStateValueMatcher, pub value_matcher: BlockStateValueMatcher,
} }
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct BlockPredicate { pub struct BlockPredicate {
pub blocks: Option<HolderSet<Block, ResourceLocation>>, pub blocks: Option<HolderSet<Block, ResourceLocation>>,
pub properties: Option<Vec<BlockStatePropertyMatcher>>, pub properties: Option<Vec<BlockStatePropertyMatcher>>,
pub nbt: Option<NbtCompound>, pub nbt: Option<NbtCompound>,
} }
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct AdventureModePredicate { pub struct AdventureModePredicate {
pub predicates: Vec<BlockPredicate>, pub predicates: Vec<BlockPredicate>,
pub show_in_tooltip: bool, pub show_in_tooltip: bool,
} }
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct CanPlaceOn { pub struct CanPlaceOn {
pub predicate: AdventureModePredicate, pub predicate: AdventureModePredicate,
} }
impl DataComponent for CanPlaceOn {} impl DataComponent for CanPlaceOn {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct CanBreak { pub struct CanBreak {
pub predicate: AdventureModePredicate, pub predicate: AdventureModePredicate,
} }
impl DataComponent for CanBreak {} impl DataComponent for CanBreak {}
#[derive(Clone, Copy, PartialEq, McBuf)] #[derive(Clone, Copy, PartialEq, AzBuf)]
pub enum EquipmentSlotGroup { pub enum EquipmentSlotGroup {
Any, Any,
Mainhand, Mainhand,
@ -267,7 +267,7 @@ pub enum EquipmentSlotGroup {
Body, Body,
} }
#[derive(Clone, Copy, PartialEq, McBuf)] #[derive(Clone, Copy, PartialEq, AzBuf)]
pub enum AttributeModifierOperation { pub enum AttributeModifierOperation {
Addition, Addition,
MultiplyBase, MultiplyBase,
@ -277,7 +277,7 @@ pub enum AttributeModifierOperation {
// this is duplicated in azalea-entity, BUT the one there has a different // this is duplicated in azalea-entity, BUT the one there has a different
// protocol format (and we can't use it anyways because it would cause a // protocol format (and we can't use it anyways because it would cause a
// circular dependency) // circular dependency)
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct AttributeModifier { pub struct AttributeModifier {
pub uuid: Uuid, pub uuid: Uuid,
pub name: String, pub name: String,
@ -285,57 +285,57 @@ pub struct AttributeModifier {
pub operation: AttributeModifierOperation, pub operation: AttributeModifierOperation,
} }
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct AttributeModifiersEntry { pub struct AttributeModifiersEntry {
pub attribute: Attribute, pub attribute: Attribute,
pub modifier: AttributeModifier, pub modifier: AttributeModifier,
pub slot: EquipmentSlotGroup, pub slot: EquipmentSlotGroup,
} }
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct AttributeModifiers { pub struct AttributeModifiers {
pub modifiers: Vec<AttributeModifiersEntry>, pub modifiers: Vec<AttributeModifiersEntry>,
pub show_in_tooltip: bool, pub show_in_tooltip: bool,
} }
impl DataComponent for AttributeModifiers {} impl DataComponent for AttributeModifiers {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct CustomModelData { pub struct CustomModelData {
#[var] #[var]
pub value: i32, pub value: i32,
} }
impl DataComponent for CustomModelData {} impl DataComponent for CustomModelData {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct HideAdditionalTooltip; pub struct HideAdditionalTooltip;
impl DataComponent for HideAdditionalTooltip {} impl DataComponent for HideAdditionalTooltip {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct HideTooltip; pub struct HideTooltip;
impl DataComponent for HideTooltip {} impl DataComponent for HideTooltip {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct RepairCost { pub struct RepairCost {
#[var] #[var]
pub cost: u32, pub cost: u32,
} }
impl DataComponent for RepairCost {} impl DataComponent for RepairCost {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct CreativeSlotLock; pub struct CreativeSlotLock;
impl DataComponent for CreativeSlotLock {} impl DataComponent for CreativeSlotLock {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct EnchantmentGlintOverride { pub struct EnchantmentGlintOverride {
pub show_glint: bool, pub show_glint: bool,
} }
impl DataComponent for EnchantmentGlintOverride {} impl DataComponent for EnchantmentGlintOverride {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct IntangibleProjectile; pub struct IntangibleProjectile;
impl DataComponent for IntangibleProjectile {} impl DataComponent for IntangibleProjectile {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct MobEffectDetails { pub struct MobEffectDetails {
#[var] #[var]
pub amplifier: i32, pub amplifier: i32,
@ -347,19 +347,19 @@ pub struct MobEffectDetails {
pub hidden_effect: Option<Box<MobEffectDetails>>, pub hidden_effect: Option<Box<MobEffectDetails>>,
} }
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct MobEffectInstance { pub struct MobEffectInstance {
pub effect: MobEffect, pub effect: MobEffect,
pub details: MobEffectDetails, pub details: MobEffectDetails,
} }
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct PossibleEffect { pub struct PossibleEffect {
pub effect: MobEffectInstance, pub effect: MobEffectInstance,
pub probability: f32, pub probability: f32,
} }
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct Food { pub struct Food {
#[var] #[var]
pub nutrition: i32, pub nutrition: i32,
@ -370,14 +370,14 @@ pub struct Food {
} }
impl DataComponent for Food {} impl DataComponent for Food {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct ToolRule { pub struct ToolRule {
pub blocks: HolderSet<Block, ResourceLocation>, pub blocks: HolderSet<Block, ResourceLocation>,
pub speed: Option<f32>, pub speed: Option<f32>,
pub correct_for_drops: Option<bool>, pub correct_for_drops: Option<bool>,
} }
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct Tool { pub struct Tool {
pub rules: Vec<ToolRule>, pub rules: Vec<ToolRule>,
pub default_mining_speed: f32, pub default_mining_speed: f32,
@ -386,7 +386,7 @@ pub struct Tool {
} }
impl DataComponent for Tool {} impl DataComponent for Tool {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct StoredEnchantments { pub struct StoredEnchantments {
#[var] #[var]
pub enchantments: HashMap<Enchantment, i32>, pub enchantments: HashMap<Enchantment, i32>,
@ -394,52 +394,52 @@ pub struct StoredEnchantments {
} }
impl DataComponent for StoredEnchantments {} impl DataComponent for StoredEnchantments {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct DyedColor { pub struct DyedColor {
pub rgb: i32, pub rgb: i32,
pub show_in_tooltip: bool, pub show_in_tooltip: bool,
} }
impl DataComponent for DyedColor {} impl DataComponent for DyedColor {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct MapColor { pub struct MapColor {
pub color: i32, pub color: i32,
} }
impl DataComponent for MapColor {} impl DataComponent for MapColor {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct MapId { pub struct MapId {
#[var] #[var]
pub id: i32, pub id: i32,
} }
impl DataComponent for MapId {} impl DataComponent for MapId {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct MapDecorations { pub struct MapDecorations {
pub decorations: NbtCompound, pub decorations: NbtCompound,
} }
impl DataComponent for MapDecorations {} impl DataComponent for MapDecorations {}
#[derive(Clone, Copy, PartialEq, McBuf)] #[derive(Clone, Copy, PartialEq, AzBuf)]
pub enum MapPostProcessing { pub enum MapPostProcessing {
Lock, Lock,
Scale, Scale,
} }
impl DataComponent for MapPostProcessing {} impl DataComponent for MapPostProcessing {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct ChargedProjectiles { pub struct ChargedProjectiles {
pub items: Vec<ItemStack>, pub items: Vec<ItemStack>,
} }
impl DataComponent for ChargedProjectiles {} impl DataComponent for ChargedProjectiles {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct BundleContents { pub struct BundleContents {
pub items: Vec<ItemStack>, pub items: Vec<ItemStack>,
} }
impl DataComponent for BundleContents {} impl DataComponent for BundleContents {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct PotionContents { pub struct PotionContents {
pub potion: Option<Potion>, pub potion: Option<Potion>,
pub custom_color: Option<i32>, pub custom_color: Option<i32>,
@ -447,26 +447,26 @@ pub struct PotionContents {
} }
impl DataComponent for PotionContents {} impl DataComponent for PotionContents {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct SuspiciousStewEffect { pub struct SuspiciousStewEffect {
pub effect: MobEffect, pub effect: MobEffect,
#[var] #[var]
pub duration: i32, pub duration: i32,
} }
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct SuspiciousStewEffects { pub struct SuspiciousStewEffects {
pub effects: Vec<SuspiciousStewEffect>, pub effects: Vec<SuspiciousStewEffect>,
} }
impl DataComponent for SuspiciousStewEffects {} impl DataComponent for SuspiciousStewEffects {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct WritableBookContent { pub struct WritableBookContent {
pub pages: Vec<String>, pub pages: Vec<String>,
} }
impl DataComponent for WritableBookContent {} impl DataComponent for WritableBookContent {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct WrittenBookContent { pub struct WrittenBookContent {
pub title: String, pub title: String,
pub author: String, pub author: String,
@ -477,7 +477,7 @@ pub struct WrittenBookContent {
} }
impl DataComponent for WrittenBookContent {} impl DataComponent for WrittenBookContent {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct Trim { pub struct Trim {
pub material: TrimMaterial, pub material: TrimMaterial,
pub pattern: TrimPattern, pub pattern: TrimPattern,
@ -485,57 +485,57 @@ pub struct Trim {
} }
impl DataComponent for Trim {} impl DataComponent for Trim {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct DebugStickState { pub struct DebugStickState {
pub properties: NbtCompound, pub properties: NbtCompound,
} }
impl DataComponent for DebugStickState {} impl DataComponent for DebugStickState {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct EntityData { pub struct EntityData {
pub entity: NbtCompound, pub entity: NbtCompound,
} }
impl DataComponent for EntityData {} impl DataComponent for EntityData {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct BucketEntityData { pub struct BucketEntityData {
pub entity: NbtCompound, pub entity: NbtCompound,
} }
impl DataComponent for BucketEntityData {} impl DataComponent for BucketEntityData {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct BlockEntityData { pub struct BlockEntityData {
pub entity: NbtCompound, pub entity: NbtCompound,
} }
impl DataComponent for BlockEntityData {} impl DataComponent for BlockEntityData {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct Instrument { pub struct Instrument {
pub instrument: azalea_registry::Instrument, pub instrument: azalea_registry::Instrument,
} }
impl DataComponent for Instrument {} impl DataComponent for Instrument {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct OminousBottleAmplifier { pub struct OminousBottleAmplifier {
#[var] #[var]
pub amplifier: i32, pub amplifier: i32,
} }
impl DataComponent for OminousBottleAmplifier {} impl DataComponent for OminousBottleAmplifier {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct Recipes { pub struct Recipes {
pub recipes: Vec<ResourceLocation>, pub recipes: Vec<ResourceLocation>,
} }
impl DataComponent for Recipes {} impl DataComponent for Recipes {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct LodestoneTracker { pub struct LodestoneTracker {
pub target: Option<GlobalPos>, pub target: Option<GlobalPos>,
pub tracked: bool, pub tracked: bool,
} }
impl DataComponent for LodestoneTracker {} impl DataComponent for LodestoneTracker {}
#[derive(Clone, Copy, PartialEq, McBuf)] #[derive(Clone, Copy, PartialEq, AzBuf)]
pub enum FireworkExplosionShape { pub enum FireworkExplosionShape {
SmallBall, SmallBall,
LargeBall, LargeBall,
@ -544,7 +544,7 @@ pub enum FireworkExplosionShape {
Burst, Burst,
} }
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct FireworkExplosion { pub struct FireworkExplosion {
pub shape: FireworkExplosionShape, pub shape: FireworkExplosionShape,
pub colors: Vec<i32>, pub colors: Vec<i32>,
@ -554,7 +554,7 @@ pub struct FireworkExplosion {
} }
impl DataComponent for FireworkExplosion {} impl DataComponent for FireworkExplosion {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct Fireworks { pub struct Fireworks {
#[var] #[var]
pub flight_duration: i32, pub flight_duration: i32,
@ -562,14 +562,14 @@ pub struct Fireworks {
} }
impl DataComponent for Fireworks {} impl DataComponent for Fireworks {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct GameProfileProperty { pub struct GameProfileProperty {
pub name: String, pub name: String,
pub value: String, pub value: String,
pub signature: Option<String>, pub signature: Option<String>,
} }
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct Profile { pub struct Profile {
pub name: String, pub name: String,
pub id: Option<Uuid>, pub id: Option<Uuid>,
@ -577,13 +577,13 @@ pub struct Profile {
} }
impl DataComponent for Profile {} impl DataComponent for Profile {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct NoteBlockSound { pub struct NoteBlockSound {
pub sound: ResourceLocation, pub sound: ResourceLocation,
} }
impl DataComponent for NoteBlockSound {} impl DataComponent for NoteBlockSound {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct BannerPattern { pub struct BannerPattern {
#[var] #[var]
pub pattern: i32, pub pattern: i32,
@ -591,13 +591,13 @@ pub struct BannerPattern {
pub color: i32, pub color: i32,
} }
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct BannerPatterns { pub struct BannerPatterns {
pub patterns: Vec<BannerPattern>, pub patterns: Vec<BannerPattern>,
} }
impl DataComponent for BannerPatterns {} impl DataComponent for BannerPatterns {}
#[derive(Clone, Copy, PartialEq, McBuf)] #[derive(Clone, Copy, PartialEq, AzBuf)]
pub enum DyeColor { pub enum DyeColor {
White, White,
Orange, Orange,
@ -617,31 +617,31 @@ pub enum DyeColor {
Black, Black,
} }
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct BaseColor { pub struct BaseColor {
pub color: DyeColor, pub color: DyeColor,
} }
impl DataComponent for BaseColor {} impl DataComponent for BaseColor {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct PotDecorations { pub struct PotDecorations {
pub items: Vec<Item>, pub items: Vec<Item>,
} }
impl DataComponent for PotDecorations {} impl DataComponent for PotDecorations {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct Container { pub struct Container {
pub items: Vec<ItemStack>, pub items: Vec<ItemStack>,
} }
impl DataComponent for Container {} impl DataComponent for Container {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct BlockState { pub struct BlockState {
pub properties: HashMap<String, String>, pub properties: HashMap<String, String>,
} }
impl DataComponent for BlockState {} impl DataComponent for BlockState {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct BeehiveOccupant { pub struct BeehiveOccupant {
pub entity_data: NbtCompound, pub entity_data: NbtCompound,
#[var] #[var]
@ -650,32 +650,32 @@ pub struct BeehiveOccupant {
pub min_ticks_in_hive: i32, pub min_ticks_in_hive: i32,
} }
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct Bees { pub struct Bees {
pub occupants: Vec<BeehiveOccupant>, pub occupants: Vec<BeehiveOccupant>,
} }
impl DataComponent for Bees {} impl DataComponent for Bees {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct Lock { pub struct Lock {
pub key: String, pub key: String,
} }
impl DataComponent for Lock {} impl DataComponent for Lock {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct ContainerLoot { pub struct ContainerLoot {
pub loot: NbtCompound, pub loot: NbtCompound,
} }
impl DataComponent for ContainerLoot {} impl DataComponent for ContainerLoot {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct JukeboxPlayable { pub struct JukeboxPlayable {
pub song: azalea_registry::JukeboxSong, pub song: azalea_registry::JukeboxSong,
pub show_in_tooltip: bool, pub show_in_tooltip: bool,
} }
impl DataComponent for JukeboxPlayable {} impl DataComponent for JukeboxPlayable {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct Consumable { pub struct Consumable {
pub consume_seconds: f32, pub consume_seconds: f32,
pub animation: ItemUseAnimation, pub animation: ItemUseAnimation,
@ -685,7 +685,7 @@ pub struct Consumable {
} }
impl DataComponent for Consumable {} impl DataComponent for Consumable {}
#[derive(Clone, Copy, PartialEq, McBuf)] #[derive(Clone, Copy, PartialEq, AzBuf)]
pub enum ItemUseAnimation { pub enum ItemUseAnimation {
None, None,
Eat, Eat,
@ -699,39 +699,39 @@ pub enum ItemUseAnimation {
Brush, Brush,
} }
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct UseRemainder { pub struct UseRemainder {
pub convert_into: ItemStack, pub convert_into: ItemStack,
} }
impl DataComponent for UseRemainder {} impl DataComponent for UseRemainder {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct UseCooldown { pub struct UseCooldown {
pub seconds: f32, pub seconds: f32,
pub cooldown_group: Option<ResourceLocation>, pub cooldown_group: Option<ResourceLocation>,
} }
impl DataComponent for UseCooldown {} impl DataComponent for UseCooldown {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct Enchantable { pub struct Enchantable {
#[var] #[var]
pub value: u32, pub value: u32,
} }
impl DataComponent for Enchantable {} impl DataComponent for Enchantable {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct Repairable { pub struct Repairable {
pub items: HolderSet<Item, ResourceLocation>, pub items: HolderSet<Item, ResourceLocation>,
} }
impl DataComponent for Repairable {} impl DataComponent for Repairable {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct ItemModel { pub struct ItemModel {
pub resource_location: ResourceLocation, pub resource_location: ResourceLocation,
} }
impl DataComponent for ItemModel {} impl DataComponent for ItemModel {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct DamageResistant { pub struct DamageResistant {
// in the vanilla code this is // in the vanilla code this is
// ``` // ```
@ -745,7 +745,7 @@ pub struct DamageResistant {
} }
impl DataComponent for DamageResistant {} impl DataComponent for DamageResistant {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct Equippable { pub struct Equippable {
pub slot: EquipmentSlot, pub slot: EquipmentSlot,
pub equip_sound: SoundEvent, pub equip_sound: SoundEvent,
@ -754,7 +754,7 @@ pub struct Equippable {
} }
impl DataComponent for Equippable {} impl DataComponent for Equippable {}
#[derive(Clone, Copy, Debug, PartialEq, McBuf)] #[derive(Clone, Copy, Debug, PartialEq, AzBuf)]
pub enum EquipmentSlot { pub enum EquipmentSlot {
Mainhand, Mainhand,
Offhand, Offhand,
@ -767,17 +767,17 @@ pub enum EquipmentSlot {
Body, Body,
} }
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct Glider; pub struct Glider;
impl DataComponent for Glider {} impl DataComponent for Glider {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct TooltipStyle { pub struct TooltipStyle {
pub resource_location: ResourceLocation, pub resource_location: ResourceLocation,
} }
impl DataComponent for TooltipStyle {} impl DataComponent for TooltipStyle {}
#[derive(Clone, PartialEq, McBuf)] #[derive(Clone, PartialEq, AzBuf)]
pub struct DeathProtection { pub struct DeathProtection {
pub death_effects: Vec<ConsumeEffectKind>, pub death_effects: Vec<ConsumeEffectKind>,
} }

View file

@ -1,6 +1,6 @@
use std::ops::RangeInclusive; use std::ops::RangeInclusive;
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use crate::{ use crate::{
item::MaxStackSizeExt, AnvilMenuLocation, BeaconMenuLocation, BlastFurnaceMenuLocation, item::MaxStackSizeExt, AnvilMenuLocation, BeaconMenuLocation, BlastFurnaceMenuLocation,
@ -250,7 +250,7 @@ impl ClickOperation {
} }
} }
#[derive(McBuf, Clone, Copy, Debug)] #[derive(AzBuf, Clone, Copy, Debug)]
pub enum ClickType { pub enum ClickType {
Pickup = 0, Pickup = 0,
QuickMove = 1, QuickMove = 1,

View file

@ -21,6 +21,6 @@ Adding new packets is usually pretty easy, but you'll want to have Minecraft's d
### Implementing packets ### Implementing packets
You can manually implement reading and writing functionality for a packet by implementing AzaleaRead and AzaleaWrite, but you can also have this automatically generated for a struct or enum by deriving McBuf. You can manually implement reading and writing functionality for a packet by implementing AzaleaRead and AzaleaWrite, but you can also have this automatically generated for a struct or enum by deriving AzBuf.
Look at other packets as an example. Look at other packets as an example.

View file

@ -1,13 +1,13 @@
//! Some serializable data types that are used by several packets. //! Some serializable data types that are used by several packets.
use azalea_buf::{AzaleaRead, AzaleaWrite, McBuf}; use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite};
use azalea_core::bitset::FixedBitSet; use azalea_core::bitset::FixedBitSet;
use bevy_ecs::component::Component; use bevy_ecs::component::Component;
/// A component that contains some of the "settings" for this client that are /// A component that contains some of the "settings" for this client that are
/// sent to the server, such as render distance. This is only present on local /// sent to the server, such as render distance. This is only present on local
/// players. /// players.
#[derive(Clone, Debug, McBuf, PartialEq, Eq, Component)] #[derive(Clone, Debug, AzBuf, PartialEq, Eq, Component)]
pub struct ClientInformation { pub struct ClientInformation {
/// The locale of the client. /// The locale of the client.
pub language: String, pub language: String,
@ -45,7 +45,7 @@ impl Default for ClientInformation {
} }
} }
#[derive(McBuf, Clone, Copy, Debug, PartialEq, Eq, Default)] #[derive(AzBuf, Clone, Copy, Debug, PartialEq, Eq, Default)]
pub enum ChatVisibility { pub enum ChatVisibility {
/// All chat messages should be sent to the client. /// All chat messages should be sent to the client.
#[default] #[default]
@ -57,7 +57,7 @@ pub enum ChatVisibility {
Hidden = 2, Hidden = 2,
} }
#[derive(McBuf, Clone, Copy, Debug, PartialEq, Eq, Default)] #[derive(AzBuf, Clone, Copy, Debug, PartialEq, Eq, Default)]
pub enum HumanoidArm { pub enum HumanoidArm {
Left = 0, Left = 0,
#[default] #[default]
@ -75,7 +75,7 @@ pub struct ModelCustomization {
pub hat: bool, pub hat: bool,
} }
#[derive(McBuf, Clone, Copy, Debug, PartialEq, Eq, Default)] #[derive(AzBuf, Clone, Copy, Debug, PartialEq, Eq, Default)]
pub enum ParticleStatus { pub enum ParticleStatus {
#[default] #[default]
All, All,

View file

@ -1,11 +1,11 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_core::{ use azalea_core::{
game_type::{GameMode, OptionalGameType}, game_type::{GameMode, OptionalGameType},
position::GlobalPos, position::GlobalPos,
resource_location::ResourceLocation, resource_location::ResourceLocation,
}; };
#[derive(Clone, Debug, McBuf)] #[derive(Clone, Debug, AzBuf)]
pub struct CommonPlayerSpawnInfo { pub struct CommonPlayerSpawnInfo {
pub dimension_type: azalea_registry::DimensionType, pub dimension_type: azalea_registry::DimensionType,
pub dimension: ResourceLocation, pub dimension: ResourceLocation,

View file

@ -1,8 +1,8 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_core::resource_location::ResourceLocation; use azalea_core::resource_location::ResourceLocation;
use azalea_protocol_macros::ClientboundConfigPacket; use azalea_protocol_macros::ClientboundConfigPacket;
#[derive(Clone, Debug, McBuf, ClientboundConfigPacket)] #[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)]
pub struct ClientboundCookieRequest { pub struct ClientboundCookieRequest {
pub key: ResourceLocation, pub key: ResourceLocation,
} }

View file

@ -1,9 +1,9 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_buf::UnsizedByteArray; use azalea_buf::UnsizedByteArray;
use azalea_core::resource_location::ResourceLocation; use azalea_core::resource_location::ResourceLocation;
use azalea_protocol_macros::ClientboundConfigPacket; use azalea_protocol_macros::ClientboundConfigPacket;
#[derive(Clone, Debug, McBuf, ClientboundConfigPacket)] #[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)]
pub struct ClientboundCustomPayload { pub struct ClientboundCustomPayload {
pub identifier: ResourceLocation, pub identifier: ResourceLocation,
pub data: UnsizedByteArray, pub data: UnsizedByteArray,

View file

@ -1,8 +1,8 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_chat::FormattedText; use azalea_chat::FormattedText;
use azalea_protocol_macros::ClientboundConfigPacket; use azalea_protocol_macros::ClientboundConfigPacket;
#[derive(Clone, Debug, McBuf, ClientboundConfigPacket)] #[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)]
pub struct ClientboundDisconnect { pub struct ClientboundDisconnect {
pub reason: FormattedText, pub reason: FormattedText,
} }

View file

@ -1,5 +1,5 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundConfigPacket; use azalea_protocol_macros::ClientboundConfigPacket;
#[derive(Clone, Debug, McBuf, ClientboundConfigPacket)] #[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)]
pub struct ClientboundFinishConfiguration {} pub struct ClientboundFinishConfiguration {}

View file

@ -1,7 +1,7 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundConfigPacket; use azalea_protocol_macros::ClientboundConfigPacket;
#[derive(Clone, Debug, McBuf, ClientboundConfigPacket)] #[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)]
pub struct ClientboundKeepAlive { pub struct ClientboundKeepAlive {
pub id: u64, pub id: u64,
} }

View file

@ -1,7 +1,7 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundConfigPacket; use azalea_protocol_macros::ClientboundConfigPacket;
#[derive(Clone, Debug, McBuf, ClientboundConfigPacket)] #[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)]
pub struct ClientboundPing { pub struct ClientboundPing {
pub id: u32, pub id: u32,
} }

View file

@ -1,11 +1,11 @@
use std::collections::HashMap; use std::collections::HashMap;
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_core::resource_location::ResourceLocation; use azalea_core::resource_location::ResourceLocation;
use azalea_protocol_macros::ClientboundConfigPacket; use azalea_protocol_macros::ClientboundConfigPacket;
use simdnbt::owned::NbtCompound; use simdnbt::owned::NbtCompound;
#[derive(Clone, Debug, McBuf, ClientboundConfigPacket)] #[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)]
pub struct ClientboundRegistryData { pub struct ClientboundRegistryData {
pub registry_id: ResourceLocation, pub registry_id: ResourceLocation,
pub entries: HashMap<ResourceLocation, Option<NbtCompound>>, pub entries: HashMap<ResourceLocation, Option<NbtCompound>>,

View file

@ -1,5 +1,5 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundConfigPacket; use azalea_protocol_macros::ClientboundConfigPacket;
#[derive(Clone, Debug, McBuf, ClientboundConfigPacket)] #[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)]
pub struct ClientboundResetChat; pub struct ClientboundResetChat;

View file

@ -1,8 +1,8 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_chat::FormattedText; use azalea_chat::FormattedText;
use azalea_protocol_macros::ClientboundConfigPacket; use azalea_protocol_macros::ClientboundConfigPacket;
#[derive(Clone, Debug, McBuf, ClientboundConfigPacket)] #[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)]
pub struct ClientboundResourcePack { pub struct ClientboundResourcePack {
pub url: String, pub url: String,
pub hash: String, pub hash: String,

View file

@ -1,8 +1,8 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundConfigPacket; use azalea_protocol_macros::ClientboundConfigPacket;
use uuid::Uuid; use uuid::Uuid;
#[derive(Clone, Debug, McBuf, ClientboundConfigPacket)] #[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)]
pub struct ClientboundResourcePackPop { pub struct ClientboundResourcePackPop {
pub id: Option<Uuid>, pub id: Option<Uuid>,
} }

View file

@ -1,9 +1,9 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_chat::FormattedText; use azalea_chat::FormattedText;
use azalea_protocol_macros::ClientboundConfigPacket; use azalea_protocol_macros::ClientboundConfigPacket;
use uuid::Uuid; use uuid::Uuid;
#[derive(Clone, Debug, McBuf, ClientboundConfigPacket)] #[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)]
pub struct ClientboundResourcePackPush { pub struct ClientboundResourcePackPush {
pub id: Uuid, pub id: Uuid,
pub url: String, pub url: String,

View file

@ -1,9 +1,9 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundConfigPacket; use azalea_protocol_macros::ClientboundConfigPacket;
use super::s_select_known_packs::KnownPack; use super::s_select_known_packs::KnownPack;
#[derive(Clone, Debug, McBuf, ClientboundConfigPacket)] #[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)]
pub struct ClientboundSelectKnownPacks { pub struct ClientboundSelectKnownPacks {
pub known_packs: Vec<KnownPack>, pub known_packs: Vec<KnownPack>,
} }

View file

@ -1,8 +1,8 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_core::resource_location::ResourceLocation; use azalea_core::resource_location::ResourceLocation;
use azalea_protocol_macros::ClientboundConfigPacket; use azalea_protocol_macros::ClientboundConfigPacket;
#[derive(Clone, Debug, McBuf, ClientboundConfigPacket)] #[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)]
pub struct ClientboundStoreCookie { pub struct ClientboundStoreCookie {
pub key: ResourceLocation, pub key: ResourceLocation,
pub payload: Vec<u8>, pub payload: Vec<u8>,

View file

@ -1,7 +1,7 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundConfigPacket; use azalea_protocol_macros::ClientboundConfigPacket;
#[derive(Clone, Debug, McBuf, ClientboundConfigPacket)] #[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)]
pub struct ClientboundTransfer { pub struct ClientboundTransfer {
pub host: String, pub host: String,
#[var] #[var]

View file

@ -1,8 +1,8 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_core::resource_location::ResourceLocation; use azalea_core::resource_location::ResourceLocation;
use azalea_protocol_macros::ClientboundConfigPacket; use azalea_protocol_macros::ClientboundConfigPacket;
#[derive(Clone, Debug, McBuf, ClientboundConfigPacket)] #[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)]
pub struct ClientboundUpdateEnabledFeatures { pub struct ClientboundUpdateEnabledFeatures {
pub features: Vec<ResourceLocation>, pub features: Vec<ResourceLocation>,
} }

View file

@ -2,12 +2,12 @@ use std::io::Cursor;
use std::ops::Deref; use std::ops::Deref;
use std::{collections::HashMap, io::Write}; use std::{collections::HashMap, io::Write};
use azalea_buf::{AzBuf, AzaleaReadVar, AzaleaWriteVar, BufReadError};
use azalea_buf::{AzaleaRead, AzaleaWrite}; use azalea_buf::{AzaleaRead, AzaleaWrite};
use azalea_buf::{AzaleaWriteVar, BufReadError, McBuf, AzaleaReadVar};
use azalea_core::resource_location::ResourceLocation; use azalea_core::resource_location::ResourceLocation;
use azalea_protocol_macros::ClientboundConfigPacket; use azalea_protocol_macros::ClientboundConfigPacket;
#[derive(Clone, Debug, McBuf, ClientboundConfigPacket)] #[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)]
pub struct ClientboundUpdateTags { pub struct ClientboundUpdateTags {
pub tags: TagMap, pub tags: TagMap,
} }

View file

@ -1,9 +1,9 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ServerboundConfigPacket; use azalea_protocol_macros::ServerboundConfigPacket;
use crate::common::ClientInformation; use crate::common::ClientInformation;
#[derive(Clone, Debug, McBuf, ServerboundConfigPacket, PartialEq, Eq)] #[derive(Clone, Debug, AzBuf, ServerboundConfigPacket, PartialEq, Eq)]
pub struct ServerboundClientInformation { pub struct ServerboundClientInformation {
pub information: ClientInformation, pub information: ClientInformation,
} }

View file

@ -1,8 +1,8 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_core::resource_location::ResourceLocation; use azalea_core::resource_location::ResourceLocation;
use azalea_protocol_macros::ServerboundConfigPacket; use azalea_protocol_macros::ServerboundConfigPacket;
#[derive(Clone, Debug, McBuf, ServerboundConfigPacket)] #[derive(Clone, Debug, AzBuf, ServerboundConfigPacket)]
pub struct ServerboundCookieResponse { pub struct ServerboundCookieResponse {
pub key: ResourceLocation, pub key: ResourceLocation,
pub payload: Option<Vec<u8>>, pub payload: Option<Vec<u8>>,

View file

@ -1,9 +1,9 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_buf::UnsizedByteArray; use azalea_buf::UnsizedByteArray;
use azalea_core::resource_location::ResourceLocation; use azalea_core::resource_location::ResourceLocation;
use azalea_protocol_macros::ServerboundConfigPacket; use azalea_protocol_macros::ServerboundConfigPacket;
#[derive(Clone, Debug, McBuf, ServerboundConfigPacket)] #[derive(Clone, Debug, AzBuf, ServerboundConfigPacket)]
pub struct ServerboundCustomPayload { pub struct ServerboundCustomPayload {
pub identifier: ResourceLocation, pub identifier: ResourceLocation,
pub data: UnsizedByteArray, pub data: UnsizedByteArray,

View file

@ -1,5 +1,5 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ServerboundConfigPacket; use azalea_protocol_macros::ServerboundConfigPacket;
#[derive(Clone, Debug, McBuf, ServerboundConfigPacket)] #[derive(Clone, Debug, AzBuf, ServerboundConfigPacket)]
pub struct ServerboundFinishConfiguration {} pub struct ServerboundFinishConfiguration {}

View file

@ -1,7 +1,7 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ServerboundConfigPacket; use azalea_protocol_macros::ServerboundConfigPacket;
#[derive(Clone, Debug, McBuf, ServerboundConfigPacket)] #[derive(Clone, Debug, AzBuf, ServerboundConfigPacket)]
pub struct ServerboundKeepAlive { pub struct ServerboundKeepAlive {
pub id: u64, pub id: u64,
} }

View file

@ -1,7 +1,7 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ServerboundConfigPacket; use azalea_protocol_macros::ServerboundConfigPacket;
#[derive(Clone, Debug, McBuf, ServerboundConfigPacket)] #[derive(Clone, Debug, AzBuf, ServerboundConfigPacket)]
pub struct ServerboundPong { pub struct ServerboundPong {
pub id: u32, pub id: u32,
} }

View file

@ -1,14 +1,14 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ServerboundConfigPacket; use azalea_protocol_macros::ServerboundConfigPacket;
use uuid::Uuid; use uuid::Uuid;
#[derive(Clone, Debug, McBuf, ServerboundConfigPacket)] #[derive(Clone, Debug, AzBuf, ServerboundConfigPacket)]
pub struct ServerboundResourcePack { pub struct ServerboundResourcePack {
pub id: Uuid, pub id: Uuid,
pub action: Action, pub action: Action,
} }
#[derive(McBuf, Clone, Copy, Debug)] #[derive(AzBuf, Clone, Copy, Debug)]
pub enum Action { pub enum Action {
SuccessfullyLoaded = 0, SuccessfullyLoaded = 0,
Declined = 1, Declined = 1,

View file

@ -1,12 +1,12 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ServerboundConfigPacket; use azalea_protocol_macros::ServerboundConfigPacket;
#[derive(Clone, Debug, McBuf, ServerboundConfigPacket)] #[derive(Clone, Debug, AzBuf, ServerboundConfigPacket)]
pub struct ServerboundSelectKnownPacks { pub struct ServerboundSelectKnownPacks {
pub known_packs: Vec<KnownPack>, pub known_packs: Vec<KnownPack>,
} }
#[derive(Clone, Debug, McBuf)] #[derive(Clone, Debug, AzBuf)]
pub struct KnownPack { pub struct KnownPack {
pub namespace: String, pub namespace: String,
pub id: String, pub id: String,

View file

@ -1,10 +1,10 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_core::{position::Vec3, resource_location::ResourceLocation}; use azalea_core::{position::Vec3, resource_location::ResourceLocation};
use azalea_entity::{metadata::apply_default_metadata, EntityBundle}; use azalea_entity::{metadata::apply_default_metadata, EntityBundle};
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
use uuid::Uuid; use uuid::Uuid;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundAddEntity { pub struct ClientboundAddEntity {
/// The id of the entity. /// The id of the entity.
#[var] #[var]

View file

@ -1,7 +1,7 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundAddExperienceOrb { pub struct ClientboundAddExperienceOrb {
#[var] #[var]
pub id: u32, pub id: u32,

View file

@ -1,4 +1,4 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_core::{ResourceLocation, Vec3}; use azalea_core::{ResourceLocation, Vec3};
use azalea_entity::{metadata::PlayerMetadataBundle, EntityBundle, PlayerBundle}; use azalea_entity::{metadata::PlayerMetadataBundle, EntityBundle, PlayerBundle};
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
@ -7,7 +7,7 @@ use uuid::Uuid;
/// This packet is sent by the server when a player comes into visible range, /// This packet is sent by the server when a player comes into visible range,
/// not when a player joins. /// not when a player joins.
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundAddPlayer { pub struct ClientboundAddPlayer {
#[var] #[var]
pub id: u32, pub id: u32,

View file

@ -1,7 +1,7 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundAnimate { pub struct ClientboundAnimate {
#[var] #[var]
pub id: u32, pub id: u32,
@ -10,7 +10,7 @@ pub struct ClientboundAnimate {
// minecraft actually uses a u8 for this, but a varint still works and makes it // minecraft actually uses a u8 for this, but a varint still works and makes it
// so i don't have to add a special handler // so i don't have to add a special handler
#[derive(Clone, Debug, Copy, McBuf)] #[derive(Clone, Debug, Copy, AzBuf)]
pub enum AnimationAction { pub enum AnimationAction {
SwingMainHand = 0, SwingMainHand = 0,
Hurt = 1, Hurt = 1,

View file

@ -1,15 +1,15 @@
use std::collections::HashMap; use std::collections::HashMap;
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundAwardStats { pub struct ClientboundAwardStats {
#[var] #[var]
pub stats: HashMap<Stat, i32>, pub stats: HashMap<Stat, i32>,
} }
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, McBuf)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, AzBuf)]
pub enum Stat { pub enum Stat {
Mined(azalea_registry::Block), Mined(azalea_registry::Block),
Crafted(azalea_registry::Item), Crafted(azalea_registry::Item),

View file

@ -1,7 +1,7 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundBlockChangedAck { pub struct ClientboundBlockChangedAck {
#[var] #[var]
pub sequence: i32, pub sequence: i32,

View file

@ -1,8 +1,8 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_core::position::BlockPos; use azalea_core::position::BlockPos;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundBlockDestruction { pub struct ClientboundBlockDestruction {
/// The ID of the entity breaking the block. /// The ID of the entity breaking the block.
#[var] #[var]

View file

@ -1,9 +1,9 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_core::position::BlockPos; use azalea_core::position::BlockPos;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
use simdnbt::owned::Nbt; use simdnbt::owned::Nbt;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundBlockEntityData { pub struct ClientboundBlockEntityData {
pub pos: BlockPos, pub pos: BlockPos,
pub block_entity_type: azalea_registry::BlockEntityKind, pub block_entity_type: azalea_registry::BlockEntityKind,

View file

@ -1,9 +1,9 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_core::position::BlockPos; use azalea_core::position::BlockPos;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
use azalea_registry::Block; use azalea_registry::Block;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundBlockEvent { pub struct ClientboundBlockEvent {
pub pos: BlockPos, pub pos: BlockPos,
pub action_id: u8, pub action_id: u8,

View file

@ -1,9 +1,9 @@
use azalea_block::BlockState; use azalea_block::BlockState;
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_core::position::BlockPos; use azalea_core::position::BlockPos;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundBlockUpdate { pub struct ClientboundBlockUpdate {
pub pos: BlockPos, pub pos: BlockPos,
pub block_state: BlockState, pub block_state: BlockState,

View file

@ -1,15 +1,13 @@
use std::io::Cursor; use std::io::Cursor;
use std::io::Write; use std::io::Write;
use azalea_buf::{ use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError};
BufReadError, McBuf, AzaleaRead, AzaleaReadVar, AzaleaWriteVar, AzaleaWrite,
};
use azalea_chat::FormattedText; use azalea_chat::FormattedText;
use azalea_core::bitset::FixedBitSet; use azalea_core::bitset::FixedBitSet;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
use uuid::Uuid; use uuid::Uuid;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundBossEvent { pub struct ClientboundBossEvent {
pub id: Uuid, pub id: Uuid,
pub operation: Operation, pub operation: Operation,
@ -75,7 +73,7 @@ impl AzaleaWrite for Operation {
} }
} }
#[derive(Clone, Debug, McBuf)] #[derive(Clone, Debug, AzBuf)]
pub struct AddOperation { pub struct AddOperation {
pub name: FormattedText, pub name: FormattedText,
pub progress: f32, pub progress: f32,
@ -83,13 +81,13 @@ pub struct AddOperation {
pub properties: Properties, pub properties: Properties,
} }
#[derive(Clone, Debug, McBuf)] #[derive(Clone, Debug, AzBuf)]
pub struct Style { pub struct Style {
pub color: BossBarColor, pub color: BossBarColor,
pub overlay: BossBarOverlay, pub overlay: BossBarOverlay,
} }
#[derive(McBuf, Clone, Copy, Debug)] #[derive(AzBuf, Clone, Copy, Debug)]
pub enum BossBarColor { pub enum BossBarColor {
Pink = 0, Pink = 0,
Blue = 1, Blue = 1,
@ -100,7 +98,7 @@ pub enum BossBarColor {
White = 6, White = 6,
} }
#[derive(McBuf, Clone, Copy, Debug)] #[derive(AzBuf, Clone, Copy, Debug)]
pub enum BossBarOverlay { pub enum BossBarOverlay {
Progress = 0, Progress = 0,
Notched6 = 1, Notched6 = 1,

View file

@ -1,5 +1,5 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundBundle {} pub struct ClientboundBundle {}

View file

@ -1,8 +1,8 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_core::difficulty::Difficulty; use azalea_core::difficulty::Difficulty;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundChangeDifficulty { pub struct ClientboundChangeDifficulty {
pub difficulty: Difficulty, pub difficulty: Difficulty,
pub locked: bool, pub locked: bool,

View file

@ -1,8 +1,8 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_chat::FormattedText; use azalea_chat::FormattedText;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundChatPreview { pub struct ClientboundChatPreview {
pub query_id: i32, pub query_id: i32,
pub preview: Option<FormattedText>, pub preview: Option<FormattedText>,

View file

@ -1,7 +1,7 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundChunkBatchFinished { pub struct ClientboundChunkBatchFinished {
#[var] #[var]
pub batch_size: u32, pub batch_size: u32,

View file

@ -1,5 +1,5 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundChunkBatchStart {} pub struct ClientboundChunkBatchStart {}

View file

@ -1,13 +1,13 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_core::position::ChunkPos; use azalea_core::position::ChunkPos;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundChunksBiomes { pub struct ClientboundChunksBiomes {
pub chunk_biome_data: Vec<ChunkBiomeData>, pub chunk_biome_data: Vec<ChunkBiomeData>,
} }
#[derive(Clone, Debug, McBuf)] #[derive(Clone, Debug, AzBuf)]
pub struct ChunkBiomeData { pub struct ChunkBiomeData {
pub pos: ChunkPos, pub pos: ChunkPos,
pub buffer: Vec<u8>, pub buffer: Vec<u8>,

View file

@ -1,7 +1,7 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundClearTitles { pub struct ClientboundClearTitles {
pub reset_times: bool, pub reset_times: bool,
} }

View file

@ -1,8 +1,8 @@
use azalea_brigadier::suggestion::Suggestions; use azalea_brigadier::suggestion::Suggestions;
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundCommandSuggestions { pub struct ClientboundCommandSuggestions {
#[var] #[var]
pub id: u32, pub id: u32,

View file

@ -1,13 +1,11 @@
use std::io::{Cursor, Write}; use std::io::{Cursor, Write};
use azalea_buf::{ use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError};
BufReadError, McBuf, AzaleaRead, AzaleaReadVar, AzaleaWriteVar, AzaleaWrite,
};
use azalea_core::{bitset::FixedBitSet, resource_location::ResourceLocation}; use azalea_core::{bitset::FixedBitSet, resource_location::ResourceLocation};
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
use tracing::warn; use tracing::warn;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundCommands { pub struct ClientboundCommands {
pub entries: Vec<BrigadierNodeStub>, pub entries: Vec<BrigadierNodeStub>,
#[var] #[var]
@ -82,7 +80,7 @@ impl<T: AzaleaWrite> AzaleaWrite for BrigadierNumber<T> {
} }
} }
#[derive(Debug, Clone, Copy, McBuf, PartialEq, Eq)] #[derive(Debug, Clone, Copy, AzBuf, PartialEq, Eq)]
pub enum BrigadierString { pub enum BrigadierString {
/// Reads a single word /// Reads a single word
SingleWord = 0, SingleWord = 0,
@ -93,7 +91,7 @@ pub enum BrigadierString {
GreedyPhrase = 2, GreedyPhrase = 2,
} }
#[derive(Debug, Clone, McBuf, PartialEq)] #[derive(Debug, Clone, AzBuf, PartialEq)]
pub enum BrigadierParser { pub enum BrigadierParser {
Bool, Bool,
Float(BrigadierNumber<f32>), Float(BrigadierNumber<f32>),

View file

@ -1,7 +1,7 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundContainerClose { pub struct ClientboundContainerClose {
pub container_id: u8, pub container_id: u8,
} }

View file

@ -1,8 +1,8 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_inventory::ItemStack; use azalea_inventory::ItemStack;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundContainerSetContent { pub struct ClientboundContainerSetContent {
pub container_id: i8, pub container_id: i8,
#[var] #[var]

View file

@ -1,7 +1,7 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundContainerSetData { pub struct ClientboundContainerSetData {
pub container_id: i8, pub container_id: i8,
pub id: u16, pub id: u16,

View file

@ -1,8 +1,8 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_inventory::ItemStack; use azalea_inventory::ItemStack;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundContainerSetSlot { pub struct ClientboundContainerSetSlot {
pub container_id: i8, pub container_id: i8,
#[var] #[var]

View file

@ -1,8 +1,8 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_core::resource_location::ResourceLocation; use azalea_core::resource_location::ResourceLocation;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundCookieRequest { pub struct ClientboundCookieRequest {
pub key: ResourceLocation, pub key: ResourceLocation,
} }

View file

@ -1,7 +1,7 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundCooldown { pub struct ClientboundCooldown {
pub item: azalea_registry::Item, pub item: azalea_registry::Item,
#[var] #[var]

View file

@ -1,13 +1,13 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundCustomChatCompletions { pub struct ClientboundCustomChatCompletions {
pub action: Action, pub action: Action,
pub entries: Vec<String>, pub entries: Vec<String>,
} }
#[derive(McBuf, Clone, Copy, Debug)] #[derive(AzBuf, Clone, Copy, Debug)]
pub enum Action { pub enum Action {
Add = 0, Add = 0,
Remove = 1, Remove = 1,

View file

@ -1,9 +1,9 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_buf::UnsizedByteArray; use azalea_buf::UnsizedByteArray;
use azalea_core::resource_location::ResourceLocation; use azalea_core::resource_location::ResourceLocation;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundCustomPayload { pub struct ClientboundCustomPayload {
pub identifier: ResourceLocation, pub identifier: ResourceLocation,
pub data: UnsizedByteArray, pub data: UnsizedByteArray,

View file

@ -1,9 +1,9 @@
use std::collections::HashMap; use std::collections::HashMap;
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundCustomReportDetails { pub struct ClientboundCustomReportDetails {
// azalea doesn't implement max lengths yet // azalea doesn't implement max lengths yet

View file

@ -1,8 +1,8 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_core::resource_location::ResourceLocation; use azalea_core::resource_location::ResourceLocation;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundCustomSound { pub struct ClientboundCustomSound {
pub name: ResourceLocation, pub name: ResourceLocation,
pub source: SoundSource, pub source: SoundSource,
@ -13,7 +13,7 @@ pub struct ClientboundCustomSound {
pub pitch: f32, pub pitch: f32,
} }
#[derive(McBuf, Clone, Copy, Debug)] #[derive(AzBuf, Clone, Copy, Debug)]
pub enum SoundSource { pub enum SoundSource {
Master = 0, Master = 0,
Music = 1, Music = 1,

View file

@ -1,10 +1,10 @@
use std::io::{Cursor, Write}; use std::io::{Cursor, Write};
use azalea_buf::{McBuf, AzaleaRead, AzaleaReadVar, AzaleaWriteVar, AzaleaWrite}; use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWriteVar, AzaleaWrite};
use azalea_core::position::Vec3; use azalea_core::position::Vec3;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundDamageEvent { pub struct ClientboundDamageEvent {
#[var] #[var]
pub entity_id: u32, pub entity_id: u32,

View file

@ -1,9 +1,9 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
use super::s_debug_sample_subscription::RemoteDebugSampleType; use super::s_debug_sample_subscription::RemoteDebugSampleType;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundDebugSample { pub struct ClientboundDebugSample {
pub sample: Vec<u64>, pub sample: Vec<u64>,
pub debug_sample_type: RemoteDebugSampleType, pub debug_sample_type: RemoteDebugSampleType,

View file

@ -1,9 +1,9 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
use super::c_player_chat::PackedMessageSignature; use super::c_player_chat::PackedMessageSignature;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundDeleteChat { pub struct ClientboundDeleteChat {
pub signature: PackedMessageSignature, pub signature: PackedMessageSignature,
} }

View file

@ -1,8 +1,8 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_chat::FormattedText; use azalea_chat::FormattedText;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundDisconnect { pub struct ClientboundDisconnect {
pub reason: FormattedText, pub reason: FormattedText,
} }

View file

@ -1,4 +1,4 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_chat::{ use azalea_chat::{
translatable_component::{StringOrComponent, TranslatableComponent}, translatable_component::{StringOrComponent, TranslatableComponent},
FormattedText, FormattedText,
@ -11,7 +11,7 @@ use super::c_player_chat::ChatTypeBound;
// [`ClientboundPlayerChat`], except that it doesn't have any of the chat // [`ClientboundPlayerChat`], except that it doesn't have any of the chat
// signing things. Vanilla servers use this when messages are sent from the // signing things. Vanilla servers use this when messages are sent from the
// console. // console.
#[derive(Clone, Debug, McBuf, ClientboundGamePacket, PartialEq)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket, PartialEq)]
pub struct ClientboundDisguisedChat { pub struct ClientboundDisguisedChat {
pub message: FormattedText, pub message: FormattedText,
pub chat_type: ChatTypeBound, pub chat_type: ChatTypeBound,

View file

@ -1,7 +1,7 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundEntityEvent { pub struct ClientboundEntityEvent {
pub entity_id: u32, pub entity_id: u32,
pub event_id: u8, pub event_id: u8,

View file

@ -1,8 +1,8 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_core::position::Vec3; use azalea_core::position::Vec3;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundEntityPositionSync { pub struct ClientboundEntityPositionSync {
#[var] #[var]
pub id: u32, pub id: u32,
@ -10,7 +10,7 @@ pub struct ClientboundEntityPositionSync {
pub on_ground: bool, pub on_ground: bool,
} }
#[derive(McBuf, Clone, Debug)] #[derive(AzBuf, Clone, Debug)]
pub struct PositionMoveRotation { pub struct PositionMoveRotation {
pub position: Vec3, pub position: Vec3,
pub delta_movement: Vec3, pub delta_movement: Vec3,

View file

@ -3,9 +3,7 @@ use std::{
str::FromStr, str::FromStr,
}; };
use azalea_buf::{ use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError};
BufReadError, McBuf, AzaleaRead, AzaleaReadVar, AzaleaWriteVar, AzaleaWrite,
};
use azalea_core::{position::BlockPos, resource_location::ResourceLocation}; use azalea_core::{position::BlockPos, resource_location::ResourceLocation};
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
use azalea_registry::{ParticleKind, SoundEvent}; use azalea_registry::{ParticleKind, SoundEvent};
@ -26,7 +24,7 @@ pub struct ClientboundExplode {
pub explosion_sound: SoundEvent, pub explosion_sound: SoundEvent,
} }
#[derive(Clone, Copy, Debug, PartialEq, McBuf)] #[derive(Clone, Copy, Debug, PartialEq, AzBuf)]
pub enum BlockInteraction { pub enum BlockInteraction {
Keep, Keep,
Destroy, Destroy,

View file

@ -1,8 +1,8 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_core::position::ChunkPos; use azalea_core::position::ChunkPos;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundForgetLevelChunk { pub struct ClientboundForgetLevelChunk {
pub pos: ChunkPos, pub pos: ChunkPos,
} }

View file

@ -1,13 +1,13 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundGameEvent { pub struct ClientboundGameEvent {
pub event: EventType, pub event: EventType,
pub param: f32, pub param: f32,
} }
#[derive(Clone, Debug, Copy, McBuf)] #[derive(Clone, Debug, Copy, AzBuf)]
pub enum EventType { pub enum EventType {
NoRespawnBlockAvailable = 0, NoRespawnBlockAvailable = 0,
StartRaining = 1, StartRaining = 1,

View file

@ -1,7 +1,7 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundHorseScreenOpen { pub struct ClientboundHorseScreenOpen {
pub container_id: u8, pub container_id: u8,
#[var] #[var]

View file

@ -1,7 +1,7 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundHurtAnimation { pub struct ClientboundHurtAnimation {
#[var] #[var]
pub id: u32, pub id: u32,

View file

@ -1,7 +1,7 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, ClientboundGamePacket, McBuf)] #[derive(Clone, Debug, ClientboundGamePacket, AzBuf)]
pub struct ClientboundInitializeBorder { pub struct ClientboundInitializeBorder {
pub new_center_x: f64, pub new_center_x: f64,
pub new_center_z: f64, pub new_center_z: f64,

View file

@ -1,7 +1,7 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundKeepAlive { pub struct ClientboundKeepAlive {
pub id: u64, pub id: u64,
} }

View file

@ -1,10 +1,10 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
use simdnbt::owned::Nbt; use simdnbt::owned::Nbt;
use super::c_light_update::ClientboundLightUpdatePacketData; use super::c_light_update::ClientboundLightUpdatePacketData;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundLevelChunkWithLight { pub struct ClientboundLevelChunkWithLight {
pub x: i32, pub x: i32,
pub z: i32, pub z: i32,
@ -12,7 +12,7 @@ pub struct ClientboundLevelChunkWithLight {
pub light_data: ClientboundLightUpdatePacketData, pub light_data: ClientboundLightUpdatePacketData,
} }
#[derive(Clone, Debug, McBuf)] #[derive(Clone, Debug, AzBuf)]
pub struct ClientboundLevelChunkPacketData { pub struct ClientboundLevelChunkPacketData {
pub heightmaps: Nbt, pub heightmaps: Nbt,
// we can't parse the data in azalea-protocol because it depends on context from other packets // we can't parse the data in azalea-protocol because it depends on context from other packets
@ -20,7 +20,7 @@ pub struct ClientboundLevelChunkPacketData {
pub block_entities: Vec<BlockEntity>, pub block_entities: Vec<BlockEntity>,
} }
#[derive(Clone, Debug, McBuf)] #[derive(Clone, Debug, AzBuf)]
pub struct BlockEntity { pub struct BlockEntity {
pub packed_xz: u8, pub packed_xz: u8,
pub y: u16, pub y: u16,

View file

@ -1,8 +1,8 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_core::position::BlockPos; use azalea_core::position::BlockPos;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundLevelEvent { pub struct ClientboundLevelEvent {
pub event_type: u32, pub event_type: u32,
pub pos: BlockPos, pub pos: BlockPos,

View file

@ -1,8 +1,8 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_entity::particle::Particle; use azalea_entity::particle::Particle;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundLevelParticles { pub struct ClientboundLevelParticles {
pub override_limiter: bool, pub override_limiter: bool,
pub x: f64, pub x: f64,

View file

@ -1,8 +1,8 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_core::bitset::BitSet; use azalea_core::bitset::BitSet;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundLightUpdate { pub struct ClientboundLightUpdate {
#[var] #[var]
pub x: i32, pub x: i32,
@ -11,7 +11,7 @@ pub struct ClientboundLightUpdate {
pub light_data: ClientboundLightUpdatePacketData, pub light_data: ClientboundLightUpdatePacketData,
} }
#[derive(Clone, Debug, McBuf)] #[derive(Clone, Debug, AzBuf)]
pub struct ClientboundLightUpdatePacketData { pub struct ClientboundLightUpdatePacketData {
pub sky_y_mask: BitSet, pub sky_y_mask: BitSet,
pub block_y_mask: BitSet, pub block_y_mask: BitSet,

View file

@ -1,4 +1,4 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_core::resource_location::ResourceLocation; use azalea_core::resource_location::ResourceLocation;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
@ -8,7 +8,7 @@ use crate::packets::common::CommonPlayerSpawnInfo;
/// ///
/// This packet contains information about the state of the player, the /// This packet contains information about the state of the player, the
/// world, and the registry. /// world, and the registry.
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundLogin { pub struct ClientboundLogin {
pub player_id: u32, pub player_id: u32,
pub hardcore: bool, pub hardcore: bool,

View file

@ -1,8 +1,8 @@
use azalea_buf::{AzaleaRead, AzaleaWrite, McBuf}; use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite};
use azalea_chat::FormattedText; use azalea_chat::FormattedText;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, ClientboundGamePacket, McBuf)] #[derive(Clone, Debug, ClientboundGamePacket, AzBuf)]
pub struct ClientboundMapItemData { pub struct ClientboundMapItemData {
#[var] #[var]
pub map_id: u32, pub map_id: u32,
@ -12,7 +12,7 @@ pub struct ClientboundMapItemData {
pub color_patch: OptionalMapPatch, pub color_patch: OptionalMapPatch,
} }
#[derive(Clone, Debug, McBuf)] #[derive(Clone, Debug, AzBuf)]
pub struct MapDecoration { pub struct MapDecoration {
pub decoration_type: DecorationType, pub decoration_type: DecorationType,
pub x: i8, pub x: i8,
@ -47,7 +47,7 @@ impl AzaleaWrite for OptionalMapPatch {
} }
} }
#[derive(Debug, Clone, McBuf)] #[derive(Debug, Clone, AzBuf)]
pub struct MapPatch { pub struct MapPatch {
pub width: u8, pub width: u8,
pub height: u8, pub height: u8,
@ -56,7 +56,7 @@ pub struct MapPatch {
pub map_colors: Vec<u8>, pub map_colors: Vec<u8>,
} }
#[derive(Clone, Copy, Debug, McBuf)] #[derive(Clone, Copy, Debug, AzBuf)]
pub enum DecorationType { pub enum DecorationType {
Player, Player,
Frame, Frame,

View file

@ -1,8 +1,8 @@
use azalea_buf::McBuf; use azalea_buf::AzBuf;
use azalea_inventory::ItemStack; use azalea_inventory::ItemStack;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundMerchantOffers { pub struct ClientboundMerchantOffers {
#[var] #[var]
pub container_id: u32, pub container_id: u32,
@ -15,7 +15,7 @@ pub struct ClientboundMerchantOffers {
pub can_restock: bool, pub can_restock: bool,
} }
#[derive(Clone, Debug, McBuf)] #[derive(Clone, Debug, AzBuf)]
pub struct MerchantOffer { pub struct MerchantOffer {
pub base_cost_a: ItemStack, pub base_cost_a: ItemStack,
pub result: ItemStack, pub result: ItemStack,

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