aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/src/mc_buf
diff options
context:
space:
mode:
Diffstat (limited to 'azalea-protocol/src/mc_buf')
-rwxr-xr-xazalea-protocol/src/mc_buf/write.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/azalea-protocol/src/mc_buf/write.rs b/azalea-protocol/src/mc_buf/write.rs
index e8845f25..2c46157b 100755
--- a/azalea-protocol/src/mc_buf/write.rs
+++ b/azalea-protocol/src/mc_buf/write.rs
@@ -2,7 +2,7 @@ use super::{UnsizedByteArray, MAX_STRING_LENGTH};
use async_trait::async_trait;
use azalea_chat::component::Component;
use azalea_core::{
- difficulty::Difficulty, game_type::GameType, resource_location::ResourceLocation,
+ difficulty::Difficulty, game_type::GameType, resource_location::ResourceLocation, Slot,
};
use byteorder::{BigEndian, WriteBytesExt};
use std::io::Write;
@@ -337,3 +337,19 @@ impl McBufWritable for Component {
todo!()
}
}
+
+// Slot
+impl McBufWritable for Slot {
+ fn write_into(&self, buf: &mut Vec<u8>) -> Result<(), std::io::Error> {
+ match self {
+ Slot::Empty => buf.write_byte(0)?,
+ Slot::Present(i) => {
+ buf.write_varint(i.id)?;
+ buf.write_byte(i.count)?;
+ buf.write_nbt(&i.nbt)?;
+ }
+ }
+
+ Ok(())
+ }
+}