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:
parent
3c8712d871
commit
0140923c35
@ -1363,17 +1363,17 @@ bool cMonster::WouldBurnAt(Vector3d a_Location, cChunk & a_Chunk)
|
|||||||
GetWorld()->IsWeatherSunnyAt(POSX_TOINT, POSZ_TOINT) // Not raining
|
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)
|
if (MobHeight >= cChunkDef::Height)
|
||||||
{
|
{
|
||||||
return true;
|
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.
|
// 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
|
// 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).
|
// instantly.(An exception is e.g. standing under a long column of glass).
|
||||||
int CurrentBlock = Chunk->GetHeight(Rel.x, Rel.z);
|
int CurrentBlock = Chunk->GetHeight(Rel.x, Rel.z);
|
||||||
while (CurrentBlock >= MobHeight)
|
while (CurrentBlock > MobHeight)
|
||||||
{
|
{
|
||||||
BLOCKTYPE Block = Chunk->GetBlock(Rel.x, CurrentBlock, Rel.z);
|
BLOCKTYPE Block = Chunk->GetBlock(Rel.x, CurrentBlock, Rel.z);
|
||||||
if (
|
if (
|
||||||
|
Loading…
Reference in New Issue
Block a user