summaryrefslogtreecommitdiffstats
path: root/src/Entities/Entity.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/Entities/Entity.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 'src/Entities/Entity.cpp')
-rw-r--r--src/Entities/Entity.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index d6bb057f4..f1d8c989d 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -1308,7 +1308,7 @@ void cEntity::DetectCacti(void)
{
for (int y = MinY; y <= MaxY; y++)
{
- if (GetWorld()->GetBlock(x, y, z) == E_BLOCK_CACTUS)
+ if (GetWorld()->GetBlock({ x, y, z }) == E_BLOCK_CACTUS)
{
TakeDamage(dtCactusContact, nullptr, 1, 0);
return;
@@ -1337,7 +1337,7 @@ void cEntity::DetectMagma(void)
{
for (int y = MinY; y <= MaxY; y++)
{
- if (GetWorld()->GetBlock(x, y, z) == E_BLOCK_MAGMA)
+ if (GetWorld()->GetBlock({ x, y, z }) == E_BLOCK_MAGMA)
{
TakeDamage(dtMagmaContact, nullptr, 1, 0);
return;
@@ -1367,10 +1367,9 @@ bool cEntity::DetectPortal()
return false;
}
- int X = POSX_TOINT, Y = POSY_TOINT, Z = POSZ_TOINT;
- if (cChunkDef::IsValidHeight(Y))
+ if (const auto Position = m_Position.Floor(); cChunkDef::IsValidHeight(Position.y))
{
- switch (GetWorld()->GetBlock(X, Y, Z))
+ switch (GetWorld()->GetBlock(Position))
{
case E_BLOCK_NETHER_PORTAL:
{