summaryrefslogtreecommitdiffstats
path: root/source/cFurnaceEntity.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-19 23:14:45 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-19 23:14:45 +0200
commit674fe1e955f729e8328772313c45fe76857ec835 (patch)
tree49511bc948f76825ee1ad6be310034f261b35e90 /source/cFurnaceEntity.cpp
parentAlmost all packets' handling is now rewritten not to use cPacket descendants elsewhere than in cClientHandle. (diff)
downloadcuberite-674fe1e955f729e8328772313c45fe76857ec835.tar
cuberite-674fe1e955f729e8328772313c45fe76857ec835.tar.gz
cuberite-674fe1e955f729e8328772313c45fe76857ec835.tar.bz2
cuberite-674fe1e955f729e8328772313c45fe76857ec835.tar.lz
cuberite-674fe1e955f729e8328772313c45fe76857ec835.tar.xz
cuberite-674fe1e955f729e8328772313c45fe76857ec835.tar.zst
cuberite-674fe1e955f729e8328772313c45fe76857ec835.zip
Diffstat (limited to '')
-rw-r--r--source/cFurnaceEntity.cpp31
1 files changed, 9 insertions, 22 deletions
diff --git a/source/cFurnaceEntity.cpp b/source/cFurnaceEntity.cpp
index 2373b3555..4b3c1d04e 100644
--- a/source/cFurnaceEntity.cpp
+++ b/source/cFurnaceEntity.cpp
@@ -12,9 +12,6 @@
#include "cServer.h"
#include "cPickup.h"
#include "cRoot.h"
-
-#include "packets/cPacket_InventoryProgressBar.h"
-
#include <json/json.h>
@@ -146,13 +143,10 @@ bool cFurnaceEntity::Tick( float a_Dt )
cWindow * Window = GetWindow();
if (Window != NULL)
{
- cPacket_InventoryProgressBar Progress;
- Progress.m_ProgressBar = 0;
- Progress.m_WindowID = (char)Window->GetWindowID();
- Progress.m_Value = (short)( m_TimeCooked * (180.f / m_CookTime) );
- if (Progress.m_Value > 180) Progress.m_Value = 180;
- if (Progress.m_Value < 0) Progress.m_Value = 0;
- Window->Broadcast(Progress);
+ short Value = (short)( m_TimeCooked * (180.f / m_CookTime));
+ if (Value > 180) Value = 180;
+ if (Value < 0) Value = 0;
+ Window->BroadcastInventoryProgress(0, Value);
}
}
}
@@ -171,21 +165,14 @@ bool cFurnaceEntity::Tick( float a_Dt )
}
if (Window != NULL)
{
- cPacket_InventoryProgressBar Progress;
- Progress.m_WindowID = (char)Window->GetWindowID();
- Progress.m_ProgressBar = 1;
-
+ short Value = 0;
if (m_BurnTime > 0.f)
{
- Progress.m_Value = 250 - (short)( m_TimeBurned * (250.f / m_BurnTime) );
- if (Progress.m_Value > 250) Progress.m_Value = 250;
- if (Progress.m_Value < 0) Progress.m_Value = 0;
- }
- else
- {
- Progress.m_Value = 0;
+ Value = 250 - (short)( m_TimeBurned * (250.f / m_BurnTime));
+ if (Value > 250) Value = 250;
+ if (Value < 0) Value = 0;
}
- Window->Broadcast(Progress);
+ Window->BroadcastInventoryProgress(1, Value);
}
return ((m_CookingItem != NULL) || (m_TimeBurned < m_BurnTime)) && (m_BurnTime > 0.0); // Keep on ticking, if there's more to cook, or if it's cooking
}