geforkt von Mirrors/Paper
8f0c1aed6b
This makes it so animals (tame or not) will sit properly and not move around. Wild animals that are sitting may override the sitting position if they are attacking.
40 Zeilen
1.0 KiB
Java
40 Zeilen
1.0 KiB
Java
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()) {
|
|
return this.b && this.a.aG() == null; // CraftBukkit - Allow sitting for wild animals
|
|
} else if (this.a.H()) {
|
|
return false;
|
|
} else if (!this.a.onGround) {
|
|
return false;
|
|
} else {
|
|
EntityLiving entityliving = this.a.getOwner();
|
|
|
|
return entityliving == null ? true : (this.a.e(entityliving) < 144.0D && entityliving.aC() != null ? false : this.b);
|
|
}
|
|
}
|
|
|
|
public void c() {
|
|
this.a.getNavigation().g();
|
|
this.a.setSitting(true);
|
|
}
|
|
|
|
public void d() {
|
|
this.a.setSitting(false);
|
|
}
|
|
|
|
public void a(boolean flag) {
|
|
this.b = flag;
|
|
}
|
|
}
|