summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authorKingCol13 <48412633+KingCol13@users.noreply.github.com>2022-04-19 01:05:51 +0200
committerGitHub <noreply@github.com>2022-04-19 01:05:51 +0200
commit900f95c42b9b6ff333cc60640c17fb197025e280 (patch)
tree4fc6e32ab97d8b5ed8c8de91526b9e98e32cdc72 /src/Entities
parentChanging Copyright Years (happy 11) (diff)
downloadcuberite-900f95c42b9b6ff333cc60640c17fb197025e280.tar
cuberite-900f95c42b9b6ff333cc60640c17fb197025e280.tar.gz
cuberite-900f95c42b9b6ff333cc60640c17fb197025e280.tar.bz2
cuberite-900f95c42b9b6ff333cc60640c17fb197025e280.tar.lz
cuberite-900f95c42b9b6ff333cc60640c17fb197025e280.tar.xz
cuberite-900f95c42b9b6ff333cc60640c17fb197025e280.tar.zst
cuberite-900f95c42b9b6ff333cc60640c17fb197025e280.zip
Diffstat (limited to 'src/Entities')
-rw-r--r--src/Entities/Player.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index c2c3b51ea..07460fe98 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -2577,9 +2577,17 @@ float cPlayer::GetLiquidHeightPercent(NIBBLETYPE a_Meta)
bool cPlayer::IsInsideWater()
{
+ const auto EyePos = GetEyePosition().Floor();
+
+ if (!cChunkDef::IsValidHeight(EyePos.y))
+ {
+ // Not in water if in void.
+ return false;
+ }
+
BLOCKTYPE Block;
NIBBLETYPE Meta;
- m_World->GetBlockTypeMeta(GetEyePosition().Floor(), Block, Meta);
+ m_World->GetBlockTypeMeta(EyePos, Block, Meta);
if ((Block != E_BLOCK_WATER) && (Block != E_BLOCK_STATIONARY_WATER))
{