pub(in worldgen::feature) struct SectionPos(pub IVec3);Expand description
A chunk section position (16x16x16 region).
Tuple Fields§
§0: IVec3Implementations§
Source§impl SectionPos
impl SectionPos
Sourcepub const fn new(x: i32, y: i32, z: i32) -> SectionPos
pub const fn new(x: i32, y: i32, z: i32) -> SectionPos
Creates a new SectionPos from section coordinates.
Sourcepub const fn block_to_section_coord(block_coord: i32) -> i32
pub const fn block_to_section_coord(block_coord: i32) -> i32
Converts a block coordinate to a section coordinate.
Sourcepub const fn from_block_pos(pos: BlockPos) -> SectionPos
pub const fn from_block_pos(pos: BlockPos) -> SectionPos
Creates a SectionPos from a BlockPos.
Sourcepub fn from_entity_pos(pos: DVec3) -> SectionPos
pub fn from_entity_pos(pos: DVec3) -> SectionPos
Creates a SectionPos containing the given floating-point world position.
Sourcepub const fn relative_to_block_x(&self, relative: PackedSectionBlockPos) -> i32
pub const fn relative_to_block_x(&self, relative: PackedSectionBlockPos) -> i32
Converts section-relative coordinates to an absolute block X coordinate.
Sourcepub const fn relative_to_block_y(&self, relative: PackedSectionBlockPos) -> i32
pub const fn relative_to_block_y(&self, relative: PackedSectionBlockPos) -> i32
Converts section-relative coordinates to an absolute block Y coordinate.
Sourcepub const fn relative_to_block_z(&self, relative: PackedSectionBlockPos) -> i32
pub const fn relative_to_block_z(&self, relative: PackedSectionBlockPos) -> i32
Converts section-relative coordinates to an absolute block Z coordinate.
Sourcepub const fn section_relative_pos(pos: BlockPos) -> PackedSectionBlockPos
pub const fn section_relative_pos(pos: BlockPos) -> PackedSectionBlockPos
Packs a block position into a section-relative offset. Format: (x << 8) | (z << 4) | y (each coordinate masked to 4 bits)
Sourcepub const fn relative_to_block_pos(
&self,
relative: PackedSectionBlockPos,
) -> BlockPos
pub const fn relative_to_block_pos( &self, relative: PackedSectionBlockPos, ) -> BlockPos
Converts a section-relative packed position back to a block position.
Trait Implementations§
Source§impl Clone for SectionPos
impl Clone for SectionPos
Source§fn clone(&self) -> SectionPos
fn clone(&self) -> SectionPos
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for SectionPos
Source§impl Debug for SectionPos
impl Debug for SectionPos
impl Eq for SectionPos
Source§impl From<PackedSectionPos> for SectionPos
impl From<PackedSectionPos> for SectionPos
Source§fn from(pos: PackedSectionPos) -> SectionPos
fn from(pos: PackedSectionPos) -> SectionPos
Converts to this type from the input type.
Source§impl Hash for SectionPos
impl Hash for SectionPos
Source§impl PartialEq for SectionPos
impl PartialEq for SectionPos
Source§impl ReadFrom for SectionPos
impl ReadFrom for SectionPos
impl StructuralPartialEq for SectionPos
Auto Trait Implementations§
impl Freeze for SectionPos
impl RefUnwindSafe for SectionPos
impl Send for SectionPos
impl Sync for SectionPos
impl Unpin for SectionPos
impl UnsafeUnpin for SectionPos
impl UnwindSafe for SectionPos
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compares
self with key and returns true if they are equal.§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<>>