From 8bd97c6c96f2c3c1ef4edfc1ff9d59f9af664972 Mon Sep 17 00:00:00 2001 From: mat Date: Wed, 20 Apr 2022 16:28:31 +0000 Subject: add player abilities packet --- azalea-protocol/src/mc_buf/write.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'azalea-protocol/src/mc_buf/write.rs') diff --git a/azalea-protocol/src/mc_buf/write.rs b/azalea-protocol/src/mc_buf/write.rs index 26c0ef35..07605b16 100644 --- a/azalea-protocol/src/mc_buf/write.rs +++ b/azalea-protocol/src/mc_buf/write.rs @@ -41,6 +41,7 @@ pub trait Writable { &mut self, location: &ResourceLocation, ) -> Result<(), std::io::Error>; + fn write_float(&mut self, n: f32) -> Result<(), std::io::Error>; } #[async_trait] @@ -147,6 +148,10 @@ impl Writable for Vec { WriteBytesExt::write_i64::(self, n) } + fn write_float(&mut self, n: f32) -> Result<(), std::io::Error> { + WriteBytesExt::write_f32::(self, n) + } + fn write_resource_location( &mut self, location: &ResourceLocation, @@ -264,6 +269,13 @@ impl McBufWritable for i8 { } } +// i8 +impl McBufWritable for f32 { + fn write_into(&self, buf: &mut Vec) -> Result<(), std::io::Error> { + buf.write_float(*self) + } +} + // GameType impl McBufWritable for GameType { fn write_into(&self, buf: &mut Vec) -> Result<(), std::io::Error> { -- cgit v1.2.3