diff options
author | Nathan Adams <dinnerbone@dinnerbone.com> | 2011-11-24 20:16:43 +0000 |
---|---|---|
committer | Nathan Adams <dinnerbone@dinnerbone.com> | 2011-11-24 20:16:43 +0000 |
commit | a7664a104fa9fb206921e9245303579b1360f5c0 (patch) | |
tree | 2005e4cca6b31510f5ad7aba61ed1fe706a79b7a /src/main | |
parent | 47b4406b7e7c183b69bf47222f7cc36e5c696845 (diff) | |
download | craftbukkit-a7664a104fa9fb206921e9245303579b1360f5c0.tar craftbukkit-a7664a104fa9fb206921e9245303579b1360f5c0.tar.gz craftbukkit-a7664a104fa9fb206921e9245303579b1360f5c0.tar.lz craftbukkit-a7664a104fa9fb206921e9245303579b1360f5c0.tar.xz craftbukkit-a7664a104fa9fb206921e9245303579b1360f5c0.zip |
Implemented new age methods in animals, and made spawned animals via eggs properly age back to children
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityEgg.java | 7 | ||||
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java | 8 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/EntityEgg.java b/src/main/java/net/minecraft/server/EntityEgg.java index 9a573809..8bc86561 100644 --- a/src/main/java/net/minecraft/server/EntityEgg.java +++ b/src/main/java/net/minecraft/server/EntityEgg.java @@ -1,6 +1,7 @@ package net.minecraft.server; import org.bukkit.Location; +import org.bukkit.entity.Animals; import org.bukkit.entity.CreatureType; import org.bukkit.entity.Projectile; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; @@ -74,7 +75,11 @@ public class EntityEgg extends EntityProjectile { if (hatching) { for (int k = 0; k < numHatching; k++) { - world.getWorld().spawn(new Location(world.getWorld(), this.locX, this.locY, this.locZ, this.yaw, 0.0F), hatchingType.getEntityClass(), SpawnReason.EGG); + org.bukkit.entity.Entity entity = world.getWorld().spawn(new Location(world.getWorld(), this.locX, this.locY, this.locZ, this.yaw, 0.0F), hatchingType.getEntityClass(), SpawnReason.EGG); + + if (entity instanceof Animals) { + ((Animals)entity).setAge(-24000); + } } } // CraftBukkit end diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java index 4f9264c4..e4b51ec8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java @@ -19,4 +19,12 @@ public class CraftAnimals extends CraftCreature implements Animals { public EntityAnimal getHandle() { return (EntityAnimal) entity; } + + public int getAge() { + return getHandle().getAge(); + } + + public void setAge(int age) { + getHandle().setAge(age); + } } |