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