diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2023-03-14 16:33:03 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-14 16:33:03 -0500 |
| commit | 12a9c8ce65b58f0c600fd7b9fc5d454ce228b420 (patch) | |
| tree | 9bada4164ea12fa533d413c0c7090f4779b519f1 /azalea-protocol/src | |
| parent | b792e21d1c2b7dba04d88dba479ed451104a6514 (diff) | |
| download | azalea-drasl-12a9c8ce65b58f0c600fd7b9fc5d454ce228b420.tar.xz | |
1.19.4 (#57)
* 23w03a
* 23w04a
* 23w05a
* 23w06a
* fix
* 23w07a
mojang broke their json data generator so some stuff is missing
* didn't mean to commit that file here
* 1.19.4-pre2
* fix
* 1.19.4-pre3
* fix
* how did these packets get here
* 1.19.4-pre4
* 1.19.4-rc1
* 1.19.4-rc2
* 1.19.4-rc3
* merge main
* remove debugging code
* 1.19.4
Diffstat (limited to 'azalea-protocol/src')
15 files changed, 400 insertions, 264 deletions
diff --git a/azalea-protocol/src/packets/game/clientbound_bundle_packet.rs b/azalea-protocol/src/packets/game/clientbound_bundle_packet.rs new file mode 100644 index 00000000..cad2eca3 --- /dev/null +++ b/azalea-protocol/src/packets/game/clientbound_bundle_packet.rs @@ -0,0 +1,5 @@ +use azalea_buf::McBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] +pub struct ClientboundBundlePacket {} diff --git a/azalea-protocol/src/packets/game/clientbound_chunks_biomes_packet.rs b/azalea-protocol/src/packets/game/clientbound_chunks_biomes_packet.rs index 9ad242a4..68b40b5d 100644 --- a/azalea-protocol/src/packets/game/clientbound_chunks_biomes_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_chunks_biomes_packet.rs @@ -1,7 +1,14 @@ -use azalea_protocol_macros::ClientboundGamePacket; use azalea_buf::McBuf; +use azalea_core::ChunkPos; +use azalea_protocol_macros::ClientboundGamePacket; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] pub struct ClientboundChunksBiomesPacket { -pub chunk_biome_data: todo!(), -}
\ No newline at end of file + pub chunk_biome_data: Vec<ChunkBiomeData>, +} + +#[derive(Clone, Debug, McBuf)] +pub struct ChunkBiomeData { + pub pos: ChunkPos, + pub buffer: Vec<u8>, +} diff --git a/azalea-protocol/src/packets/game/clientbound_commands_packet.rs b/azalea-protocol/src/packets/game/clientbound_commands_packet.rs index 36a82c7e..54bf0b7d 100755 --- a/azalea-protocol/src/packets/game/clientbound_commands_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_commands_packet.rs @@ -1,13 +1,10 @@ -use azalea_buf::BufReadError; -use azalea_buf::McBuf; -use azalea_buf::McBufVarReadable; -use azalea_buf::{McBufReadable, McBufVarWritable, McBufWritable}; -use azalea_core::FixedBitSet; -use azalea_core::ResourceLocation; +use azalea_buf::{ + BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable, +}; +use azalea_core::{FixedBitSet, ResourceLocation}; use azalea_protocol_macros::ClientboundGamePacket; use log::warn; -use std::io::Cursor; -use std::io::Write; +use std::io::{Cursor, Write}; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] pub struct ClientboundCommandsPacket { @@ -137,13 +134,14 @@ pub enum BrigadierParser { FloatRange, Dimension, GameMode, - Time, + Time { min: i32 }, ResourceOrTag { registry_key: ResourceLocation }, ResourceOrTagKey { registry_key: ResourceLocation }, Resource { registry_key: ResourceLocation }, ResourceKey { registry_key: ResourceLocation }, TemplateMirror, TemplateRotation, + Heightmap, Uuid, } diff --git a/azalea-protocol/src/packets/game/clientbound_custom_sound_packet.rs b/azalea-protocol/src/packets/game/clientbound_custom_sound_packet.rs new file mode 100644 index 00000000..9cc348b2 --- /dev/null +++ b/azalea-protocol/src/packets/game/clientbound_custom_sound_packet.rs @@ -0,0 +1,28 @@ +use azalea_buf::McBuf; +use azalea_core::ResourceLocation; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] +pub struct ClientboundCustomSoundPacket { + pub name: ResourceLocation, + pub source: SoundSource, + pub x: i32, + pub y: i32, + pub z: i32, + pub volume: f32, + pub pitch: f32, +} + +#[derive(McBuf, Clone, Copy, Debug)] +pub enum SoundSource { + Master = 0, + Music = 1, + Records = 2, + Weather = 3, + Blocks = 4, + Hostile = 5, + Neutral = 6, + Players = 7, + Ambient = 8, + Voice = 9, +} diff --git a/azalea-protocol/src/packets/game/clientbound_damage_event_packet.rs b/azalea-protocol/src/packets/game/clientbound_damage_event_packet.rs new file mode 100644 index 00000000..93731445 --- /dev/null +++ b/azalea-protocol/src/packets/game/clientbound_damage_event_packet.rs @@ -0,0 +1,30 @@ +use std::io::{Cursor, Write}; + +use azalea_buf::{McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable}; +use azalea_core::Vec3; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] +pub struct ClientboundDamageEventPacket { + #[var] + pub entity_id: u32, + #[var] + pub source_type_id: u32, + pub source_cause_id: OptionalEntityId, + pub source_direct_id: OptionalEntityId, + pub source_position: Option<Vec3>, +} + +#[derive(Clone, Debug)] +pub struct OptionalEntityId(pub u32); +impl McBufReadable for OptionalEntityId { + fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, azalea_buf::BufReadError> { + Ok(OptionalEntityId(u32::var_read_from(buf)? - 1)) + } +} +impl McBufWritable for OptionalEntityId { + fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + (self.0 + 1).var_write_into(buf)?; + Ok(()) + } +} diff --git a/azalea-protocol/src/packets/game/clientbound_hurt_animation_packet.rs b/azalea-protocol/src/packets/game/clientbound_hurt_animation_packet.rs new file mode 100644 index 00000000..d4a79a27 --- /dev/null +++ b/azalea-protocol/src/packets/game/clientbound_hurt_animation_packet.rs @@ -0,0 +1,9 @@ +use azalea_buf::McBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] +pub struct ClientboundHurtAnimationPacket { + #[var] + pub id: u32, + pub yaw: f32, +} diff --git a/azalea-protocol/src/packets/game/clientbound_login_packet.rs b/azalea-protocol/src/packets/game/clientbound_login_packet.rs index a79e0f5e..37273b03 100755 --- a/azalea-protocol/src/packets/game/clientbound_login_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_login_packet.rs @@ -96,9 +96,15 @@ pub mod registry { #[cfg_attr(feature = "strict_registry", serde(deny_unknown_fields))] pub struct RegistryRoot { #[cfg(feature = "strict_registry")] + #[serde(rename = "minecraft:trim_material")] + pub trim_material: RegistryType<TrimMaterialElement>, + #[cfg(not(feature = "strict_registry"))] + #[serde(rename = "minecraft:trim_material")] + pub trim_material: Tag, + + #[cfg(feature = "strict_registry")] #[serde(rename = "minecraft:chat_type")] pub chat_type: RegistryType<ChatTypeElement>, - #[cfg(not(feature = "strict_registry"))] #[serde(rename = "minecraft:chat_type")] pub chat_type: Tag, @@ -109,10 +115,23 @@ pub mod registry { #[cfg(feature = "strict_registry")] #[serde(rename = "minecraft:worldgen/biome")] pub world_type: RegistryType<WorldTypeElement>, - #[cfg(not(feature = "strict_registry"))] #[serde(rename = "minecraft:worldgen/biome")] pub world_type: Tag, + + #[cfg(feature = "strict_registry")] + #[serde(rename = "minecraft:trim_pattern")] + pub trim_pattern: RegistryType<TrimPatternElement>, + #[cfg(not(feature = "strict_registry"))] + #[serde(rename = "minecraft:trim_pattern")] + pub trim_pattern: Tag, + + #[cfg(feature = "strict_registry")] + #[serde(rename = "minecraft:damage_type")] + pub damage_type: RegistryType<DamageTypeElement>, + #[cfg(not(feature = "strict_registry"))] + #[serde(rename = "minecraft:damage_type")] + pub damage_type: Tag, } /// A collection of values for a certain type of registry data. @@ -133,6 +152,18 @@ pub mod registry { pub element: T, } + #[derive(Debug, Clone, Serialize, Deserialize)] + #[cfg_attr(feature = "strict_registry", serde(deny_unknown_fields))] + pub struct TrimMaterialElement { + pub asset_name: String, + pub ingredient: ResourceLocation, + pub item_model_index: f32, + pub override_armor_materials: HashMap<String, String>, + #[serde(default)] + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<String>, + } + /// Data about a kind of chat message #[derive(Debug, Clone, Serialize, Deserialize)] #[cfg_attr(feature = "strict_registry", serde(deny_unknown_fields))] @@ -259,12 +290,13 @@ pub mod registry { #[derive(Debug, Clone, Serialize, Deserialize)] #[cfg_attr(feature = "strict_registry", serde(deny_unknown_fields))] pub struct WorldTypeElement { + #[serde(with = "Convert")] + pub has_precipitation: bool, pub temperature: f32, #[serde(default)] #[serde(skip_serializing_if = "Option::is_none")] pub temperature_modifier: Option<String>, pub downfall: f32, - pub precipitation: BiomePrecipitation, pub effects: BiomeEffects, } @@ -309,7 +341,7 @@ pub mod registry { pub additions_sound: Option<AdditionsSound>, #[serde(default)] #[serde(skip_serializing_if = "Option::is_none")] - pub ambient_sound: Option<SoundId>, + pub ambient_sound: Option<ResourceLocation>, #[serde(default)] #[serde(skip_serializing_if = "Option::is_none")] pub particle: Option<BiomeParticle>, @@ -325,7 +357,7 @@ pub mod registry { pub replace_current_music: bool, pub max_delay: u32, pub min_delay: u32, - pub sound: SoundId, + pub sound: azalea_registry::SoundEvent, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -334,21 +366,14 @@ pub mod registry { pub tick_delay: u32, pub block_search_extent: u32, pub offset: f32, - pub sound: SoundId, + pub sound: azalea_registry::SoundEvent, } #[derive(Debug, Clone, Serialize, Deserialize)] #[cfg_attr(feature = "strict_registry", serde(deny_unknown_fields))] pub struct AdditionsSound { pub tick_chance: f32, - pub sound: SoundId, - } - - /// The ID of a sound. - #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] - #[cfg_attr(feature = "strict_registry", serde(deny_unknown_fields))] - pub struct SoundId { - pub sound_id: azalea_registry::SoundEvent, + pub sound: azalea_registry::SoundEvent, } /// Biome particles. @@ -361,6 +386,27 @@ pub mod registry { pub options: HashMap<String, String>, } + #[derive(Debug, Clone, Serialize, Deserialize)] + #[cfg_attr(feature = "strict_registry", serde(deny_unknown_fields))] + pub struct TrimPatternElement { + #[serde(flatten)] + pub pattern: HashMap<String, String>, + } + + #[derive(Debug, Clone, Serialize, Deserialize)] + #[cfg_attr(feature = "strict_registry", serde(deny_unknown_fields))] + pub struct DamageTypeElement { + pub message_id: String, + pub scaling: String, + pub exhaustion: f32, + #[serde(default)] + #[serde(skip_serializing_if = "Option::is_none")] + pub effects: Option<String>, + #[serde(default)] + #[serde(skip_serializing_if = "Option::is_none")] + pub death_message_type: Option<String>, + } + // Using a trait because you can't implement methods for // types you don't own, in this case Option<bool> and bool. trait Convert: Sized { @@ -443,12 +489,15 @@ mod tests { // This is just for testing. let registry = RegistryHolder { root: RegistryRoot { + trim_material: Tag::End, chat_type: Tag::End, dimension_type: RegistryType::<DimensionTypeElement> { kind: ResourceLocation::new("minecraft:dimension_type"), value: Vec::new(), }, world_type: Tag::End, + trim_pattern: Tag::End, + damage_type: Tag::End, }, }; diff --git a/azalea-protocol/src/packets/game/clientbound_player_position_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_position_packet.rs index 3ad422e7..f59d20ac 100755 --- a/azalea-protocol/src/packets/game/clientbound_player_position_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_player_position_packet.rs @@ -1,8 +1,8 @@ -use azalea_buf::{BufReadError, McBuf}; -use azalea_buf::{McBufReadable, McBufWritable}; +use std::io::{Cursor, Write}; + +use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable}; use azalea_core::FixedBitSet; use azalea_protocol_macros::ClientboundGamePacket; -use std::io::{Cursor, Write}; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] pub struct ClientboundPlayerPositionPacket { @@ -11,16 +11,13 @@ pub struct ClientboundPlayerPositionPacket { pub z: f64, pub y_rot: f32, pub x_rot: f32, - pub relative_arguments: RelativeArguments, - /// Client should confirm this packet with Teleport Confirm containing the - /// same Teleport ID. + pub relative_arguments: RelativeMovements, #[var] pub id: u32, - pub dismount_vehicle: bool, } #[derive(Debug, Clone)] -pub struct RelativeArguments { +pub struct RelativeMovements { pub x: bool, pub y: bool, pub z: bool, @@ -28,10 +25,10 @@ pub struct RelativeArguments { pub x_rot: bool, } -impl McBufReadable for RelativeArguments { +impl McBufReadable for RelativeMovements { fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { let set = FixedBitSet::<5>::read_from(buf)?; - Ok(RelativeArguments { + Ok(RelativeMovements { x: set.index(0), y: set.index(1), z: set.index(2), @@ -41,7 +38,7 @@ impl McBufReadable for RelativeArguments { } } -impl McBufWritable for RelativeArguments { +impl McBufWritable for RelativeMovements { fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { let mut set = FixedBitSet::<5>::new(); if self.x { diff --git a/azalea-protocol/src/packets/game/clientbound_server_data_packet.rs b/azalea-protocol/src/packets/game/clientbound_server_data_packet.rs index 4b2bf055..1a9d9ffc 100755 --- a/azalea-protocol/src/packets/game/clientbound_server_data_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_server_data_packet.rs @@ -4,7 +4,7 @@ use azalea_protocol_macros::ClientboundGamePacket; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] pub struct ClientboundServerDataPacket { - pub motd: Option<FormattedText>, - pub icon_base64: Option<String>, + pub motd: FormattedText, + pub icon_bytes: Option<Vec<u8>>, pub enforces_secure_chat: bool, } diff --git a/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs index d9acb20d..937a1220 100755 --- a/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs @@ -3,7 +3,10 @@ use azalea_buf::{ }; use azalea_core::{ResourceLocation, Slot}; use azalea_protocol_macros::ClientboundGamePacket; +use azalea_registry::RecipeSerializer; + use std::io::{Cursor, Write}; +use std::str::FromStr; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] pub struct ClientboundUpdateRecipesPacket { @@ -33,6 +36,7 @@ pub struct ShapedRecipe { pub category: CraftingBookCategory, pub ingredients: Vec<Ingredient>, pub result: Slot, + pub show_notification: bool, } #[derive(Clone, Debug, Copy, McBuf)] @@ -68,6 +72,7 @@ impl McBufReadable for ShapedRecipe { ingredients.push(Ingredient::read_from(buf)?); } let result = Slot::read_from(buf)?; + let show_notification = bool::read_from(buf)?; Ok(ShapedRecipe { width, @@ -76,6 +81,7 @@ impl McBufReadable for ShapedRecipe { category, ingredients, result, + show_notification, }) } } @@ -109,9 +115,24 @@ pub struct SimpleRecipe { } #[derive(Clone, Debug, McBuf)] +pub struct SmithingTransformRecipe { + pub template: Ingredient, + pub base: Ingredient, + pub addition: Ingredient, + pub result: Slot, +} + +#[derive(Clone, Debug, McBuf)] +pub struct SmithingTrimRecipe { + pub template: Ingredient, + pub base: Ingredient, + pub addition: Ingredient, +} + +#[derive(Clone, Debug, McBuf)] pub enum RecipeData { - CraftingShapeless(ShapelessRecipe), CraftingShaped(ShapedRecipe), + CraftingShapeless(ShapelessRecipe), CraftingSpecialArmorDye(SimpleRecipe), CraftingSpecialBookCloning(SimpleRecipe), CraftingSpecialMapCloning(SimpleRecipe), @@ -122,7 +143,6 @@ pub enum RecipeData { CraftingSpecialRepairItem(SimpleRecipe), CraftingSpecialTippedArrow(SimpleRecipe), CraftingSpecialBannerDuplicate(SimpleRecipe), - CraftingSpecialBannerAddPattern(SimpleRecipe), CraftingSpecialShieldDecoration(SimpleRecipe), CraftingSpecialShulkerBoxColoring(SimpleRecipe), CraftingSpecialSuspiciousStew(SimpleRecipe), @@ -132,6 +152,9 @@ pub enum RecipeData { CampfireCooking(CookingRecipe), Stonecutting(StoneCutterRecipe), Smithing(SmithingRecipe), + SmithingTransform(SmithingTransformRecipe), + SmithingTrim(SmithingTrimRecipe), + CraftingDecoratedPot(SimpleRecipe), } #[derive(Clone, Debug, McBuf)] @@ -141,48 +164,55 @@ pub struct Ingredient { impl McBufWritable for Recipe { fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - let resource_location = match &self.data { - RecipeData::CraftingShapeless(_) => "minecraft:crafting_shapeless", - RecipeData::CraftingShaped(_) => "minecraft:crafting_shaped", - RecipeData::CraftingSpecialArmorDye(_) => "minecraft:crafting_special_armordye", - RecipeData::CraftingSpecialBookCloning(_) => "minecraft:crafting_special_bookcloning", - RecipeData::CraftingSpecialMapCloning(_) => "minecraft:crafting_special_mapcloning", - RecipeData::CraftingSpecialMapExtending(_) => "minecraft:crafting_special_mapextending", + let recipe_serializer = match &self.data { + RecipeData::CraftingShapeless(_) => RecipeSerializer::CraftingShapeless, + RecipeData::CraftingShaped(_) => RecipeSerializer::CraftingShaped, + RecipeData::CraftingSpecialArmorDye(_) => RecipeSerializer::CraftingSpecialArmordye, + RecipeData::CraftingSpecialBookCloning(_) => { + RecipeSerializer::CraftingSpecialBookcloning + } + RecipeData::CraftingSpecialMapCloning(_) => RecipeSerializer::CraftingSpecialMapcloning, + RecipeData::CraftingSpecialMapExtending(_) => { + RecipeSerializer::CraftingSpecialMapextending + } RecipeData::CraftingSpecialFireworkRocket(_) => { - "minecraft:crafting_special_firework_rocket" + RecipeSerializer::CraftingSpecialFireworkRocket } RecipeData::CraftingSpecialFireworkStar(_) => { - "minecraft:crafting_special_firework_star" + RecipeSerializer::CraftingSpecialFireworkStar } RecipeData::CraftingSpecialFireworkStarFade(_) => { - "minecraft:crafting_special_firework_star_fade" + RecipeSerializer::CraftingSpecialFireworkStarFade } - RecipeData::CraftingSpecialRepairItem(_) => "minecraft:crafting_special_repairitem", - RecipeData::CraftingSpecialTippedArrow(_) => "minecraft:crafting_special_tippedarrow", - RecipeData::CraftingSpecialBannerDuplicate(_) => { - "minecraft:crafting_special_bannerduplicate" + RecipeData::CraftingSpecialRepairItem(_) => RecipeSerializer::CraftingSpecialRepairitem, + RecipeData::CraftingSpecialTippedArrow(_) => { + RecipeSerializer::CraftingSpecialTippedarrow } - RecipeData::CraftingSpecialBannerAddPattern(_) => { - "minecraft:crafting_special_banneraddpattern" + RecipeData::CraftingSpecialBannerDuplicate(_) => { + RecipeSerializer::CraftingSpecialBannerduplicate } RecipeData::CraftingSpecialShieldDecoration(_) => { - "minecraft:crafting_special_shielddecoration" + RecipeSerializer::CraftingSpecialShielddecoration } RecipeData::CraftingSpecialShulkerBoxColoring(_) => { - "minecraft:crafting_special_shulkerboxcoloring" + RecipeSerializer::CraftingSpecialShulkerboxcoloring } RecipeData::CraftingSpecialSuspiciousStew(_) => { - "minecraft:crafting_special_suspiciousstew" + RecipeSerializer::CraftingSpecialSuspiciousstew } - RecipeData::Smelting(_) => "minecraft:smelting", - RecipeData::Blasting(_) => "minecraft:blasting", - RecipeData::Smoking(_) => "minecraft:smoking", - RecipeData::CampfireCooking(_) => "minecraft:campfire_cooking", - RecipeData::Stonecutting(_) => "minecraft:stonecutting", - RecipeData::Smithing(_) => "minecraft:smithing", + RecipeData::Smelting(_) => RecipeSerializer::Smelting, + RecipeData::Blasting(_) => RecipeSerializer::Blasting, + RecipeData::Smoking(_) => RecipeSerializer::Smoking, + RecipeData::CampfireCooking(_) => RecipeSerializer::CampfireCooking, + RecipeData::Stonecutting(_) => RecipeSerializer::Stonecutting, + RecipeData::Smithing(_) => RecipeSerializer::Smithing, + RecipeData::SmithingTransform(_) => RecipeSerializer::SmithingTransform, + RecipeData::SmithingTrim(_) => RecipeSerializer::SmithingTrim, + RecipeData::CraftingDecoratedPot(_) => RecipeSerializer::CraftingDecoratedPot, }; - ResourceLocation::new(resource_location).write_into(buf)?; + let resource_location = ResourceLocation::new(&recipe_serializer.to_string()); + resource_location.write_into(buf)?; self.identifier.write_into(buf)?; self.data.write_without_id(buf)?; Ok(()) @@ -191,74 +221,79 @@ impl McBufWritable for Recipe { impl McBufReadable for Recipe { fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let recipe_type = ResourceLocation::read_from(buf)?; + let recipe_serializer_name = ResourceLocation::read_from(buf)?; + let Ok(recipe_serializer) = + RecipeSerializer::from_str(&recipe_serializer_name.to_string()) else { + return Err(BufReadError::UnexpectedStringEnumVariant { id: recipe_serializer_name.to_string() }); + }; let identifier = ResourceLocation::read_from(buf)?; // rust doesn't let us match ResourceLocation so we have to do a big // if-else chain :( - let data = match recipe_type.to_string().as_str() { - "minecraft:crafting_shapeless" => { - RecipeData::CraftingShapeless(ShapelessRecipe::read_from(buf)?) - } - "minecraft:crafting_shaped" => { + let data = match recipe_serializer { + RecipeSerializer::CraftingShaped => { RecipeData::CraftingShaped(ShapedRecipe::read_from(buf)?) } - "minecraft:crafting_special_armordye" => { + RecipeSerializer::CraftingShapeless => { + RecipeData::CraftingShapeless(ShapelessRecipe::read_from(buf)?) + } + RecipeSerializer::CraftingSpecialArmordye => { RecipeData::CraftingSpecialArmorDye(SimpleRecipe::read_from(buf)?) } - "minecraft:crafting_special_bookcloning" => { + RecipeSerializer::CraftingSpecialBookcloning => { RecipeData::CraftingSpecialBookCloning(SimpleRecipe::read_from(buf)?) } - "minecraft:crafting_special_mapcloning" => { + RecipeSerializer::CraftingSpecialMapcloning => { RecipeData::CraftingSpecialMapCloning(SimpleRecipe::read_from(buf)?) } - "minecraft:crafting_special_mapextending" => { + RecipeSerializer::CraftingSpecialMapextending => { RecipeData::CraftingSpecialMapExtending(SimpleRecipe::read_from(buf)?) } - "minecraft:crafting_special_firework_rocket" => { + RecipeSerializer::CraftingSpecialFireworkRocket => { RecipeData::CraftingSpecialFireworkRocket(SimpleRecipe::read_from(buf)?) } - "minecraft:crafting_special_firework_star" => { + RecipeSerializer::CraftingSpecialFireworkStar => { RecipeData::CraftingSpecialFireworkStar(SimpleRecipe::read_from(buf)?) } - "minecraft:crafting_special_firework_star_fade" => { + RecipeSerializer::CraftingSpecialFireworkStarFade => { RecipeData::CraftingSpecialFireworkStarFade(SimpleRecipe::read_from(buf)?) } - "minecraft:crafting_special_repairitem" => { + RecipeSerializer::CraftingSpecialRepairitem => { RecipeData::CraftingSpecialRepairItem(SimpleRecipe::read_from(buf)?) } - "minecraft:crafting_special_tippedarrow" => { + RecipeSerializer::CraftingSpecialTippedarrow => { RecipeData::CraftingSpecialTippedArrow(SimpleRecipe::read_from(buf)?) } - "minecraft:crafting_special_bannerduplicate" => { + RecipeSerializer::CraftingSpecialBannerduplicate => { RecipeData::CraftingSpecialBannerDuplicate(SimpleRecipe::read_from(buf)?) } - "minecraft:crafting_special_banneraddpattern" => { - RecipeData::CraftingSpecialBannerAddPattern(SimpleRecipe::read_from(buf)?) - } - "minecraft:crafting_special_shielddecoration" => { + RecipeSerializer::CraftingSpecialShielddecoration => { RecipeData::CraftingSpecialShieldDecoration(SimpleRecipe::read_from(buf)?) } - "minecraft:crafting_special_shulkerboxcoloring" => { + RecipeSerializer::CraftingSpecialShulkerboxcoloring => { RecipeData::CraftingSpecialShulkerBoxColoring(SimpleRecipe::read_from(buf)?) } - "minecraft:crafting_special_suspiciousstew" => { + RecipeSerializer::CraftingSpecialSuspiciousstew => { RecipeData::CraftingSpecialSuspiciousStew(SimpleRecipe::read_from(buf)?) } - "minecraft:smelting" => RecipeData::Smelting(CookingRecipe::read_from(buf)?), - "minecraft:blasting" => RecipeData::Blasting(CookingRecipe::read_from(buf)?), - "minecraft:smoking" => RecipeData::Smoking(CookingRecipe::read_from(buf)?), - "minecraft:campfire_cooking" => { + RecipeSerializer::Smelting => RecipeData::Smelting(CookingRecipe::read_from(buf)?), + RecipeSerializer::Blasting => RecipeData::Blasting(CookingRecipe::read_from(buf)?), + RecipeSerializer::Smoking => RecipeData::Smoking(CookingRecipe::read_from(buf)?), + RecipeSerializer::CampfireCooking => { RecipeData::CampfireCooking(CookingRecipe::read_from(buf)?) } - "minecraft:stonecutting" => { + RecipeSerializer::Stonecutting => { RecipeData::Stonecutting(StoneCutterRecipe::read_from(buf)?) } - "minecraft:smithing" => RecipeData::Smithing(SmithingRecipe::read_from(buf)?), - _ => { - return Err(BufReadError::UnexpectedStringEnumVariant { - id: recipe_type.to_string(), - }); + RecipeSerializer::Smithing => RecipeData::Smithing(SmithingRecipe::read_from(buf)?), + RecipeSerializer::SmithingTransform => { + RecipeData::SmithingTransform(SmithingTransformRecipe::read_from(buf)?) + } + RecipeSerializer::SmithingTrim => { + RecipeData::SmithingTrim(SmithingTrimRecipe::read_from(buf)?) + } + RecipeSerializer::CraftingDecoratedPot => { + RecipeData::CraftingDecoratedPot(SimpleRecipe::read_from(buf)?) } }; diff --git a/azalea-protocol/src/packets/game/mod.rs b/azalea-protocol/src/packets/game/mod.rs index 8c9207b5..1acd5364 100755 --- a/azalea-protocol/src/packets/game/mod.rs +++ b/azalea-protocol/src/packets/game/mod.rs @@ -9,7 +9,9 @@ pub mod clientbound_block_entity_data_packet; pub mod clientbound_block_event_packet; pub mod clientbound_block_update_packet; pub mod clientbound_boss_event_packet; +pub mod clientbound_bundle_packet; pub mod clientbound_change_difficulty_packet; +pub mod clientbound_chunks_biomes_packet; pub mod clientbound_command_suggestions_packet; pub mod clientbound_commands_packet; pub mod clientbound_container_close_packet; @@ -19,6 +21,7 @@ pub mod clientbound_container_set_slot_packet; pub mod clientbound_cooldown_packet; pub mod clientbound_custom_chat_completions_packet; pub mod clientbound_custom_payload_packet; +pub mod clientbound_damage_event_packet; pub mod clientbound_delete_chat_packet; pub mod clientbound_disconnect_packet; pub mod clientbound_disguised_chat_packet; @@ -27,6 +30,7 @@ pub mod clientbound_explode_packet; pub mod clientbound_forget_level_chunk_packet; pub mod clientbound_game_event_packet; pub mod clientbound_horse_screen_open_packet; +pub mod clientbound_hurt_animation_packet; pub mod clientbound_initialize_border_packet; pub mod clientbound_keep_alive_packet; pub mod clientbound_level_chunk_with_light_packet; @@ -167,33 +171,33 @@ declare_state_packets!( 0x03: serverbound_chat_ack_packet::ServerboundChatAckPacket, 0x04: serverbound_chat_command_packet::ServerboundChatCommandPacket, 0x05: serverbound_chat_packet::ServerboundChatPacket, - 0x06: serverbound_client_command_packet::ServerboundClientCommandPacket, - 0x07: serverbound_client_information_packet::ServerboundClientInformationPacket, - 0x08: serverbound_command_suggestion_packet::ServerboundCommandSuggestionPacket, - 0x09: serverbound_container_button_click_packet::ServerboundContainerButtonClickPacket, - 0x0a: serverbound_container_click_packet::ServerboundContainerClickPacket, - 0x0b: serverbound_container_close_packet::ServerboundContainerClosePacket, - 0x0c: serverbound_custom_payload_packet::ServerboundCustomPayloadPacket, - 0x0d: serverbound_edit_book_packet::ServerboundEditBookPacket, - 0x0e: serverbound_entity_tag_query::ServerboundEntityTagQuery, - 0x0f: serverbound_interact_packet::ServerboundInteractPacket, - 0x10: serverbound_jigsaw_generate_packet::ServerboundJigsawGeneratePacket, - 0x11: serverbound_keep_alive_packet::ServerboundKeepAlivePacket, - 0x12: serverbound_lock_difficulty_packet::ServerboundLockDifficultyPacket, - 0x13: serverbound_move_player_pos_packet::ServerboundMovePlayerPosPacket, - 0x14: serverbound_move_player_pos_rot_packet::ServerboundMovePlayerPosRotPacket, - 0x15: serverbound_move_player_rot_packet::ServerboundMovePlayerRotPacket, - 0x16: serverbound_move_player_status_only_packet::ServerboundMovePlayerStatusOnlyPacket, - 0x17: serverbound_move_vehicle_packet::ServerboundMoveVehiclePacket, - 0x18: serverbound_paddle_boat_packet::ServerboundPaddleBoatPacket, - 0x19: serverbound_pick_item_packet::ServerboundPickItemPacket, - 0x1a: serverbound_place_recipe_packet::ServerboundPlaceRecipePacket, - 0x1b: serverbound_player_abilities_packet::ServerboundPlayerAbilitiesPacket, - 0x1c: serverbound_player_action_packet::ServerboundPlayerActionPacket, - 0x1d: serverbound_player_command_packet::ServerboundPlayerCommandPacket, - 0x1e: serverbound_player_input_packet::ServerboundPlayerInputPacket, - 0x1f: serverbound_pong_packet::ServerboundPongPacket, - 0x20: serverbound_chat_session_update_packet::ServerboundChatSessionUpdatePacket, + 0x06: serverbound_chat_session_update_packet::ServerboundChatSessionUpdatePacket, + 0x07: serverbound_client_command_packet::ServerboundClientCommandPacket, + 0x08: serverbound_client_information_packet::ServerboundClientInformationPacket, + 0x09: serverbound_command_suggestion_packet::ServerboundCommandSuggestionPacket, + 0x0a: serverbound_container_button_click_packet::ServerboundContainerButtonClickPacket, + 0x0b: serverbound_container_click_packet::ServerboundContainerClickPacket, + 0x0c: serverbound_container_close_packet::ServerboundContainerClosePacket, + 0x0d: serverbound_custom_payload_packet::ServerboundCustomPayloadPacket, + 0x0e: serverbound_edit_book_packet::ServerboundEditBookPacket, + 0x0f: serverbound_entity_tag_query::ServerboundEntityTagQuery, + 0x10: serverbound_interact_packet::ServerboundInteractPacket, + 0x11: serverbound_jigsaw_generate_packet::ServerboundJigsawGeneratePacket, + 0x12: serverbound_keep_alive_packet::ServerboundKeepAlivePacket, + 0x13: serverbound_lock_difficulty_packet::ServerboundLockDifficultyPacket, + 0x14: serverbound_move_player_pos_packet::ServerboundMovePlayerPosPacket, + 0x15: serverbound_move_player_pos_rot_packet::ServerboundMovePlayerPosRotPacket, + 0x16: serverbound_move_player_rot_packet::ServerboundMovePlayerRotPacket, + 0x17: serverbound_move_player_status_only_packet::ServerboundMovePlayerStatusOnlyPacket, + 0x18: serverbound_move_vehicle_packet::ServerboundMoveVehiclePacket, + 0x19: serverbound_paddle_boat_packet::ServerboundPaddleBoatPacket, + 0x1a: serverbound_pick_item_packet::ServerboundPickItemPacket, + 0x1b: serverbound_place_recipe_packet::ServerboundPlaceRecipePacket, + 0x1c: serverbound_player_abilities_packet::ServerboundPlayerAbilitiesPacket, + 0x1d: serverbound_player_action_packet::ServerboundPlayerActionPacket, + 0x1e: serverbound_player_command_packet::ServerboundPlayerCommandPacket, + 0x1f: serverbound_player_input_packet::ServerboundPlayerInputPacket, + 0x20: serverbound_pong_packet::ServerboundPongPacket, 0x21: serverbound_recipe_book_change_settings_packet::ServerboundRecipeBookChangeSettingsPacket, 0x22: serverbound_recipe_book_seen_recipe_packet::ServerboundRecipeBookSeenRecipePacket, 0x23: serverbound_rename_item_packet::ServerboundRenameItemPacket, @@ -214,111 +218,115 @@ declare_state_packets!( 0x32: serverbound_use_item_packet::ServerboundUseItemPacket, }, Clientbound => { - 0x00: clientbound_add_entity_packet::ClientboundAddEntityPacket, - 0x01: clientbound_add_experience_orb_packet::ClientboundAddExperienceOrbPacket, - 0x02: clientbound_add_player_packet::ClientboundAddPlayerPacket, - 0x03: clientbound_animate_packet::ClientboundAnimatePacket, - 0x04: clientbound_award_stats_packet::ClientboundAwardStatsPacket, - 0x05: clientbound_block_changed_ack_packet::ClientboundBlockChangedAckPacket, - 0x06: clientbound_block_destruction_packet::ClientboundBlockDestructionPacket, - 0x07: clientbound_block_entity_data_packet::ClientboundBlockEntityDataPacket, - 0x08: clientbound_block_event_packet::ClientboundBlockEventPacket, - 0x09: clientbound_block_update_packet::ClientboundBlockUpdatePacket, - 0x0a: clientbound_boss_event_packet::ClientboundBossEventPacket, - 0x0b: clientbound_change_difficulty_packet::ClientboundChangeDifficultyPacket, - 0x0d: clientbound_command_suggestions_packet::ClientboundCommandSuggestionsPacket, - 0x0e: clientbound_commands_packet::ClientboundCommandsPacket, - 0x0f: clientbound_container_close_packet::ClientboundContainerClosePacket, - 0x10: clientbound_container_set_content_packet::ClientboundContainerSetContentPacket, - 0x11: clientbound_container_set_data_packet::ClientboundContainerSetDataPacket, - 0x12: clientbound_container_set_slot_packet::ClientboundContainerSetSlotPacket, - 0x13: clientbound_cooldown_packet::ClientboundCooldownPacket, - 0x14: clientbound_custom_chat_completions_packet::ClientboundCustomChatCompletionsPacket, - 0x15: clientbound_custom_payload_packet::ClientboundCustomPayloadPacket, - 0x16: clientbound_delete_chat_packet::ClientboundDeleteChatPacket, - 0x17: clientbound_disconnect_packet::ClientboundDisconnectPacket, - 0x18: clientbound_disguised_chat_packet::ClientboundDisguisedChatPacket, - 0x19: clientbound_entity_event_packet::ClientboundEntityEventPacket, - 0x1a: clientbound_explode_packet::ClientboundExplodePacket, - 0x1b: clientbound_forget_level_chunk_packet::ClientboundForgetLevelChunkPacket, - 0x1c: clientbound_game_event_packet::ClientboundGameEventPacket, - 0x1d: clientbound_horse_screen_open_packet::ClientboundHorseScreenOpenPacket, - 0x1e: clientbound_initialize_border_packet::ClientboundInitializeBorderPacket, - 0x1f: clientbound_keep_alive_packet::ClientboundKeepAlivePacket, - 0x20: clientbound_level_chunk_with_light_packet::ClientboundLevelChunkWithLightPacket, - 0x21: clientbound_level_event_packet::ClientboundLevelEventPacket, - 0x22: clientbound_level_particles_packet::ClientboundLevelParticlesPacket, - 0x23: clientbound_light_update_packet::ClientboundLightUpdatePacket, - 0x24: clientbound_login_packet::ClientboundLoginPacket, - 0x25: clientbound_map_item_data_packet::ClientboundMapItemDataPacket, - 0x26: clientbound_merchant_offers_packet::ClientboundMerchantOffersPacket, - 0x27: clientbound_move_entity_pos_packet::ClientboundMoveEntityPosPacket, - 0x28: clientbound_move_entity_pos_rot_packet::ClientboundMoveEntityPosRotPacket, - 0x29: clientbound_move_entity_rot_packet::ClientboundMoveEntityRotPacket, - 0x2a: clientbound_move_vehicle_packet::ClientboundMoveVehiclePacket, - 0x2b: clientbound_open_book_packet::ClientboundOpenBookPacket, - 0x2c: clientbound_open_screen_packet::ClientboundOpenScreenPacket, - 0x2d: clientbound_open_sign_editor_packet::ClientboundOpenSignEditorPacket, - 0x2e: clientbound_ping_packet::ClientboundPingPacket, - 0x2f: clientbound_place_ghost_recipe_packet::ClientboundPlaceGhostRecipePacket, - 0x30: clientbound_player_abilities_packet::ClientboundPlayerAbilitiesPacket, - 0x31: clientbound_player_chat_packet::ClientboundPlayerChatPacket, - 0x32: clientbound_player_combat_end_packet::ClientboundPlayerCombatEndPacket, - 0x33: clientbound_player_combat_enter_packet::ClientboundPlayerCombatEnterPacket, - 0x34: clientbound_player_combat_kill_packet::ClientboundPlayerCombatKillPacket, - 0x35: clientbound_player_info_remove_packet::ClientboundPlayerInfoRemovePacket, - 0x36: clientbound_player_info_update_packet::ClientboundPlayerInfoUpdatePacket, - 0x37: clientbound_player_look_at_packet::ClientboundPlayerLookAtPacket, - 0x38: clientbound_player_position_packet::ClientboundPlayerPositionPacket, - 0x39: clientbound_recipe_packet::ClientboundRecipePacket, - 0x3a: clientbound_remove_entities_packet::ClientboundRemoveEntitiesPacket, - 0x3b: clientbound_remove_mob_effect_packet::ClientboundRemoveMobEffectPacket, - 0x3c: clientbound_resource_pack_packet::ClientboundResourcePackPacket, - 0x3d: clientbound_respawn_packet::ClientboundRespawnPacket, - 0x3e: clientbound_rotate_head_packet::ClientboundRotateHeadPacket, - 0x3f: clientbound_section_blocks_update_packet::ClientboundSectionBlocksUpdatePacket, - 0x40: clientbound_select_advancements_tab_packet::ClientboundSelectAdvancementsTabPacket, - 0x41: clientbound_server_data_packet::ClientboundServerDataPacket, - 0x42: clientbound_set_action_bar_text_packet::ClientboundSetActionBarTextPacket, - 0x43: clientbound_set_border_center_packet::ClientboundSetBorderCenterPacket, - 0x44: clientbound_set_border_lerp_size_packet::ClientboundSetBorderLerpSizePacket, - 0x45: clientbound_set_border_size_packet::ClientboundSetBorderSizePacket, - 0x46: clientbound_set_border_warning_delay_packet::ClientboundSetBorderWarningDelayPacket, - 0x47: clientbound_set_border_warning_distance_packet::ClientboundSetBorderWarningDistancePacket, - 0x48: clientbound_set_camera_packet::ClientboundSetCameraPacket, - 0x49: clientbound_set_carried_item_packet::ClientboundSetCarriedItemPacket, - 0x4a: clientbound_set_chunk_cache_center_packet::ClientboundSetChunkCacheCenterPacket, - 0x4b: clientbound_set_chunk_cache_radius_packet::ClientboundSetChunkCacheRadiusPacket, - 0x4c: clientbound_set_default_spawn_position_packet::ClientboundSetDefaultSpawnPositionPacket, - 0x4d: clientbound_set_display_objective_packet::ClientboundSetDisplayObjectivePacket, - 0x4e: clientbound_set_entity_data_packet::ClientboundSetEntityDataPacket, - 0x4f: clientbound_set_entity_link_packet::ClientboundSetEntityLinkPacket, - 0x50: clientbound_set_entity_motion_packet::ClientboundSetEntityMotionPacket, - 0x51: clientbound_set_equipment_packet::ClientboundSetEquipmentPacket, - 0x52: clientbound_set_experience_packet::ClientboundSetExperiencePacket, - 0x53: clientbound_set_health_packet::ClientboundSetHealthPacket, - 0x54: clientbound_set_objective_packet::ClientboundSetObjectivePacket, - 0x55: clientbound_set_passengers_packet::ClientboundSetPassengersPacket, - 0x56: clientbound_set_player_team_packet::ClientboundSetPlayerTeamPacket, - 0x57: clientbound_set_score_packet::ClientboundSetScorePacket, - 0x58: clientbound_set_simulation_distance_packet::ClientboundSetSimulationDistancePacket, - 0x59: clientbound_set_subtitle_text_packet::ClientboundSetSubtitleTextPacket, - 0x5a: clientbound_set_time_packet::ClientboundSetTimePacket, - 0x5b: clientbound_set_title_text_packet::ClientboundSetTitleTextPacket, - 0x5c: clientbound_set_titles_animation_packet::ClientboundSetTitlesAnimationPacket, - 0x5d: clientbound_sound_entity_packet::ClientboundSoundEntityPacket, - 0x5e: clientbound_sound_packet::ClientboundSoundPacket, - 0x5f: clientbound_stop_sound_packet::ClientboundStopSoundPacket, - 0x60: clientbound_system_chat_packet::ClientboundSystemChatPacket, - 0x61: clientbound_tab_list_packet::ClientboundTabListPacket, - 0x62: clientbound_tag_query_packet::ClientboundTagQueryPacket, - 0x63: clientbound_take_item_entity_packet::ClientboundTakeItemEntityPacket, - 0x64: clientbound_teleport_entity_packet::ClientboundTeleportEntityPacket, - 0x65: clientbound_update_advancements_packet::ClientboundUpdateAdvancementsPacket, - 0x66: clientbound_update_attributes_packet::ClientboundUpdateAttributesPacket, - 0x67: clientbound_update_enabled_features_packet::ClientboundUpdateEnabledFeaturesPacket, - 0x68: clientbound_update_mob_effect_packet::ClientboundUpdateMobEffectPacket, - 0x69: clientbound_update_recipes_packet::ClientboundUpdateRecipesPacket, - 0x6a: clientbound_update_tags_packet::ClientboundUpdateTagsPacket, + 0x00: clientbound_bundle_packet::ClientboundBundlePacket, + 0x01: clientbound_add_entity_packet::ClientboundAddEntityPacket, + 0x02: clientbound_add_experience_orb_packet::ClientboundAddExperienceOrbPacket, + 0x03: clientbound_add_player_packet::ClientboundAddPlayerPacket, + 0x04: clientbound_animate_packet::ClientboundAnimatePacket, + 0x05: clientbound_award_stats_packet::ClientboundAwardStatsPacket, + 0x06: clientbound_block_changed_ack_packet::ClientboundBlockChangedAckPacket, + 0x07: clientbound_block_destruction_packet::ClientboundBlockDestructionPacket, + 0x08: clientbound_block_entity_data_packet::ClientboundBlockEntityDataPacket, + 0x09: clientbound_block_event_packet::ClientboundBlockEventPacket, + 0x0a: clientbound_block_update_packet::ClientboundBlockUpdatePacket, + 0x0b: clientbound_boss_event_packet::ClientboundBossEventPacket, + 0x0c: clientbound_change_difficulty_packet::ClientboundChangeDifficultyPacket, + 0x0d: clientbound_chunks_biomes_packet::ClientboundChunksBiomesPacket, + 0x0f: clientbound_command_suggestions_packet::ClientboundCommandSuggestionsPacket, + 0x10: clientbound_commands_packet::ClientboundCommandsPacket, + 0x11: clientbound_container_close_packet::ClientboundContainerClosePacket, + 0x12: clientbound_container_set_content_packet::ClientboundContainerSetContentPacket, + 0x13: clientbound_container_set_data_packet::ClientboundContainerSetDataPacket, + 0x14: clientbound_container_set_slot_packet::ClientboundContainerSetSlotPacket, + 0x15: clientbound_cooldown_packet::ClientboundCooldownPacket, + 0x16: clientbound_custom_chat_completions_packet::ClientboundCustomChatCompletionsPacket, + 0x17: clientbound_custom_payload_packet::ClientboundCustomPayloadPacket, + 0x18: clientbound_damage_event_packet::ClientboundDamageEventPacket, + 0x19: clientbound_delete_chat_packet::ClientboundDeleteChatPacket, + 0x1a: clientbound_disconnect_packet::ClientboundDisconnectPacket, + 0x1b: clientbound_disguised_chat_packet::ClientboundDisguisedChatPacket, + 0x1c: clientbound_entity_event_packet::ClientboundEntityEventPacket, + 0x1d: clientbound_explode_packet::ClientboundExplodePacket, + 0x1e: clientbound_forget_level_chunk_packet::ClientboundForgetLevelChunkPacket, + 0x1f: clientbound_game_event_packet::ClientboundGameEventPacket, + 0x20: clientbound_horse_screen_open_packet::ClientboundHorseScreenOpenPacket, + 0x21: clientbound_hurt_animation_packet::ClientboundHurtAnimationPacket, + 0x22: clientbound_initialize_border_packet::ClientboundInitializeBorderPacket, + 0x23: clientbound_keep_alive_packet::ClientboundKeepAlivePacket, + 0x24: clientbound_level_chunk_with_light_packet::ClientboundLevelChunkWithLightPacket, + 0x25: clientbound_level_event_packet::ClientboundLevelEventPacket, + 0x26: clientbound_level_particles_packet::ClientboundLevelParticlesPacket, + 0x27: clientbound_light_update_packet::ClientboundLightUpdatePacket, + 0x28: clientbound_login_packet::ClientboundLoginPacket, + 0x29: clientbound_map_item_data_packet::ClientboundMapItemDataPacket, + 0x2a: clientbound_merchant_offers_packet::ClientboundMerchantOffersPacket, + 0x2b: clientbound_move_entity_pos_packet::ClientboundMoveEntityPosPacket, + 0x2c: clientbound_move_entity_pos_rot_packet::ClientboundMoveEntityPosRotPacket, + 0x2d: clientbound_move_entity_rot_packet::ClientboundMoveEntityRotPacket, + 0x2e: clientbound_move_vehicle_packet::ClientboundMoveVehiclePacket, + 0x2f: clientbound_open_book_packet::ClientboundOpenBookPacket, + 0x30: clientbound_open_screen_packet::ClientboundOpenScreenPacket, + 0x31: clientbound_open_sign_editor_packet::ClientboundOpenSignEditorPacket, + 0x32: clientbound_ping_packet::ClientboundPingPacket, + 0x33: clientbound_place_ghost_recipe_packet::ClientboundPlaceGhostRecipePacket, + 0x34: clientbound_player_abilities_packet::ClientboundPlayerAbilitiesPacket, + 0x35: clientbound_player_chat_packet::ClientboundPlayerChatPacket, + 0x36: clientbound_player_combat_end_packet::ClientboundPlayerCombatEndPacket, + 0x37: clientbound_player_combat_enter_packet::ClientboundPlayerCombatEnterPacket, + 0x38: clientbound_player_combat_kill_packet::ClientboundPlayerCombatKillPacket, + 0x39: clientbound_player_info_remove_packet::ClientboundPlayerInfoRemovePacket, + 0x3a: clientbound_player_info_update_packet::ClientboundPlayerInfoUpdatePacket, + 0x3b: clientbound_player_look_at_packet::ClientboundPlayerLookAtPacket, + 0x3c: clientbound_player_position_packet::ClientboundPlayerPositionPacket, + 0x3d: clientbound_recipe_packet::ClientboundRecipePacket, + 0x3e: clientbound_remove_entities_packet::ClientboundRemoveEntitiesPacket, + 0x3f: clientbound_remove_mob_effect_packet::ClientboundRemoveMobEffectPacket, + 0x40: clientbound_resource_pack_packet::ClientboundResourcePackPacket, + 0x41: clientbound_respawn_packet::ClientboundRespawnPacket, + 0x42: clientbound_rotate_head_packet::ClientboundRotateHeadPacket, + 0x43: clientbound_section_blocks_update_packet::ClientboundSectionBlocksUpdatePacket, + 0x44: clientbound_select_advancements_tab_packet::ClientboundSelectAdvancementsTabPacket, + 0x45: clientbound_server_data_packet::ClientboundServerDataPacket, + 0x46: clientbound_set_action_bar_text_packet::ClientboundSetActionBarTextPacket, + 0x47: clientbound_set_border_center_packet::ClientboundSetBorderCenterPacket, + 0x48: clientbound_set_border_lerp_size_packet::ClientboundSetBorderLerpSizePacket, + 0x49: clientbound_set_border_size_packet::ClientboundSetBorderSizePacket, + 0x4a: clientbound_set_border_warning_delay_packet::ClientboundSetBorderWarningDelayPacket, + 0x4b: clientbound_set_border_warning_distance_packet::ClientboundSetBorderWarningDistancePacket, + 0x4c: clientbound_set_camera_packet::ClientboundSetCameraPacket, + 0x4d: clientbound_set_carried_item_packet::ClientboundSetCarriedItemPacket, + 0x4e: clientbound_set_chunk_cache_center_packet::ClientboundSetChunkCacheCenterPacket, + 0x4f: clientbound_set_chunk_cache_radius_packet::ClientboundSetChunkCacheRadiusPacket, + 0x50: clientbound_set_default_spawn_position_packet::ClientboundSetDefaultSpawnPositionPacket, + 0x51: clientbound_set_display_objective_packet::ClientboundSetDisplayObjectivePacket, + 0x52: clientbound_set_entity_data_packet::ClientboundSetEntityDataPacket, + 0x53: clientbound_set_entity_link_packet::ClientboundSetEntityLinkPacket, + 0x54: clientbound_set_entity_motion_packet::ClientboundSetEntityMotionPacket, + 0x55: clientbound_set_equipment_packet::ClientboundSetEquipmentPacket, + 0x56: clientbound_set_experience_packet::ClientboundSetExperiencePacket, + 0x57: clientbound_set_health_packet::ClientboundSetHealthPacket, + 0x58: clientbound_set_objective_packet::ClientboundSetObjectivePacket, + 0x59: clientbound_set_passengers_packet::ClientboundSetPassengersPacket, + 0x5a: clientbound_set_player_team_packet::ClientboundSetPlayerTeamPacket, + 0x5b: clientbound_set_score_packet::ClientboundSetScorePacket, + 0x5c: clientbound_set_simulation_distance_packet::ClientboundSetSimulationDistancePacket, + 0x5d: clientbound_set_subtitle_text_packet::ClientboundSetSubtitleTextPacket, + 0x5e: clientbound_set_time_packet::ClientboundSetTimePacket, + 0x5f: clientbound_set_title_text_packet::ClientboundSetTitleTextPacket, + 0x60: clientbound_set_titles_animation_packet::ClientboundSetTitlesAnimationPacket, + 0x61: clientbound_sound_entity_packet::ClientboundSoundEntityPacket, + 0x62: clientbound_sound_packet::ClientboundSoundPacket, + 0x63: clientbound_stop_sound_packet::ClientboundStopSoundPacket, + 0x64: clientbound_system_chat_packet::ClientboundSystemChatPacket, + 0x65: clientbound_tab_list_packet::ClientboundTabListPacket, + 0x66: clientbound_tag_query_packet::ClientboundTagQueryPacket, + 0x67: clientbound_take_item_entity_packet::ClientboundTakeItemEntityPacket, + 0x68: clientbound_teleport_entity_packet::ClientboundTeleportEntityPacket, + 0x69: clientbound_update_advancements_packet::ClientboundUpdateAdvancementsPacket, + 0x6a: clientbound_update_attributes_packet::ClientboundUpdateAttributesPacket, + 0x6b: clientbound_update_enabled_features_packet::ClientboundUpdateEnabledFeaturesPacket, + 0x6c: clientbound_update_mob_effect_packet::ClientboundUpdateMobEffectPacket, + 0x6d: clientbound_update_recipes_packet::ClientboundUpdateRecipesPacket, + 0x6e: clientbound_update_tags_packet::ClientboundUpdateTagsPacket, } ); diff --git a/azalea-protocol/src/packets/mod.rs b/azalea-protocol/src/packets/mod.rs index e803e85f..2b8d917d 100755 --- a/azalea-protocol/src/packets/mod.rs +++ b/azalea-protocol/src/packets/mod.rs @@ -10,7 +10,7 @@ use std::io::{Cursor, Write}; // TODO: rename the packet files to just like clientbound_add_entity instead of // clientbound_add_entity_packet -pub const PROTOCOL_VERSION: u32 = 761; +pub const PROTOCOL_VERSION: u32 = 762; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum ConnectionProtocol { diff --git a/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs b/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs index 40452c87..c8b9a208 100755 --- a/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs +++ b/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs @@ -36,10 +36,6 @@ pub struct ClientboundStatusResponsePacket { pub version: Version, #[serde(default)] #[serde(skip_serializing_if = "Option::is_none")] - #[serde(rename = "previewsChat")] - pub previews_chat: Option<bool>, - #[serde(default)] - #[serde(skip_serializing_if = "Option::is_none")] #[serde(rename = "enforcesSecureChat")] pub enforces_secure_chat: Option<bool>, } diff --git a/azalea-protocol/src/read.rs b/azalea-protocol/src/read.rs index 5436fb1d..d92897b9 100755 --- a/azalea-protocol/src/read.rs +++ b/azalea-protocol/src/read.rs @@ -257,29 +257,3 @@ where Ok(packet) } - -#[cfg(test)] -mod tests { - use super::*; - use crate::packets::game::ClientboundGamePacket; - use std::io::Cursor; - - #[test] - fn test_read_packet() { - let mut buf: Cursor<&[u8]> = Cursor::new(&[ - 56, 64, 85, 58, 141, 138, 71, 146, 193, 64, 88, 0, 0, 0, 0, 0, 0, 64, 60, 224, 105, 34, - 119, 8, 228, 67, 50, 51, 68, 194, 177, 230, 101, 0, 17, 0, - ]); - let packet = packet_decoder::<ClientboundGamePacket>(&mut buf).unwrap(); - match &packet { - ClientboundGamePacket::PlayerPosition(p) => { - assert_eq!(p.id, 17); - assert_eq!(p.x, 84.91488892545296); - assert_eq!(p.y, 96.0); - assert_eq!(p.z, 28.876604227124417); - assert_eq!(p.dismount_vehicle, false); - } - _ => panic!("Wrong packet type"), - } - } -} diff --git a/azalea-protocol/src/resolver.rs b/azalea-protocol/src/resolver.rs index f99cec05..6f6f799c 100755 --- a/azalea-protocol/src/resolver.rs +++ b/azalea-protocol/src/resolver.rs @@ -56,7 +56,7 @@ pub async fn resolve_address(address: &ServerAddress) -> Result<SocketAddr, Reso return Ok(SocketAddr::new( lookup_ip.iter().next().unwrap(), redirect_address.port, - )) + )); } // debug!("redirecting to {:?}", redirect_address); |
