summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Monster.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2021-03-15 03:28:18 +0100
committerGitHub <noreply@github.com>2021-03-15 03:28:18 +0100
commit45591cbe7bef4c54c241a286ece07bc4ade4489e (patch)
treea6b2b8a7e8c2d2986612e70cd904f5446b82e2d6 /src/Mobs/Monster.cpp
parentFixed some death messages showing up even when they are disabled. (#5153) (diff)
downloadcuberite-45591cbe7bef4c54c241a286ece07bc4ade4489e.tar
cuberite-45591cbe7bef4c54c241a286ece07bc4ade4489e.tar.gz
cuberite-45591cbe7bef4c54c241a286ece07bc4ade4489e.tar.bz2
cuberite-45591cbe7bef4c54c241a286ece07bc4ade4489e.tar.lz
cuberite-45591cbe7bef4c54c241a286ece07bc4ade4489e.tar.xz
cuberite-45591cbe7bef4c54c241a286ece07bc4ade4489e.tar.zst
cuberite-45591cbe7bef4c54c241a286ece07bc4ade4489e.zip
Diffstat (limited to '')
-rw-r--r--src/Mobs/Monster.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 237c50524..09c0974a0 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -541,26 +541,26 @@ void cMonster::HandleFalling()
int cMonster::FindFirstNonAirBlockPosition(double a_PosX, double a_PosZ)
{
- int PosY = POSY_TOINT;
- PosY = Clamp(PosY, 0, cChunkDef::Height);
+ auto Position = GetPosition().Floor();
+ Position.y = Clamp(Position.y, 0, cChunkDef::Height);
- if (!cBlockInfo::IsSolid(m_World->GetBlock(FloorC(a_PosX), PosY, FloorC(a_PosZ))))
+ if (!cBlockInfo::IsSolid(m_World->GetBlock(Position)))
{
- while (!cBlockInfo::IsSolid(m_World->GetBlock(FloorC(a_PosX), PosY, FloorC(a_PosZ))) && (PosY > 0))
+ while (!cBlockInfo::IsSolid(m_World->GetBlock(Position)) && (Position.y > 0))
{
- PosY--;
+ Position.y--;
}
- return PosY + 1;
+ return Position.y + 1;
}
else
{
- while ((PosY < cChunkDef::Height) && cBlockInfo::IsSolid(m_World->GetBlock(static_cast<int>(floor(a_PosX)), PosY, static_cast<int>(floor(a_PosZ)))))
+ while ((Position.y < cChunkDef::Height) && cBlockInfo::IsSolid(m_World->GetBlock(Position)))
{
- PosY++;
+ Position.y++;
}
- return PosY;
+ return Position.y;
}
}