    001    package net.minecraft.item;
    002
    003    import cpw.mods.fml.relauncher.Side;
    004    import cpw.mods.fml.relauncher.SideOnly;
    005    import net.minecraft.creativetab.CreativeTabs;
    006    import net.minecraft.entity.item.EntityExpBottle;
    007    import net.minecraft.entity.player.EntityPlayer;
    008    import net.minecraft.world.World;
    009
    010    public class ItemExpBottle extends Item
    011    {
    012        public ItemExpBottle(int par1)
    013        {
    014            super(par1);
    015            this.setCreativeTab(CreativeTabs.tabMisc);
    016        }
    017
    018        @SideOnly(Side.CLIENT)
    019        public boolean hasEffect(ItemStack par1ItemStack)
    020        {
    021            return true;
    022        }
    023
    024        /**
    025         * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
    026         */
    027        public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
    028        {
    029            if (!par3EntityPlayer.capabilities.isCreativeMode)
    030            {
    031                --par1ItemStack.stackSize;
    032            }
    033
    034            par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
    035
    036            if (!par2World.isRemote)
    037            {
    038                par2World.spawnEntityInWorld(new EntityExpBottle(par2World, par3EntityPlayer));
    039            }
    040
    041            return par1ItemStack;
    042        }
    043    }