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§impl PartialOrd for ChunkSectionPos
impl PartialOrd for ChunkSectionPos
Source§impl Rem<i32> for ChunkSectionPos
impl Rem<i32> for ChunkSectionPos
Source§impl Sub for &ChunkSectionPos
impl Sub for &ChunkSectionPos
Source§impl Sub for ChunkSectionPos
impl Sub for ChunkSectionPos
impl Copy for ChunkSectionPos
impl Eq for ChunkSectionPos
impl StructuralPartialEq for ChunkSectionPos
Auto Trait Implementations§
impl Freeze for ChunkSectionPos
impl RefUnwindSafe for ChunkSectionPos
impl Send for ChunkSectionPos
impl Sync for ChunkSectionPos
impl Unpin for ChunkSectionPos
impl UnwindSafe for ChunkSectionPos
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,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DynEq for T
impl<T> DynEq for T
§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> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self
using data from the given [World
].