aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/src/mc_buf/write.rs
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-01-02 17:19:04 -0600
committermat <github@matdoes.dev>2022-01-02 17:19:04 -0600
commit094c210dada7c0ee83c19965739312d2d00e4099 (patch)
tree00b678a2aa0c03bbfde12475431d749c0b2b837f /azalea-protocol/src/mc_buf/write.rs
parentbb566aa54131a23b6d9e605c81a8ff4d1d1c21d7 (diff)
downloadazalea-drasl-094c210dada7c0ee83c19965739312d2d00e4099.tar.xz
switch all current macro types to the new system
Diffstat (limited to 'azalea-protocol/src/mc_buf/write.rs')
-rw-r--r--azalea-protocol/src/mc_buf/write.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/azalea-protocol/src/mc_buf/write.rs b/azalea-protocol/src/mc_buf/write.rs
index 7b1ac861..f22b218a 100644
--- a/azalea-protocol/src/mc_buf/write.rs
+++ b/azalea-protocol/src/mc_buf/write.rs
@@ -184,3 +184,45 @@ impl McBufWritable for Vec<u8> {
buf.write_bytes(self)
}
}
+
+// string
+impl McBufWritable for String {
+ fn write_into(&self, buf: &mut Vec<u8>) -> Result<(), std::io::Error> {
+ buf.write_utf(self)
+ }
+}
+
+// ResourceLocation
+impl McBufWritable for ResourceLocation {
+ fn write_into(&self, buf: &mut Vec<u8>) -> Result<(), std::io::Error> {
+ buf.write_resource_location(self)
+ }
+}
+
+// u32
+impl McBufWritable for u32 {
+ fn write_into(&self, buf: &mut Vec<u8>) -> Result<(), std::io::Error> {
+ buf.write_varint(*self as i32)
+ }
+}
+
+// u32 varint
+impl McBufVarintWritable for u32 {
+ fn varint_write_into(&self, buf: &mut Vec<u8>) -> Result<(), std::io::Error> {
+ buf.write_varint(*self as i32)
+ }
+}
+
+// u16
+impl McBufWritable for u16 {
+ fn write_into(&self, buf: &mut Vec<u8>) -> Result<(), std::io::Error> {
+ buf.write_varint(*self as i32)
+ }
+}
+
+// u16 varint
+impl McBufVarintWritable for u16 {
+ fn varint_write_into(&self, buf: &mut Vec<u8>) -> Result<(), std::io::Error> {
+ buf.write_varint(*self as i32)
+ }
+}