aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/src/packets
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-01-14 03:18:38 +0000
committermat <git@matdoes.dev>2025-01-14 03:18:38 +0000
commit2dcfbe96c3024f9e1d32473d58130efa518c91cf (patch)
treefb3eba8d165d80ab47dc83b41adab124e32dad8a /azalea-protocol/src/packets
parenta86d011d4ae869128dd404535f8d377c3a5e4c18 (diff)
downloadazalea-drasl-2dcfbe96c3024f9e1d32473d58130efa518c91cf.tar.xz
fix wrong ServerLinkKind and serialize hex colors correctly in nbt
Diffstat (limited to 'azalea-protocol/src/packets')
-rwxr-xr-xazalea-protocol/src/packets/game/c_container_set_content.rs3
-rw-r--r--azalea-protocol/src/packets/game/c_server_links.rs26
2 files changed, 27 insertions, 2 deletions
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 33fbf77b..2b315a5a 100755
--- a/azalea-protocol/src/packets/game/c_container_set_content.rs
+++ b/azalea-protocol/src/packets/game/c_container_set_content.rs
@@ -19,7 +19,6 @@ mod tests {
use azalea_buf::AzaleaRead;
use super::ClientboundContainerSetContent;
- use crate::packets::ProtocolPacket;
#[test]
fn test_read_write_container_set_content() {
@@ -29,7 +28,7 @@ mod tests {
0, 0, 0, 0, 0, 0, 0, 1, 196, 6, 0, 0, 0,
];
let mut buf = Cursor::new(contents.as_slice());
- let packet = ClientboundContainerSetContent::read(&mut buf).unwrap();
+ let packet = ClientboundContainerSetContent::azalea_read(&mut buf).unwrap();
println!("{:?}", packet);
assert_eq!(buf.position(), contents.len() as u64);
diff --git a/azalea-protocol/src/packets/game/c_server_links.rs b/azalea-protocol/src/packets/game/c_server_links.rs
index 80c444f0..ac08ec27 100644
--- a/azalea-protocol/src/packets/game/c_server_links.rs
+++ b/azalea-protocol/src/packets/game/c_server_links.rs
@@ -7,3 +7,29 @@ use crate::common::server_links::ServerLinkEntry;
pub struct ClientboundServerLinks {
pub links: Vec<ServerLinkEntry>,
}
+
+#[cfg(test)]
+mod tests {
+ use std::io::Cursor;
+
+ use azalea_buf::AzaleaRead;
+
+ use super::*;
+
+ #[test]
+ fn test_read_server_links() {
+ tracing_subscriber::fmt::try_init().ok();
+ let contents = [
+ 1, 0, 10, 8, 0, 5, 99, 111, 108, 111, 114, 0, 7, 35, 48, 48, 70, 66, 57, 65, 8, 0, 4,
+ 116, 101, 120, 116, 0, 15, 65, 98, 111, 117, 116, 32, 86, 101, 108, 111, 99, 105, 116,
+ 97, 98, 0, 40, 104, 116, 116, 112, 115, 58, 47, 47, 119, 105, 108, 108, 105, 97, 109,
+ 50, 55, 56, 46, 110, 101, 116, 47, 112, 114, 111, 106, 101, 99, 116, 47, 118, 101, 108,
+ 111, 99, 105, 116, 97, 98,
+ ];
+ let mut buf = Cursor::new(contents.as_slice());
+ let packet = ClientboundServerLinks::azalea_read(&mut buf).unwrap();
+ println!("{:?}", packet);
+
+ assert_eq!(buf.position(), contents.len() as u64);
+ }
+}