diff options
author | Mattes D <github@xoft.cz> | 2015-06-05 10:12:10 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-06-05 10:12:10 +0200 |
commit | 52672855298fc489ee73d78b8704927457cb8b6e (patch) | |
tree | 9a092147529f5d5fc08a2234cb3f8850d49d0041 /src/BlockEntities/FurnaceEntity.cpp | |
parent | Debuggers: Added a LineBlockTracer console test command. (diff) | |
parent | Merge remote-tracking branch 'upstream/master' (diff) | |
download | cuberite-52672855298fc489ee73d78b8704927457cb8b6e.tar cuberite-52672855298fc489ee73d78b8704927457cb8b6e.tar.gz cuberite-52672855298fc489ee73d78b8704927457cb8b6e.tar.bz2 cuberite-52672855298fc489ee73d78b8704927457cb8b6e.tar.lz cuberite-52672855298fc489ee73d78b8704927457cb8b6e.tar.xz cuberite-52672855298fc489ee73d78b8704927457cb8b6e.tar.zst cuberite-52672855298fc489ee73d78b8704927457cb8b6e.zip |
Diffstat (limited to 'src/BlockEntities/FurnaceEntity.cpp')
-rw-r--r-- | src/BlockEntities/FurnaceEntity.cpp | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/src/BlockEntities/FurnaceEntity.cpp b/src/BlockEntities/FurnaceEntity.cpp index 2621b560b..d1588160d 100644 --- a/src/BlockEntities/FurnaceEntity.cpp +++ b/src/BlockEntities/FurnaceEntity.cpp @@ -32,7 +32,8 @@ cFurnaceEntity::cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTY m_NeedCookTime(0), m_TimeCooked(0), m_FuelBurnTime(0), - m_TimeBurned(0) + m_TimeBurned(0), + m_IsLoading(false) { m_Contents.AddListener(*this); } @@ -178,20 +179,15 @@ void cFurnaceEntity::BurnNewFuel(void) { cFurnaceRecipe * FR = cRoot::Get()->GetFurnaceRecipe(); int NewTime = FR->GetBurnTime(m_Contents.GetSlot(fsFuel)); - if (NewTime == 0) + if ((NewTime == 0) || !CanCookInputToOutput()) { // The item in the fuel slot is not suitable + // or the input and output isn't available for cooking SetBurnTimes(0, 0); SetIsCooking(false); return; } - // Is the input and output ready for cooking? - if (!CanCookInputToOutput()) - { - return; - } - // Burn one new fuel: SetBurnTimes(NewTime, 0); SetIsCooking(true); @@ -218,6 +214,11 @@ void cFurnaceEntity::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) return; } + if (m_IsLoading) + { + return; + } + ASSERT(a_ItemGrid == &m_Contents); switch (a_SlotNum) { @@ -238,7 +239,10 @@ void cFurnaceEntity::UpdateInput(void) if (!m_Contents.GetSlot(fsInput).IsEqual(m_LastInput)) { // The input is different from what we had before, reset the cooking time - m_TimeCooked = 0; + if (!m_IsLoading) + { + m_TimeCooked = 0; + } } m_LastInput = m_Contents.GetSlot(fsInput); @@ -253,13 +257,17 @@ void cFurnaceEntity::UpdateInput(void) else { m_NeedCookTime = m_CurrentRecipe->CookTime; - SetIsCooking(true); // Start burning new fuel if there's no flame now: if (GetFuelBurnTimeLeft() <= 0) { BurnNewFuel(); } + // Already burning, set cooking to ensure that cooking is occuring + else + { + SetIsCooking(true); + } } } @@ -293,11 +301,19 @@ void cFurnaceEntity::UpdateOutput(void) return; } - // No need to burn new fuel, the Tick() function will take care of that - // Can cook, start cooking if not already underway: m_NeedCookTime = m_CurrentRecipe->CookTime; - SetIsCooking(m_FuelBurnTime > 0); + + // Check if fuel needs to start a burn + if (GetFuelBurnTimeLeft() <= 0) + { + BurnNewFuel(); + } + // Already burning, set cooking to ensure that cooking is occuring + else + { + SetIsCooking(true); + } } |