SPIGOT-892: Set chicken egg baby age before adding it to world.

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2015-06-12 16:00:08 +10:00
parent 181cd3fd33
commit a06700d1aa
2 changed files with 26 additions and 11 deletions

View File

@@ -13,7 +13,7 @@
public class EntityEgg extends EntityProjectile {
public EntityEgg(World world) {
@@ -19,21 +26,36 @@
@@ -19,21 +26,37 @@
movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.getShooter()), 0.0F);
}
@@ -53,10 +53,11 @@
- }
+ if (hatching) {
+ for (int k = 0; k < numHatching; k++) {
+ org.bukkit.entity.Entity entity = world.getWorld().spawn(new org.bukkit.Location(world.getWorld(), this.locX, this.locY, this.locZ, this.yaw, 0.0F), hatchingType.getEntityClass(), org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG);
+ if (entity instanceof Ageable) {
+ ((Ageable) entity).setBaby();
+ Entity entity = world.getWorld().createEntity(new org.bukkit.Location(world.getWorld(), this.locX, this.locY, this.locZ, this.yaw, 0.0F), hatchingType.getEntityClass());
+ if (entity.getBukkitEntity() instanceof Ageable) {
+ ((Ageable) entity.getBukkitEntity()).setBaby();
+ }
+ world.getWorld().addEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG);
+ }
}
+ // CraftBukkit end