Rotate.java
package com.hypixel.hytale.builtin.buildertools.tooloperations.transform;
import com.hypixel.hytale.math.Axis;
import com.hypixel.hytale.math.vector.Vector3i;
import com.hypixel.hytale.protocol.Rotation;
import com.hypixel.hytale.protocol.packets.buildertools.BrushAxis;
import javax.annotation.Nonnull;
public class Rotate implements Transform {
public static final Transform X_90;
public static final Transform X_180;
public static final Transform X_270;
public static final Transform Y_90;
public static final Transform Y_180;
public static final Transform Y_270;
public static final Transform Z_90;
public static final Transform Z_180;
public static final Transform Z_270;
public static final Transform FACING_NORTH;
Transform FACING_EAST;
Transform FACING_SOUTH;
Transform FACING_WEST;
Axis axis;
rotations;
{
(axis, );
}
{
angle = Math.floorMod(angle, );
angle / ;
.axis = axis;
.rotations = rotations;
}
{
(.rotations == ) {
.axis.rotate(vector3i);
} (.rotations > ) {
( ; i < .rotations; ++i) {
.axis.rotate(vector3i);
}
}
}
String {
String.valueOf(.axis);
+ var10000 + + .rotations + ;
}
Transform {
(direction.getX() < ) {
selectRotation(angle, FACING_WEST, FACING_NORTH, FACING_EAST, FACING_SOUTH);
} (direction.getX() > ) {
selectRotation(angle, FACING_EAST, FACING_SOUTH, FACING_WEST, FACING_NORTH);
} (direction.getZ() < ) {
selectRotation(angle, FACING_NORTH, FACING_EAST, FACING_SOUTH, FACING_WEST);
} {
direction.getZ() > ? selectRotation(angle, FACING_SOUTH, FACING_WEST, FACING_NORTH, FACING_EAST) : NONE;
}
}
Transform {
(axis == BrushAxis.X) {
selectRotation(angle, NONE, X_90, X_180, X_270);
} (axis == BrushAxis.Y) {
selectRotation(angle, NONE, Y_90, Y_180, Y_270);
} {
axis == BrushAxis.Z ? selectRotation(angle, NONE, Z_90, Z_180, Z_270) : NONE;
}
}
Transform {
(angle == Rotation.Ninety) {
rotate90;
} (angle == Rotation.OneEighty) {
rotate180;
} {
angle == Rotation.TwoSeventy ? rotate270 : rotate0;
}
}
{
X_90 = (Axis.X, );
X_180 = (Axis.X, );
X_270 = (Axis.X, );
Y_90 = (Axis.Y, );
Y_180 = (Axis.Y, );
Y_270 = (Axis.Y, );
Z_90 = (Axis.Z, );
Z_180 = (Axis.Z, );
Z_270 = (Axis.Z, );
FACING_NORTH = X_90;
FACING_EAST = Z_90;
FACING_SOUTH = X_90.then(Y_180);
FACING_WEST = Z_90.then(Y_180);
}
}