Update CraftBukkit to 1.6.1
This commit is contained in:
committed by
Wesley Wolfe
parent
f887b76a25
commit
6c09066e22
@@ -5,26 +5,24 @@ import org.bukkit.event.entity.EntityTargetEvent; // CraftBukkit
|
||||
public class PathfinderGoalMeleeAttack extends PathfinderGoal {
|
||||
|
||||
World a;
|
||||
EntityLiving b;
|
||||
EntityLiving c;
|
||||
int d;
|
||||
float e;
|
||||
boolean f;
|
||||
PathEntity g;
|
||||
Class h;
|
||||
private int i;
|
||||
EntityCreature b;
|
||||
int c;
|
||||
double d;
|
||||
boolean e;
|
||||
PathEntity f;
|
||||
Class g;
|
||||
private int h;
|
||||
|
||||
public PathfinderGoalMeleeAttack(EntityLiving entityliving, Class oclass, float f, boolean flag) {
|
||||
this(entityliving, f, flag);
|
||||
this.h = oclass;
|
||||
public PathfinderGoalMeleeAttack(EntityCreature entitycreature, Class oclass, double d0, boolean flag) {
|
||||
this(entitycreature, d0, flag);
|
||||
this.g = 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;
|
||||
public PathfinderGoalMeleeAttack(EntityCreature entitycreature, double d0, boolean flag) {
|
||||
this.b = entitycreature;
|
||||
this.a = entitycreature.world;
|
||||
this.d = d0;
|
||||
this.e = flag;
|
||||
this.a(3);
|
||||
}
|
||||
|
||||
@@ -33,54 +31,58 @@ public class PathfinderGoalMeleeAttack extends PathfinderGoal {
|
||||
|
||||
if (entityliving == null) {
|
||||
return false;
|
||||
} else if (this.h != null && !this.h.isAssignableFrom(entityliving.getClass())) {
|
||||
} else if (!entityliving.isAlive()) {
|
||||
return false;
|
||||
} else if (this.g != null && !this.g.isAssignableFrom(entityliving.getClass())) {
|
||||
return false;
|
||||
} else {
|
||||
this.c = entityliving;
|
||||
this.g = this.b.getNavigation().a(this.c);
|
||||
return this.g != null;
|
||||
this.f = this.b.getNavigation().a(entityliving);
|
||||
return this.f != null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
EntityLiving entityliving = this.b.getGoalTarget();
|
||||
|
||||
return entityliving == null ? false : (!this.c.isAlive() ? false : (!this.f ? !this.b.getNavigation().f() : this.b.d(MathHelper.floor(this.c.locX), MathHelper.floor(this.c.locY), MathHelper.floor(this.c.locZ))));
|
||||
// CraftBukkit start
|
||||
EntityTargetEvent.TargetReason reason = this.b.getGoalTarget() == null ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
|
||||
if (this.b.getGoalTarget() == null || (this.b.getGoalTarget() != null && !this.b.getGoalTarget().isAlive())) {
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent(b, null, reason);
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
return entityliving == null ? false : (!entityliving.isAlive() ? false : (!this.e ? !this.b.getNavigation().g() : this.b.b(MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))));
|
||||
}
|
||||
|
||||
public void c() {
|
||||
this.b.getNavigation().a(this.g, this.e);
|
||||
this.i = 0;
|
||||
this.b.getNavigation().a(this.f, this.d);
|
||||
this.h = 0;
|
||||
}
|
||||
|
||||
public void d() {
|
||||
// CraftBukkit start
|
||||
EntityTargetEvent.TargetReason reason = this.c.isAlive() ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent(b, null, reason);
|
||||
// CraftBukkit end
|
||||
|
||||
this.c = null;
|
||||
this.b.getNavigation().g();
|
||||
this.b.getNavigation().h();
|
||||
}
|
||||
|
||||
public void e() {
|
||||
this.b.getControllerLook().a(this.c, 30.0F, 30.0F);
|
||||
if ((this.f || this.b.getEntitySenses().canSee(this.c)) && --this.i <= 0) {
|
||||
this.i = 4 + this.b.aE().nextInt(7);
|
||||
this.b.getNavigation().a(this.c, this.e);
|
||||
EntityLiving entityliving = this.b.getGoalTarget();
|
||||
|
||||
this.b.getControllerLook().a(entityliving, 30.0F, 30.0F);
|
||||
if ((this.e || this.b.getEntitySenses().canSee(entityliving)) && --this.h <= 0) {
|
||||
this.h = 4 + this.b.aB().nextInt(7);
|
||||
this.b.getNavigation().a((Entity) entityliving, this.d);
|
||||
}
|
||||
|
||||
this.d = Math.max(this.d - 1, 0);
|
||||
double d0 = (double) (this.b.width * 2.0F * this.b.width * 2.0F);
|
||||
this.c = Math.max(this.c - 1, 0);
|
||||
double d0 = (double) (this.b.width * 2.0F * this.b.width * 2.0F + entityliving.width);
|
||||
|
||||
if (this.b.e(this.c.locX, this.c.boundingBox.b, this.c.locZ) <= d0) {
|
||||
if (this.d <= 0) {
|
||||
this.d = 20;
|
||||
if (this.b.bG() != null) {
|
||||
this.b.bK();
|
||||
if (this.b.e(entityliving.locX, entityliving.boundingBox.b, entityliving.locZ) <= d0) {
|
||||
if (this.c <= 0) {
|
||||
this.c = 20;
|
||||
if (this.b.aV() != null) {
|
||||
this.b.aR();
|
||||
}
|
||||
|
||||
this.b.m(this.c);
|
||||
this.b.m(entityliving);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user