From ecb3f2ffd7dd4aa26213844a023e37fab4057ed0 Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 23 Mar 2023 13:55:33 +0000 Subject: rename Tag to Nbt --- .../game/clientbound_block_entity_data_packet.rs | 2 +- .../clientbound_level_chunk_with_light_packet.rs | 4 +-- .../src/packets/game/clientbound_login_packet.rs | 40 +++++++++++----------- .../packets/game/clientbound_tag_query_packet.rs | 2 +- .../game/clientbound_update_mob_effect_packet.rs | 2 +- .../game/clientbound_update_recipes_packet.rs | 2 +- 6 files changed, 26 insertions(+), 26 deletions(-) (limited to 'azalea-protocol/src/packets') diff --git a/azalea-protocol/src/packets/game/clientbound_block_entity_data_packet.rs b/azalea-protocol/src/packets/game/clientbound_block_entity_data_packet.rs index e3c95034..fda1bd43 100755 --- a/azalea-protocol/src/packets/game/clientbound_block_entity_data_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_block_entity_data_packet.rs @@ -6,5 +6,5 @@ use azalea_protocol_macros::ClientboundGamePacket; pub struct ClientboundBlockEntityDataPacket { pub pos: BlockPos, pub block_entity_type: azalea_registry::BlockEntityKind, - pub tag: azalea_nbt::Tag, + pub tag: azalea_nbt::Nbt, } diff --git a/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs b/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs index 1a8cf3df..30813013 100755 --- a/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs @@ -13,7 +13,7 @@ pub struct ClientboundLevelChunkWithLightPacket { #[derive(Clone, Debug, McBuf)] pub struct ClientboundLevelChunkPacketData { - pub heightmaps: azalea_nbt::Tag, + pub heightmaps: azalea_nbt::Nbt, // we can't parse the data in azalea-protocol because it dependso on context from other packets pub data: Vec, pub block_entities: Vec, @@ -25,5 +25,5 @@ pub struct BlockEntity { pub y: u16, #[var] pub type_: i32, - pub data: azalea_nbt::Tag, + pub data: azalea_nbt::Nbt, } diff --git a/azalea-protocol/src/packets/game/clientbound_login_packet.rs b/azalea-protocol/src/packets/game/clientbound_login_packet.rs index 37273b03..42f93c40 100755 --- a/azalea-protocol/src/packets/game/clientbound_login_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_login_packet.rs @@ -42,7 +42,7 @@ pub mod registry { use azalea_buf::{BufReadError, McBufReadable, McBufWritable}; use azalea_core::ResourceLocation; - use azalea_nbt::Tag; + use azalea_nbt::Nbt; use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; use std::{collections::HashMap, io::Cursor}; @@ -58,32 +58,32 @@ pub mod registry { pub root: RegistryRoot, } - impl TryFrom for RegistryHolder { + impl TryFrom for RegistryHolder { type Error = serde_json::Error; - fn try_from(value: Tag) -> Result { + fn try_from(value: Nbt) -> Result { serde_json::from_value(serde_json::to_value(value)?) } } - impl TryInto for RegistryHolder { + impl TryInto for RegistryHolder { type Error = serde_json::Error; - fn try_into(self) -> Result { + fn try_into(self) -> Result { serde_json::from_value(serde_json::to_value(self)?) } } impl McBufReadable for RegistryHolder { fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - RegistryHolder::try_from(Tag::read_from(buf)?) + RegistryHolder::try_from(Nbt::read_from(buf)?) .map_err(|e| BufReadError::Deserialization { source: e }) } } impl McBufWritable for RegistryHolder { fn write_into(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { - TryInto::::try_into(self.clone())?.write_into(buf) + TryInto::::try_into(self.clone())?.write_into(buf) } } @@ -100,14 +100,14 @@ pub mod registry { pub trim_material: RegistryType, #[cfg(not(feature = "strict_registry"))] #[serde(rename = "minecraft:trim_material")] - pub trim_material: Tag, + pub trim_material: Nbt, #[cfg(feature = "strict_registry")] #[serde(rename = "minecraft:chat_type")] pub chat_type: RegistryType, #[cfg(not(feature = "strict_registry"))] #[serde(rename = "minecraft:chat_type")] - pub chat_type: Tag, + pub chat_type: Nbt, #[serde(rename = "minecraft:dimension_type")] pub dimension_type: RegistryType, @@ -117,21 +117,21 @@ pub mod registry { pub world_type: RegistryType, #[cfg(not(feature = "strict_registry"))] #[serde(rename = "minecraft:worldgen/biome")] - pub world_type: Tag, + pub world_type: Nbt, #[cfg(feature = "strict_registry")] #[serde(rename = "minecraft:trim_pattern")] pub trim_pattern: RegistryType, #[cfg(not(feature = "strict_registry"))] #[serde(rename = "minecraft:trim_pattern")] - pub trim_pattern: Tag, + pub trim_pattern: Nbt, #[cfg(feature = "strict_registry")] #[serde(rename = "minecraft:damage_type")] pub damage_type: RegistryType, #[cfg(not(feature = "strict_registry"))] #[serde(rename = "minecraft:damage_type")] - pub damage_type: Tag, + pub damage_type: Nbt, } /// A collection of values for a certain type of registry data. @@ -481,27 +481,27 @@ pub mod registry { mod tests { use super::registry::{DimensionTypeElement, RegistryHolder, RegistryRoot, RegistryType}; use azalea_core::ResourceLocation; - use azalea_nbt::Tag; + use azalea_nbt::Nbt; #[test] fn test_convert() { - // Do NOT use Tag::End, they should be Tag::Compound. + // Do NOT use Nbt::End, they should be Nbt::Compound. // This is just for testing. let registry = RegistryHolder { root: RegistryRoot { - trim_material: Tag::End, - chat_type: Tag::End, + trim_material: Nbt::End, + chat_type: Nbt::End, dimension_type: RegistryType:: { kind: ResourceLocation::new("minecraft:dimension_type"), value: Vec::new(), }, - world_type: Tag::End, - trim_pattern: Tag::End, - damage_type: Tag::End, + world_type: Nbt::End, + trim_pattern: Nbt::End, + damage_type: Nbt::End, }, }; - let tag: Tag = registry.try_into().unwrap(); + let tag: Nbt = registry.try_into().unwrap(); let root = tag .as_compound() .unwrap() diff --git a/azalea-protocol/src/packets/game/clientbound_tag_query_packet.rs b/azalea-protocol/src/packets/game/clientbound_tag_query_packet.rs index ff9f4ba1..db238f66 100755 --- a/azalea-protocol/src/packets/game/clientbound_tag_query_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_tag_query_packet.rs @@ -5,5 +5,5 @@ use azalea_protocol_macros::ClientboundGamePacket; pub struct ClientboundTagQueryPacket { #[var] pub transaction_id: u32, - pub tag: azalea_nbt::Tag, + pub tag: azalea_nbt::Nbt, } diff --git a/azalea-protocol/src/packets/game/clientbound_update_mob_effect_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_mob_effect_packet.rs index d1d9f9cc..c43d64bb 100755 --- a/azalea-protocol/src/packets/game/clientbound_update_mob_effect_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_update_mob_effect_packet.rs @@ -10,5 +10,5 @@ pub struct ClientboundUpdateMobEffectPacket { #[var] pub effect_duration_ticks: u32, pub flags: u8, - pub factor_data: Option, + pub factor_data: Option, } 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 937a1220..318adb7f 100755 --- a/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs @@ -22,7 +22,7 @@ pub struct Recipe { #[derive(Clone, Debug, McBuf)] pub struct ShapelessRecipe { /// Used to group similar recipes together in the recipe book. - /// Tag is present in recipe JSON + /// Nbt is present in recipe JSON pub group: String, pub category: CraftingBookCategory, pub ingredients: Vec, -- cgit v1.2.3