1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 14:26:04 +00:00
This commit is contained in:
mat 2024-04-27 06:08:38 +00:00
parent 6553d9510d
commit 8e2e81651c
2 changed files with 5 additions and 4 deletions

View file

@ -51,7 +51,7 @@ use azalea_protocol::{
serverbound_login_acknowledged_packet::ServerboundLoginAcknowledgedPacket, serverbound_login_acknowledged_packet::ServerboundLoginAcknowledgedPacket,
ClientboundLoginPacket, ClientboundLoginPacket,
}, },
ConnectionProtocol, ClientIntention, PROTOCOL_VERSION, ClientIntention, ConnectionProtocol, PROTOCOL_VERSION,
}, },
resolver, ServerAddress, resolver, ServerAddress,
}; };

View file

@ -54,7 +54,7 @@ where
pub enum ClientIntention { pub enum ClientIntention {
Status = 1, Status = 1,
Login = 2, Login = 2,
Transfer = 3 Transfer = 3,
} }
impl TryFrom<i32> for ClientIntention { impl TryFrom<i32> for ClientIntention {
@ -82,7 +82,8 @@ impl From<ClientIntention> for ConnectionProtocol {
impl azalea_buf::McBufReadable for ClientIntention { impl azalea_buf::McBufReadable for ClientIntention {
fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
let id = i32::var_read_from(buf)?; let id = i32::var_read_from(buf)?;
id.try_into().map_err(|_| BufReadError::UnexpectedEnumVariant { id }) id.try_into()
.map_err(|_| BufReadError::UnexpectedEnumVariant { id })
} }
} }
@ -90,4 +91,4 @@ impl McBufWritable for ClientIntention {
fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
(*self as i32).var_write_into(buf) (*self as i32).var_write_into(buf)
} }
} }