Add support for waterlogged blocks

This commit is contained in:
TomTom 2024-02-07 11:06:24 +01:00
parent 74f9cd5965
commit 67a516a46b

View File

@ -6,6 +6,7 @@ import org.bukkit.Location
import org.bukkit.Material import org.bukkit.Material
import org.bukkit.block.Block import org.bukkit.block.Block
import org.bukkit.block.BlockFace import org.bukkit.block.BlockFace
import org.bukkit.block.data.Waterlogged
object MinionUtils { object MinionUtils {
private val FACES = private val FACES =
@ -44,13 +45,14 @@ object MinionUtils {
val locBlock = location.block val locBlock = location.block
FACES.fastFor { FACES.fastFor {
val relative = locBlock.getRelative(it) val relative = locBlock.getRelative(it)
val type = relative.type val state = relative.state
val type = state.type
if (!lava) { if (!lava) {
lava = type == Material.LAVA lava = type == Material.LAVA
} }
if (!water) { if (!water) {
water = type == Material.WATER water = type == Material.WATER || (state as? Waterlogged)?.isWaterlogged ?: return@fastFor
} }
if (water && lava) { if (water && lava) {