void Update() { if (IsBaking()) { } else if (currentBake != null) { FinishBaking(); } else { if (ingredientSlot.amount > 0 && fuelSlot.amount > 0) { if (!lastIngredientSlot.Equals(ingredientSlot) || !lastFuelSlot.Equals(fuelSlot)) { FurnaceRecipe recipe = FurnaceRecipe.Find(ingredientSlot, fuelSlot); if (recipe != null) { StartBaking(recipe); } } } lastIngredientSlot = ingredientSlot; lastFuelSlot = fuelSlot; } }
public override void Update() { if (currentRecipe == null && checkTimer <= 0) { FurnaceRecipe recipe = GetRecipe(); if (recipe != null && (outputItem.IsAir || outputItem.type == recipe.GetResult().type)) { currentRecipe = recipe; } checkTimer = 20; } if (currentRecipe != null) { updateItem(); progression++; } if (boundCapacitor != null) { energy.addEnergy(boundCapacitor.energy.ConsumeEnergy(boundCapacitor.maxTransferRate)); } checkTimer--; }
public override void Update() { if (fuel == null) { fuel = new FuelCore(maxFuel); } if (currentRecipe == null && checkTimer <= 0) { FurnaceRecipe recipe = inputItem.IsAir ? null : FurnaceRecipeManager.Instance.IsValid(inputItem) ? FurnaceRecipeManager.Instance.Recipe : null; if (recipe != null && (outputItem.IsAir || outputItem.type == recipe.GetResult().type)) { currentRecipe = recipe; } checkTimer = 2; } if (currentRecipe != null) { UpdateItem(); progression++; } checkTimer--; }
public void addIngotRecipe(int itemID, int itemResult, int timer = 20) { FurnaceRecipe r1 = FurnaceRecipeManager.CreateRecipe(this); r1.addIngredient(itemID, 1); r1.setResult(itemResult, 1); r1.setCookTime(timer); r1.addRecipe(); }
public override void AddRecipes() { FurnaceRecipe furnace = new FurnaceRecipe(mod); furnace.AddIngredient(ModContent.ItemType <WastelandOre_Item>(), 3); furnace.SetCostAndCookTime(500); furnace.SetResult(ModContent.ItemType <WastestoneIngot_Item>()); furnace.AddRecipe(); }
protected override Task OnAttached() { _currentRecipe = null; _isCooking = false; _fuelLeft = 0; _maxFuelTime = 0; _cookProgress = 0; _maxFuelTime = 200; Register(); return(base.OnAttached()); }
private void updateItem() { if (progression >= currentRecipe.getCookTime() && energy.consumeEnergy(50) == 50) { inventory[0].stack -= currentRecipe.getIngredientStack(); inventory[1] = currentRecipe.getResult(); currentRecipe = null; progression = 0; } }
public bool StartBaking(FurnaceRecipe recipe) { if (resultSlot.amount == 0 || (resultSlot.item.data == recipe.result && resultSlot.amount < resultSlot.item.maxStack)) { currentBake = recipe; bakeTimeStart = NetworkTime.time; bakeTimeEnd = NetworkTime.time + recipe.bakingTime; return(true); } return(false); }
public override void AddRecipes() { FurnaceRecipe furnace = new FurnaceRecipe(mod); furnace.AddIngredient(ItemID.LeadOre, 25); furnace.SetCostAndCookTime(500); furnace.SetResult(ModContent.ItemType <LeadenSoles>()); furnace.AddRecipe(); furnace = new FurnaceRecipe(mod); furnace.AddIngredient(ItemID.IronOre, 26); furnace.SetCostAndCookTime(500); furnace.SetResult(ModContent.ItemType <LeadenSoles>()); furnace.AddRecipe(); }
public void FinishBaking() { if (currentBake != null) { ingredientSlot.DecreaseAmount(1); fuelSlot.DecreaseAmount(1); if (resultSlot.amount > 0 && resultSlot.item.data == currentBake.result) { resultSlot.IncreaseAmount(1); } else { resultSlot = new ItemSlot(new Item(currentBake.result), 1); } currentBake = null; } }
private void updateItem() { if (progression >= currentRecipe.GetCookTime() && energy.ConsumeEnergy(50) == 50) { inputItem.stack -= currentRecipe.GetIngredientStack(); Item result = currentRecipe.GetResult().Clone(); if (outputItem.IsAir) { outputItem = result; } else { outputItem.stack++; } currentRecipe = null; progression = 0; } }
public override void Update() { if (currentRecipe == null && checkTimer <= 0 && inventory[1] == null) { currentRecipe = getRecipe(); checkTimer = 20; } if (currentRecipe != null) { updateItem(); progression++; } if (boundCapacitor != null) { Main.NewText("true"); energy.addEnergy(boundCapacitor.energy.consumeEnergy(boundCapacitor.maxTransferRate)); } checkTimer--; }
/*****************************************************************/ /* TIME FOR FUN :D */ /*****************************************************************/ private void UpdateItem() { if (progression >= cookTimer && fuel.getCurrentEnergyLevel() > 0) { inputItem.stack -= currentRecipe.GetIngredientStack(); Item result = currentRecipe.GetResult().Clone(); if (outputItem.IsAir) { _outputItem.Value = result; } else { outputItem.stack++; } fuel.ConsumeEnergy(1); currentRecipe = null; progression = 0; } }
public void CancelBaking() { currentBake = null; bakeTimeEnd = NetworkTime.time; }