2013-01-01 06:40:59 +01:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
public class PathfinderGoalSit extends PathfinderGoal {
|
|
|
|
|
|
|
|
private EntityTameableAnimal a;
|
|
|
|
private boolean b = false;
|
|
|
|
|
|
|
|
public PathfinderGoalSit(EntityTameableAnimal entitytameableanimal) {
|
|
|
|
this.a = entitytameableanimal;
|
|
|
|
this.a(5);
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean a() {
|
|
|
|
if (!this.a.isTamed()) {
|
2013-01-17 10:28:44 +01:00
|
|
|
return this.b && this.a.getGoalTarget() == null; // CraftBukkit - Allow sitting for wild animals
|
2013-03-13 23:33:27 +01:00
|
|
|
} else if (this.a.G()) {
|
2013-01-01 06:40:59 +01:00
|
|
|
return false;
|
|
|
|
} else if (!this.a.onGround) {
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
EntityLiving entityliving = this.a.getOwner();
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
return entityliving == null ? true : (this.a.e(entityliving) < 144.0D && entityliving.aF() != null ? false : this.b);
|
2013-01-01 06:40:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void c() {
|
|
|
|
this.a.getNavigation().g();
|
|
|
|
this.a.setSitting(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void d() {
|
|
|
|
this.a.setSitting(false);
|
|
|
|
}
|
|
|
|
|
2013-01-17 10:28:44 +01:00
|
|
|
public void setSitting(boolean flag) {
|
2013-01-01 06:40:59 +01:00
|
|
|
this.b = flag;
|
|
|
|
}
|
|
|
|
}
|