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) -> BlockPos
pub const fn offset(&self, dx: i32, dy: i32, dz: i32) -> BlockPos
Returns a new BlockPos offset by the given amounts.
Sourcepub const fn north_n(&self, n: i32) -> BlockPos
pub const fn north_n(&self, n: i32) -> BlockPos
Returns the position n blocks to the north (Z - n).
Sourcepub const fn south_n(&self, n: i32) -> BlockPos
pub const fn south_n(&self, n: i32) -> BlockPos
Returns the position n blocks to the south (Z + n).
Sourcepub const fn west_n(&self, n: i32) -> BlockPos
pub const fn west_n(&self, n: i32) -> BlockPos
Returns the position n blocks to the west (X - n).
Sourcepub const fn east_n(&self, n: i32) -> BlockPos
pub const fn east_n(&self, n: i32) -> BlockPos
Returns the position n blocks to the east (X + n).
Sourcepub const fn relative(self, direction: Direction) -> BlockPos
pub const fn relative(self, direction: Direction) -> BlockPos
Returns the position offset by one block in the given direction.
Sourcepub const fn relative_n(&self, direction: Direction, n: i32) -> BlockPos
pub const fn relative_n(&self, direction: Direction, n: i32) -> BlockPos
Returns the position offset by n blocks in the given direction.
Sourcepub const fn relative_axis(&self, axis: Axis, n: i32) -> BlockPos
pub const fn relative_axis(&self, axis: Axis, n: i32) -> BlockPos
Returns the position offset by n blocks along the given axis.
Sourcepub const fn at_y(&self, y: i32) -> BlockPos
pub const fn at_y(&self, y: i32) -> BlockPos
Returns a new position with the same X and Z but the given Y.
Sourcepub const fn multiply(&self, factor: i32) -> BlockPos
pub const fn multiply(&self, factor: i32) -> BlockPos
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) -> BlockPos
pub const fn containing(x: f64, y: f64, z: f64) -> BlockPos
Creates a BlockPos containing the given floating-point coordinates.
Trait Implementations§
impl Copy for BlockPos
impl Eq for BlockPos
Source§impl From<PackedBlockPos> for BlockPos
impl From<PackedBlockPos> for BlockPos
Source§fn from(pos: PackedBlockPos) -> BlockPos
fn from(pos: PackedBlockPos) -> BlockPos
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
key and return true if they are equal.