package openonyx.events; import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import openonyx.core.MinecraftAccess; public class RotationMath implements MinecraftAccess { public static float L(float f, float g, float h, float i, float j) { if ((g = d(f, g, h)) >= i && g <= j) { return g; } if (h <= 0.0F) { return MathHelper.clamp_float(g, i, j); } g = g > j ? j : i; double d = (g - f) / h; return (float)(f + (double)((long)d) * h); } public static float d(float f, float g, float h) { if (h <= 0.0F) { return g; } double d = g - f; return (float)(f + (double)Math.round(d / h) * h); } public static Rotation L(Vec3 vec3, Rotation rotation) { Vec3 vec31 = vec3; vec3 = GeometryUtils.L(); double d = vec31.xCoord - vec3.xCoord; double e = vec31.yCoord - vec3.yCoord; double f = vec31.zCoord - vec3.zCoord; if (d * d + e * e + f * f < 1.0E-8) { return rotation; } float g = (float)(MathHelper.atan2(f, d) * 180.0 / Math.PI) - 90.0F; float h = (float)(-(MathHelper.atan2(e, Math.sqrt(d * d + f * f)) * 180.0 / Math.PI)); return new Rotation(rotation.yaw() + MathHelper.wrapAngleTo180_float(g - rotation.yaw()), MathHelper.clamp_float(h, -90.0F, 90.0F)); } public static float L() { double d; double e = d = mc.gameSettings.mouseSensitivity * 0.6F + 0.2F; return (float)(e * e * d * 8.0) * 0.15F; } public static Rotation L(Vec3 vec3) { return L(vec3, new Rotation(mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch)); } public static float L(float f, float g, float h) { return f + MathHelper.wrapAngleTo180_float(g - f) * h; } }