ItemBucketMilk .java

net.minecraft.item.ItemBucketMilk (class): members: getMaxItemUseDuration, getItemUseAction, onItemUseFinish, onItemRightClick. imports: StatList, Items.

net.minecraft.itemclass62 linescommonextends Item1.7 KB

API Surface (4)

ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityPlayer playerIn)
int getMaxItemUseDuration(ItemStack stack)
EnumAction getItemUseAction(ItemStack stack)
ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)

Code Graph: Dependencies (8)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

ItemBucketMilk.java62 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.item;
2
3
import net.minecraft.creativetab.CreativeTabs;
4
import net.minecraft.entity.player.EntityPlayer;
5
import net.minecraft.init.Items;
6
import net.minecraft.stats.StatList;
7
import net.minecraft.world.World;
8
9
public class ItemBucketMilk extends Item
10
{
11
    public ItemBucketMilk()
12
    {
13
        this.setMaxStackSize(1);
14
        this.setCreativeTab(CreativeTabs.tabMisc);
15
    }
16
17
    /**
18
     * Called when the player finishes using this Item (E.g. finishes eating.). Not called when the player stops using
19
     * the Item before the action is complete.
20
     */
21
    public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityPlayer playerIn)
22
    {
23
        if (!playerIn.capabilities.isCreativeMode)
24
        {
25
            --stack.stackSize;
26
        }
27
28
        if (!worldIn.isRemote)
29
        {
30
            playerIn.clearActivePotions();
31
        }
32
33
        playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
34
        return stack.stackSize <= 0 ? new ItemStack(Items.bucket) : stack;
35
    }
36
37
    /**
38
     * How long it takes to use or consume an item
39
     */
40
    public int getMaxItemUseDuration(ItemStack stack)
41
    {
42
        return 32;
43
    }
44
45
    /**
46
     * returns the action that specifies what animation to play when the items is being used
47
     */
48
    public EnumAction getItemUseAction(ItemStack stack)
49
    {
50
        return EnumAction.DRINK;
51
    }
52
53
    /**
54
     * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
55
     */
56
    public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
57
    {
58
        playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn));
59
        return itemStackIn;
60
    }
61
}
62

Deobfuscated MCP 1.8.9 source of ItemBucketMilk from Marcelektro/MavenMCP-1.8.9 (net/minecraft/item/ItemBucketMilk.java), stored verbatim.