package net.minecraft.item; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.item.EntityEnderPearl; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; public class ItemEnderPearl extends Item { private static final String __OBFID = "CL_00000027"; public ItemEnderPearl() { this.maxStackSize = 16; this.setCreativeTab(CreativeTabs.tabMisc); } /** * 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) { if (player.capabilities.isCreativeMode) { return itemStackIn; } else { --itemStackIn.stackSize; worldIn.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); if (!worldIn.isRemote) { worldIn.spawnEntityInWorld(new EntityEnderPearl(worldIn, player)); } return itemStackIn; } } }