section occlusion: check if side blocks are set

Otherwise skip flood filling and tracing.
This commit is contained in:
Moritz Zwerger 2025-03-09 15:27:43 +01:00
parent 31fa6a809d
commit 5160ad3160
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -46,7 +46,15 @@ class SectionOcclusion(
fun recalculate(notify: Boolean) {
if (!calculate) return
if (provider.count < ProtocolDefinition.SECTION_WIDTH_X * ProtocolDefinition.SECTION_WIDTH_Z) { // When there are less than 256 blocks set, you will always be able to look from one side to another
val min = provider.minPosition
val max = provider.minPosition
if (min.x > 0 && min.y > 0 && min.z > 0 && max.x < ProtocolDefinition.SECTION_MAX_X && max.y < ProtocolDefinition.SECTION_MAX_X && max.z < ProtocolDefinition.SECTION_MAX_X) {
// blocks are only set in inner section, no blocking of any side possible.
clear(notify)
return
}
if (provider.count < ProtocolDefinition.SECTION_WIDTH_X * ProtocolDefinition.SECTION_WIDTH_Z) {
// When there are less than 256 blocks set, you will always be able to look from one side to another
clear(notify)
return
}