diff --git a/core/common/src/main/kotlin/com/willfp/libreforge/effects/impl/EffectMineRadiusOneDeep.kt b/core/common/src/main/kotlin/com/willfp/libreforge/effects/impl/EffectMineRadiusOneDeep.kt index 932de16d..64becf27 100644 --- a/core/common/src/main/kotlin/com/willfp/libreforge/effects/impl/EffectMineRadiusOneDeep.kt +++ b/core/common/src/main/kotlin/com/willfp/libreforge/effects/impl/EffectMineRadiusOneDeep.kt @@ -12,7 +12,6 @@ import com.willfp.libreforge.triggers.TriggerData import com.willfp.libreforge.triggers.TriggerParameter import org.bukkit.Material import org.bukkit.block.Block -import org.bukkit.block.BlockFace import kotlin.math.abs object EffectMineRadiusOneDeep : MineBlockEffect("mine_radius_one_deep") { @@ -36,32 +35,27 @@ object EffectMineRadiusOneDeep : MineBlockEffect("mine_radius_one val whitelist = config.getStringsOrNull("whitelist") - // Get the block face the player is interacting with - val targetBlock = player.getTargetBlockExact(5) ?: return false - val blockFace = block.getFace(targetBlock) ?: return false - val blocks = mutableSetOf() - // Determine the range and direction based on the block face - val (xRange, yRange, zRange) = when (blockFace) { - BlockFace.UP, BlockFace.DOWN -> { - val yRange = if (blockFace == BlockFace.UP) 0..radius else -radius..0 - Triple(-radius..radius, yRange, -radius..radius) - } - BlockFace.NORTH, BlockFace.SOUTH -> { - val zRange = if (blockFace == BlockFace.NORTH) -radius..0 else 0..radius - Triple(-radius..radius, -radius..radius, zRange) - } - BlockFace.EAST, BlockFace.WEST -> { - val xRange = if (blockFace == BlockFace.EAST) 0..radius else -radius..0 - Triple(xRange, -radius..radius, -radius..radius) - } - else -> return false // In case of invalid or unexpected block face - } + val ignoreVector = player.location.direction.simplify() + + for (x in (-radius..radius)) { + for (y in (-radius..radius)) { + for (z in (-radius..radius)) { + // Jank + if (ignoreVector.x != 0.0 && x != 0) { + continue + } + + if (ignoreVector.y != 0.0 && y != 0) { + continue + } + + if (ignoreVector.z != 0.0 && z != 0) { + continue + } + // End Jank - for (x in xRange) { - for (y in yRange) { - for (z in zRange) { if (x == 0 && y == 0 && z == 0) { continue } @@ -124,5 +118,4 @@ object EffectMineRadiusOneDeep : MineBlockEffect("mine_radius_one return true } - }