[Bleeding] Implement animal breeding API changes.

By: Erik Broes <erikbroes@grum.nl>
This commit is contained in:
CraftBukkit/Spigot 2012-01-05 19:30:00 +01:00
parent a9e780978a
commit 8c6136662c

View file

@ -23,6 +23,42 @@ public class CraftAnimals extends CraftCreature implements Animals {
return (EntityAnimal) entity;
}
public void setAgeLock(boolean lock) {
getHandle().ageLocked = lock;
}
public boolean getAgeLock() {
return getHandle().ageLocked;
}
public void setBaby() {
if (isAdult()) {
setAge(-24000);
}
}
public void setAdult() {
if (!isAdult()) {
setAge(0);
}
}
public boolean isAdult() {
return getAge() >= 0;
}
public boolean canBreed() {
return getAge() == 0;
}
public void setBreed(boolean breed) {
if (breed) {
setAge(0);
} else if (isAdult()) {
setAge(6000);
}
}
@Override
public String toString() {
return "CraftAnimals";