You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.5 KiB
Java
57 lines
1.5 KiB
Java
package net.minecraft.item;
|
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.init.Items;
|
|
import net.minecraft.world.World;
|
|
|
|
public class ItemBucketMilk extends Item
|
|
{
|
|
private static final String __OBFID = "CL_00000048";
|
|
|
|
public ItemBucketMilk()
|
|
{
|
|
this.setMaxStackSize(1);
|
|
this.setCreativeTab(CreativeTabs.tabMisc);
|
|
}
|
|
|
|
public ItemStack onEaten(ItemStack p_77654_1_, World p_77654_2_, EntityPlayer p_77654_3_)
|
|
{
|
|
if (!p_77654_3_.capabilities.isCreativeMode)
|
|
{
|
|
--p_77654_1_.stackSize;
|
|
}
|
|
|
|
if (!p_77654_2_.isRemote)
|
|
{
|
|
p_77654_3_.curePotionEffects(p_77654_1_);
|
|
}
|
|
|
|
return p_77654_1_.stackSize <= 0 ? new ItemStack(Items.bucket) : p_77654_1_;
|
|
}
|
|
|
|
/**
|
|
* How long it takes to use or consume an item
|
|
*/
|
|
public int getMaxItemUseDuration(ItemStack p_77626_1_)
|
|
{
|
|
return 32;
|
|
}
|
|
|
|
/**
|
|
* returns the action that specifies what animation to play when the items is being used
|
|
*/
|
|
public EnumAction getItemUseAction(ItemStack stack)
|
|
{
|
|
return EnumAction.drink;
|
|
}
|
|
|
|
/**
|
|
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
|
|
*/
|
|
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer player)
|
|
{
|
|
player.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn));
|
|
return itemStackIn;
|
|
}
|
|
} |