mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-09-18 18:01:17 +02:00
Fix manhattan methods using doubles, add signature for LocationS.
This commit is contained in:
parent
9827570e2d
commit
e12c2a2bfc
@ -392,6 +392,16 @@ public class TrigUtil {
|
|||||||
return yawDiff;
|
return yawDiff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manhattan distance.
|
||||||
|
* @param loc1
|
||||||
|
* @param loc2
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static int manhattan(final Location loc1, final Location loc2) {
|
||||||
|
return manhattan(loc1.getBlockX(), loc1.getBlockY(), loc1.getBlockZ(), loc2.getBlockX(), loc2.getBlockY(), loc2.getBlockZ());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manhattan distance.
|
* Manhattan distance.
|
||||||
* @param x1
|
* @param x1
|
||||||
@ -405,7 +415,7 @@ public class TrigUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static double manhattan(final double x1,final double z1, final double x2, final double z2){
|
public static double manhattan(final double x1,final double z1, final double x2, final double z2){
|
||||||
return Math.abs(x1 - x2) + Math.abs(z1 - z2);
|
return manhattan(Location.locToBlock(x1), Location.locToBlock(z1), Location.locToBlock(x2), Location.locToBlock(z2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -423,7 +433,7 @@ public class TrigUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static double manhattan(final double x1, final double y1, final double z1, final double x2, final double y2, final double z2){
|
public static double manhattan(final double x1, final double y1, final double z1, final double x2, final double y2, final double z2){
|
||||||
return Math.abs(x1 - x2) + Math.abs(y1 - y2) + Math.abs(z1 - z2);
|
return manhattan(Location.locToBlock(x1), Location.locToBlock(y1), Location.locToBlock(z1), Location.locToBlock(x2), Location.locToBlock(y2), Location.locToBlock(z2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user