void OnConsumeFuel(BaseOven oven, Item fuel, ItemModBurnable burnable) { if (!init) { return; } bool charcoal = false; int mul = GetMultiplier(oven.OwnerID); foreach (var item in oven.inventory.itemList.ToList()) { if (!charcoal && item.info == charcoalDef) { charcoal = true; item.amount += mul; } if (!cookableItems.ContainsKey(item.info)) { continue; } int amountToCreate; if (item.amount > mul) { item.MarkDirty(); item.amount -= mul; amountToCreate = mul; } else { amountToCreate = item.amount; item.RemoveFromContainer(); item.Remove(); } var cookedDef = cookableItems[item.info].becomeOnCooked; var cookedAmount = amountToCreate * cookableItems[item.info].amountOfBecome; var cookedOvenItem = oven.inventory.itemList.Where(p => p.info == cookedDef).OrderBy(p => p.amount).FirstOrDefault(); if (cookedOvenItem != null) { var amount = Math.Min(cookedOvenItem.MaxStackable() - cookedOvenItem.amount, cookedAmount); cookedOvenItem.amount += amount; if (cookedAmount - amount <= 0) { continue; } } var cookedItem = ItemManager.Create(cookedDef, cookedAmount); if (!cookedItem.MoveToContainer(oven.inventory)) { cookedItem.Drop(oven.GetDropPosition(), oven.GetDropVelocity()); } } }