From 98eb3151427259b47fc21cf9e637de91eeb74fa2 Mon Sep 17 00:00:00 2001 From: illyum <90023277+itzilly@users.noreply.github.com> Date: Thu, 22 Aug 2024 12:53:56 -0600 Subject: [PATCH] (BugFix): Fixes powder chest click not being detected correctly --- .../github/itzilly/sbt/features/ChestEsp.kt | 24 +++---------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/src/main/kotlin/com/github/itzilly/sbt/features/ChestEsp.kt b/src/main/kotlin/com/github/itzilly/sbt/features/ChestEsp.kt index f43c65c..087e456 100644 --- a/src/main/kotlin/com/github/itzilly/sbt/features/ChestEsp.kt +++ b/src/main/kotlin/com/github/itzilly/sbt/features/ChestEsp.kt @@ -60,27 +60,9 @@ object ChestEsp { fun rightClickEvent(event: PlayerInteractEvent) { if (!enabled) return if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { - val player = event.entityPlayer - val reachDistance = 5.0 - val eyePosition = player.getPositionEyes(1.0f) - val lookVec = player.getLook(1.0f) - val reachVec = eyePosition.addVector( - lookVec.xCoord * reachDistance, - lookVec.yCoord * reachDistance, - lookVec.zCoord * reachDistance - ) - val rayTraceResult = event.world.rayTraceBlocks(eyePosition, reachVec, false, false, false) - - if (rayTraceResult != null && rayTraceResult.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { - val pos = rayTraceResult.blockPos - - val x = pos.x - val y = pos.y - val z = pos.z - - if (chestNodeExists(x, y, z)) { - chestList.removeIf { it.x == x && it.y == y && it.z == z } - } + val pos = event.pos + if (chestNodeExists(pos.x, pos.y, pos.z)) { + chestList.removeIf { it.x == pos.x && it.y == pos.y && it.z == pos.z } } } }