cargo fmt
This commit is contained in:
parent
5f8cbdbba6
commit
6485c99167
@ -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::*;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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(®ion_file_path) {
|
||||
let mut region_file = match std::fs::File::options()
|
||||
.read(true)
|
||||
.write(false)
|
||||
.open(®ion_file_path)
|
||||
{
|
||||
Ok(f) => f,
|
||||
Err(err) => match err.kind() {
|
||||
std::io::ErrorKind::NotFound => {
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
use super::Command;
|
||||
|
||||
pub struct StopCommand {
|
||||
|
||||
}
|
||||
pub struct StopCommand {}
|
||||
|
||||
impl<'a> Command<'a> for StopCommand {
|
||||
const NAME: &'static str = "stop";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user