    001    package net.minecraft.src;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005
    006    public class EntityEnderPearl extends EntityThrowable
    007    {
    008        public EntityEnderPearl(World par1World)
    009        {
    010            super(par1World);
    011        }
    012
    013        public EntityEnderPearl(World par1World, EntityLiving par2EntityLiving)
    014        {
    015            super(par1World, par2EntityLiving);
    016        }
    017
    018        @SideOnly(Side.CLIENT)
    019        public EntityEnderPearl(World par1World, double par2, double par4, double par6)
    020        {
    021            super(par1World, par2, par4, par6);
    022        }
    023
    024        /**
    025         * Called when this EntityThrowable hits a block or entity.
    026         */
    027        protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
    028        {
    029            if (par1MovingObjectPosition.entityHit != null)
    030            {
    031                par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.func_85052_h()), 0);
    032            }
    033
    034            for (int var2 = 0; var2 < 32; ++var2)
    035            {
    036                this.worldObj.spawnParticle("portal", this.posX, this.posY + this.rand.nextDouble() * 2.0D, this.posZ, this.rand.nextGaussian(), 0.0D, this.rand.nextGaussian());
    037            }
    038
    039            if (!this.worldObj.isRemote)
    040            {
    041                if (this.func_85052_h() != null && this.func_85052_h() instanceof EntityPlayerMP)
    042                {
    043                    EntityPlayerMP var3 = (EntityPlayerMP)this.func_85052_h();
    044
    045                    if (!var3.playerNetServerHandler.connectionClosed && var3.worldObj == this.worldObj)
    046                    {
    047                        this.func_85052_h().setPositionAndUpdate(this.posX, this.posY, this.posZ);
    048                        this.func_85052_h().fallDistance = 0.0F;
    049                        this.func_85052_h().attackEntityFrom(DamageSource.fall, 5);
    050                    }
    051                }
    052
    053                this.setDead();
    054            }
    055        }
    056    }