    001package net.minecraft.entity.item;
    002
    003import net.minecraft.entity.EntityLiving;
    004import net.minecraft.entity.projectile.EntityThrowable;
    005import net.minecraft.util.MovingObjectPosition;
    006import net.minecraft.world.World;
    007
    008public class EntityExpBottle extends EntityThrowable
    009{
    010    public EntityExpBottle(World par1World)
    011    {
    012        super(par1World);
    013    }
    014
    015    public EntityExpBottle(World par1World, EntityLiving par2EntityLiving)
    016    {
    017        super(par1World, par2EntityLiving);
    018    }
    019
    020    public EntityExpBottle(World par1World, double par2, double par4, double par6)
    021    {
    022        super(par1World, par2, par4, par6);
    023    }
    024
    025    /**
    026     * Gets the amount of gravity to apply to the thrown entity with each tick.
    027     */
    028    protected float getGravityVelocity()
    029    {
    030        return 0.07F;
    031    }
    032
    033    protected float func_70182_d()
    034    {
    035        return 0.7F;
    036    }
    037
    038    protected float func_70183_g()
    039    {
    040        return -20.0F;
    041    }
    042
    043    /**
    044     * Called when this EntityThrowable hits a block or entity.
    045     */
    046    protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
    047    {
    048        if (!this.worldObj.isRemote)
    049        {
    050            this.worldObj.playAuxSFX(2002, (int)Math.round(this.posX), (int)Math.round(this.posY), (int)Math.round(this.posZ), 0);
    051            int i = 3 + this.worldObj.rand.nextInt(5) + this.worldObj.rand.nextInt(5);
    052
    053            while (i > 0)
    054            {
    055                int j = EntityXPOrb.getXPSplit(i);
    056                i -= j;
    057                this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j));
    058            }
    059
    060            this.setDead();
    061        }
    062    }
    063}