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