diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2012-08-15 05:15:36 -0500 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2012-08-19 09:51:00 -0500 |
commit | 7b20caf8fe1866fdfcc6e90e76703ed14c7da4ba (patch) | |
tree | 20e88f6cd330ac982aaffa4523a3bc10a37d0123 /src/main/java/net/minecraft/server/ControllerLook.java | |
parent | 8219081385833a4f020fc5912e27a78da227e777 (diff) | |
download | craftbukkit-7b20caf8fe1866fdfcc6e90e76703ed14c7da4ba.tar craftbukkit-7b20caf8fe1866fdfcc6e90e76703ed14c7da4ba.tar.gz craftbukkit-7b20caf8fe1866fdfcc6e90e76703ed14c7da4ba.tar.lz craftbukkit-7b20caf8fe1866fdfcc6e90e76703ed14c7da4ba.tar.xz craftbukkit-7b20caf8fe1866fdfcc6e90e76703ed14c7da4ba.zip |
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.
Diffstat (limited to 'src/main/java/net/minecraft/server/ControllerLook.java')
-rw-r--r-- | src/main/java/net/minecraft/server/ControllerLook.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/ControllerLook.java b/src/main/java/net/minecraft/server/ControllerLook.java index 32999b96..1f323d7b 100644 --- a/src/main/java/net/minecraft/server/ControllerLook.java +++ b/src/main/java/net/minecraft/server/ControllerLook.java @@ -1,5 +1,7 @@ package net.minecraft.server; +import org.bukkit.craftbukkit.TrigMath; // CraftBukkit + public class ControllerLook { private EntityLiving a; @@ -45,8 +47,10 @@ public class ControllerLook { double d1 = this.f - (this.a.locY + (double) this.a.getHeadHeight()); double d2 = this.g - this.a.locZ; double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2); - float f = (float) (Math.atan2(d2, d0) * 180.0D / 3.1415927410125732D) - 90.0F; - float f1 = (float) (-(Math.atan2(d1, d3) * 180.0D / 3.1415927410125732D)); + // CraftBukkit start - Math -> TrigMath + float f = (float) (TrigMath.atan2(d2, d0) * 180.0D / 3.1415927410125732D) - 90.0F; + float f1 = (float) (-(TrigMath.atan2(d1, d3) * 180.0D / 3.1415927410125732D)); + // CraftBukkit end this.a.pitch = this.a(this.a.pitch, f1, this.c); this.a.as = this.a(this.a.as, f, this.b); |