summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-08-19 14:09:10 +0200
committerMattes D <github@xoft.cz>2016-08-19 14:09:10 +0200
commit7549f468b396325be0094495a80cb5f4ec3efdf0 (patch)
tree4bf43680b38b96c1286f5aed5c4dba73f078b857 /src
parentRemoved Decoda project files, no longer used. (#3320) (diff)
downloadcuberite-7549f468b396325be0094495a80cb5f4ec3efdf0.tar
cuberite-7549f468b396325be0094495a80cb5f4ec3efdf0.tar.gz
cuberite-7549f468b396325be0094495a80cb5f4ec3efdf0.tar.bz2
cuberite-7549f468b396325be0094495a80cb5f4ec3efdf0.tar.lz
cuberite-7549f468b396325be0094495a80cb5f4ec3efdf0.tar.xz
cuberite-7549f468b396325be0094495a80cb5f4ec3efdf0.tar.zst
cuberite-7549f468b396325be0094495a80cb5f4ec3efdf0.zip
Diffstat (limited to 'src')
-rw-r--r--src/Items/ItemBoat.h13
-rw-r--r--src/Mobs/Monster.cpp2
2 files changed, 9 insertions, 6 deletions
diff --git a/src/Items/ItemBoat.h b/src/Items/ItemBoat.h
index de16c70dc..5f7f91b57 100644
--- a/src/Items/ItemBoat.h
+++ b/src/Items/ItemBoat.h
@@ -73,19 +73,22 @@ public:
return false;
}
- double x = Callbacks.m_Pos.x;
- double y = Callbacks.m_Pos.y;
- double z = Callbacks.m_Pos.z;
+ auto x = Callbacks.m_Pos.x;
+ auto y = Callbacks.m_Pos.y;
+ auto z = Callbacks.m_Pos.z;
+ auto bx = FloorC(x);
+ auto by = FloorC(y);
+ auto bz = FloorC(z);
// Verify that block type for spawn point is water
- BLOCKTYPE SpawnBlock = a_World->GetBlock(x, y, z);
+ BLOCKTYPE SpawnBlock = a_World->GetBlock(bx, by, bz);
if (!IsBlockWater(SpawnBlock))
{
return false;
}
// Block above must be air to spawn a boat (prevents spawning a boat underwater)
- BLOCKTYPE BlockAbove = a_World->GetBlock(x, y + 1, z);
+ BLOCKTYPE BlockAbove = a_World->GetBlock(bx, by + 1, bz);
if (BlockAbove != E_BLOCK_AIR)
{
return false;
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 3b0fdd36c..98c22e299 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -1213,7 +1213,7 @@ bool cMonster::WouldBurnAt(Vector3d a_Location, cChunk & a_Chunk)
GetWorld()->IsWeatherSunnyAt(POSX_TOINT, POSZ_TOINT) // Not raining
)
{
- int MobHeight = static_cast<int>(a_Location.y) + round(GetHeight()) - 1; // The height of the mob head
+ int MobHeight = FloorC(a_Location.y + GetHeight()) - 1; // The block Y coord of the mob's head
if (MobHeight >= cChunkDef::Height)
{
return true;