예제 #1
0
        public override ItemStack OnFoodEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
        {
            par1ItemStack.StackSize--;

            if (!par2World.IsRemote)
            {
                List <PotionEffect> list = GetEffects(par1ItemStack);

                if (list != null)
                {
                    PotionEffect potioneffect;

                    for (IEnumerator <PotionEffect> iterator = list.GetEnumerator(); iterator.MoveNext(); par3EntityPlayer.AddPotionEffect(new PotionEffect(potioneffect)))
                    {
                        potioneffect = iterator.Current;
                    }
                }
            }

            if (par1ItemStack.StackSize <= 0)
            {
                return(new ItemStack(Item.GlassBottle));
            }
            else
            {
                par3EntityPlayer.Inventory.AddItemStackToInventory(new ItemStack(Item.GlassBottle));
                return(par1ItemStack);
            }
        }