cargo fmt

This commit is contained in:
Snowiiii 2024-08-14 21:37:27 +02:00
parent 5f8cbdbba6
commit 6485c99167
9 changed files with 36 additions and 32 deletions

View File

@ -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;

View File

@ -3,13 +3,14 @@ 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> {
D: serde::Deserializer<'de>,
{
struct Visitor;
impl<'a> serde::de::Visitor<'a> for Visitor {
type Value = WorldPosition;
@ -18,11 +19,12 @@ impl<'de> Deserialize<'de> for WorldPosition {
}
fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
where
E: serde::de::Error, {
E: serde::de::Error,
{
Ok(WorldPosition {
x: (v >> 38) as i32,
y: (v << 52 >> 52) as i32,
z: (v << 26 >> 38) as i32
z: (v << 26 >> 38) as i32,
})
}
}

View File

@ -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::*;

View File

@ -4,5 +4,5 @@ pub const WORLD_HEIGHT: usize = 384;
pub const WORLD_Y_START_AT: i32 = -64;
pub const DIRECT_PALETTE_BITS: u32 = 15;
mod block_registry;
mod world;
pub mod radial_chunk_iterator;
mod world;

View File

@ -89,7 +89,11 @@ impl Level {
region_file_path.push(format!("r.{}.{}.mca", region.0, region.1));
// return different error when file is not found (because that means that the chunks have just not been generated yet)
let mut region_file = match std::fs::File::options().read(true).write(false).open(&region_file_path) {
let mut region_file = match std::fs::File::options()
.read(true)
.write(false)
.open(&region_file_path)
{
Ok(f) => f,
Err(err) => match err.kind() {
std::io::ErrorKind::NotFound => {

View File

@ -1,8 +1,6 @@
use super::Command;
pub struct StopCommand {
}
pub struct StopCommand {}
impl<'a> Command<'a> for StopCommand {
const NAME: &'static str = "stop";