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