Skip to content

Commit

Permalink
fix: blockoverlay not rendering some blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
opZywl committed Dec 7, 2024
1 parent d3458e4 commit d367e94
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit d367e94

Please sign in to comment.