summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java
diff options
context:
space:
mode:
authorfeildmaster <admin@feildmaster.com>2012-03-08 18:22:09 -0600
committerEvilSeph <evilseph@gmail.com>2012-03-10 02:07:23 -0500
commita967d6e3710df70bbbc7663ed0f3ed8b65810d4d (patch)
tree7771fb88f24a8c272233cebc0b1a1198ebf59070 /src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java
parent08bd33a3ed979109e912064b0e2dd6959c2fb20f (diff)
downloadcraftbukkit-a967d6e3710df70bbbc7663ed0f3ed8b65810d4d.tar
craftbukkit-a967d6e3710df70bbbc7663ed0f3ed8b65810d4d.tar.gz
craftbukkit-a967d6e3710df70bbbc7663ed0f3ed8b65810d4d.tar.lz
craftbukkit-a967d6e3710df70bbbc7663ed0f3ed8b65810d4d.tar.xz
craftbukkit-a967d6e3710df70bbbc7663ed0f3ed8b65810d4d.zip
Added PathfinderGoalTarget, PathfinderGoalArrowAttack, PathfinderGoalMeleeAttack for diff visibility.
Diffstat (limited to 'src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java')
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java76
1 files changed, 76 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java b/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java
new file mode 100644
index 00000000..bed2ba50
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java
@@ -0,0 +1,76 @@
+package net.minecraft.server;
+
+public class PathfinderGoalMeleeAttack extends PathfinderGoal {
+
+ World a;
+ EntityLiving b;
+ EntityLiving c;
+ int d;
+ float e;
+ boolean f;
+ PathEntity g;
+ Class h;
+ private int i;
+
+ public PathfinderGoalMeleeAttack(EntityLiving entityliving, Class oclass, float f, boolean flag) {
+ this(entityliving, f, flag);
+ this.h = oclass;
+ }
+
+ public PathfinderGoalMeleeAttack(EntityLiving entityliving, float f, boolean flag) {
+ this.d = 0;
+ this.b = entityliving;
+ this.a = entityliving.world;
+ this.e = f;
+ this.f = flag;
+ this.a(3);
+ }
+
+ public boolean a() {
+ EntityLiving entityliving = this.b.as();
+
+ if (entityliving == null) {
+ return false;
+ } else if (this.h != null && !this.h.isAssignableFrom(entityliving.getClass())) {
+ return false;
+ } else {
+ this.c = entityliving;
+ this.g = this.b.ak().a(this.c);
+ return this.g != null;
+ }
+ }
+
+ public boolean b() {
+ EntityLiving entityliving = this.b.as();
+
+ return entityliving == null ? false : (!this.c.isAlive() ? false : (!this.f ? !this.b.ak().e() : this.b.e(MathHelper.floor(this.c.locX), MathHelper.floor(this.c.locY), MathHelper.floor(this.c.locZ))));
+ }
+
+ public void c() {
+ this.b.ak().a(this.g, this.e);
+ this.i = 0;
+ }
+
+ public void d() {
+ this.c = null;
+ this.b.ak().f();
+ }
+
+ public void e() {
+ this.b.getControllerLook().a(this.c, 30.0F, 30.0F);
+ if ((this.f || this.b.al().canSee(this.c)) && --this.i <= 0) {
+ this.i = 4 + this.b.am().nextInt(7);
+ this.b.ak().a(this.c, this.e);
+ }
+
+ this.d = Math.max(this.d - 1, 0);
+ double d0 = (double) (this.b.width * 2.0F * this.b.width * 2.0F);
+
+ if (this.b.e(this.c.locX, this.c.boundingBox.b, this.c.locZ) <= d0) {
+ if (this.d <= 0) {
+ this.d = 20;
+ this.b.a((Entity) this.c);
+ }
+ }
+ }
+}