001 package net.minecraft.src; 002 003 public class ItemEnderPearl extends Item 004 { 005 public ItemEnderPearl(int par1) 006 { 007 super(par1); 008 this.maxStackSize = 16; 009 this.setTabToDisplayOn(CreativeTabs.tabMisc); 010 } 011 012 /** 013 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer 014 */ 015 public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) 016 { 017 if (par3EntityPlayer.capabilities.isCreativeMode) 018 { 019 return par1ItemStack; 020 } 021 else if (par3EntityPlayer.ridingEntity != null) 022 { 023 return par1ItemStack; 024 } 025 else 026 { 027 --par1ItemStack.stackSize; 028 par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); 029 030 if (!par2World.isRemote) 031 { 032 par2World.spawnEntityInWorld(new EntityEnderPearl(par2World, par3EntityPlayer)); 033 } 034 035 return par1ItemStack; 036 } 037 } 038 }