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

Commit

Permalink
Implement Light structure
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitriTimoz committed Dec 24, 2023
1 parent b0bfac4 commit 53fe27a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions minecraft-server/src/world/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,28 @@ impl LightSystem {
}
}

pub(super) struct Light {
sky_light: LightSystem,
}

impl Light {
pub fn new() -> Self {
// TODO: Make this configurable with the world.
Self {
sky_light: LightSystem {
level: MAX_LIGHT_LEVEL,
light_arrays: vec![SectionLightData::new(); 24+2],
light_mask: 0,
empty_light_mask: !0,
},
}
}

pub fn get_packet(&self) -> (Array<Array<u8, VarInt>, VarInt>, BitSet, BitSet) {
self.sky_light.get_packet_data()
}

pub fn get_skylight_level(&self, position: LightPositionInChunkColumn) -> u8 {
self.sky_light.get_level(position).unwrap_or_default()
}
}

0 comments on commit 53fe27a

Please sign in to comment.