From d367e94052e84047f89511aa0915edc83a1f8648 Mon Sep 17 00:00:00 2001 From: Zywl <86253343+opZywl@users.noreply.github.com> Date: Sat, 7 Dec 2024 16:43:05 -0300 Subject: [PATCH] fix: blockoverlay not rendering some blocks --- .../features/module/modules/visual/BlockOverlay.kt | 4 +++- .../java/net/ccbluex/liquidbounce/utils/block/BlockUtils.kt | 2 -- .../ccbluex/liquidbounce/utils/extensions/BlockExtension.kt | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/visual/BlockOverlay.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/visual/BlockOverlay.kt index ef856c148a..48539a6c26 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/visual/BlockOverlay.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/visual/BlockOverlay.kt @@ -27,6 +27,7 @@ import net.ccbluex.liquidbounce.value.int import net.minecraft.block.Block import net.minecraft.client.gui.ScaledResolution import net.minecraft.client.renderer.GlStateManager.* +import net.minecraft.init.Blocks import net.minecraft.util.BlockPos import org.lwjgl.opengl.GL11.* import java.awt.Color @@ -45,9 +46,10 @@ object BlockOverlay : Module("BlockOverlay", Category.VISUAL, gameDetecting = fa val currentBlock: BlockPos? get() { + val world = mc.theWorld ?: return null val blockPos = mc.objectMouseOver?.blockPos ?: return null - if (blockPos.canBeClicked() && mc.theWorld.worldBorder.contains(blockPos)) + if (blockPos.block !in arrayOf(Blocks.air, Blocks.water, Blocks.lava) && world.worldBorder.contains(blockPos)) return blockPos return null diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/block/BlockUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/block/BlockUtils.kt index e0b3e05079..933f566e44 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/block/BlockUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/block/BlockUtils.kt @@ -7,11 +7,9 @@ package net.ccbluex.liquidbounce.utils.block import net.ccbluex.liquidbounce.utils.MinecraftInstance import net.ccbluex.liquidbounce.utils.extensions.block -import net.ccbluex.liquidbounce.utils.extensions.canBeClicked import net.ccbluex.liquidbounce.utils.extensions.state import net.minecraft.block.* import net.minecraft.block.state.IBlockState -import net.minecraft.entity.item.EntityFallingBlock import net.minecraft.init.Blocks import net.minecraft.util.AxisAlignedBB import net.minecraft.util.BlockPos diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/extensions/BlockExtension.kt b/src/main/java/net/ccbluex/liquidbounce/utils/extensions/BlockExtension.kt index d1944d9d75..557d7458d9 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/extensions/BlockExtension.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/extensions/BlockExtension.kt @@ -32,16 +32,17 @@ val BlockPos.center: Vec3 fun BlockPos.toVec() = Vec3(this) fun BlockPos.canBeClicked(): Boolean { + val world = mc.theWorld ?: return false val state = this.state ?: return false val block = state.block ?: return false return when { - this !in mc.theWorld.worldBorder -> false + this !in world.worldBorder -> false !block.canCollideCheck(state, false) -> false block.material.isReplaceable -> false block.hasTileEntity(state) -> false !isBlockBBValid(this, state, supportSlabs = true, supportPartialBlocks = true) -> false - mc.theWorld.loadedEntityList.any { it is EntityFallingBlock && it.position == this } -> false + world.loadedEntityList.any { it is EntityFallingBlock && it.position == this } -> false block is BlockContainer || block is BlockWorkbench -> false else -> true }