pub struct CarvingMask {
min_y: i32,
height: i32,
bits: Vec<u64>,
}Expand description
A 16 × height × 16 bitset of local block positions in a chunk.
Fields§
§min_y: i32§height: i32§bits: Vec<u64>Implementations§
Source§impl CarvingMask
impl CarvingMask
Sourcepub fn new(min_y: i32, max_y: i32) -> Self
pub fn new(min_y: i32, max_y: i32) -> Self
Creates an empty mask covering the inclusive range [min_y, max_y].
§Panics
Panics if min_y is greater than max_y.
Sourcepub fn for_worldgen_context(min_y: i32, height: i32) -> Self
pub fn for_worldgen_context(min_y: i32, height: i32) -> Self
Creates the range used by NoiseBasedChunkGenerator.generateCarvers.
The bottom block and the top seven blocks are protected for normal generation, matching vanilla’s non-upgrading chunk path.
Sourceconst fn index(&self, x: i32, y: i32, z: i32) -> usize
const fn index(&self, x: i32, y: i32, z: i32) -> usize
Vanilla’s getIndex: y - min_y + (z + (x << 4)) * height.
Sourcepub fn set_if_unset(&mut self, x: i32, y: i32, z: i32) -> bool
pub fn set_if_unset(&mut self, x: i32, y: i32, z: i32) -> bool
Marks (x, y, z) as carved if it was not already marked.
Returns true when this call set the bit, or false when a previous
carver step had already visited the position.
Sourcepub fn visit(&self, visitor: impl FnMut(i32, i32, i32, i32))
pub fn visit(&self, visitor: impl FnMut(i32, i32, i32, i32))
Visits the marked vertical ranges in vanilla’s bitset order.
fn visit_segment( &self, visitor: &mut impl FnMut(i32, i32, i32, i32), start_index: usize, end_index: usize, )
fn next_set_bit(&self, from: usize) -> Option<usize>
fn next_clear_bit(&self, from: usize) -> usize
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CarvingMask
impl RefUnwindSafe for CarvingMask
impl Send for CarvingMask
impl Sync for CarvingMask
impl Unpin for CarvingMask
impl UnsafeUnpin for CarvingMask
impl UnwindSafe for CarvingMask
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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<>>