pub struct Vec3i {
pub x: i32,
pub y: i32,
pub z: i32,
}Expand description
An arbitrary position that’s represented as 32-bit integers.
This is similar to BlockPos, but isn’t limited to representing block
positions and can represent a larger range of numbers.
Fields§
§x: i32§y: i32§z: i32Implementations§
Source§impl Vec3i
impl Vec3i
pub const fn new(x: i32, y: i32, z: i32) -> Self
Sourcepub fn length_squared(&self) -> i32
pub fn length_squared(&self) -> i32
Get the distance of this vector to the origin by doing x^2 + y^2 + z^2.
Sourcepub fn distance_squared_to(self, other: Self) -> i32
pub fn distance_squared_to(self, other: Self) -> i32
Get the squared distance from this position to another position.
Equivalent to (self - other).length_squared().
pub fn horizontal_distance_squared(&self) -> i32
pub fn horizontal_distance_squared_to(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
Sourcepub fn min(&self, other: Self) -> Self
pub fn min(&self, other: Self) -> Self
Make a new position with the lower coordinates for each axis.
Sourcepub fn max(&self, other: Self) -> Self
pub fn max(&self, other: Self) -> Self
Make a new position with the higher coordinates for each axis.
pub fn with_x(&self, x: i32) -> Self
pub fn with_y(&self, y: i32) -> Self
pub fn with_z(&self, z: i32) -> Self
Trait Implementations§
Source§impl AddAssign for Vec3i
impl AddAssign for Vec3i
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read moreSource§impl DivAssign<i32> for Vec3i
impl DivAssign<i32> for Vec3i
Source§fn div_assign(&mut self, divisor: i32)
fn div_assign(&mut self, divisor: i32)
/= operation. Read moreSource§impl MulAssign<i32> for Vec3i
impl MulAssign<i32> for Vec3i
Source§fn mul_assign(&mut self, multiplier: i32)
fn mul_assign(&mut self, multiplier: i32)
*= operation. Read moreimpl Copy for Vec3i
impl Eq for Vec3i
impl StructuralPartialEq for Vec3i
Auto Trait Implementations§
impl Freeze for Vec3i
impl RefUnwindSafe for Vec3i
impl Send for Vec3i
impl Sync for Vec3i
impl Unpin for Vec3i
impl UnwindSafe for Vec3i
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<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>, which can then be
downcast into Box<dyn 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>, which 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> DowncastSend for T
impl<T> DowncastSend 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
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
Creates Self using default().