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 ItemExpBottle extends Item
007    {
008        public ItemExpBottle(int par1)
009        {
010            super(par1);
011            this.setCreativeTab(CreativeTabs.tabMisc);
012        }
013    
014        @SideOnly(Side.CLIENT)
015        public boolean hasEffect(ItemStack par1ItemStack)
016        {
017            return true;
018        }
019    
020        /**
021         * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
022         */
023        public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
024        {
025            if (!par3EntityPlayer.capabilities.isCreativeMode)
026            {
027                --par1ItemStack.stackSize;
028            }
029    
030            par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
031    
032            if (!par2World.isRemote)
033            {
034                par2World.spawnEntityInWorld(new EntityExpBottle(par2World, par3EntityPlayer));
035            }
036    
037            return par1ItemStack;
038        }
039    }