Skip to content

Commit 1d3a692

Browse files
committed
Fix detectLavaPool
1 parent 66e0c87 commit 1d3a692

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

bukkit/version/v1_18/src/main/kotlin/io/github/rothes/esu/bukkit/module/networkthrottle/chunkdatathrottle/v1_18/ChunkDataThrottleHandlerImpl.kt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -463,21 +463,22 @@ class ChunkDataThrottleHandlerImpl: ChunkDataThrottleHandler,
463463
val x = id and 0xf
464464
val z = id shr 4 and 0xf
465465
fun checkBlock(id: Int, b: Byte) {
466-
if (invisible[id] and BV_UPPER_OCCLUDING == BV_UPPER_OCCLUDING) {
466+
if (invisible[id] == BV_LAVA_COVERED) {
467467
bvArr[id] = bvArr[id] or b
468-
pending.add(id)
469468
}
470469
}
471470
fun checkEdge(id: Int, check: Byte, set: Byte) {
472-
if (id in (0 ..< invisible.size) && bvArr[id] and check != 0.toByte()) {
473-
bvArr[id] = bvArr[id] and set
471+
// it and upper block should both be lava-covered
472+
if (bvArr[id] and check != 0.toByte() && bvArr[id + 0x100] and check != 0.toByte()) {
473+
bvArr[id] = bvArr[id] or set
474474
}
475475
}
476-
if (x != 0 ) checkBlock(id - 0x001, X_PLUS ) else checkEdge(id - 0x001, X_LAVA, X_MINUS)
477-
if (x != 15) checkBlock(id + 0x001, X_MINUS) else checkEdge(id - 0x001, X_LAVA, X_PLUS )
478-
if (z != 0 ) checkBlock(id - 0x010, Z_PLUS ) else checkEdge(id - 0x010, Z_LAVA, Z_MINUS)
479-
if (z != 15) checkBlock(id + 0x010, Z_MINUS) else checkEdge(id - 0x010, Z_LAVA, Z_PLUS )
476+
if (x != 0 ) checkBlock(id - 0x001, X_PLUS ) else checkEdge(id, X_LAVA, X_MINUS)
477+
if (x != 15) checkBlock(id + 0x001, X_MINUS) else checkEdge(id, X_LAVA, X_PLUS )
478+
if (z != 0 ) checkBlock(id - 0x010, Z_PLUS ) else checkEdge(id, Z_LAVA, Z_MINUS)
479+
if (z != 15) checkBlock(id + 0x010, Z_MINUS) else checkEdge(id, Z_LAVA, Z_PLUS )
480480
checkBlock(id + 0x100, Y_MINUS)
481+
pending.add(id)
481482
}
482483
val iterator = pending.intIterator()
483484
while (iterator.hasNext()) {

0 commit comments

Comments
 (0)