Skip to content

Commit

Permalink
Fix: forgot serde_inline_default in config
Browse files Browse the repository at this point in the history
  • Loading branch information
Snowiiii committed Oct 14, 2024
1 parent ee4db10 commit c5fdb39
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
8 changes: 3 additions & 5 deletions pumpkin-config/src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,21 @@ use serde_inline_default::serde_inline_default;

#[serde_inline_default]
#[derive(Deserialize, Serialize)]
#[serde(default)]
pub struct AuthenticationConfig {
/// Whether to use Mojang authentication.
#[serde_inline_default(true)]
pub enabled: bool,

#[serde_inline_default("https://sessionserver.mojang.com/session/minecraft/hasJoined?username={username}&serverId={server_hash}".to_string())]
pub auth_url: String,

/// Prevent proxy connections.
#[serde_inline_default(false)]
pub prevent_proxy_connections: bool,

#[serde_inline_default("https://sessionserver.mojang.com/session/minecraft/hasJoined?username={username}&serverId={server_hash}&ip={ip}".to_string())]
pub prevent_proxy_connection_auth_url: String,

/// Player profile handling.
#[serde(default)]
pub player_profile: PlayerProfileConfig,

/// Texture handling.
#[serde(default)]
pub textures: TextureConfig,
Expand Down
2 changes: 1 addition & 1 deletion pumpkin-core/src/math/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ pub fn squared_magnitude(a: f64, b: f64, c: f64) -> f64 {

/// Converts a world coordinate to the corresponding chunk-section coordinate.
// TODO: This proberbly should place not here
pub fn get_section_cord(coord: i32) -> i32 {
pub const fn get_section_cord(coord: i32) -> i32 {
coord >> 4
}
2 changes: 1 addition & 1 deletion pumpkin-core/src/math/vector3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct Vector3<T> {
}

impl<T: Math + Copy> Vector3<T> {
pub fn new(x: T, y: T, z: T) -> Self {
pub const fn new(x: T, y: T, z: T) -> Self {
Vector3 { x, y, z }
}

Expand Down
6 changes: 2 additions & 4 deletions pumpkin-world/src/chunk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,8 @@ impl ChunkData {
return Err(ChunkParsingError::ChunkNotGenerated);
}

let chunk_data = match fastnbt::from_bytes::<ChunkNbt>(chunk_data.as_slice()) {
Ok(v) => v,
Err(err) => return Err(ChunkParsingError::ErrorDeserializingChunk(err.to_string())),
};
let chunk_data = fastnbt::from_bytes::<ChunkNbt>(chunk_data.as_slice())
.map_err(|e| ChunkParsingError::ErrorDeserializingChunk(e.to_string()))?;

// this needs to be boxed, otherwise it will cause a stack-overflow
let mut blocks = ChunkBlocks::empty_with_heightmap(chunk_data.heightmaps);
Expand Down
2 changes: 1 addition & 1 deletion pumpkin/src/world/player_chunker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pub async fn update_position(entity: &Entity, player: &Player) {
}
}

fn chunk_section_from_pos(block_pos: &WorldPosition) -> Vector3<i32> {
const fn chunk_section_from_pos(block_pos: &WorldPosition) -> Vector3<i32> {
let block_pos = block_pos.0;
Vector3::new(
get_section_cord(block_pos.x),
Expand Down

0 comments on commit c5fdb39

Please sign in to comment.