From 2c610826fc9f8e16897f52313faa8e0602d1dc3d Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Sun, 19 Nov 2023 22:07:38 -0600 Subject: Replace azalea-nbt with simdnbt (#111) * delete azalea-nbt and replace with simdnbt * use simdnbt from crates.io * remove serde dependency on azalea-registry --- azalea-buf/src/write.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'azalea-buf/src/write.rs') diff --git a/azalea-buf/src/write.rs b/azalea-buf/src/write.rs index f48bf2ec..03d40d79 100755 --- a/azalea-buf/src/write.rs +++ b/azalea-buf/src/write.rs @@ -257,3 +257,27 @@ impl McBufWritable for [T; N] { Ok(()) } } + +impl McBufWritable for simdnbt::owned::NbtTag { + fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + let mut data = Vec::new(); + self.write(&mut data); + data.write_into(buf) + } +} + +impl McBufWritable for simdnbt::owned::NbtCompound { + fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + let mut data = Vec::new(); + simdnbt::owned::NbtTag::Compound(self.clone()).write(&mut data); + data.write_into(buf) + } +} + +impl McBufWritable for simdnbt::owned::Nbt { + fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + let mut data = Vec::new(); + self.write_unnamed(&mut data); + data.write_into(buf) + } +} -- cgit v1.2.3