1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Break liquid reflow scan early for all-air blocks (#15975)

Avoid scanning the a newly loaded block if it is all air and no liquid is flowing from above.
This commit is contained in:
lhofhansl 2025-04-05 08:01:39 -10:00 committed by GitHub
parent 52b974184d
commit 6a71095655
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -121,6 +121,12 @@ void ReflowScan::scanColumn(int x, int z)
bool was_checked = false; bool was_checked = false;
bool was_pushed = false; bool was_pushed = false;
// if there is no liquid above and the current block is air
// we can skip scanning the block
if (!was_liquid && block->isAir()) {
// continue after the block with air
was_ignore = false;
} else {
// Scan through the whole block // Scan through the whole block
for (s16 y = MAP_BLOCKSIZE - 1; y >= 0; y--) { for (s16 y = MAP_BLOCKSIZE - 1; y >= 0; y--) {
MapNode node = block->getNodeNoCheck(dx, y, dz); MapNode node = block->getNodeNoCheck(dx, y, dz);
@ -157,6 +163,7 @@ void ReflowScan::scanColumn(int x, int z)
was_liquid = is_liquid; was_liquid = is_liquid;
was_ignore = is_ignore; was_ignore = is_ignore;
} }
}
// Check the node below the current block // Check the node below the current block
MapBlock *below = lookupBlock(x, -1, z); MapBlock *below = lookupBlock(x, -1, z);