Struct azalea_core::position::ChunkSectionPos
source · pub struct ChunkSectionPos {
pub x: i32,
pub y: i32,
pub z: i32,
}
Expand description
The coordinates of a chunk section in the world.
Fields§
§x: i32
§y: i32
§z: i32
Implementations§
source§impl ChunkSectionPos
impl ChunkSectionPos
pub fn new(x: i32, y: i32, z: i32) -> Self
sourcepub fn length_sqr(&self) -> i32
pub fn length_sqr(&self) -> i32
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) -> i32
pub fn distance_to_sqr(&self, other: &Self) -> i32
Get the squared distance from this position to another position.
Equivalent to (self - other).length_sqr()
.
pub fn horizontal_distance_sqr(&self) -> i32
pub fn horizontal_distance_to_sqr(&self, other: &Self) -> i32
sourcepub fn down(&self, y: i32) -> Self
pub fn down(&self, y: i32) -> Self
Return a new instance of this position with the y coordinate decreased by the given number.
sourcepub fn up(&self, y: i32) -> Self
pub fn up(&self, y: i32) -> Self
Return a new instance of this position with the y coordinate increased by the given number.
sourcepub fn north(&self, z: i32) -> Self
pub fn north(&self, z: i32) -> Self
Return a new instance of this position with the z coordinate subtracted by the given number.
sourcepub fn east(&self, x: i32) -> Self
pub fn east(&self, x: i32) -> Self
Return a new instance of this position with the x coordinate increased by the given number.
sourcepub fn south(&self, z: i32) -> Self
pub fn south(&self, z: i32) -> Self
Return a new instance of this position with the z coordinate increased by the given number.
sourcepub fn west(&self, x: i32) -> Self
pub fn west(&self, x: i32) -> Self
Return a new instance of this position with the x coordinate subtracted by the given number.
pub fn dot(&self, other: Self) -> i32
source§impl ChunkSectionPos
impl ChunkSectionPos
pub fn block_to_section_coord(block: i32) -> i32
Trait Implementations§
source§impl Add<ChunkSectionBlockPos> for ChunkSectionPos
impl Add<ChunkSectionBlockPos> for ChunkSectionPos
source§impl Add for &ChunkSectionPos
impl Add for &ChunkSectionPos
source§impl Add for ChunkSectionPos
impl Add for ChunkSectionPos
source§impl AddAssign for ChunkSectionPos
impl AddAssign for ChunkSectionPos
source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+=
operation. Read moresource§impl Clone for ChunkSectionPos
impl Clone for ChunkSectionPos
source§fn clone(&self) -> ChunkSectionPos
fn clone(&self) -> ChunkSectionPos
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ChunkSectionPos
impl Debug for ChunkSectionPos
source§impl Default for ChunkSectionPos
impl Default for ChunkSectionPos
source§fn default() -> ChunkSectionPos
fn default() -> ChunkSectionPos
source§impl From<&BlockPos> for ChunkSectionPos
impl From<&BlockPos> for ChunkSectionPos
source§impl From<BlockPos> for ChunkSectionPos
impl From<BlockPos> for ChunkSectionPos
source§impl From<ChunkSectionPos> for (i32, i32, i32)
impl From<ChunkSectionPos> for (i32, i32, i32)
source§fn from(pos: ChunkSectionPos) -> Self
fn from(pos: ChunkSectionPos) -> Self
source§impl From<ChunkSectionPos> for ChunkPos
impl From<ChunkSectionPos> for ChunkPos
source§fn from(pos: ChunkSectionPos) -> Self
fn from(pos: ChunkSectionPos) -> Self
source§impl McBufReadable for ChunkSectionPos
impl McBufReadable for ChunkSectionPos
source§impl McBufWritable for ChunkSectionPos
impl McBufWritable for ChunkSectionPos
source§impl Mul<i32> for ChunkSectionPos
impl Mul<i32> for ChunkSectionPos
source§impl Ord for ChunkSectionPos
impl Ord for ChunkSectionPos
source§fn cmp(&self, other: &ChunkSectionPos) -> Ordering
fn cmp(&self, other: &ChunkSectionPos) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for ChunkSectionPos
impl PartialEq for ChunkSectionPos
source§fn eq(&self, other: &ChunkSectionPos) -> bool
fn eq(&self, other: &ChunkSectionPos) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for ChunkSectionPos
impl PartialOrd for ChunkSectionPos
source§fn partial_cmp(&self, other: &ChunkSectionPos) -> Option<Ordering>
fn partial_cmp(&self, other: &ChunkSectionPos) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more