aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/src
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2023-03-23 13:55:33 +0000
committermat <github@matdoes.dev>2023-03-23 13:55:33 +0000
commitecb3f2ffd7dd4aa26213844a023e37fab4057ed0 (patch)
tree0cd0ea7eec8c05cdc8fae0a3ab15ef7c1402383c /azalea-protocol/src
parent2a07962af9a318114f38d3afe748a05212cfbd59 (diff)
downloadazalea-drasl-ecb3f2ffd7dd4aa26213844a023e37fab4057ed0.tar.xz
rename Tag to Nbt
Diffstat (limited to 'azalea-protocol/src')
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_block_entity_data_packet.rs2
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs4
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_login_packet.rs40
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_tag_query_packet.rs2
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_update_mob_effect_packet.rs2
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs2
6 files changed, 26 insertions, 26 deletions
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<u8>,
pub block_entities: Vec<BlockEntity>,
@@ -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<Tag> for RegistryHolder {
+ impl TryFrom<Nbt> for RegistryHolder {
type Error = serde_json::Error;
- fn try_from(value: Tag) -> Result<Self, Self::Error> {
+ fn try_from(value: Nbt) -> Result<Self, Self::Error> {
serde_json::from_value(serde_json::to_value(value)?)
}
}
- impl TryInto<Tag> for RegistryHolder {
+ impl TryInto<Nbt> for RegistryHolder {
type Error = serde_json::Error;
- fn try_into(self) -> Result<Tag, Self::Error> {
+ fn try_into(self) -> Result<Nbt, Self::Error> {
serde_json::from_value(serde_json::to_value(self)?)
}
}
impl McBufReadable for RegistryHolder {
fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
- 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::<Tag>::try_into(self.clone())?.write_into(buf)
+ TryInto::<Nbt>::try_into(self.clone())?.write_into(buf)
}
}
@@ -100,14 +100,14 @@ pub mod registry {
pub trim_material: RegistryType<TrimMaterialElement>,
#[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<ChatTypeElement>,
#[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<DimensionTypeElement>,
@@ -117,21 +117,21 @@ pub mod registry {
pub world_type: RegistryType<WorldTypeElement>,
#[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<TrimPatternElement>,
#[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<DamageTypeElement>,
#[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::<DimensionTypeElement> {
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<azalea_nbt::Tag>,
+ pub factor_data: Option<azalea_nbt::Nbt>,
}
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<Ingredient>,