diff options
author | RoseGoldIsntGay <yoavkau@gmail.com> | 2022-02-05 19:00:17 +0200 |
---|---|---|
committer | RoseGoldIsntGay <yoavkau@gmail.com> | 2022-02-05 19:00:17 +0200 |
commit | 5e484b169e736408ada925d9cdcea9ac6df7374a (patch) | |
tree | d43c997cf821910a53a918f39ea6b51096a0b485 /src/main/java/rosegoldaddons/utils/ShadyRotation.java | |
parent | 20894963147ef84a7ad7d578191de69a856f6403 (diff) | |
download | RGA-5e484b169e736408ada925d9cdcea9ac6df7374a.tar.gz RGA-5e484b169e736408ada925d9cdcea9ac6df7374a.tar.bz2 RGA-5e484b169e736408ada925d9cdcea9ac6df7374a.zip |
2.7.3
lag fixed (real) and other stuff
Diffstat (limited to 'src/main/java/rosegoldaddons/utils/ShadyRotation.java')
-rw-r--r-- | src/main/java/rosegoldaddons/utils/ShadyRotation.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/rosegoldaddons/utils/ShadyRotation.java b/src/main/java/rosegoldaddons/utils/ShadyRotation.java index fdacc59..111ea6e 100644 --- a/src/main/java/rosegoldaddons/utils/ShadyRotation.java +++ b/src/main/java/rosegoldaddons/utils/ShadyRotation.java @@ -30,6 +30,10 @@ public class ShadyRotation { return angle - Math.floor(angle / 360 + 0.5) * 360; } + private static float wrapAngleTo180(float angle) { + return (float) (angle - Math.floor(angle / 360 + 0.5) * 360); + } + public static Rotation getRotationToBlock(BlockPos block) { double diffX = block.getX() - Main.mc.thePlayer.posX + 0.5; double diffY = block.getY() - Main.mc.thePlayer.posY + 0.5 - Main.mc.thePlayer.getEyeHeight(); @@ -81,8 +85,8 @@ public class ShadyRotation { ShadyRotation.callback = callback; - pitchDifference = rotation.pitch - Main.mc.thePlayer.rotationPitch; - yawDifference = rotation.yaw - Main.mc.thePlayer.rotationYaw; + pitchDifference = wrapAngleTo180(rotation.pitch - Main.mc.thePlayer.rotationPitch); + yawDifference = wrapAngleTo180(rotation.yaw - Main.mc.thePlayer.rotationYaw); ShadyRotation.ticks = ticks * 20; ShadyRotation.tickCounter = 0; |