Exemple #1
0
        /// <summary>
        /// Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
        /// </summary>
        public override ItemStack OnItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
        {
            if (IsSplash(par1ItemStack.GetItemDamage()))
            {
                par1ItemStack.StackSize--;
                par2World.PlaySoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / ((float)ItemRand.NextDouble() * 0.4F + 0.8F));

                if (!par2World.IsRemote)
                {
                    par2World.SpawnEntityInWorld(new EntityPotion(par2World, par3EntityPlayer, par1ItemStack.GetItemDamage()));
                }

                return(par1ItemStack);
            }
            else
            {
                par3EntityPlayer.SetItemInUse(par1ItemStack, GetMaxItemUseDuration(par1ItemStack));
                return(par1ItemStack);
            }
        }