diff --git a/src/openonyx/protocol/group_d/RotationAngleMath.java b/src/openonyx/protocol/group_d/RotationAngleMath.java new file mode 100644 index 0000000..8d16202 --- /dev/null +++ b/src/openonyx/protocol/group_d/RotationAngleMath.java @@ -0,0 +1,72 @@ +package openonyx.protocol.group_d; + +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import openonyx.core.MinecraftAccess; +import openonyx.protocol.group_m.Angles; +import openonyx.protocol.group_m.RotationDelta; +import openonyx.utilities.PlayerUtils; + +public final class RotationAngleMath implements MinecraftAccess { + private static final double e = 0.15; + + public static double d() { + return (float)(L() * 0.15); + } + + public static Angles L(Angles angles, double d, double e) { + RotationDelta rotationDelta = L(d, ex); + return new Angles(angles.yaw2() + rotationDelta.deltaYaw(), MathHelper.clamp_float(angles.pitch2() + rotationDelta.deltaPitch(), -90.0F, 90.0F)); + } + + public static float L(float f, float g, float h) { + if (f < g) { + return g; + } else { + return f > h ? h : f; + } + } + + public static void L(EntityPlayerSP entityPlayerSP, Angles angles) { + Angles angles1; + Angles angles2 = angles1 = angles.L(); + entityPlayerSP.prevRotationPitch = entityPlayerSP.rotationPitch; + entityPlayerSP.prevRotationYaw = entityPlayerSP.rotationYaw; + entityPlayerSP.renderYawOffset = entityPlayerSP.rotationYaw; + entityPlayerSP.prevRenderYawOffset = entityPlayerSP.rotationYaw; + entityPlayerSP.rotationYaw = angles1.yaw2(); + entityPlayerSP.rotationPitch = angles2.pitch2(); + } + + public static float L(Entity entity) { + Entity entity1 = entity; + if (mc.thePlayer == null) { + return 0.0F; + } + + Angles angles = Angles.L(entity1.getEntityBoundingBox().getCenter(), mc.thePlayer.getPositionEyes(1.0F)); + return PlayerUtils.L((Entity)mc.thePlayer).L(angles); + } + + public static float L(float f, float g) { + return MathHelper.wrapAngleTo180_float(f - g); + } + + private static double L() { + float f; + float g = f = (float)mc.gameSettings.mouseSensitivity * 0.6F + 0.2F; + return g * g * f * 8.0F; + } + + public static float L(EntityPlayerSP entityPlayerSP, Angles angles) { + return angles.yaw2() + L(entityPlayerSP.rotationYaw, angles.yaw2()); + } + + public static RotationDelta L(double d, double e) { + return new RotationDelta((float)(d * 0.15), (float)(ex * 0.15)); + } + + private RotationAngleMath() { + } +}