Skip to main content

Rotation

Enum Rotation 

Source
pub enum Rotation {
    None,
    Clockwise90,
    Clockwise180,
    CounterClockwise90,
}
Expand description

Horizontal rotation around the Y axis.

Variants§

§

None

0°.

§

Clockwise90

90° clockwise.

§

Clockwise180

180°.

§

CounterClockwise90

270° clockwise (= 90° counter-clockwise).

Implementations§

Source§

impl Rotation

Source

pub fn get_random(rng: &mut impl Random) -> Self

Matches vanilla’s Rotation.getRandom(random).

Source

pub fn get_shuffled(rng: &mut impl Random) -> [Rotation; 4]

Matches vanilla’s Util.shuffledCopy(values(), random) (reverse Fisher-Yates).

Source

pub const fn rotate(self, dir: Direction) -> Direction

Vertical directions (Up/Down) are unchanged.

Source

pub const fn then(self, other: Self) -> Self

self.then(other) = apply self first, then other.

Source

pub const fn transform_pos( self, x: i32, y: i32, z: i32, pivot_x: i32, pivot_z: i32, ) -> (i32, i32, i32)

Matches vanilla’s StructureTemplate.transform(pos, Mirror.NONE, rotation, pivot).

Source

pub const fn rotate_size( self, size_x: i32, size_y: i32, size_z: i32, ) -> (i32, i32, i32)

90°/270° swap the X and Z dimensions.

Source

pub const fn transform_pos_mirrored( self, x: i32, y: i32, z: i32, pivot_x: i32, pivot_z: i32, mirror_front_back: bool, ) -> (i32, i32, i32)

Matches vanilla’s StructureTemplate.transform(pos, Mirror.FRONT_BACK, rotation, pivot).

Source

pub const fn get_bounding_box_full( self, pos: (i32, i32, i32), size: (i32, i32, i32), pivot_x: i32, pivot_z: i32, mirror_front_back: bool, ) -> BoundingBox

Matches vanilla’s StructureTemplate.getBoundingBox(position, rotation, pivot, mirror, size).

Source

pub const fn get_bounding_box_with_pivot( self, pos: (i32, i32, i32), size: (i32, i32, i32), pivot_x: i32, pivot_z: i32, ) -> BoundingBox

[get_bounding_box_full] with mirror=NONE.

Source

pub const fn get_bounding_box( self, pos_x: i32, pos_y: i32, pos_z: i32, size_x: i32, size_y: i32, size_z: i32, ) -> BoundingBox

[get_bounding_box_full] with pivot=ZERO and mirror=NONE. Used by jigsaw pool elements.

Trait Implementations§

Source§

impl Clone for Rotation

Source§

fn clone(&self) -> Rotation

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Rotation

Source§

impl Debug for Rotation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Rotation

Source§

impl PartialEq for Rotation

Source§

fn eq(&self, other: &Rotation) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Rotation

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more