Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Commit

Permalink
Implement LightPositionInChunkColumn
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitriTimoz committed Dec 24, 2023
1 parent 782f974 commit 3f2ac20
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
28 changes: 28 additions & 0 deletions minecraft-positions/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,31 @@ impl ChunkColumnPosition {
}
}
}

#[derive(Debug, Clone)]
pub struct LightPositionInChunkColumn {
pub bx: u8,
pub y: usize,
pub bz: u8,
}

impl LightPositionInChunkColumn {
pub fn in_chunk(&self) -> BlockPositionInChunk {
BlockPositionInChunk {
bx: self.bx,
by: self.y.rem_euclid(16) as u8,
bz: self.bz,
}
}
}


impl From<BlockPositionInChunkColumn> for LightPositionInChunkColumn {
fn from(val: BlockPositionInChunkColumn) -> Self {
Self {
bx: val.bx,
y: (val.y + 64 + 16) as usize, // TODO: Use the world config
bz: val.bz,
}
}
}
1 change: 1 addition & 0 deletions minecraft-server/src/world/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,4 @@ impl SectionLightData {
Ok(())
}
}

0 comments on commit 3f2ac20

Please sign in to comment.