cargo fmt
This commit is contained in:
1 parent
5f8cbdbba6
commit
6485c99167
9 files changed
+36
-32
No files matched your search
@@ -8,9 +8,9 @@ pub mod bytebuf;
|
||||
pub mod client;
|
||||
pub mod packet_decoder;
|
||||
pub mod packet_encoder;
|
||||
pub mod position;
|
||||
pub mod server;
|
||||
pub mod uuid;
|
||||
pub mod position;
|
||||
|
||||
pub const CURRENT_MC_PROTOCOL: u32 = 767;
|
||||
|
||||
|
||||
@@ -3,29 +3,31 @@ use serde::Deserialize;
|
||||
pub struct WorldPosition {
|
||||
x: i32,
|
||||
y: i32,
|
||||
z: i32
|
||||
z: i32,
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for WorldPosition {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: serde::Deserializer<'de> {
|
||||
struct Visitor;
|
||||
impl<'a> serde::de::Visitor<'a> for Visitor {
|
||||
type Value = WorldPosition;
|
||||
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
formatter.write_str("An i64 int")
|
||||
}
|
||||
fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
|
||||
where
|
||||
E: serde::de::Error, {
|
||||
Ok(WorldPosition {
|
||||
x: (v >> 38) as i32,
|
||||
y: (v << 52 >> 52) as i32,
|
||||
z: (v << 26 >> 38) as i32
|
||||
})
|
||||
}
|
||||
D: serde::Deserializer<'de>,
|
||||
{
|
||||
struct Visitor;
|
||||
impl<'a> serde::de::Visitor<'a> for Visitor {
|
||||
type Value = WorldPosition;
|
||||
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
formatter.write_str("An i64 int")
|
||||
}
|
||||
fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
|
||||
where
|
||||
E: serde::de::Error,
|
||||
{
|
||||
Ok(WorldPosition {
|
||||
x: (v >> 38) as i32,
|
||||
y: (v << 52 >> 52) as i32,
|
||||
z: (v << 26 >> 38) as i32,
|
||||
})
|
||||
}
|
||||
deserializer.deserialize_i64(Visitor)
|
||||
}
|
||||
}
|
||||
deserializer.deserialize_i64(Visitor)
|
||||
}
|
||||
}
|
||||
@@ -3,21 +3,21 @@ mod c_interact;
|
||||
mod s_chat_command;
|
||||
mod s_chat_message;
|
||||
mod s_confirm_teleport;
|
||||
mod s_player_action;
|
||||
mod s_player_command;
|
||||
mod s_player_position;
|
||||
mod s_player_position_rotation;
|
||||
mod s_player_rotation;
|
||||
mod s_swing_arm;
|
||||
mod s_player_action;
|
||||
|
||||
pub use c_client_information::*;
|
||||
pub use c_interact::*;
|
||||
pub use s_chat_command::*;
|
||||
pub use s_chat_message::*;
|
||||
pub use s_confirm_teleport::*;
|
||||
pub use s_player_action::*;
|
||||
pub use s_player_command::*;
|
||||
pub use s_player_position::*;
|
||||
pub use s_player_position_rotation::*;
|
||||
pub use s_player_rotation::*;
|
||||
pub use s_swing_arm::*;
|
||||
pub use s_player_action::*;
|
||||
@@ -9,4 +9,4 @@ pub struct SPlayerAction {
|
||||
location: WorldPosition,
|
||||
face: u8,
|
||||
sequence: VarInt,
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user