From 8c6136662ca6119534dc2921fbcfce2377802cef Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Thu, 5 Jan 2012 19:30:00 +0100 Subject: [PATCH] [Bleeding] Implement animal breeding API changes. By: Erik Broes --- .../craftbukkit/entity/CraftAnimals.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java index 5211bbb017..4e229f5733 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java @@ -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";