Struct azalea_core::ChunkSectionBlockPos
source · pub struct ChunkSectionBlockPos {
pub x: u8,
pub y: u8,
pub z: u8,
}
Expand description
The coordinates of a block inside a chunk section. Each coordinate must be in the range [0, 15].
Fields§
§x: u8
§y: u8
§z: u8
Implementations§
source§impl ChunkSectionBlockPos
impl ChunkSectionBlockPos
pub fn new(x: u8, y: u8, z: u8) -> Self
sourcepub fn length_sqr(&self) -> u8
pub fn length_sqr(&self) -> u8
Get the distance of this vector to the origin by doing x^2 + y^2 + z^2
.
sourcepub fn distance_to_sqr(&self, other: &Self) -> u8
pub fn distance_to_sqr(&self, other: &Self) -> u8
Get the squared distance from this position to another position.
Equivalent to (self - other).length_sqr()
.
sourcepub fn down(&self, y: u8) -> Self
pub fn down(&self, y: u8) -> Self
Return a new instance of this position with the y coordinate decreased by the given number.
sourcepub fn up(&self, y: u8) -> Self
pub fn up(&self, y: u8) -> Self
Return a new instance of this position with the y coordinate increased by the given number.
pub fn dot(&self, other: Self) -> u8
Trait Implementations§
source§impl Add<&ChunkSectionBlockPos> for &ChunkSectionBlockPos
impl Add<&ChunkSectionBlockPos> for &ChunkSectionBlockPos
source§impl Add<ChunkSectionBlockPos> for ChunkSectionPos
impl Add<ChunkSectionBlockPos> for ChunkSectionPos
source§impl AddAssign<ChunkSectionBlockPos> for ChunkSectionBlockPos
impl AddAssign<ChunkSectionBlockPos> for ChunkSectionBlockPos
source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moresource§impl Clone for ChunkSectionBlockPos
impl Clone for ChunkSectionBlockPos
source§fn clone(&self) -> ChunkSectionBlockPos
fn clone(&self) -> ChunkSectionBlockPos
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ChunkSectionBlockPos
impl Debug for ChunkSectionBlockPos
source§impl Default for ChunkSectionBlockPos
impl Default for ChunkSectionBlockPos
source§fn default() -> ChunkSectionBlockPos
fn default() -> ChunkSectionBlockPos
Returns the “default value” for a type. Read more
source§impl From<&BlockPos> for ChunkSectionBlockPos
impl From<&BlockPos> for ChunkSectionBlockPos
source§impl From<&ChunkBlockPos> for ChunkSectionBlockPos
impl From<&ChunkBlockPos> for ChunkSectionBlockPos
source§fn from(pos: &ChunkBlockPos) -> Self
fn from(pos: &ChunkBlockPos) -> Self
Converts to this type from the input type.
source§impl Mul<u8> for ChunkSectionBlockPos
impl Mul<u8> for ChunkSectionBlockPos
source§impl PartialEq<ChunkSectionBlockPos> for ChunkSectionBlockPos
impl PartialEq<ChunkSectionBlockPos> for ChunkSectionBlockPos
source§fn eq(&self, other: &ChunkSectionBlockPos) -> bool
fn eq(&self, other: &ChunkSectionBlockPos) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Rem<u8> for ChunkSectionBlockPos
impl Rem<u8> for ChunkSectionBlockPos
source§impl Sub<&ChunkSectionBlockPos> for &ChunkSectionBlockPos
impl Sub<&ChunkSectionBlockPos> for &ChunkSectionBlockPos
impl Eq for ChunkSectionBlockPos
impl StructuralEq for ChunkSectionBlockPos
impl StructuralPartialEq for ChunkSectionBlockPos
Auto Trait Implementations§
impl RefUnwindSafe for ChunkSectionBlockPos
impl Send for ChunkSectionBlockPos
impl Sync for ChunkSectionBlockPos
impl Unpin for ChunkSectionBlockPos
impl UnwindSafe for ChunkSectionBlockPos
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