summaryrefslogtreecommitdiffstats
path: root/source/Entities
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-11-02 15:08:00 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-11-02 15:08:00 +0100
commit77b3db7e25c401d4ff78ee4fe291880df441a6fe (patch)
tree833472405110d46701276e1da3cbca5f9831da98 /source/Entities
parentProtocol 1.7: Implemented the first batch of sent packets. (diff)
downloadcuberite-77b3db7e25c401d4ff78ee4fe291880df441a6fe.tar
cuberite-77b3db7e25c401d4ff78ee4fe291880df441a6fe.tar.gz
cuberite-77b3db7e25c401d4ff78ee4fe291880df441a6fe.tar.bz2
cuberite-77b3db7e25c401d4ff78ee4fe291880df441a6fe.tar.lz
cuberite-77b3db7e25c401d4ff78ee4fe291880df441a6fe.tar.xz
cuberite-77b3db7e25c401d4ff78ee4fe291880df441a6fe.tar.zst
cuberite-77b3db7e25c401d4ff78ee4fe291880df441a6fe.zip
Diffstat (limited to '')
-rw-r--r--source/Entities/Player.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/source/Entities/Player.cpp b/source/Entities/Player.cpp
index d94bc944c..ffd829663 100644
--- a/source/Entities/Player.cpp
+++ b/source/Entities/Player.cpp
@@ -297,7 +297,6 @@ void cPlayer::CancelChargingBow(void)
void cPlayer::SetTouchGround(bool a_bTouchGround)
{
- // If just
m_bTouchGround = a_bTouchGround;
if (!m_bTouchGround)
@@ -307,12 +306,11 @@ void cPlayer::SetTouchGround(bool a_bTouchGround)
m_LastJumpHeight = (float)GetPosY();
}
cWorld * World = GetWorld();
- if ((GetPosY() >= 0) && (GetPosY() < 256))
+ if ((GetPosY() >= 0) && (GetPosY() < cChunkDef::Height))
{
- BLOCKTYPE BlockType = World->GetBlock( float2int(GetPosX()), float2int(GetPosY()), float2int(GetPosZ()) );
+ BLOCKTYPE BlockType = World->GetBlock(float2int(GetPosX()), float2int(GetPosY()), float2int(GetPosZ()));
if (BlockType != E_BLOCK_AIR)
{
- // LOGD("TouchGround set to true by server");
m_bTouchGround = true;
}
if (
@@ -320,21 +318,20 @@ void cPlayer::SetTouchGround(bool a_bTouchGround)
(BlockType == E_BLOCK_STATIONARY_WATER) ||
(BlockType == E_BLOCK_LADDER) ||
(BlockType == E_BLOCK_VINES)
- )
+ )
{
- // LOGD("Water / Ladder / Torch");
m_LastGroundHeight = (float)GetPosY();
}
}
}
-
- if (m_bTouchGround)
+ else
{
float Dist = (float)(m_LastGroundHeight - floor(GetPosY()));
int Damage = (int)(Dist - 3.f);
- if(m_LastJumpHeight > m_LastGroundHeight) Damage++;
+ if (m_LastJumpHeight > m_LastGroundHeight) Damage++;
m_LastJumpHeight = (float)GetPosY();
- if (Damage > 0)
+
+ if ((Damage > 0) && (!IsGameModeCreative()))
{
TakeDamage(dtFalling, NULL, Damage, Damage, 0);
}
@@ -1416,11 +1413,11 @@ cPlayer::StringList cPlayer::GetResolvedPermissions()
void cPlayer::UseEquippedItem(void)
{
- if (GetGameMode() == gmCreative) // No damage in creative
+ if (IsGameModeCreative()) // No damage in creative
{
return;
}
-
+
GetInventory().DamageEquippedItem();
}