    001    package net.minecraft.entity.projectile;
    002
    003    import net.minecraft.entity.EntityLiving;
    004    import net.minecraft.entity.passive.EntityChicken;
    005    import net.minecraft.util.DamageSource;
    006    import net.minecraft.util.MovingObjectPosition;
    007    import net.minecraft.world.World;
    008
    009    public class EntityEgg extends EntityThrowable
    010    {
    011        public EntityEgg(World par1World)
    012        {
    013            super(par1World);
    014        }
    015
    016        public EntityEgg(World par1World, EntityLiving par2EntityLiving)
    017        {
    018            super(par1World, par2EntityLiving);
    019        }
    020
    021        public EntityEgg(World par1World, double par2, double par4, double par6)
    022        {
    023            super(par1World, par2, par4, par6);
    024        }
    025
    026        /**
    027         * Called when this EntityThrowable hits a block or entity.
    028         */
    029        protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
    030        {
    031            if (par1MovingObjectPosition.entityHit != null)
    032            {
    033                par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.func_85052_h()), 0);
    034            }
    035
    036            if (!this.worldObj.isRemote && this.rand.nextInt(8) == 0)
    037            {
    038                byte var2 = 1;
    039
    040                if (this.rand.nextInt(32) == 0)
    041                {
    042                    var2 = 4;
    043                }
    044
    045                for (int var3 = 0; var3 < var2; ++var3)
    046                {
    047                    EntityChicken var4 = new EntityChicken(this.worldObj);
    048                    var4.setGrowingAge(-24000);
    049                    var4.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
    050                    this.worldObj.spawnEntityInWorld(var4);
    051                }
    052            }
    053
    054            for (int var5 = 0; var5 < 8; ++var5)
    055            {
    056                this.worldObj.spawnParticle("snowballpoof", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
    057            }
    058
    059            if (!this.worldObj.isRemote)
    060            {
    061                this.setDead();
    062            }
    063        }
    064    }