Files
OpenOnyx/src/openonyx/events/RotationManager.java
T

141 lines
3.5 KiB
Java

package openonyx.events;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.entity.Entity;
import openonyx.core.MinecraftAccess;
import openonyx.protocol.RotationHandler;
import openonyx.protocol.group_m.Angles;
import openonyx.utilities.PlayerUtils;
public class RotationManager implements MinecraftAccess {
private static RotationFixMode rotationFixMode = RotationFixMode.OFF;
private static boolean g = false;
private static float M = 0.0F;
private static boolean L = false;
private static float j = 0.0F;
private static boolean m = false;
private static boolean h = false;
private static EntityPlayerSP entityPlayerSP = null;
private static float I = 0.0F;
private static float d = 0.0F;
private static float i = 0.0F;
private static float f = 0.0F;
private static float H = 0.0F;
private static float e = 0.0F;
public static void D() {
if (g) {
g = false;
if (mc.thePlayer != null) {
mc.thePlayer.rotationYaw = i;
mc.thePlayer.rotationPitch = e;
}
}
}
public static boolean i() {
return !L() && h && rotationFixMode != RotationFixMode.OFF && mc.thePlayer != null;
}
public static boolean D() {
return L;
}
public static Rotation L() {
return m ? new Rotation(f, j) : new Rotation(M, H);
}
public static float i() {
return H;
}
public static float D() {
return I;
}
public static float d() {
return d;
}
public static void L(float f, float g) {
f = fx;
j = gx;
m = true;
M = fx;
H = gx;
}
public static float L() {
return M;
}
public static void d() {
h = false;
rotationFixMode = RotationFixMode.OFF;
}
public static void L() {
if (mc.thePlayer != null) {
if (entityPlayerSP != mc.thePlayer) {
entityPlayerSP = mc.thePlayer;
M = mc.thePlayer.rotationYaw;
H = mc.thePlayer.rotationPitch;
f = M;
j = H;
m = true;
L = false;
}
if (L()) {
Angles angles;
if ((angles = RotationHandler.INSTANCE.getAngles3()) == null) {
angles = PlayerUtils.L((Entity)mc.thePlayer);
}
g = false;
L = true;
M = angles.yaw2();
H = angles.pitch2();
MovementRotation.L(M, H);
} else {
if (h) {
if (m) {
mc.thePlayer.lastReportedYaw = f;
mc.thePlayer.lastReportedPitch = j;
}
i = mc.thePlayer.rotationYaw;
e = mc.thePlayer.rotationPitch;
g = true;
mc.thePlayer.rotationYaw = I;
mc.thePlayer.rotationPitch = d;
}
L = h;
M = mc.thePlayer.rotationYaw;
H = mc.thePlayer.rotationPitch;
MovementRotation.L(mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch);
}
}
}
public static boolean d() {
return h;
}
private static boolean L() {
return h ? false : RotationHandler.INSTANCE.getAngles3() != null || RotationHandler.INSTANCE.d() != null;
}
public static RotationFixMode getRotationFixMode() {
return rotationFixMode;
}
public static void setRotation(Rotation rotation, RotationFixMode rotationFixMode) {
I = rotation.yaw();
d = rotation.pitch();
rotationFixMode = rotationFixModex;
h = true;
}
}