diff options
author | Mike Primm <mike@primmhome.com> | 2012-08-10 00:21:24 -0500 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2012-08-19 09:19:28 -0500 |
commit | 852602e430f94a1ce627afd8de1599f2e804d788 (patch) | |
tree | 9f8884bd136be29175612c3bf3e4be8903c7ed6c /src/main/java/net/minecraft/server/ControllerMove.java | |
parent | b44fc8ed28a75db889a96ea26bafd299a10b4e8f (diff) | |
download | craftbukkit-852602e430f94a1ce627afd8de1599f2e804d788.tar craftbukkit-852602e430f94a1ce627afd8de1599f2e804d788.tar.gz craftbukkit-852602e430f94a1ce627afd8de1599f2e804d788.tar.lz craftbukkit-852602e430f94a1ce627afd8de1599f2e804d788.tar.xz craftbukkit-852602e430f94a1ce627afd8de1599f2e804d788.zip |
Add files from mc-dev for diff visibility
Diffstat (limited to 'src/main/java/net/minecraft/server/ControllerMove.java')
-rw-r--r-- | src/main/java/net/minecraft/server/ControllerMove.java | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/ControllerMove.java b/src/main/java/net/minecraft/server/ControllerMove.java new file mode 100644 index 00000000..7a8ebe75 --- /dev/null +++ b/src/main/java/net/minecraft/server/ControllerMove.java @@ -0,0 +1,70 @@ +package net.minecraft.server; + +public class ControllerMove { + + private EntityLiving a; + private double b; + private double c; + private double d; + private float e; + private boolean f = false; + + public ControllerMove(EntityLiving entityliving) { + this.a = entityliving; + this.b = entityliving.locX; + this.c = entityliving.locY; + this.d = entityliving.locZ; + } + + public boolean a() { + return this.f; + } + + public float b() { + return this.e; + } + + public void a(double d0, double d1, double d2, float f) { + this.b = d0; + this.c = d1; + this.d = d2; + this.e = f; + this.f = true; + } + + public void c() { + this.a.f(0.0F); + if (this.f) { + this.f = false; + int i = MathHelper.floor(this.a.boundingBox.b + 0.5D); + double d0 = this.b - this.a.locX; + double d1 = this.d - this.a.locZ; + double d2 = this.c - (double) i; + 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; + + this.a.yaw = this.a(this.a.yaw, f, 30.0F); + this.a.e(this.e); + if (d2 > 0.0D && d0 * d0 + d1 * d1 < 1.0D) { + this.a.getControllerJump().a(); + } + } + } + } + + private float a(float f, float f1, float f2) { + float f3 = MathHelper.g(f1 - f); + + if (f3 > f2) { + f3 = f2; + } + + if (f3 < -f2) { + f3 = -f2; + } + + return f + f3; + } +} |