diff --git a/minecraft-positions/src/lib.rs b/minecraft-positions/src/lib.rs index e67cc314..3164931f 100644 --- a/minecraft-positions/src/lib.rs +++ b/minecraft-positions/src/lib.rs @@ -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 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, + } + } +} diff --git a/minecraft-server/src/world/light.rs b/minecraft-server/src/world/light.rs index f2427b85..3760b82e 100644 --- a/minecraft-server/src/world/light.rs +++ b/minecraft-server/src/world/light.rs @@ -78,3 +78,4 @@ impl SectionLightData { Ok(()) } } +