ItemEnderPearl .java

net.minecraft.item.ItemEnderPearl (class, 41 lines): members: onItemRightClick. strings: "random.bow". imports: EntityEnderPearl, StatList, CreativeTabs.

net.minecraft.itemclass41 linescommonextends Item1.2 KB

API Surface (1)

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

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

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