summaryrefslogtreecommitdiffstats
path: root/src/Entities/Player.cpp
diff options
context:
space:
mode:
authorAlexander Harkness <bearbin@gmail.com>2014-02-16 08:05:11 +0100
committerAlexander Harkness <bearbin@gmail.com>2014-02-16 08:05:11 +0100
commit233f0add2930f316c5fafce9e29a12f2e4f007bc (patch)
tree8007f9a88f30eb7b209c68e9ab2a88bb290d382b /src/Entities/Player.cpp
parentRemoved the unnecessary LoopPlayersAndBroadcastChat() functions. (diff)
parentReplace random Float Generation and broadcast the Exp Pickup Sound (diff)
downloadcuberite-233f0add2930f316c5fafce9e29a12f2e4f007bc.tar
cuberite-233f0add2930f316c5fafce9e29a12f2e4f007bc.tar.gz
cuberite-233f0add2930f316c5fafce9e29a12f2e4f007bc.tar.bz2
cuberite-233f0add2930f316c5fafce9e29a12f2e4f007bc.tar.lz
cuberite-233f0add2930f316c5fafce9e29a12f2e4f007bc.tar.xz
cuberite-233f0add2930f316c5fafce9e29a12f2e4f007bc.tar.zst
cuberite-233f0add2930f316c5fafce9e29a12f2e4f007bc.zip
Diffstat (limited to 'src/Entities/Player.cpp')
-rw-r--r--src/Entities/Player.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index d568e068d..be26e4f6e 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -1059,6 +1059,15 @@ void cPlayer::CloseWindowIfID(char a_WindowID, bool a_CanRefuse)
+void cPlayer::PlaySoundEffect(const AString & a_SoundName, float a_Volume, float a_Pitch)
+{
+ m_ClientHandle->SendSoundEffect(a_SoundName, (int) (GetPosX() * 8.0), (int) (GetPosY() * 8.0), (int) (GetPosZ() * 8.0), a_Volume, a_Pitch);
+}
+
+
+
+
+
void cPlayer::SetLastBlockActionTime()
{
if (m_World != NULL)
@@ -1764,6 +1773,12 @@ void cPlayer::HandleFood(void)
{
// Ref.: http://www.minecraftwiki.net/wiki/Hunger
+ if (IsGameModeCreative())
+ {
+ // Hunger is disabled for Creative
+ return;
+ }
+
// Remember the food level before processing, for later comparison
int LastFoodLevel = m_FoodLevel;
@@ -1781,7 +1796,7 @@ void cPlayer::HandleFood(void)
Heal(1);
m_FoodExhaustionLevel += 3;
}
- else if (m_FoodLevel <= 0)
+ else if (m_FoodLevel <= 0 && m_Health > 1)
{
// Damage from starving
TakeDamage(dtStarving, NULL, 1, 1, 0);