1
0
Fork 0

Fix mobs not burning in daylight when on snow (#3961)

* Fix mobs not burning in daylight when on snow

or other non-transparent partial blocks.

Fixes #3945

* Change from floor to ceil
This commit is contained in:
Alexander Harkness 2017-08-25 16:26:45 +01:00 committed by GitHub
parent 3c8712d871
commit 0140923c35
1 changed files with 3 additions and 3 deletions

View File

@ -1363,17 +1363,17 @@ bool cMonster::WouldBurnAt(Vector3d a_Location, cChunk & a_Chunk)
GetWorld()->IsWeatherSunnyAt(POSX_TOINT, POSZ_TOINT) // Not raining
)
{
int MobHeight = FloorC(a_Location.y + GetHeight()) - 1; // The block Y coord of the mob's head
int MobHeight = CeilC(a_Location.y + GetHeight()) - 1; // The block Y coord of the mob's head
if (MobHeight >= cChunkDef::Height)
{
return true;
}
// Start with the highest block and scan down to the mob's head.
// Start with the highest block and scan down to just above the mob's head.
// If a non transparent is found, return false (do not burn). Otherwise return true.
// Note that this loop is not a performance concern as transparent blocks are rare and the loop almost always bailes out
// instantly.(An exception is e.g. standing under a long column of glass).
int CurrentBlock = Chunk->GetHeight(Rel.x, Rel.z);
while (CurrentBlock >= MobHeight)
while (CurrentBlock > MobHeight)
{
BLOCKTYPE Block = Chunk->GetBlock(Rel.x, CurrentBlock, Rel.z);
if (