pub struct ChunkLightData {
pub block: ChunkLightLayerStorage,
pub sky: ChunkLightLayerStorage,
}Expand description
Chunk-owned block and sky light storage.
Fields§
§block: ChunkLightLayerStorageBlock light sections and section emptiness metadata.
sky: ChunkLightLayerStorageSky light sections and section emptiness metadata.
Implementations§
Source§impl ChunkLightData
impl ChunkLightData
Sourcepub fn new(min_y: i32, height: i32) -> Result<Self, LightSectionRangeError>
pub fn new(min_y: i32, height: i32) -> Result<Self, LightSectionRangeError>
Creates empty light storage for one chunk.
Sourcepub fn for_valid_world_height(min_y: i32, height: i32) -> Self
pub fn for_valid_world_height(min_y: i32, height: i32) -> Self
Creates storage for world heights already accepted by chunk construction.
Invalid world heights are fatal because chunk-owned light arrays cannot be indexed coherently without the vanilla padded light-section range.
§Panics
Panics when the supplied world height cannot form a valid light-section range.
Sourcepub fn refresh_emptiness_maps_from_sections(
&mut self,
sections: &Sections,
) -> Result<(), ChunkLightEmptinessMapLengthError>
pub fn refresh_emptiness_maps_from_sections( &mut self, sections: &Sections, ) -> Result<(), ChunkLightEmptinessMapLengthError>
Refreshes both layer emptiness maps from current chunk section counters.
Sourcepub fn set_section_empty(&mut self, section_y: i32, empty: bool) -> bool
pub fn set_section_empty(&mut self, section_y: i32, empty: bool) -> bool
Updates one real chunk section’s known emptiness in both light layers.
Sourcepub fn get_light_value(&self, layer: LightLayer, block_pos: BlockPos) -> u8
pub fn get_light_value(&self, layer: LightLayer, block_pos: BlockPos) -> u8
Returns the visible light value for one layer at a block position.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ChunkLightData
impl RefUnwindSafe for ChunkLightData
impl Send for ChunkLightData
impl Sync for ChunkLightData
impl Unpin for ChunkLightData
impl UnsafeUnpin for ChunkLightData
impl UnwindSafe for ChunkLightData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreWraps this value in an
Arc<SyncMutex<>>