diff options
| author | mat <github@matdoes.dev> | 2022-04-20 16:28:31 +0000 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-04-20 16:28:39 +0000 |
| commit | 8bd97c6c96f2c3c1ef4edfc1ff9d59f9af664972 (patch) | |
| tree | d435eea3d11b59e1d93124b1293d1c50fc063792 /azalea-protocol/src/mc_buf/write.rs | |
| parent | c5f10af09d1d2fee640b946da9ec5ca1bcd1e62d (diff) | |
| download | azalea-drasl-8bd97c6c96f2c3c1ef4edfc1ff9d59f9af664972.tar.xz | |
add player abilities packet
Diffstat (limited to 'azalea-protocol/src/mc_buf/write.rs')
| -rw-r--r-- | azalea-protocol/src/mc_buf/write.rs | 12 |
1 files changed, 12 insertions, 0 deletions
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<u8> { WriteBytesExt::write_i64::<BigEndian>(self, n) } + fn write_float(&mut self, n: f32) -> Result<(), std::io::Error> { + WriteBytesExt::write_f32::<BigEndian>(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<u8>) -> Result<(), std::io::Error> { + buf.write_float(*self) + } +} + // GameType impl McBufWritable for GameType { fn write_into(&self, buf: &mut Vec<u8>) -> Result<(), std::io::Error> { |
