summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ravenscroft <ravenscroftj@gmail.com>2013-08-08 17:57:34 +0200
committerJames Ravenscroft <ravenscroftj@gmail.com>2013-08-08 17:57:34 +0200
commit2b9fdc3e36d45c9db9ccf0b2a5f3b24f2ab2e038 (patch)
tree3265042d81c1a8014fd7e01ce0a8d8216cc66ece
parentFixed food handler for mushroom soup - proper food level and saturation are applied and the player receives a wooden bowl back after nomming (diff)
downloadcuberite-2b9fdc3e36d45c9db9ccf0b2a5f3b24f2ab2e038.tar
cuberite-2b9fdc3e36d45c9db9ccf0b2a5f3b24f2ab2e038.tar.gz
cuberite-2b9fdc3e36d45c9db9ccf0b2a5f3b24f2ab2e038.tar.bz2
cuberite-2b9fdc3e36d45c9db9ccf0b2a5f3b24f2ab2e038.tar.lz
cuberite-2b9fdc3e36d45c9db9ccf0b2a5f3b24f2ab2e038.tar.xz
cuberite-2b9fdc3e36d45c9db9ccf0b2a5f3b24f2ab2e038.tar.zst
cuberite-2b9fdc3e36d45c9db9ccf0b2a5f3b24f2ab2e038.zip
Diffstat (limited to '')
-rw-r--r--source/ClientHandle.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/ClientHandle.cpp b/source/ClientHandle.cpp
index 52c4b3061..328e7de70 100644
--- a/source/ClientHandle.cpp
+++ b/source/ClientHandle.cpp
@@ -32,8 +32,7 @@
#include "Protocol/ProtocolRecognizer.h"
-
-
+#define float2int(x) ((x)<0 ? ((int)(x))-1 : (int)(x))
#define AddPistonDir(x, y, z, dir, amount) switch (dir) { case 0: (y)-=(amount); break; case 1: (y)+=(amount); break;\
@@ -505,7 +504,13 @@ void cClientHandle::HandlePlayerPos(double a_PosX, double a_PosY, double a_PosZ,
// If a jump just started, process food exhaustion:
if ((a_PosY > m_Player->GetPosY()) && !a_IsOnGround && m_Player->IsOnGround())
{
- m_Player->AddFoodExhaustion(m_Player->IsSprinting() ? 0.8 : 0.2);
+ // we only add this exhaustion if the player is not swimming - otherwise we end up with both jump + swim exhaustion
+ cWorld * World = m_Player->GetWorld();
+ BLOCKTYPE BlockType = World->GetBlock( float2int(m_Player->GetPosX()), float2int(m_Player->GetPosY()), float2int(m_Player->GetPosZ()) );
+ if(! IsBlockWater(BlockType) )
+ {
+ m_Player->AddFoodExhaustion(m_Player->IsSprinting() ? 0.8 : 0.2);
+ }
}
m_Player->MoveTo(Pos);