mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 22:14:49 +00:00
Fix #167, vastly improved aimbot check (experimental)
This commit is contained in:
1 parent
e2d0fbda18
commit
78ae04a2a8
12 files changed
+110
-70
No files matched your search
@@ -840,7 +840,40 @@ public final class Utilities {
|
||||
}
|
||||
return block.getType() == XMaterial.HONEY_BLOCK.parseMaterial();
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the difference between two angles
|
||||
* @param a Angle A
|
||||
* @param b Angle B
|
||||
* @return the difference between two angles
|
||||
*/
|
||||
public static float computeAngleDifference(final float a, final float b) {
|
||||
float diff = Math.abs(a - b);
|
||||
final float altDiff = b + 360 - a;
|
||||
final float altAltDiff = a + 360 - b;
|
||||
if (altDiff < diff) diff = altDiff;
|
||||
if (altAltDiff < diff) diff = altAltDiff;
|
||||
return diff;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the greatest common divider
|
||||
* @param a value a
|
||||
* @param b value b
|
||||
* @return the greatest common divider of a and b
|
||||
*/
|
||||
public static double computeGcd(final double a, final double b) {
|
||||
if (a < b) {
|
||||
return computeGcd(b, a);
|
||||
}
|
||||
|
||||
if (Math.abs(b) < 0.001) {
|
||||
return a;
|
||||
} else {
|
||||
return computeGcd(b, a - Math.floor(a / b) * b);
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
MinecraftVersion currentVersion = MinecraftVersion.getCurrentVersion();
|
||||
|
||||
|
||||
Reference in new issue
Block a user