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