mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 19:34:09 +01:00
[Bleeding] Implement animal breeding API changes.
By: Erik Broes <erikbroes@grum.nl>
This commit is contained in:
parent
a9e780978a
commit
8c6136662c
1 changed files with 36 additions and 0 deletions
|
@ -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";
|
||||
|
|
Loading…
Reference in a new issue