2012-03-10 21:54:23 +01:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
public class PathfinderGoalBreakDoor extends PathfinderGoalDoorInteract {
|
|
|
|
|
|
|
|
private int i;
|
2012-07-29 09:33:13 +02:00
|
|
|
private int j = -1;
|
2012-03-10 21:54:23 +01:00
|
|
|
|
|
|
|
public PathfinderGoalBreakDoor(EntityLiving entityliving) {
|
|
|
|
super(entityliving);
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean a() {
|
2012-07-29 09:33:13 +02:00
|
|
|
return !super.a() ? false : !this.e.a_(this.a.world, this.b, this.c, this.d);
|
2012-03-10 21:54:23 +01:00
|
|
|
}
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
public void e() {
|
|
|
|
super.e();
|
|
|
|
this.i = 0;
|
2012-03-10 21:54:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean b() {
|
|
|
|
double d0 = this.a.e((double) this.b, (double) this.c, (double) this.d);
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
return this.i <= 240 && !this.e.a_(this.a.world, this.b, this.c, this.d) && d0 < 4.0D;
|
2012-03-10 21:54:23 +01:00
|
|
|
}
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
public void c() {
|
|
|
|
super.c();
|
|
|
|
this.a.world.f(this.a.id, this.b, this.c, this.d, -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void d() {
|
|
|
|
super.d();
|
|
|
|
if (this.a.au().nextInt(20) == 0) {
|
2012-03-10 21:54:23 +01:00
|
|
|
this.a.world.triggerEffect(1010, this.b, this.c, this.d, 0);
|
|
|
|
}
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
++this.i;
|
|
|
|
int i = (int) ((float) this.i / 240.0F * 10.0F);
|
|
|
|
|
|
|
|
if (i != this.j) {
|
|
|
|
this.a.world.f(this.a.id, this.b, this.c, this.d, i);
|
|
|
|
this.j = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.i == 240 && this.a.world.difficulty == 3) {
|
2012-03-11 01:43:35 +01:00
|
|
|
// CraftBukkit start
|
|
|
|
if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreakDoorEvent(this.a, this.b, this.c, this.d).isCancelled()) {
|
2012-07-29 09:33:13 +02:00
|
|
|
this.e();
|
2012-03-11 01:43:35 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
2012-07-29 09:33:13 +02:00
|
|
|
|
2012-03-10 21:54:23 +01:00
|
|
|
this.a.world.setTypeId(this.b, this.c, this.d, 0);
|
|
|
|
this.a.world.triggerEffect(1012, this.b, this.c, this.d, 0);
|
|
|
|
this.a.world.triggerEffect(2001, this.b, this.c, this.d, this.e.id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|