pub struct BlockPos(pub IVec3);Expand description
A block position.
Tuple Fields§
§0: IVec3Implementations§
Source§impl BlockPos
impl BlockPos
pub const ZERO: BlockPos
Sourcepub const MAX_HORIZONTAL_COORDINATE: i32
pub const MAX_HORIZONTAL_COORDINATE: i32
Maximum horizontal coordinate value: (1 << 26) / 2 - 1 = 33554431
Sourcepub const fn offset(&self, dx: i32, dy: i32, dz: i32) -> Self
pub const fn offset(&self, dx: i32, dy: i32, dz: i32) -> Self
Returns a new BlockPos offset by the given amounts.
Sourcepub fn relative(self, direction: Direction) -> Self
pub fn relative(self, direction: Direction) -> Self
Returns the position offset by one block in the given direction.
Sourcepub fn breadth_first_traversal<NP, P>(
start_pos: Self,
max_depth: i32,
max_count: i32,
neighbor_provider: NP,
node_processor: P,
) -> i32
pub fn breadth_first_traversal<NP, P>( start_pos: Self, max_depth: i32, max_count: i32, neighbor_provider: NP, node_processor: P, ) -> i32
Does a breadth-first traversal of all block pos from start_pos
Sourcepub fn relative_n(&self, direction: Direction, n: i32) -> Self
pub fn relative_n(&self, direction: Direction, n: i32) -> Self
Returns the position offset by n blocks in the given direction.
Sourcepub fn spiral_around(
center: Self,
radius: i32,
first_direction: Direction,
second_direction: Direction,
) -> SpiralAround ⓘ
pub fn spiral_around( center: Self, radius: i32, first_direction: Direction, second_direction: Direction, ) -> SpiralAround ⓘ
Returns vanilla BlockPos.spiralAround.
§Panics
Panics if radius is negative or if both directions are on the same axis.
Sourcepub const fn relative_axis(&self, axis: Axis, n: i32) -> Self
pub const fn relative_axis(&self, axis: Axis, n: i32) -> Self
Returns the position offset by n blocks along the given axis.
Sourcepub const fn at_y(&self, y: i32) -> Self
pub const fn at_y(&self, y: i32) -> Self
Returns a new position with the same X and Z but the given Y.
Sourcepub const fn multiply(&self, factor: i32) -> Self
pub const fn multiply(&self, factor: i32) -> Self
Returns a new position with all coordinates multiplied by the given factor.
Sourcepub fn get_center(&self) -> (f64, f64, f64)
pub fn get_center(&self) -> (f64, f64, f64)
Returns the center of this block as a floating-point position.
Sourcepub fn get_bottom_center(&self) -> (f64, f64, f64)
pub fn get_bottom_center(&self) -> (f64, f64, f64)
Returns the bottom center of this block (center of the bottom face).
Sourcepub const fn containing(x: f64, y: f64, z: f64) -> Self
pub const fn containing(x: f64, y: f64, z: f64) -> Self
Creates a BlockPos containing the given floating-point coordinates.
Sourcepub const fn min(a: BlockPos, b: BlockPos) -> Self
pub const fn min(a: BlockPos, b: BlockPos) -> Self
Returns the minimum coordinates of two positions.
Sourcepub const fn max(a: BlockPos, b: BlockPos) -> Self
pub const fn max(a: BlockPos, b: BlockPos) -> Self
Returns the maximum coordinates of two positions.
Sourcepub const fn within_manhattan(
self,
reach_x: i32,
reach_y: i32,
reach_z: i32,
) -> BlockPosWithinManhattan ⓘ
pub const fn within_manhattan( self, reach_x: i32, reach_y: i32, reach_z: i32, ) -> BlockPosWithinManhattan ⓘ
Returns positions in vanilla BlockPos.withinManhattan order.
Trait Implementations§
impl Copy for BlockPos
impl Eq for BlockPos
Source§impl From<BlockPos> for PackedBlockPos
impl From<BlockPos> for PackedBlockPos
Source§impl From<BlockPos> for PackedChunkLocalXZ
impl From<BlockPos> for PackedChunkLocalXZ
Source§impl From<BlockPos> for PackedSectionBlockPos
impl From<BlockPos> for PackedSectionBlockPos
Source§impl From<PackedBlockPos> for BlockPos
impl From<PackedBlockPos> for BlockPos
Source§fn from(pos: PackedBlockPos) -> Self
fn from(pos: PackedBlockPos) -> Self
impl StructuralPartialEq for BlockPos
Auto Trait Implementations§
impl Freeze for BlockPos
impl RefUnwindSafe for BlockPos
impl Send for BlockPos
impl Sync for BlockPos
impl Unpin for BlockPos
impl UnsafeUnpin for BlockPos
impl UnwindSafe for BlockPos
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
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
§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
key and return 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> ⓘ
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> ⓘ
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 moreArc<SyncMutex<>>