mirror of
https://github.com/PaperMC/Paper.git
synced 2026-11-25 10:29:41 -05:00
Use TrigMath in hotspots
Use our implementation of atan2 in AI routines as profiling shows these are hotspots and (for these cases) our implementation is much faster.
This commit is contained in:
1 parent
8219081385
commit
7b20caf8fe
3 files changed
+14
-5
No files matched your search
@@ -43,7 +43,8 @@ public class ControllerMove {
|
||||
double d3 = d0 * d0 + d2 * d2 + d1 * d1;
|
||||
|
||||
if (d3 >= 2.500000277905201E-7D) {
|
||||
float f = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
|
||||
// CraftBukkit - Math -> TrigMath
|
||||
float f = (float) (org.bukkit.craftbukkit.TrigMath.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
|
||||
|
||||
this.a.yaw = this.a(this.a.yaw, f, 30.0F);
|
||||
this.a.e(this.e);
|
||||
|
||||
Reference in new issue
Block a user