summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntityEgg.patch
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2015-06-12 16:00:08 +1000
committermd_5 <git@md-5.net>2015-06-21 09:20:07 +1000
commit994b2aae3f9988d87fe89614083108ca194e6236 (patch)
treebf3950f1f1c6965166df156670553e507ce38f7c /nms-patches/EntityEgg.patch
parent0dfb243c86eb2a1e214f5d7b7a43291381412d30 (diff)
downloadcraftbukkit-994b2aae3f9988d87fe89614083108ca194e6236.tar
craftbukkit-994b2aae3f9988d87fe89614083108ca194e6236.tar.gz
craftbukkit-994b2aae3f9988d87fe89614083108ca194e6236.tar.lz
craftbukkit-994b2aae3f9988d87fe89614083108ca194e6236.tar.xz
craftbukkit-994b2aae3f9988d87fe89614083108ca194e6236.zip
SPIGOT-892: Set chicken egg baby age before adding it to world.
Diffstat (limited to 'nms-patches/EntityEgg.patch')
-rw-r--r--nms-patches/EntityEgg.patch9
1 files changed, 5 insertions, 4 deletions
diff --git a/nms-patches/EntityEgg.patch b/nms-patches/EntityEgg.patch
index 424dd94a..9b33c184 100644
--- a/nms-patches/EntityEgg.patch
+++ b/nms-patches/EntityEgg.patch
@@ -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