summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Monster.cpp
diff options
context:
space:
mode:
authorJulian Laubstein <julianlaubstein@yahoo.de>2015-12-30 02:40:23 +0100
committerJulian Laubstein <julianlaubstein@yahoo.de>2015-12-30 02:40:23 +0100
commit2440b9bea10a4e8690c4a7bc9be0b2a75946cf8a (patch)
treeca5071a8317ea1c04d5cc33310e288ac2b9e93b5 /src/Mobs/Monster.cpp
parentDebuggers plugin: Added "uuid" console command. (diff)
parentFixed the monster burn code. (diff)
downloadcuberite-2440b9bea10a4e8690c4a7bc9be0b2a75946cf8a.tar
cuberite-2440b9bea10a4e8690c4a7bc9be0b2a75946cf8a.tar.gz
cuberite-2440b9bea10a4e8690c4a7bc9be0b2a75946cf8a.tar.bz2
cuberite-2440b9bea10a4e8690c4a7bc9be0b2a75946cf8a.tar.lz
cuberite-2440b9bea10a4e8690c4a7bc9be0b2a75946cf8a.tar.xz
cuberite-2440b9bea10a4e8690c4a7bc9be0b2a75946cf8a.tar.zst
cuberite-2440b9bea10a4e8690c4a7bc9be0b2a75946cf8a.zip
Diffstat (limited to 'src/Mobs/Monster.cpp')
-rw-r--r--src/Mobs/Monster.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 571118b7d..7d8c3de02 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -1098,6 +1098,19 @@ void cMonster::HandleDaylightBurning(cChunk & a_Chunk, bool WouldBurn)
bool cMonster::WouldBurnAt(Vector3d a_Location, cChunk & a_Chunk)
{
+ // If the Y coord is out of range, return the most logical result without considering anything else:
+ int RelY = FloorC(a_Location.y);
+ if (RelY < 0)
+ {
+ // Never burn under the world
+ return false;
+ }
+ if (RelY >= cChunkDef::Height)
+ {
+ // Always burn above the world
+ return true;
+ }
+
cChunk * Chunk = a_Chunk.GetNeighborChunk(FloorC(a_Location.x), FloorC(a_Location.z));
if ((Chunk == nullptr) || (!Chunk->IsValid()))
{
@@ -1105,14 +1118,13 @@ bool cMonster::WouldBurnAt(Vector3d a_Location, cChunk & a_Chunk)
}
int RelX = FloorC(a_Location.x) - Chunk->GetPosX() * cChunkDef::Width;
- int RelY = FloorC(a_Location.y);
int RelZ = FloorC(a_Location.z) - Chunk->GetPosZ() * cChunkDef::Width;
if (
(Chunk->GetSkyLight(RelX, RelY, RelZ) == 15) && // In the daylight
(Chunk->GetBlock(RelX, RelY, RelZ) != E_BLOCK_SOULSAND) && // Not on soulsand
- (GetWorld()->GetTimeOfDay() < (12000 + 1000)) && // It is nighttime
- GetWorld()->IsWeatherSunnyAt(POSX_TOINT, POSZ_TOINT) // Not raining
+ (GetWorld()->GetTimeOfDay() < 12000 + 1000) && // Daytime
+ GetWorld()->IsWeatherSunnyAt(POSX_TOINT, POSZ_TOINT) // Not raining
)
{
return true;