Package redempt.redlib.multiblock
Class Rotator
java.lang.Object
redempt.redlib.multiblock.Rotator
Used to rotate blocks and block sections when building or testing for the presence of a MultiBlockStructure
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Gets a clone of this RotatorGets a Rotator which will negate the operations of this Rotatorint
int
double
double
int
Gets the rotation, in number of 90-degree clockwise rotationsboolean
Gets whether this rotator mirrors over the X axisorg.bukkit.block.data.BlockData
rotate
(org.bukkit.block.data.BlockData data) Rotates block data.org.bukkit.block.BlockFace
rotateBlockFace
(org.bukkit.block.BlockFace face) Rotates a BlockFace according to this Rotatorstatic org.bukkit.block.BlockFace
rotateBlockFace
(org.bukkit.block.BlockFace face, int rotation) Rotates a BlockFace according to given valuesstatic org.bukkit.block.BlockFace
rotateBlockFace
(org.bukkit.block.BlockFace face, int rotation, boolean mirror) Rotates a BlockFace according to given valuesorg.bukkit.util.Vector
rotateVector
(org.bukkit.util.Vector vector) Rotates a Vector according to this Rotatorvoid
setLocation
(double x, double z) Sets the relative coordinates this Rotator will rotatevoid
setMirrored
(boolean mirrored) Sets whether this rotator mirrors over the X axisvoid
setRotation
(int rotation) Sets the rotation
-
Constructor Details
-
Rotator
public Rotator(int rotation, boolean mirrored) Constructs a new Rotator- Parameters:
rotation
- The number of 90-degree clockwise rotations this Rotator appliesmirrored
- Whether this Rotator should mirror over the X axis
-
-
Method Details
-
rotateBlockFace
public static org.bukkit.block.BlockFace rotateBlockFace(org.bukkit.block.BlockFace face, int rotation, boolean mirror) Rotates a BlockFace according to given values- Parameters:
face
- The BlockFace to rotaterotation
- The number of clockwise rotations to applymirror
- Whether or not to mirror over the X axis- Returns:
- The rotated BlockFace
-
rotateBlockFace
public static org.bukkit.block.BlockFace rotateBlockFace(org.bukkit.block.BlockFace face, int rotation) Rotates a BlockFace according to given values- Parameters:
face
- The BlockFace to rotaterotation
- The number of clockwise rotations to apply- Returns:
- The rotated BlockFace
-
rotate
public org.bukkit.block.data.BlockData rotate(org.bukkit.block.data.BlockData data) Rotates block data. NOTE: Only works for 1.13+- Parameters:
data
- The block data to rotate- Returns:
- The rotated block data
-
rotateBlockFace
public org.bukkit.block.BlockFace rotateBlockFace(org.bukkit.block.BlockFace face) Rotates a BlockFace according to this Rotator- Parameters:
face
- The BlockFace to rotate- Returns:
- The rotated BlockFace
-
rotateVector
public org.bukkit.util.Vector rotateVector(org.bukkit.util.Vector vector) Rotates a Vector according to this Rotator- Parameters:
vector
- The Vector to rotate- Returns:
- The rotated Vector
-
setLocation
public void setLocation(double x, double z) Sets the relative coordinates this Rotator will rotate- Parameters:
x
- The relative X coordinatez
- The relative Z coordinate
-
getRotatedBlockX
public int getRotatedBlockX()- Returns:
- The rotated relative block X
-
getRotatedBlockZ
public int getRotatedBlockZ()- Returns:
- The rotated relative block Z
-
getRotatedX
public double getRotatedX()- Returns:
- The rotated relative X
-
getRotatedZ
public double getRotatedZ()- Returns:
- The rotated relative Z
-
getInverse
Gets a Rotator which will negate the operations of this Rotator- Returns:
- The inverse Rotator
-
clone
Gets a clone of this Rotator -
getRotation
public int getRotation()Gets the rotation, in number of 90-degree clockwise rotations- Returns:
- The rotation
-
setRotation
public void setRotation(int rotation) Sets the rotation- Parameters:
rotation
- The rotation to set
-
setMirrored
public void setMirrored(boolean mirrored) Sets whether this rotator mirrors over the X axis- Parameters:
mirrored
- Whether this rotator mirrors over the X axis
-
isMirrored
public boolean isMirrored()Gets whether this rotator mirrors over the X axis- Returns:
- Whether this rotator mirrors over the X axis
-