ItemSnowball .java

net.minecraft.item.ItemSnowball (class): members: onItemRightClick. strings: "random.bow". imports: EntitySnowball, StatList, CreativeTabs, EntityPlayer.

net.minecraft.itemclass38 linescommonextends Item1.1 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

ItemSnowball.java38 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.entity.projectile.EntitySnowball;
6
import net.minecraft.stats.StatList;
7
import net.minecraft.world.World;
8
9
public class ItemSnowball extends Item
10
{
11
    public ItemSnowball()
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
            --itemStackIn.stackSize;
25
        }
26
27
        worldIn.playSoundAtEntity(playerIn, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
28
29
        if (!worldIn.isRemote)
30
        {
31
            worldIn.spawnEntityInWorld(new EntitySnowball(worldIn, playerIn));
32
        }
33
34
        playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
35
        return itemStackIn;
36
    }
37
}
38

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