fix light increasing back

This commit is contained in:
Bixilon 2022-09-14 00:21:42 +02:00
parent 72aef78ad0
commit c1dfc10ea2
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -127,7 +127,7 @@ class SectionLight(
val neighbourLuminance = nextLuminance - 1 val neighbourLuminance = nextLuminance - 1
if (source == null || block?.lightProperties?.propagatesBlockLight(source, Directions.DOWN) != false) { if (source == null || (source != Directions.DOWN && block?.lightProperties?.propagatesBlockLight(source, Directions.DOWN) != false)) {
if (y > 0) { if (y > 0) {
traceIncrease(x, y - 1, z, neighbourLuminance, Directions.UP) traceIncrease(x, y - 1, z, neighbourLuminance, Directions.UP)
} else if (section.sectionHeight == section.chunk?.lowestSection) { } else if (section.sectionHeight == section.chunk?.lowestSection) {
@ -136,7 +136,7 @@ class SectionLight(
neighbours[Directions.O_DOWN]?.light?.traceIncrease(x, ProtocolDefinition.SECTION_MAX_Y, z, neighbourLuminance, Directions.UP) neighbours[Directions.O_DOWN]?.light?.traceIncrease(x, ProtocolDefinition.SECTION_MAX_Y, z, neighbourLuminance, Directions.UP)
} }
} }
if (source == null || block?.lightProperties?.propagatesBlockLight(source, Directions.UP) != false) { if (source == null || (source != Directions.UP && block?.lightProperties?.propagatesBlockLight(source, Directions.UP) != false)) {
if (y < ProtocolDefinition.SECTION_MAX_Y) { if (y < ProtocolDefinition.SECTION_MAX_Y) {
traceIncrease(x, y + 1, z, neighbourLuminance, Directions.DOWN) traceIncrease(x, y + 1, z, neighbourLuminance, Directions.DOWN)
} else if (section.sectionHeight == section.chunk?.highestSection) { } else if (section.sectionHeight == section.chunk?.highestSection) {
@ -146,28 +146,28 @@ class SectionLight(
} }
} }
if (source == null || block?.lightProperties?.propagatesBlockLight(source, Directions.NORTH) != false) { if (source == null || (source != Directions.NORTH && block?.lightProperties?.propagatesBlockLight(source, Directions.NORTH) != false)) {
if (z > 0) { if (z > 0) {
traceIncrease(x, y, z - 1, neighbourLuminance, Directions.SOUTH) traceIncrease(x, y, z - 1, neighbourLuminance, Directions.SOUTH)
} else { } else {
neighbours[Directions.O_NORTH]?.light?.traceIncrease(x, y, ProtocolDefinition.SECTION_MAX_Z, neighbourLuminance, Directions.SOUTH) neighbours[Directions.O_NORTH]?.light?.traceIncrease(x, y, ProtocolDefinition.SECTION_MAX_Z, neighbourLuminance, Directions.SOUTH)
} }
} }
if (source == null || block?.lightProperties?.propagatesBlockLight(source, Directions.SOUTH) != false) { if (source == null || (source != Directions.SOUTH && block?.lightProperties?.propagatesBlockLight(source, Directions.SOUTH) != false)) {
if (z < ProtocolDefinition.SECTION_MAX_Y) { if (z < ProtocolDefinition.SECTION_MAX_Y) {
traceIncrease(x, y, z + 1, neighbourLuminance, Directions.NORTH) traceIncrease(x, y, z + 1, neighbourLuminance, Directions.NORTH)
} else { } else {
neighbours[Directions.O_SOUTH]?.light?.traceIncrease(x, y, 0, neighbourLuminance, Directions.NORTH) neighbours[Directions.O_SOUTH]?.light?.traceIncrease(x, y, 0, neighbourLuminance, Directions.NORTH)
} }
} }
if (source == null || block?.lightProperties?.propagatesBlockLight(source, Directions.WEST) != false) { if (source == null || (source != Directions.WEST && block?.lightProperties?.propagatesBlockLight(source, Directions.WEST) != false)) {
if (x > 0) { if (x > 0) {
traceIncrease(x - 1, y, z, neighbourLuminance, Directions.EAST) traceIncrease(x - 1, y, z, neighbourLuminance, Directions.EAST)
} else { } else {
neighbours[Directions.O_WEST]?.light?.traceIncrease(ProtocolDefinition.SECTION_MAX_X, y, z, neighbourLuminance, Directions.EAST) neighbours[Directions.O_WEST]?.light?.traceIncrease(ProtocolDefinition.SECTION_MAX_X, y, z, neighbourLuminance, Directions.EAST)
} }
} }
if (source == null || block?.lightProperties?.propagatesBlockLight(source, Directions.EAST) != false) { if (source == null || (source != Directions.EAST && block?.lightProperties?.propagatesBlockLight(source, Directions.EAST) != false)) {
if (x < ProtocolDefinition.SECTION_MAX_X) { if (x < ProtocolDefinition.SECTION_MAX_X) {
traceIncrease(x + 1, y, z, neighbourLuminance, Directions.WEST) traceIncrease(x + 1, y, z, neighbourLuminance, Directions.WEST)
} else { } else {