001    package net.minecraft.src;
002    
003    public class ItemEgg extends Item
004    {
005        public ItemEgg(int par1)
006        {
007            super(par1);
008            this.maxStackSize = 16;
009            this.setCreativeTab(CreativeTabs.tabMaterials);
010        }
011    
012        /**
013         * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
014         */
015        public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
016        {
017            if (!par3EntityPlayer.capabilities.isCreativeMode)
018            {
019                --par1ItemStack.stackSize;
020            }
021    
022            par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
023    
024            if (!par2World.isRemote)
025            {
026                par2World.spawnEntityInWorld(new EntityEgg(par2World, par3EntityPlayer));
027            }
028    
029            return par1ItemStack;
030        }
031    }