diff --git a/Cargo.lock b/Cargo.lock index 60b0a0df8..ceb530d26 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -428,6 +428,7 @@ dependencies = [ "azalea-core", "azalea-inventory-macros", "azalea-registry", + "indexmap", "simdnbt", "uuid", ] diff --git a/azalea-inventory/Cargo.toml b/azalea-inventory/Cargo.toml index b34367558..43459bc74 100644 --- a/azalea-inventory/Cargo.toml +++ b/azalea-inventory/Cargo.toml @@ -14,6 +14,7 @@ azalea-chat = { path = "../azalea-chat", version = "0.11.0", features = [ azalea-core = { path = "../azalea-core", version = "0.11.0" } azalea-inventory-macros = { path = "./azalea-inventory-macros", version = "0.11.0" } azalea-registry = { path = "../azalea-registry", version = "0.11.0" } +indexmap = "2.7.0" simdnbt = { workspace = true } uuid = { workspace = true } diff --git a/azalea-inventory/src/components.rs b/azalea-inventory/src/components.rs index e62288c61..2675bee43 100644 --- a/azalea-inventory/src/components.rs +++ b/azalea-inventory/src/components.rs @@ -305,8 +305,7 @@ pub enum AttributeModifierOperation { // circular dependency) #[derive(Clone, PartialEq, AzBuf)] pub struct AttributeModifier { - pub uuid: Uuid, - pub name: String, + pub id: ResourceLocation, pub amount: f64, pub operation: AttributeModifierOperation, } @@ -877,8 +876,12 @@ impl DataComponent for DamageResistant { pub struct Equippable { pub slot: EquipmentSlot, pub equip_sound: SoundEvent, - pub model: Option, - pub allowed_entities: HolderSet, + pub asset_id: Option, + pub camera_overlay: Option, + pub allowed_entities: Option>, + pub dispensable: bool, + pub swappable: bool, + pub damage_on_hurt: bool, } impl DataComponent for Equippable { const KIND: DataComponentKind = DataComponentKind::Equippable; diff --git a/azalea-inventory/src/slot.rs b/azalea-inventory/src/slot.rs index f541c54d1..3ca38f56e 100644 --- a/azalea-inventory/src/slot.rs +++ b/azalea-inventory/src/slot.rs @@ -1,12 +1,12 @@ use std::{ any::Any, - collections::HashMap, fmt, io::{Cursor, Write}, }; use azalea_buf::{AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError}; use azalea_registry::DataComponentKind; +use indexmap::IndexMap; use crate::components::{self}; @@ -178,7 +178,7 @@ impl AzaleaWrite for ItemStack { /// and Azalea does not implement that yet. #[derive(Default)] pub struct DataComponentPatch { - components: HashMap>>, + components: IndexMap>>, } impl DataComponentPatch { @@ -238,7 +238,7 @@ impl AzaleaRead for DataComponentPatch { return Ok(DataComponentPatch::default()); } - let mut components = HashMap::new(); + let mut components = IndexMap::new(); for _ in 0..components_with_data_count { let component_kind = DataComponentKind::azalea_read(buf)?; let component_data = components::from_kind(component_kind, buf)?; @@ -256,8 +256,8 @@ impl AzaleaRead for DataComponentPatch { impl AzaleaWrite for DataComponentPatch { fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - let mut components_with_data_count = 0; - let mut components_without_data_count = 0; + let mut components_with_data_count: u32 = 0; + let mut components_without_data_count: u32 = 0; for component in self.components.values() { if component.is_some() { components_with_data_count += 1; @@ -269,12 +269,14 @@ impl AzaleaWrite for DataComponentPatch { components_with_data_count.azalea_write_var(buf)?; components_without_data_count.azalea_write_var(buf)?; + let mut component_buf = Vec::new(); for (kind, component) in &self.components { if let Some(component) = component { kind.azalea_write(buf)?; - let mut component_buf = Vec::new(); - component.encode(&mut component_buf).unwrap(); - component_buf.azalea_write(buf)?; + + component_buf.clear(); + component.encode(&mut component_buf)?; + buf.write_all(&component_buf)?; } } @@ -290,7 +292,7 @@ impl AzaleaWrite for DataComponentPatch { impl Clone for DataComponentPatch { fn clone(&self) -> Self { - let mut components = HashMap::with_capacity(self.components.len()); + let mut components = IndexMap::with_capacity(self.components.len()); for (kind, component) in &self.components { components.insert(*kind, component.as_ref().map(|c| (*c).clone())); } diff --git a/azalea-protocol/src/packets/game/c_container_set_content.rs b/azalea-protocol/src/packets/game/c_container_set_content.rs index 0a7e910b9..33fbf77bf 100755 --- a/azalea-protocol/src/packets/game/c_container_set_content.rs +++ b/azalea-protocol/src/packets/game/c_container_set_content.rs @@ -2,7 +2,7 @@ use azalea_buf::AzBuf; use azalea_inventory::ItemStack; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket, PartialEq)] pub struct ClientboundContainerSetContent { #[var] pub container_id: i32, @@ -16,6 +16,8 @@ pub struct ClientboundContainerSetContent { mod tests { use std::io::Cursor; + use azalea_buf::AzaleaRead; + use super::ClientboundContainerSetContent; use crate::packets::ProtocolPacket; @@ -36,4 +38,32 @@ mod tests { packet.write(&mut buf).unwrap(); assert_eq!(buf, contents); } + + #[test] + fn test_read_write_big_container_set_packet() { + #[rustfmt::skip] + let contents = [10, 1, 90, 1, 170, 5, 2, 0, 5, 10, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 5, 119, 104, 105, 116, 101, 9, 0, 5, 101, 120, 116, 114, 97, 8, 0, 0, 0, 1, 0, 17, 80, 114, 101, 118, 105, 111, 117, 115, 32, 80, 97, 103, 101, 32, 40, 54, 41, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 62, 5, 231, 107, 8, 147, 65, 45, 135, 242, 47, 95, 58, 70, 91, 105, 0, 0, 1, 254, 3, 2, 0, 5, 10, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 5, 119, 104, 105, 116, 101, 9, 0, 5, 101, 120, 116, 114, 97, 8, 0, 0, 0, 1, 0, 8, 80, 97, 103, 101, 32, 55, 47, 56, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 25, 24, 96, 187, 51, 242, 65, 97, 131, 122, 26, 153, 143, 122, 216, 134, 0, 0, 1, 148, 3, 2, 0, 5, 10, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 5, 119, 104, 105, 116, 101, 9, 0, 5, 101, 120, 116, 114, 97, 8, 0, 0, 0, 1, 0, 13, 78, 101, 120, 116, 32, 80, 97, 103, 101, 32, 40, 56, 41, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 203, 101, 74, 157, 4, 159, 71, 173, 149, 228, 121, 170, 64, 127, 182, 58, 0, 0, 1, 223, 5, 2, 0, 5, 10, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 5, 119, 104, 105, 116, 101, 9, 0, 5, 101, 120, 116, 114, 97, 8, 0, 0, 0, 1, 0, 25, 71, 111, 32, 66, 97, 99, 107, 32, 116, 111, 32, 67, 105, 116, 121, 32, 83, 101, 108, 101, 99, 116, 105, 111, 110, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 134, 183, 152, 100, 133, 118, 74, 35, 179, 188, 177, 175, 164, 81, 113, 14, 0, 0, 1, 157, 9, 2, 0, 5, 10, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 5, 119, 104, 105, 116, 101, 9, 0, 5, 101, 120, 116, 114, 97, 8, 0, 0, 0, 1, 0, 6, 83, 101, 97, 114, 99, 104, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 65, 126, 18, 219, 85, 224, 70, 89, 177, 255, 35, 221, 5, 138, 243, 157, 0, 0, 0, 0, 0, 0, 1, 251, 4, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 47, 12, 197, 190, 121, 244, 75, 144, 170, 28, 179, 220, 82, 113, 250, 18, 0, 0, 1, 241, 4, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 144, 255, 123, 43, 53, 133, 71, 98, 163, 18, 128, 43, 9, 102, 109, 17, 0, 0, 1, 141, 4, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 122, 201, 62, 11, 115, 80, 78, 42, 164, 59, 191, 218, 36, 100, 99, 28, 0, 0, 1, 175, 2, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 254, 1, 161, 38, 93, 186, 70, 76, 133, 57, 77, 149, 86, 143, 160, 210, 0, 0, 1, 169, 5, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 59, 28, 30, 213, 214, 194, 67, 236, 152, 225, 40, 235, 18, 182, 106, 118, 0, 0, 1, 181, 3, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 89, 127, 100, 45, 23, 41, 69, 93, 187, 167, 229, 42, 235, 37, 203, 200, 0, 0, 1, 164, 5, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 80, 82, 232, 142, 122, 39, 78, 76, 139, 86, 231, 223, 147, 188, 151, 31, 0, 0, 1, 252, 6, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 110, 202, 120, 27, 81, 112, 68, 6, 176, 78, 138, 236, 74, 155, 102, 36, 0, 0, 1, 254, 6, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 250, 148, 180, 54, 223, 106, 65, 72, 133, 155, 228, 152, 38, 164, 13, 76, 0, 0, 1, 203, 5, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 104, 50, 30, 169, 227, 21, 78, 111, 145, 140, 61, 251, 171, 87, 237, 156, 0, 0, 1, 141, 5, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 116, 16, 80, 89, 88, 134, 73, 130, 159, 154, 11, 187, 152, 47, 15, 246, 0, 0, 1, 205, 2, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 198, 182, 15, 238, 191, 229, 78, 55, 167, 200, 119, 172, 172, 194, 250, 64, 0, 0, 1, 225, 4, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 125, 180, 76, 110, 110, 204, 75, 122, 164, 224, 99, 32, 106, 188, 93, 128, 0, 0, 1, 196, 5, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 14, 58, 78, 26, 151, 80, 68, 89, 138, 123, 32, 101, 206, 101, 33, 218, 0, 0, 1, 190, 9, 4, 0, 5, 10, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 5, 119, 104, 105, 116, 101, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 1, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 2, 8, 0, 5, 99, 111, 108, 111, 114, 0, 7, 35, 102, 102, 53, 102, 49, 53, 8, 0, 4, 116, 101, 120, 116, 0, 6, 79, 114, 97, 110, 103, 101, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 6, 121, 101, 108, 108, 111, 119, 8, 0, 4, 116, 101, 120, 116, 0, 13, 32, 69, 110, 101, 114, 103, 121, 32, 83, 119, 111, 114, 100, 0, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 13, 2, 2, 23, 105, 111, 110, 58, 101, 110, 101, 114, 103, 121, 95, 115, 119, 111, 114, 100, 95, 100, 97, 109, 97, 103, 101, 64, 24, 0, 0, 0, 0, 0, 0, 0, 1, 4, 22, 105, 111, 110, 58, 101, 110, 101, 114, 103, 121, 95, 115, 119, 111, 114, 100, 95, 115, 112, 101, 101, 100, 63, 252, 204, 204, 204, 204, 204, 205, 0, 1, 1, 7, 51, 104, 111, 114, 105, 122, 111, 110, 115, 101, 110, 100, 58, 119, 101, 97, 112, 111, 110, 47, 101, 110, 101, 114, 103, 121, 95, 115, 119, 111, 114, 100, 47, 111, 114, 97, 110, 103, 101, 95, 101, 110, 101, 114, 103, 121, 95, 115, 119, 111, 114, 100, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 24, 115, 5, 163, 74, 89, 79, 249, 146, 120, 81, 85, 5, 199, 50, 36, 8, 0, 14, 105, 111, 110, 58, 99, 117, 115, 116, 111, 109, 105, 116, 101, 109, 0, 19, 69, 78, 69, 82, 71, 89, 95, 83, 87, 79, 82, 68, 95, 79, 82, 65, 78, 71, 69, 0, 0, 1, 170, 3, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 228, 45, 52, 184, 186, 231, 64, 249, 154, 85, 220, 89, 185, 191, 18, 132, 0, 0, 1, 148, 5, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 208, 70, 163, 62, 217, 139, 70, 183, 137, 197, 67, 252, 152, 48, 227, 138, 0, 0, 1, 162, 5, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 254, 202, 177, 230, 229, 182, 73, 123, 155, 132, 135, 87, 114, 149, 42, 115, 0, 0, 1, 250, 3, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 185, 163, 63, 49, 137, 40, 68, 201, 185, 96, 22, 91, 249, 114, 84, 156, 0, 0, 1, 160, 6, 7, 0, 5, 10, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 5, 119, 104, 105, 116, 101, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 1, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 2, 8, 0, 5, 99, 111, 108, 111, 114, 0, 4, 103, 111, 108, 100, 8, 0, 4, 116, 101, 120, 116, 0, 6, 80, 111, 119, 101, 114, 32, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 4, 103, 114, 97, 121, 8, 0, 4, 116, 101, 120, 116, 0, 8, 76, 101, 103, 103, 105, 110, 103, 115, 0, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 8, 3, 10, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 5, 119, 104, 105, 116, 101, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 1, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 4, 8, 0, 5, 99, 111, 108, 111, 114, 0, 7, 35, 55, 54, 56, 97, 56, 97, 8, 0, 4, 116, 101, 120, 116, 0, 7, 80, 111, 119, 101, 114, 58, 32, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 7, 35, 101, 49, 101, 49, 101, 49, 8, 0, 4, 116, 101, 120, 116, 0, 5, 53, 48, 48, 48, 48, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 7, 35, 55, 54, 56, 97, 56, 97, 8, 0, 4, 116, 101, 120, 116, 0, 3, 32, 47, 32, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 7, 35, 101, 49, 101, 49, 101, 49, 8, 0, 4, 116, 101, 120, 116, 0, 5, 53, 48, 48, 48, 48, 0, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 8, 0, 0, 10, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 5, 119, 104, 105, 116, 101, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 1, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 3, 8, 0, 5, 99, 111, 108, 111, 114, 0, 7, 35, 55, 54, 56, 97, 56, 97, 8, 0, 4, 116, 101, 120, 116, 0, 13, 77, 111, 100, 115, 32, 40, 108, 105, 109, 105, 116, 58, 32, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 7, 35, 101, 49, 101, 49, 101, 49, 8, 0, 4, 116, 101, 120, 116, 0, 1, 49, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 7, 35, 55, 54, 56, 97, 56, 97, 8, 0, 4, 116, 101, 120, 116, 0, 2, 41, 58, 0, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 13, 2, 0, 24, 105, 111, 110, 58, 112, 111, 119, 101, 114, 95, 97, 114, 109, 111, 114, 95, 108, 101, 103, 103, 105, 110, 103, 115, 64, 20, 0, 0, 0, 0, 0, 0, 0, 5, 1, 24, 105, 111, 110, 58, 112, 111, 119, 101, 114, 95, 97, 114, 109, 111, 114, 95, 108, 101, 103, 103, 105, 110, 103, 115, 64, 0, 0, 0, 0, 0, 0, 0, 0, 5, 1, 7, 44, 104, 111, 114, 105, 122, 111, 110, 115, 101, 110, 100, 58, 112, 111, 119, 101, 114, 95, 97, 114, 109, 111, 114, 47, 112, 111, 119, 101, 114, 95, 97, 114, 109, 111, 114, 95, 108, 101, 103, 103, 105, 110, 103, 115, 4, 0, 28, 2, 75, 1, 23, 104, 111, 114, 105, 122, 111, 110, 115, 101, 110, 100, 58, 112, 111, 119, 101, 114, 95, 97, 114, 109, 111, 114, 0, 0, 1, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 22, 105, 111, 110, 58, 116, 111, 111, 108, 95, 109, 111, 100, 105, 102, 105, 99, 97, 116, 105, 111, 110, 115, 0, 0, 0, 4, 0, 0, 0, 0, 3, 0, 9, 105, 111, 110, 58, 112, 111, 119, 101, 114, 0, 0, 195, 80, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 222, 50, 97, 187, 223, 130, 78, 27, 181, 50, 191, 193, 220, 26, 166, 32, 8, 0, 14, 105, 111, 110, 58, 99, 117, 115, 116, 111, 109, 105, 116, 101, 109, 0, 20, 80, 79, 87, 69, 82, 95, 65, 82, 77, 79, 82, 95, 76, 69, 71, 71, 73, 78, 71, 83, 0, 0, 1, 206, 3, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 92, 15, 75, 242, 229, 111, 69, 230, 135, 17, 151, 154, 254, 156, 73, 69, 0, 0, 1, 197, 4, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 237, 209, 204, 250, 47, 89, 72, 89, 151, 44, 64, 89, 253, 12, 194, 68, 0, 0, 1, 253, 5, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 139, 69, 194, 233, 38, 229, 66, 224, 170, 40, 138, 147, 33, 232, 61, 126, 0, 0, 1, 241, 3, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 180, 235, 163, 39, 91, 237, 70, 48, 177, 149, 170, 41, 26, 167, 129, 237, 0, 0, 1, 213, 4, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 202, 18, 209, 104, 36, 46, 76, 49, 166, 97, 11, 72, 137, 61, 236, 127, 0, 0, 1, 145, 5, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 78, 5, 94, 87, 195, 173, 75, 190, 141, 204, 226, 162, 70, 68, 236, 32, 0, 0, 1, 174, 3, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 67, 94, 169, 41, 126, 228, 74, 154, 147, 81, 231, 116, 151, 234, 148, 174, 0, 0, 1, 160, 6, 7, 0, 5, 10, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 5, 119, 104, 105, 116, 101, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 1, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 2, 8, 0, 5, 99, 111, 108, 111, 114, 0, 4, 103, 111, 108, 100, 8, 0, 4, 116, 101, 120, 116, 0, 6, 80, 111, 119, 101, 114, 32, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 4, 103, 114, 97, 121, 8, 0, 4, 116, 101, 120, 116, 0, 10, 67, 104, 101, 115, 116, 112, 108, 97, 116, 101, 0, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 8, 3, 10, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 5, 119, 104, 105, 116, 101, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 1, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 4, 8, 0, 5, 99, 111, 108, 111, 114, 0, 7, 35, 55, 54, 56, 97, 56, 97, 8, 0, 4, 116, 101, 120, 116, 0, 7, 80, 111, 119, 101, 114, 58, 32, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 7, 35, 101, 49, 101, 49, 101, 49, 8, 0, 4, 116, 101, 120, 116, 0, 5, 53, 48, 48, 48, 48, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 7, 35, 55, 54, 56, 97, 56, 97, 8, 0, 4, 116, 101, 120, 116, 0, 3, 32, 47, 32, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 7, 35, 101, 49, 101, 49, 101, 49, 8, 0, 4, 116, 101, 120, 116, 0, 5, 53, 48, 48, 48, 48, 0, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 8, 0, 0, 10, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 5, 119, 104, 105, 116, 101, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 1, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 3, 8, 0, 5, 99, 111, 108, 111, 114, 0, 7, 35, 55, 54, 56, 97, 56, 97, 8, 0, 4, 116, 101, 120, 116, 0, 13, 77, 111, 100, 115, 32, 40, 108, 105, 109, 105, 116, 58, 32, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 7, 35, 101, 49, 101, 49, 101, 49, 8, 0, 4, 116, 101, 120, 116, 0, 1, 49, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 7, 35, 55, 54, 56, 97, 56, 97, 8, 0, 4, 116, 101, 120, 116, 0, 2, 41, 58, 0, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 13, 2, 0, 26, 105, 111, 110, 58, 112, 111, 119, 101, 114, 95, 97, 114, 109, 111, 114, 95, 99, 104, 101, 115, 116, 112, 108, 97, 116, 101, 64, 20, 0, 0, 0, 0, 0, 0, 0, 6, 1, 26, 105, 111, 110, 58, 112, 111, 119, 101, 114, 95, 97, 114, 109, 111, 114, 95, 99, 104, 101, 115, 116, 112, 108, 97, 116, 101, 64, 0, 0, 0, 0, 0, 0, 0, 0, 6, 1, 7, 46, 104, 111, 114, 105, 122, 111, 110, 115, 101, 110, 100, 58, 112, 111, 119, 101, 114, 95, 97, 114, 109, 111, 114, 47, 112, 111, 119, 101, 114, 95, 97, 114, 109, 111, 114, 95, 99, 104, 101, 115, 116, 112, 108, 97, 116, 101, 4, 0, 28, 3, 75, 1, 23, 104, 111, 114, 105, 122, 111, 110, 115, 101, 110, 100, 58, 112, 111, 119, 101, 114, 95, 97, 114, 109, 111, 114, 0, 0, 1, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 22, 105, 111, 110, 58, 116, 111, 111, 108, 95, 109, 111, 100, 105, 102, 105, 99, 97, 116, 105, 111, 110, 115, 0, 0, 0, 4, 0, 0, 0, 0, 3, 0, 9, 105, 111, 110, 58, 112, 111, 119, 101, 114, 0, 0, 195, 80, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 53, 127, 15, 194, 212, 201, 74, 70, 155, 232, 218, 234, 82, 153, 238, 47, 8, 0, 14, 105, 111, 110, 58, 99, 117, 115, 116, 111, 109, 105, 116, 101, 109, 0, 22, 80, 79, 87, 69, 82, 95, 65, 82, 77, 79, 82, 95, 67, 72, 69, 83, 84, 80, 76, 65, 84, 69, 0, 0, 1, 97, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 100, 41, 241, 127, 125, 34, 74, 58, 133, 101, 247, 96, 145, 221, 60, 238, 0, 0, 1, 193, 9, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 86, 207, 202, 78, 106, 201, 69, 109, 177, 216, 70, 183, 142, 31, 252, 142, 0, 0, 1, 228, 5, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 129, 79, 1, 9, 230, 105, 65, 230, 141, 182, 24, 27, 16, 35, 39, 28, 0, 0, 1, 144, 7, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 215, 204, 51, 17, 142, 220, 76, 120, 140, 230, 249, 238, 88, 171, 55, 182, 0, 0, 1, 190, 9, 4, 0, 5, 10, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 5, 119, 104, 105, 116, 101, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 1, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 2, 8, 0, 5, 99, 111, 108, 111, 114, 0, 5, 103, 114, 101, 101, 110, 8, 0, 4, 116, 101, 120, 116, 0, 5, 71, 114, 101, 101, 110, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 6, 121, 101, 108, 108, 111, 119, 8, 0, 4, 116, 101, 120, 116, 0, 13, 32, 69, 110, 101, 114, 103, 121, 32, 83, 119, 111, 114, 100, 0, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 13, 2, 2, 23, 105, 111, 110, 58, 101, 110, 101, 114, 103, 121, 95, 115, 119, 111, 114, 100, 95, 100, 97, 109, 97, 103, 101, 64, 24, 0, 0, 0, 0, 0, 0, 0, 1, 4, 22, 105, 111, 110, 58, 101, 110, 101, 114, 103, 121, 95, 115, 119, 111, 114, 100, 95, 115, 112, 101, 101, 100, 63, 252, 204, 204, 204, 204, 204, 205, 0, 1, 1, 7, 50, 104, 111, 114, 105, 122, 111, 110, 115, 101, 110, 100, 58, 119, 101, 97, 112, 111, 110, 47, 101, 110, 101, 114, 103, 121, 95, 115, 119, 111, 114, 100, 47, 103, 114, 101, 101, 110, 95, 101, 110, 101, 114, 103, 121, 95, 115, 119, 111, 114, 100, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 72, 52, 170, 201, 22, 92, 65, 184, 150, 136, 65, 82, 84, 115, 106, 113, 8, 0, 14, 105, 111, 110, 58, 99, 117, 115, 116, 111, 109, 105, 116, 101, 109, 0, 18, 69, 78, 69, 82, 71, 89, 95, 83, 87, 79, 82, 68, 95, 71, 82, 69, 69, 78, 0, 0, 1, 136, 2, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 0, 165, 77, 13, 179, 51, 70, 68, 191, 96, 26, 204, 238, 96, 249, 216, 0, 0, 1, 159, 9, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 194, 171, 221, 186, 156, 251, 64, 2, 133, 121, 107, 227, 126, 27, 88, 6, 0, 0, 1, 128, 6, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 183, 245, 245, 213, 233, 254, 75, 183, 157, 222, 154, 9, 0, 186, 209, 255, 0, 0, 1, 131, 9, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 48, 31, 245, 210, 195, 183, 77, 84, 130, 121, 149, 159, 163, 96, 14, 174, 0, 0, 1, 180, 5, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 236, 182, 64, 231, 198, 112, 78, 24, 128, 144, 124, 223, 190, 183, 218, 155, 0, 0, 1, 153, 7, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 24, 101, 83, 78, 117, 67, 77, 192, 173, 51, 135, 133, 24, 84, 180, 243, 0, 0, 1, 168, 3, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 121, 78, 175, 38, 3, 164, 66, 129, 157, 35, 76, 224, 199, 236, 82, 219, 0, 0, 1, 160, 5, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 63, 89, 122, 3, 188, 16, 76, 29, 137, 182, 222, 54, 115, 93, 215, 85, 0, 0, 1, 161, 3, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 68, 122, 30, 52, 205, 241, 66, 229, 162, 100, 143, 216, 152, 182, 103, 235, 0, 0, 1, 199, 2, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 234, 252, 235, 31, 201, 181, 70, 138, 134, 166, 65, 26, 173, 44, 174, 189, 0, 0, 1, 245, 1, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 110, 110, 28, 171, 11, 212, 67, 199, 189, 34, 188, 84, 105, 66, 42, 131, 0, 0, 1, 229, 4, 1, 0, 0, 10, 10, 0, 18, 80, 117, 98, 108, 105, 99, 66, 117, 107, 107, 105, 116, 86, 97, 108, 117, 101, 115, 7, 0, 11, 105, 111, 110, 58, 105, 102, 45, 117, 117, 105, 100, 0, 0, 0, 16, 203, 97, 235, 205, 232, 71, 68, 32, 164, 18, 197, 153, 84, 138, 196, 239, 0, 0, 0, 1, 141, 4, 0, 0, 1, 204, 4, 0, 0, 1, 161, 2, 0, 0, 1, 155, 3, 0, 0, 3, 220, 3, 0, 0, 1, 201, 3, 0, 0, 1, 207, 3, 0, 0, 1, 197, 3, 0, 0, 1, 202, 3, 0, 0, 1, 199, 3, 0, 0, 1, 157, 5, 0, 0, 1, 151, 5, 0, 0, 1, 169, 2, 0, 0, 1, 90, 0, 0, 1, 193, 1, 0, 0, 1, 92, 0, 0, 1, 205, 3, 0, 0, 0, 0, 1, 162, 6, 0, 0, 1, 162, 6, 0, 0, 1, 251, 6, 0, 0, 0, 1, 214, 7, 0, 0, 0, 1, 183, 5, 0, 0, 1, 212, 6, 0, 0, 1, 213, 7, 0, 0, 1, 244, 5, 0, 0, 1, 159, 5, 0, 0, 1, 202, 4, 0, 0, 1, 142, 5, 0, 0, 0, 1, 194, 4, 0, 0, 0, 0]; + let mut buf = Cursor::new(contents.as_slice()); + let packet = ClientboundContainerSetContent::azalea_read(&mut buf).unwrap(); + println!("{:?}", packet); + + assert_eq!(buf.position(), contents.len() as u64); + + let mut re_encoded = Vec::new(); + packet.write(&mut re_encoded).unwrap(); + + // TODO: make FormattedText re-encode to the same bytes and then + // uncomment the code below + + // assert_eq!(buf, contents); + + // let mut re_decoded = Cursor::new(re_encoded.as_slice()); + // let re_decoded_packet = + // ClientboundContainerSetContent::azalea_read(&mut + // re_decoded).unwrap(); println!("{:?}", packet); + + // assert_eq!(re_decoded.position(), re_encoded.len() as u64); + + // assert_eq!(packet, re_decoded_packet); + } }