001    package net.minecraft.src;
002    
003    public class ItemBucketMilk extends Item
004    {
005        public ItemBucketMilk(int par1)
006        {
007            super(par1);
008            this.setMaxStackSize(1);
009            this.setTabToDisplayOn(CreativeTabs.tabMisc);
010        }
011    
012        public ItemStack onFoodEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
013        {
014            if (!par3EntityPlayer.capabilities.isCreativeMode)
015            {
016                --par1ItemStack.stackSize;
017            }
018    
019            if (!par2World.isRemote)
020            {
021                par3EntityPlayer.clearActivePotions();
022            }
023    
024            return par1ItemStack.stackSize <= 0 ? new ItemStack(Item.bucketEmpty) : par1ItemStack;
025        }
026    
027        /**
028         * How long it takes to use or consume an item
029         */
030        public int getMaxItemUseDuration(ItemStack par1ItemStack)
031        {
032            return 32;
033        }
034    
035        /**
036         * returns the action that specifies what animation to play when the items is being used
037         */
038        public EnumAction getItemUseAction(ItemStack par1ItemStack)
039        {
040            return EnumAction.drink;
041        }
042    
043        /**
044         * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
045         */
046        public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
047        {
048            par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
049            return par1ItemStack;
050        }
051    }