MCPcopy Create free account
hub / github.com/cuberite/cuberite / UpdateInput

Method UpdateInput

src/BlockEntities/FurnaceEntity.cpp:310–338  ·  view source on GitHub ↗

Updates the current recipe, based on the current input

Source from the content-addressed store, hash-verified

308
309/// Updates the current recipe, based on the current input
310void cFurnaceEntity::UpdateInput(void)
311{
312 if (!m_Contents.GetSlot(fsInput).IsEqual(m_LastInput))
313 {
314 // The input is different from what we had before, reset the cooking time
315 m_TimeCooked = 0;
316 }
317 m_LastInput = m_Contents.GetSlot(fsInput);
318
319 cFurnaceRecipe * FR = cRoot::Get()->GetFurnaceRecipe();
320 m_CurrentRecipe = FR->GetRecipeFrom(m_Contents.GetSlot(fsInput));
321 if (!CanCookInputToOutput())
322 {
323 // This input cannot be cooked
324 m_NeedCookTime = 0;
325 SetIsCooking(false);
326 }
327 else
328 {
329 m_NeedCookTime = m_CurrentRecipe->CookTime;
330 SetIsCooking(true);
331
332 // Start burning new fuel if there's no flame now:
333 if (GetFuelBurnTimeLeft() <= 0)
334 {
335 BurnNewFuel();
336 }
337 }
338}
339
340
341

Callers

nothing calls this directly

Calls 4

IsEqualMethod · 0.80
GetFurnaceRecipeMethod · 0.80
GetRecipeFromMethod · 0.80
GetSlotMethod · 0.45

Tested by

no test coverage detected