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
impl Rotation
Sourcepub fn get_random(rng: &mut impl Random) -> Self
pub fn get_random(rng: &mut impl Random) -> Self
Matches vanilla’s Rotation.getRandom(random).
Sourcepub fn get_shuffled(rng: &mut impl Random) -> [Rotation; 4]
pub fn get_shuffled(rng: &mut impl Random) -> [Rotation; 4]
Matches vanilla’s Util.shuffledCopy(values(), random) (reverse Fisher-Yates).
Sourcepub const fn rotate(self, dir: Direction) -> Direction
pub const fn rotate(self, dir: Direction) -> Direction
Vertical directions (Up/Down) are unchanged.
Sourcepub const fn transform_pos(
self,
x: i32,
y: i32,
z: i32,
pivot_x: i32,
pivot_z: i32,
) -> (i32, i32, i32)
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).
Sourcepub const fn rotate_size(
self,
size_x: i32,
size_y: i32,
size_z: i32,
) -> (i32, i32, i32)
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.
Sourcepub 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)
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).
Sourcepub 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
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).
Sourcepub const fn get_bounding_box_with_pivot(
self,
pos: (i32, i32, i32),
size: (i32, i32, i32),
pivot_x: i32,
pivot_z: i32,
) -> BoundingBox
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.
Sourcepub 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
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§
impl Copy for Rotation
impl Eq for Rotation
impl StructuralPartialEq for Rotation
Auto Trait Implementations§
impl Freeze for Rotation
impl RefUnwindSafe for Rotation
impl Send for Rotation
impl Sync for Rotation
impl Unpin for Rotation
impl UnsafeUnpin for Rotation
impl UnwindSafe for Rotation
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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
Compare self to
key and return true if they are equal.