ItemExpBottle .java

net.minecraft.item.ItemExpBottle (class): members: hasEffect, onItemRightClick. strings: "random.bow". imports: EntityExpBottle, StatList, CreativeTabs.

net.minecraft.itemclass42 linescommonextends Item1.2 KB

API Surface (2)

boolean hasEffect(ItemStack stack)
ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)

String literals (1)

"random.bow"

Code Graph: Dependencies (7)

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

Full Source

ItemExpBottle.java42 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.item;
2
3
import net.minecraft.creativetab.CreativeTabs;
4
import net.minecraft.entity.item.EntityExpBottle;
5
import net.minecraft.entity.player.EntityPlayer;
6
import net.minecraft.stats.StatList;
7
import net.minecraft.world.World;
8
9
public class ItemExpBottle extends Item
10
{
11
    public ItemExpBottle()
12
    {
13
        this.setCreativeTab(CreativeTabs.tabMisc);
14
    }
15
16
    public boolean hasEffect(ItemStack stack)
17
    {
18
        return true;
19
    }
20
21
    /**
22
     * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
23
     */
24
    public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
25
    {
26
        if (!playerIn.capabilities.isCreativeMode)
27
        {
28
            --itemStackIn.stackSize;
29
        }
30
31
        worldIn.playSoundAtEntity(playerIn, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
32
33
        if (!worldIn.isRemote)
34
        {
35
            worldIn.spawnEntityInWorld(new EntityExpBottle(worldIn, playerIn));
36
        }
37
38
        playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
39
        return itemStackIn;
40
    }
41
}
42

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